SpatiaLite  5.0.0
gg_mbr.h
Go to the documentation of this file.
1 /*
2  gg_mbr.h -- Gaia common support for geometries: MBR functions
3 
4  version 5.0, 2020 August 1
5 
6  Author: Sandro Furieri a.furieri@lqt.it
7 
8  ------------------------------------------------------------------------------
9 
10  Version: MPL 1.1/GPL 2.0/LGPL 2.1
11 
12  The contents of this file are subject to the Mozilla Public License Version
13  1.1 (the "License"); you may not use this file except in compliance with
14  the License. You may obtain a copy of the License at
15  http://www.mozilla.org/MPL/
16 
17 Software distributed under the License is distributed on an "AS IS" basis,
18 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19 for the specific language governing rights and limitations under the
20 License.
21 
22 The Original Code is the SpatiaLite library
23 
24 The Initial Developer of the Original Code is Alessandro Furieri
25 
26 Portions created by the Initial Developer are Copyright (C) 2008-2020
27 the Initial Developer. All Rights Reserved.
28 
29 Contributor(s):
30 
31 
32 Alternatively, the contents of this file may be used under the terms of
33 either the GNU General Public License Version 2 or later (the "GPL"), or
34 the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
35 in which case the provisions of the GPL or the LGPL are applicable instead
36 of those above. If you wish to allow use of your version of this file only
37 under the terms of either the GPL or the LGPL, and not to allow others to
38 use your version of this file under the terms of the MPL, indicate your
39 decision by deleting the provisions above and replace them with the notice
40 and other provisions required by the GPL or the LGPL. If you do not delete
41 the provisions above, a recipient may use your version of this file under
42 the terms of any one of the MPL, the GPL or the LGPL.
43 
44 */
45 
46 
53 #ifndef _GG_MBR_H
54 #ifndef DOXYGEN_SHOULD_SKIP_THIS
55 #define _GG_MBR_H
56 #endif
57 
58 #ifdef __cplusplus
59 extern "C"
60 {
61 #endif
62 
63 /* function prototypes */
64 
70  GAIAGEO_DECLARE void gaiaMbrLinestring (gaiaLinestringPtr line);
71 
77  GAIAGEO_DECLARE void gaiaMbrRing (gaiaRingPtr rng);
78 
84  GAIAGEO_DECLARE void gaiaMbrPolygon (gaiaPolygonPtr polyg);
85 
91  GAIAGEO_DECLARE void gaiaMbrGeometry (gaiaGeomCollPtr geom);
92 
104  GAIAGEO_DECLARE int gaiaGetMbrMinX (const unsigned char *blob,
105  unsigned int size, double *minx);
106 
118  GAIAGEO_DECLARE int gaiaGetMbrMaxX (const unsigned char *blob,
119  unsigned int size, double *maxx);
120 
132  GAIAGEO_DECLARE int gaiaGetMbrMinY (const unsigned char *blob,
133  unsigned int size, double *miny);
134 
146  GAIAGEO_DECLARE int gaiaGetMbrMaxY (const unsigned char *blob,
147  unsigned int size, double *maxy);
148 
166  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromSpatiaLiteBlobMbr (const unsigned
167  char *blob,
168  unsigned int
169  size);
170 
182  GAIAGEO_DECLARE int gaiaMbrsContains (gaiaGeomCollPtr mbr1,
183  gaiaGeomCollPtr mbr2);
184 
196  GAIAGEO_DECLARE int gaiaMbrsDisjoint (gaiaGeomCollPtr mbr1,
197  gaiaGeomCollPtr mbr2);
198 
210  GAIAGEO_DECLARE int gaiaMbrsEqual (gaiaGeomCollPtr mbr1,
211  gaiaGeomCollPtr mbr2);
212 
224  GAIAGEO_DECLARE int gaiaMbrsIntersects (gaiaGeomCollPtr mbr1,
225  gaiaGeomCollPtr mbr2);
226 
238  GAIAGEO_DECLARE int gaiaMbrsOverlaps (gaiaGeomCollPtr mbr1,
239  gaiaGeomCollPtr mbr2);
240 
252  GAIAGEO_DECLARE int gaiaMbrsTouches (gaiaGeomCollPtr mbr1,
253  gaiaGeomCollPtr mbr2);
254 
266  GAIAGEO_DECLARE int gaiaMbrsWithin (gaiaGeomCollPtr mbr1,
267  gaiaGeomCollPtr mbr2);
268 
289  GAIAGEO_DECLARE void gaiaBuildMbr (double x1, double y1, double x2,
290  double y2, int srid,
291  unsigned char **result, int *size);
292 
310  GAIAGEO_DECLARE void gaiaBuildCircleMbr (double x, double y,
311  double radius, int srid,
312  unsigned char **result, int *size);
313 
337  GAIAGEO_DECLARE void gaiaBuildFilterMbr (double x1, double y1, double x2,
338  double y2, int mode,
339  unsigned char **result, int *size);
340 
358  GAIAGEO_DECLARE int gaiaParseFilterMbr (unsigned char *result, int size,
359  double *minx, double *miny,
360  double *maxx, double *maxy,
361  int *mode);
362 
374  GAIAGEO_DECLARE void gaiaZRangeLinestring (gaiaLinestringPtr line,
375  double *min, double *max);
376 
389  GAIAGEO_DECLARE void gaiaZRangeLinestringEx (gaiaLinestringPtr line,
390  double nodata, double *min,
391  double *max);
392 
404  GAIAGEO_DECLARE void gaiaZRangeRing (gaiaRingPtr rng, double *min,
405  double *max);
406 
419  GAIAGEO_DECLARE void gaiaZRangeRingEx (gaiaRingPtr rng, double nodata,
420  double *min, double *max);
421 
433  GAIAGEO_DECLARE void gaiaZRangePolygon (gaiaPolygonPtr polyg, double *min,
434  double *max);
435 
448  GAIAGEO_DECLARE void gaiaZRangePolygonEx (gaiaPolygonPtr polyg,
449  double nodata, double *min,
450  double *max);
451 
463  GAIAGEO_DECLARE void gaiaZRangeGeometry (gaiaGeomCollPtr geom,
464  double *min, double *max);
465 
478  GAIAGEO_DECLARE void gaiaZRangeGeometryEx (gaiaGeomCollPtr geom,
479  double nodata, double *min,
480  double *max);
481 
493  GAIAGEO_DECLARE void gaiaMRangeLinestring (gaiaLinestringPtr line,
494  double *min, double *max);
495 
508  GAIAGEO_DECLARE void gaiaMRangeLinestringEx (gaiaLinestringPtr line,
509  double nodata, double *min,
510  double *max);
511 
523  GAIAGEO_DECLARE void gaiaMRangeRing (gaiaRingPtr rng, double *min,
524  double *max);
525 
538  GAIAGEO_DECLARE void gaiaMRangeRingEx (gaiaRingPtr rng, double nodata,
539  double *min, double *max);
540 
552  GAIAGEO_DECLARE void gaiaMRangePolygon (gaiaPolygonPtr polyg, double *min,
553  double *max);
554 
567  GAIAGEO_DECLARE void gaiaMRangePolygonEx (gaiaPolygonPtr polyg,
568  double nodata, double *min,
569  double *max);
570 
582  GAIAGEO_DECLARE void gaiaMRangeGeometry (gaiaGeomCollPtr geom,
583  double *min, double *max);
584 
597  GAIAGEO_DECLARE void gaiaMRangeGeometryEx (gaiaGeomCollPtr geom,
598  double nodata, double *min,
599  double *max);
600 
601 
602 #ifdef __cplusplus
603 }
604 #endif
605 
606 #endif /* _GG_MBR_H */
GAIAGEO_DECLARE void gaiaMRangePolygon(gaiaPolygonPtr polyg, double *min, double *max)
Computes the M-Range for a Polygon object.
GAIAGEO_DECLARE void gaiaMRangeLinestringEx(gaiaLinestringPtr line, double nodata, double *min, double *max)
Computes the M-Range for a Linestring object (NODATA flavor)
GAIAGEO_DECLARE void gaiaZRangePolygon(gaiaPolygonPtr polyg, double *min, double *max)
Computes the Z-Range for a Polygon object.
GAIAGEO_DECLARE void gaiaMbrRing(gaiaRingPtr rng)
Updates the actual MBR for a Ring object.
GAIAGEO_DECLARE int gaiaMbrsIntersects(gaiaGeomCollPtr mbr1, gaiaGeomCollPtr mbr2)
MBRs comparison: Intersects.
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 int gaiaGetMbrMaxX(const unsigned char *blob, unsigned int size, double *maxx)
Retrieves the MBR (MaxX) from a BLOB-Geometry object.
GAIAGEO_DECLARE void gaiaZRangeGeometry(gaiaGeomCollPtr geom, double *min, double *max)
Computes the Z-Range for a Geometry object.
GAIAGEO_DECLARE int gaiaGetMbrMinY(const unsigned char *blob, unsigned int size, double *miny)
Retrieves the MBR (MinY) from a BLOB-Geometry object.
Container for OGC POLYGON Geometry.
Definition: gg_structs.h:192
GAIAGEO_DECLARE void gaiaMRangeRing(gaiaRingPtr rng, double *min, double *max)
Computes the M-Range for a Ring 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 gaiaGetMbrMaxY(const unsigned char *blob, unsigned int size, double *maxy)
Retrieves the MBR (MaxY) from a BLOB-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 void gaiaMbrPolygon(gaiaPolygonPtr polyg)
Updates the actual MBR for a Polygon object.
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 void gaiaMRangeLinestring(gaiaLinestringPtr line, double *min, double *max)
Computes the M-Range for a Linestring object.
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 gaiaZRangeLinestringEx(gaiaLinestringPtr line, double nodata, double *min, double *max)
Computes the Z-Range for a Linestring object (NODATA flavor)
Container for OGC RING Geometry.
Definition: gg_structs.h:158
GAIAGEO_DECLARE void gaiaMRangeGeometry(gaiaGeomCollPtr geom, double *min, double *max)
Computes the Z-Range for a Geometry object.
GAIAGEO_DECLARE void gaiaMbrLinestring(gaiaLinestringPtr line)
Updates the actual MBR for a Linestring object.
GAIAGEO_DECLARE void gaiaZRangeRingEx(gaiaRingPtr rng, double nodata, double *min, double *max)
Computes the Z-Range for a Ring object (NODATA flavor)
GAIAGEO_DECLARE void gaiaMRangePolygonEx(gaiaPolygonPtr polyg, double nodata, double *min, double *max)
Computes the M-Range for a Polygon object (NODATA flavor)
Container for OGC LINESTRING Geometry.
Definition: gg_structs.h:128
GAIAGEO_DECLARE int gaiaMbrsContains(gaiaGeomCollPtr mbr1, gaiaGeomCollPtr mbr2)
MBRs comparison: Contains.
GAIAGEO_DECLARE int gaiaMbrsWithin(gaiaGeomCollPtr mbr1, gaiaGeomCollPtr mbr2)
MBRs comparison: Within.
GAIAGEO_DECLARE void gaiaZRangeLinestring(gaiaLinestringPtr line, double *min, double *max)
Computes the Z-Range for a Linestring object.
GAIAGEO_DECLARE void gaiaMbrGeometry(gaiaGeomCollPtr geom)
Updates the actual MBR for a Geometry object.
GAIAGEO_DECLARE void gaiaZRangeRing(gaiaRingPtr rng, double *min, double *max)
Computes the Z-Range for a Ring object.
GAIAGEO_DECLARE void gaiaZRangeGeometryEx(gaiaGeomCollPtr geom, double nodata, double *min, double *max)
Computes the Z-Range for a Geometry object (NODATA flavor)
GAIAGEO_DECLARE void gaiaZRangePolygonEx(gaiaPolygonPtr polyg, double nodata, double *min, double *max)
Computes the Z-Range for a Polygon object (NODATA flavor)
GAIAGEO_DECLARE int gaiaMbrsEqual(gaiaGeomCollPtr mbr1, gaiaGeomCollPtr mbr2)
MBRs comparison: Equal.
GAIAGEO_DECLARE int gaiaMbrsDisjoint(gaiaGeomCollPtr mbr1, gaiaGeomCollPtr mbr2)
MBRs comparison: Disjoint.
Container for OGC GEOMETRYCOLLECTION Geometry.
Definition: gg_structs.h:226
GAIAGEO_DECLARE void gaiaMRangeRingEx(gaiaRingPtr rng, double nodata, double *min, double *max)
Computes the M-Range for a Ring object (NODATA flavor)
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 int gaiaMbrsTouches(gaiaGeomCollPtr mbr1, gaiaGeomCollPtr mbr2)
MBRs comparison: Touches.
GAIAGEO_DECLARE void gaiaMRangeGeometryEx(gaiaGeomCollPtr geom, double nodata, double *min, double *max)
Computes the Z-Range for a Geometry object (NODATA flavor)
GAIAGEO_DECLARE int gaiaMbrsOverlaps(gaiaGeomCollPtr mbr1, gaiaGeomCollPtr mbr2)
MBRs comparison: Overlaps.