SpatiaLite  3.0.0-stable
Functions
src/headers/spatialite/gg_mbr.h File Reference

Geometry handling functions: MBR. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

GAIAGEO_DECLARE void gaiaMbrLinestring (gaiaLinestringPtr line)
 Updates the actual MBR for a Linestring object.
GAIAGEO_DECLARE void gaiaMbrRing (gaiaRingPtr rng)
 Updates the actual MBR for a Ring object.
GAIAGEO_DECLARE void gaiaMbrPolygon (gaiaPolygonPtr polyg)
 Updates the actual MBR for a Polygon object.
GAIAGEO_DECLARE void gaiaMbrGeometry (gaiaGeomCollPtr geom)
 Updates the actual MBR for a Geometry object.
GAIAGEO_DECLARE int gaiaGetMbrMinX (const unsigned char *blob, unsigned int size, double *minx)
 Retrieves the MBR (MinX) from a BLOB-Geometry object.
GAIAGEO_DECLARE int gaiaGetMbrMaxX (const unsigned char *blob, unsigned int size, double *maxx)
 Retrieves the MBR (MaxX) from a BLOB-Geometry object.
GAIAGEO_DECLARE int gaiaGetMbrMinY (const unsigned char *blob, unsigned int size, double *miny)
 Retrieves the MBR (MinY) from a BLOB-Geometry object.
GAIAGEO_DECLARE int gaiaGetMbrMaxY (const unsigned char *blob, unsigned int size, double *maxy)
 Retrieves the MBR (MaxY) from a BLOB-Geometry object.
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromSpatiaLiteBlobMbr (const unsigned char *blob, unsigned int size)
 Creates a Geometry object corresponding to the Envelope [MBR] for a BLOB-Geometry.
GAIAGEO_DECLARE int gaiaMbrsContains (gaiaGeomCollPtr mbr1, gaiaGeomCollPtr mbr2)
 MBRs comparison: Contains.
GAIAGEO_DECLARE int gaiaMbrsDisjoint (gaiaGeomCollPtr mbr1, gaiaGeomCollPtr mbr2)
 MBRs comparison: Disjoint.
GAIAGEO_DECLARE int gaiaMbrsEqual (gaiaGeomCollPtr mbr1, gaiaGeomCollPtr mbr2)
 MBRs comparison: Equal.
GAIAGEO_DECLARE int gaiaMbrsIntersects (gaiaGeomCollPtr mbr1, gaiaGeomCollPtr mbr2)
 MBRs comparison: Intersects.
GAIAGEO_DECLARE int gaiaMbrsOverlaps (gaiaGeomCollPtr mbr1, gaiaGeomCollPtr mbr2)
 MBRs comparison: Overlaps.
GAIAGEO_DECLARE int gaiaMbrsTouches (gaiaGeomCollPtr mbr1, gaiaGeomCollPtr mbr2)
 MBRs comparison: Touches.
GAIAGEO_DECLARE int gaiaMbrsWithin (gaiaGeomCollPtr mbr1, gaiaGeomCollPtr mbr2)
 MBRs comparison: Within.
GAIAGEO_DECLARE void gaiaBuildMbr (double x1, double y1, double x2, double y2, int srid, unsigned char **result, int *size)
 Creates a BLOB-Geometry representing an Envelope [MBR].
GAIAGEO_DECLARE void gaiaBuildCircleMbr (double x, double y, double radius, int srid, unsigned char **result, int *size)
 Creates a BLOB-Geometry representing an Envelope [MBR].
GAIAGEO_DECLARE void gaiaBuildFilterMbr (double x1, double y1, double x2, double y2, int mode, unsigned char **result, int *size)
 Creates a BLOB-FilterMBR.
GAIAGEO_DECLARE int gaiaParseFilterMbr (unsigned char *result, int size, double *minx, double *miny, double *maxx, double *maxy, int *mode)
 Creates a BLOB-FilterMBR.
GAIAGEO_DECLARE void gaiaZRangeLinestring (gaiaLinestringPtr line, double *min, double *max)
 Computes the Z-Range for a Linestring object.
GAIAGEO_DECLARE void gaiaZRangeRing (gaiaRingPtr rng, double *min, double *max)
 Computes the Z-Range for a Ring object.
GAIAGEO_DECLARE void gaiaZRangePolygon (gaiaPolygonPtr polyg, double *min, double *max)
 Computes the Z-Range for a Polygon object.
GAIAGEO_DECLARE void gaiaZRangeGeometry (gaiaGeomCollPtr geom, double *min, double *max)
 Computes the Z-Range for a Geometry object.
GAIAGEO_DECLARE void gaiaMRangeLinestring (gaiaLinestringPtr line, double *min, double *max)
 Computes the M-Range for a Linestring object.
GAIAGEO_DECLARE void gaiaMRangeRing (gaiaRingPtr rng, double *min, double *max)
 Computes the M-Range for a Ring object.
GAIAGEO_DECLARE void gaiaMRangePolygon (gaiaPolygonPtr polyg, double *min, double *max)
 Computes the M-Range for a Polygon object.
GAIAGEO_DECLARE void gaiaMRangeGeometry (gaiaGeomCollPtr geom, double *min, double *max)
 Computes the Z-Range for a Geometry object.

Detailed Description

Geometry handling functions: MBR.


Function Documentation

GAIAGEO_DECLARE void gaiaBuildCircleMbr ( double  x,
double  y,
double  radius,
int  srid,
unsigned char **  result,
int *  size 
)

Creates a BLOB-Geometry representing an Envelope [MBR].

Parameters:
xcentre X coordinate.
ycentre Y coordinate.
radiusthe radius of the circle
sridthe SRID associated to the Envelope
resulton completion will contain a pointer to newly created BLOB-Geometry
sizeon completion this variabile will contain the BLOB's size (in bytes)
See also:
gaiaBuildMbr
Note:
the circle of givern radius and centre will be used so to determine the corresponding square Envelope
GAIAGEO_DECLARE void gaiaBuildFilterMbr ( double  x1,
double  y1,
double  x2,
double  y2,
int  mode,
unsigned char **  result,
int *  size 
)

Creates a BLOB-FilterMBR.

Parameters:
x1first X coordinate.
y1first Y coordinate.
x2second X coordinate.
y2second Y coordinate.
modeone of: GAIA_FILTER_MBR_WITHIN, GAIA_FILTER_MBR_CONTAINS, GAIA_FILTER_MBR_INTERSECTS, GAIA_FILTER_MBR_DECLARE
resulton completion will contain a pointer to newly created BLOB-FilterMBR
sizeon completion this variabile will contain the BLOB's size (in bytes)
See also:
gaiaParseFilterMbr
Note:
[XY] coords must define two extreme Points identifying a diagonal of the MBR [Envelope]
no special order is required for coords: MAX / MIN values will be internally arranged as appropriate.
Remarks:
internally used to implement Geometry Callback R*Tree filtering.
GAIAGEO_DECLARE void gaiaBuildMbr ( double  x1,
double  y1,
double  x2,
double  y2,
int  srid,
unsigned char **  result,
int *  size 
)

Creates a BLOB-Geometry representing an Envelope [MBR].

Parameters:
x1first X coordinate.
y1first Y coordinate.
x2second X coordinate.
y2second Y coordinate.
sridthe SRID associated to the Envelope
resulton completion will contain a pointer to newly created BLOB-Geometry
sizeon completion this variabile will contain the BLOB's size (in bytes)
See also:
gaiaBuildCircleMbr
Note:
[XY] coords must define two extreme Points identifying a diagonal of the MBR [Envelope]
no special order is required for coords: MAX / MIN values will be internally arranged as appropriate.
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromSpatiaLiteBlobMbr ( const unsigned char *  blob,
unsigned int  size 
)

Creates a Geometry object corresponding to the Envelope [MBR] for a BLOB-Geometry.

Parameters:
blobpointer to BLOB-Geometry
sizethe BLOB's size (in bytes)
Returns:
the pointer to the newly created Geometry object: NULL on failure
See also:
gaiaFreeGeomColl
Note:
you are responsible to destroy (before or after) any allocated Geometry, unless you've passed ownership of the Geometry object to some further object: in this case destroying the higher order object will implicitly destroy any contained child object.
GAIAGEO_DECLARE int gaiaGetMbrMaxX ( const unsigned char *  blob,
unsigned int  size,
double *  maxx 
)

Retrieves the MBR (MaxX) from a BLOB-Geometry object.

Parameters:
blobpointer to BLOB-Geometry.
sizethe BLOB's size (in bytes).
maxxon completion this variable will contain the MBR MaxX coordinate.
Returns:
0 on failure: any other value on success.
See also:
gaiaGetMbrMinX, gaiaGetMbrMinY, gaiaGetMbrMaxY
GAIAGEO_DECLARE int gaiaGetMbrMaxY ( const unsigned char *  blob,
unsigned int  size,
double *  maxy 
)

Retrieves the MBR (MaxY) from a BLOB-Geometry object.

Parameters:
blobpointer to BLOB-Geometry.
sizethe BLOB's size (in bytes).
maxyon completion this variable will contain the MBR MaxY coordinate.
Returns:
0 on failure: any other value on success.
See also:
gaiaGetMbrMinX, gaiaGetMbrMaxX, gaiaGetMbrMinY
GAIAGEO_DECLARE int gaiaGetMbrMinX ( const unsigned char *  blob,
unsigned int  size,
double *  minx 
)

Retrieves the MBR (MinX) from a BLOB-Geometry object.

Parameters:
blobpointer to BLOB-Geometry.
sizethe BLOB's size (in bytes).
minxon completion this variable will contain the MBR MinX coordinate.
Returns:
0 on failure: any other value on success.
See also:
gaiaGetMbrMaxX, gaiaGetMbrMinY, gaiaGetMbrMaxY
GAIAGEO_DECLARE int gaiaGetMbrMinY ( const unsigned char *  blob,
unsigned int  size,
double *  miny 
)

Retrieves the MBR (MinY) from a BLOB-Geometry object.

Parameters:
blobpointer to BLOB-Geometry.
sizethe BLOB's size (in bytes).
minyon completion this variable will contain the MBR MinY coordinate.
Returns:
0 on failure: any other value on success.
See also:
gaiaGetMbrMinX, gaiaGetMbrMaxX, gaiaGetMbrMaxY
GAIAGEO_DECLARE void gaiaMbrGeometry ( gaiaGeomCollPtr  geom)

Updates the actual MBR for a Geometry object.

Parameters:
geompointer to the Geometry object
GAIAGEO_DECLARE void gaiaMbrLinestring ( gaiaLinestringPtr  line)

Updates the actual MBR for a Linestring object.

Parameters:
linepointer to the Linestring object
GAIAGEO_DECLARE void gaiaMbrPolygon ( gaiaPolygonPtr  polyg)

Updates the actual MBR for a Polygon object.

Parameters:
polygpointer to the Polygon object
GAIAGEO_DECLARE void gaiaMbrRing ( gaiaRingPtr  rng)

Updates the actual MBR for a Ring object.

Parameters:
rngpointer to the Ring object
GAIAGEO_DECLARE int gaiaMbrsContains ( gaiaGeomCollPtr  mbr1,
gaiaGeomCollPtr  mbr2 
)

MBRs comparison: Contains.

Parameters:
mbr1pointer to first Geometry object.
mbr2pointer to second Geometry object.
Returns:
0 if false; any other value if mbr1 spatially contains mbr2
See also:
gaiaMbrsDisjoint, gaiaMbrsEqual, gaiaMbrsIntersects, gaiaMbrsOverlaps, gaiaMbrsTouches, gaiaMbrsWithin
GAIAGEO_DECLARE int gaiaMbrsDisjoint ( gaiaGeomCollPtr  mbr1,
gaiaGeomCollPtr  mbr2 
)

MBRs comparison: Disjoint.

Parameters:
mbr1pointer to first Geometry object.
mbr2pointer to second Geometry object.
Returns:
0 if false; any other value if mbr1 and mbr2 are spatially disjoint
See also:
gaiaMbrsContains, gaiaMbrsEqual, gaiaMbrsIntersects, gaiaMbrsOverlaps, gaiaMbrsTouches, gaiaMbrsWithin
GAIAGEO_DECLARE int gaiaMbrsEqual ( gaiaGeomCollPtr  mbr1,
gaiaGeomCollPtr  mbr2 
)

MBRs comparison: Equal.

Parameters:
mbr1pointer to first Geometry object.
mbr2pointer to second Geometry object.
Returns:
0 if false; any other value if mbr1 and mbr2 are spatially equal
See also:
gaiaMbrsContains, gaiaMbrsDisjoint, gaiaMbrsIntersects, gaiaMbrsOverlaps, gaiaMbrsTouches, gaiaMbrsWithin
GAIAGEO_DECLARE int gaiaMbrsIntersects ( gaiaGeomCollPtr  mbr1,
gaiaGeomCollPtr  mbr2 
)

MBRs comparison: Intersects.

Parameters:
mbr1pointer to first Geometry object.
mbr2pointer to second Geometry object.
Returns:
0 if false; any other value if mbr1 and mbr2 spatially intersect
See also:
gaiaMbrsContains, gaiaMbrsDisjoint, gaiaMbrsEqual, gaiaMbrsOverlaps, gaiaMbrsTouches, gaiaMbrsWithin
GAIAGEO_DECLARE int gaiaMbrsOverlaps ( gaiaGeomCollPtr  mbr1,
gaiaGeomCollPtr  mbr2 
)

MBRs comparison: Overlaps.

Parameters:
mbr1pointer to first Geometry object.
mbr2pointer to second Geometry object.
Returns:
0 if false; any other value if mbr1 and mbr2 spatially overlap
See also:
gaiaMbrsContains, gaiaMbrsDisjoint, gaiaMbrsEqual, gaiaMbrsIntersects, gaiaMbrsTouches, gaiaMbrsWithin
GAIAGEO_DECLARE int gaiaMbrsTouches ( gaiaGeomCollPtr  mbr1,
gaiaGeomCollPtr  mbr2 
)

MBRs comparison: Touches.

Parameters:
mbr1pointer to first Geometry object.
mbr2pointer to second Geometry object.
Returns:
0 if false; any other value if mbr1 and mbr2 spatially touche
See also:
gaiaMbrsContains, gaiaMbrsDisjoint, gaiaMbrsEqual, gaiaMbrsIntersects, gaiaMbrsOverlaps, gaiaMbrsWithin
GAIAGEO_DECLARE int gaiaMbrsWithin ( gaiaGeomCollPtr  mbr1,
gaiaGeomCollPtr  mbr2 
)

MBRs comparison: Within.

Parameters:
mbr1pointer to first Geometry object.
mbr2pointer to second Geometry object.
Returns:
0 if false; any other value if mbr1 is spatially within mbr2
See also:
gaiaMbrsContains, gaiaMbrsDisjoint, gaiaMbrsEqual, gaiaMbrsIntersects, gaiaMbrsOverlaps, gaiaMbrsTouches
GAIAGEO_DECLARE void gaiaMRangeGeometry ( gaiaGeomCollPtr  geom,
double *  min,
double *  max 
)

Computes the Z-Range for a Geometry object.

Parameters:
geompointer to the Geometry object
minon completion this variable will contain the min M value found
maxon completion this variable will contain the max M value found
Note:
if the Geometry has XY or XYZ dims, the M-Range is meaningless
GAIAGEO_DECLARE void gaiaMRangeLinestring ( gaiaLinestringPtr  line,
double *  min,
double *  max 
)

Computes the M-Range for a Linestring object.

Parameters:
linepointer to the Linestring object
minon completion this variable will contain the min M value found
maxon completion this variable will contain the max M value found
Note:
if the Linestring has XY or XYZ dims, the M-Range is meaningless
GAIAGEO_DECLARE void gaiaMRangePolygon ( gaiaPolygonPtr  polyg,
double *  min,
double *  max 
)

Computes the M-Range for a Polygon object.

Parameters:
polygpointer to the Polygon object
minon completion this variable will contain the min M value found
maxon completion this variable will contain the max M value found
Note:
if the Polygon has XY or XYZ dims, the M-Range is meaningless
GAIAGEO_DECLARE void gaiaMRangeRing ( gaiaRingPtr  rng,
double *  min,
double *  max 
)

Computes the M-Range for a Ring object.

Parameters:
rngpointer to the Ring object
minon completion this variable will contain the min M value found
maxon completion this variable will contain the max M value found
Note:
if the Ring has XY or XYZ dims, the M-Range is meaningless
GAIAGEO_DECLARE int gaiaParseFilterMbr ( unsigned char *  result,
int  size,
double *  minx,
double *  miny,
double *  maxx,
double *  maxy,
int *  mode 
)

Creates a BLOB-FilterMBR.

Parameters:
resultpointer to BLOB-FilterMBR [previously created by gaiaBuildFilterMbr] BLOB-Geometry
sizeBLOB's size (in bytes)
minxon completion this variable will contain the MBR MinX coord.
minyon completion this variable will contain the MBR MinY coord.
maxxon completion this variable will contain the MBR MinY coord.
maxyon completion this variable will contain the MBR MaxY coord.
modeon completion this variable will contain the FilterMBR mode.
See also:
gaiaBuildFilterMbr
Remarks:
internally used to implement Geometry Callback R*Tree filtering.
GAIAGEO_DECLARE void gaiaZRangeGeometry ( gaiaGeomCollPtr  geom,
double *  min,
double *  max 
)

Computes the Z-Range for a Geometry object.

Parameters:
geompointer to the Geometry object
minon completion this variable will contain the min Z value found
maxon completion this variable will contain the max Z value found
Note:
if the Geometry has XY or XYM dims, the Z-Range is meaningless
GAIAGEO_DECLARE void gaiaZRangeLinestring ( gaiaLinestringPtr  line,
double *  min,
double *  max 
)

Computes the Z-Range for a Linestring object.

Parameters:
linepointer to the Linestring object
minon completion this variable will contain the min Z value found
maxon completion this variable will contain the max Z value found
Note:
if the Linestring has XY or XYM dims, the Z-Range is meaningless
GAIAGEO_DECLARE void gaiaZRangePolygon ( gaiaPolygonPtr  polyg,
double *  min,
double *  max 
)

Computes the Z-Range for a Polygon object.

Parameters:
polygpointer to the Polygon object
minon completion this variable will contain the min Z value found
maxon completion this variable will contain the max Z value found
Note:
if the Polygon has XY or XYM dims, the Z-Range is meaningless
GAIAGEO_DECLARE void gaiaZRangeRing ( gaiaRingPtr  rng,
double *  min,
double *  max 
)

Computes the Z-Range for a Ring object.

Parameters:
rngpointer to the Ring object
minon completion this variable will contain the min Z value found
maxon completion this variable will contain the max Z value found
Note:
if the Ring has XY or XYM dims, the Z-Range is meaningless
 All Data Structures Files Functions Variables Typedefs Defines