SpatiaLite  4.1.0
 All Data Structures Files Functions Variables Typedefs Macros Pages
gg_advanced.h
Go to the documentation of this file.
1 /*
2  gg_advanced.h -- Gaia common support for geometries: advanced
3 
4  version 4.1, 2013 May 8
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-2013
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 /*
47 
48 CREDITS:
49 
50 this module has been partly funded by:
51 Regione Toscana - Settore Sistema Informativo Territoriale ed Ambientale
52 (wrapping liblwgeom APIs)
53 
54 */
55 
56 
63 #ifndef _GG_ADVANCED_H
64 #ifndef DOXYGEN_SHOULD_SKIP_THIS
65 #define _GG_ADVANCED_H
66 #endif
67 
69 #define GAIA2GEOS_ALL 0
70 
72 #define GAIA2GEOS_ONLY_POINTS 1
73 
75 #define GAIA2GEOS_ONLY_LINESTRINGS 2
76 
78 #define GAIA2GEOS_ONLY_POLYGONS 3
79 
80 #ifdef __cplusplus
81 extern "C"
82 {
83 #endif
84 
85 #ifndef DOXYGEN_SHOULD_SKIP_THIS
86 #ifndef OMIT_PROJ /* including PROJ.4 */
87 #endif
88 
99  GAIAGEO_DECLARE double gaiaRadsToDegs (double rads);
100 
111  GAIAGEO_DECLARE double gaiaDegsToRads (double degs);
112 
130  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaTransform (gaiaGeomCollPtr org,
131  char *proj_from,
132  char *proj_to);
133 
134 #endif /* end including PROJ.4 */
135 
136 #ifndef OMIT_GEOS /* including GEOS */
137 
146  GAIAGEO_DECLARE void gaiaResetGeosMsg (void);
147 
159  GAIAGEO_DECLARE const char *gaiaGetGeosErrorMsg (void);
160 
172  GAIAGEO_DECLARE const char *gaiaGetGeosWarningMsg (void);
173 
185  GAIAGEO_DECLARE const char *gaiaGetGeosAuxErrorMsg (void);
186 
197  GAIAGEO_DECLARE void gaiaSetGeosErrorMsg (const char *msg);
198 
209  GAIAGEO_DECLARE void gaiaSetGeosWarningMsg (const char *msg);
210 
221  GAIAGEO_DECLARE void gaiaSetGeosAuxErrorMsg (const char *msg);
222 
237  GAIAGEO_DECLARE void *gaiaToGeos (const gaiaGeomCollPtr gaia);
238 
255  GAIAGEO_DECLARE void *gaiaToGeosSelective (const gaiaGeomCollPtr gaia,
256  int mode);
257 
272  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromGeos_XY (const void *geos);
273 
288  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromGeos_XYZ (const void *geos);
289 
304  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromGeos_XYM (const void *geos);
305 
320  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromGeos_XYZM (const void *geos);
321 
333  GAIAGEO_DECLARE int gaiaIsSimple (gaiaGeomCollPtr geom);
334 
350  GAIAGEO_DECLARE int gaiaIsClosed (gaiaLinestringPtr line);
351 
363  GAIAGEO_DECLARE int gaiaIsClosedGeom (gaiaGeomCollPtr geom);
364 
376  GAIAGEO_DECLARE int gaiaIsRing (gaiaLinestringPtr line);
377 
389  GAIAGEO_DECLARE int gaiaIsValid (gaiaGeomCollPtr geom);
390 
403  GAIAGEO_DECLARE int gaiaGeomCollLength (gaiaGeomCollPtr geom,
404  double *length);
405 
421  GAIAGEO_DECLARE int gaiaGeomCollLengthOrPerimeter (gaiaGeomCollPtr geom,
422  int perimeter,
423  double *length);
436  GAIAGEO_DECLARE int gaiaGeomCollArea (gaiaGeomCollPtr geom, double *area);
437 
455  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaPolygonize (gaiaGeomCollPtr geom,
456  int force_multi);
471  GAIAGEO_DECLARE int gaiaGeomCollEquals (gaiaGeomCollPtr geom1,
472  gaiaGeomCollPtr geom2);
473 
488  GAIAGEO_DECLARE int gaiaGeomCollDisjoint (gaiaGeomCollPtr geom1,
489  gaiaGeomCollPtr geom2);
490 
508  GAIAGEO_DECLARE int gaiaGeomCollPreparedDisjoint (void *p_cache,
509  gaiaGeomCollPtr geom1,
510  unsigned char *blob1,
511  int size1,
512  gaiaGeomCollPtr geom2,
513  unsigned char *blob2,
514  int size2);
515 
531  GAIAGEO_DECLARE int gaiaGeomCollIntersects (gaiaGeomCollPtr geom1,
532  gaiaGeomCollPtr geom2);
549  GAIAGEO_DECLARE int gaiaGeomCollPreparedIntersects (void *p_cache,
550  gaiaGeomCollPtr geom1,
551  unsigned char *blob1,
552  int size1,
553  gaiaGeomCollPtr geom2,
554  unsigned char *blob2,
555  int size2);
556 
571  GAIAGEO_DECLARE int gaiaGeomCollOverlaps (gaiaGeomCollPtr geom1,
572  gaiaGeomCollPtr geom2);
573 
591  GAIAGEO_DECLARE int gaiaGeomCollPreparedOverlaps (void *p_cache,
592  gaiaGeomCollPtr geom1,
593  unsigned char *blob1,
594  int size1,
595  gaiaGeomCollPtr geom2,
596  unsigned char *blob2,
597  int size2);
598 
613  GAIAGEO_DECLARE int gaiaGeomCollCrosses (gaiaGeomCollPtr geom1,
614  gaiaGeomCollPtr geom2);
615 
633  GAIAGEO_DECLARE int gaiaGeomCollPreparedCrosses (void *p_cache,
634  gaiaGeomCollPtr geom1,
635  unsigned char *blob1,
636  int size1,
637  gaiaGeomCollPtr geom2,
638  unsigned char *blob2,
639  int size2);
640 
655  GAIAGEO_DECLARE int gaiaGeomCollContains (gaiaGeomCollPtr geom1,
656  gaiaGeomCollPtr geom2);
657 
675  GAIAGEO_DECLARE int gaiaGeomCollPreparedContains (void *p_cache,
676  gaiaGeomCollPtr geom1,
677  unsigned char *blob1,
678  int size1,
679  gaiaGeomCollPtr geom2,
680  unsigned char *blob2,
681  int size2);
682 
697  GAIAGEO_DECLARE int gaiaGeomCollWithin (gaiaGeomCollPtr geom1,
698  gaiaGeomCollPtr geom2);
699 
717  GAIAGEO_DECLARE int gaiaGeomCollPreparedWithin (void *p_cache,
718  gaiaGeomCollPtr geom1,
719  unsigned char *blob1,
720  int size1,
721  gaiaGeomCollPtr geom2,
722  unsigned char *blob2,
723  int size2);
724 
739  GAIAGEO_DECLARE int gaiaGeomCollTouches (gaiaGeomCollPtr geom1,
740  gaiaGeomCollPtr geom2);
741 
759  GAIAGEO_DECLARE int gaiaGeomCollPreparedTouches (void *p_cache,
760  gaiaGeomCollPtr geom1,
761  unsigned char *blob1,
762  int size1,
763  gaiaGeomCollPtr geom2,
764  unsigned char *blob2,
765  int size2);
766 
782  GAIAGEO_DECLARE int gaiaGeomCollRelate (gaiaGeomCollPtr geom1,
783  gaiaGeomCollPtr geom2,
784  const char *pattern);
785 
801  GAIAGEO_DECLARE int gaiaGeomCollDistance (gaiaGeomCollPtr geom1,
802  gaiaGeomCollPtr geom2,
803  double *dist);
804 
823  geom1,
825  geom2);
826 
843  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaGeometryUnion (gaiaGeomCollPtr geom1,
844  gaiaGeomCollPtr geom2);
845 
863  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaUnionCascaded (gaiaGeomCollPtr geom);
864 
882  geom1,
884  geom2);
885 
903  geom1,
905  geom2);
906 
922  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaBoundary (gaiaGeomCollPtr geom);
923 
937  GAIAGEO_DECLARE int gaiaGeomCollCentroid (gaiaGeomCollPtr geom, double *x,
938  double *y);
939 
951  GAIAGEO_DECLARE int gaiaGetPointOnSurface (gaiaGeomCollPtr geom, double *x,
952  double *y);
953 
971  double tolerance);
972 
989  GAIAGEO_DECLARE gaiaGeomCollPtr
991  double tolerance);
992 
1008  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaConvexHull (gaiaGeomCollPtr geom);
1009 
1028  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaGeomCollBuffer (gaiaGeomCollPtr geom,
1029  double radius,
1030  int points);
1031 
1032 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
1033 #ifdef GEOS_ADVANCED
1034 #endif
1035 
1048  GAIAGEO_DECLARE int gaiaHausdorffDistance (gaiaGeomCollPtr geom1,
1049  gaiaGeomCollPtr geom2,
1050  double *dist);
1051 
1072  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaOffsetCurve (gaiaGeomCollPtr geom,
1073  double radius, int points,
1074  int left_right);
1075 
1097  double radius,
1098  int points,
1099  int left_right);
1100 
1117  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSharedPaths (gaiaGeomCollPtr geom1,
1118  gaiaGeomCollPtr geom2);
1119 
1139  ln_geom,
1140  double fraction);
1141 
1162  GAIAGEO_DECLARE gaiaGeomCollPtr
1164  double distance);
1165 
1186  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaLineSubstring (gaiaGeomCollPtr ln_geom,
1187  double start_fraction,
1188  double end_fraction);
1189 
1208  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaShortestLine (gaiaGeomCollPtr geom1,
1209  gaiaGeomCollPtr geom2);
1210 
1229  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSnap (gaiaGeomCollPtr geom1,
1230  gaiaGeomCollPtr geom2,
1231  double tolerance);
1232 
1248  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaLineMerge (gaiaGeomCollPtr geom);
1249 
1267  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaLinesCutAtNodes (gaiaGeomCollPtr geom1,
1268  gaiaGeomCollPtr geom2);
1269 
1287  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaUnaryUnion (gaiaGeomCollPtr geom);
1288 
1302  GAIAGEO_DECLARE double gaiaLineLocatePoint (gaiaGeomCollPtr ln_geom,
1303  gaiaGeomCollPtr pt_geom);
1304 
1317  GAIAGEO_DECLARE int gaiaGeomCollCovers (gaiaGeomCollPtr geom1,
1318  gaiaGeomCollPtr geom2);
1319 
1337  GAIAGEO_DECLARE int gaiaGeomCollPreparedCovers (void *p_cache,
1338  gaiaGeomCollPtr geom1,
1339  unsigned char *blob1,
1340  int size1,
1341  gaiaGeomCollPtr geom2,
1342  unsigned char *blob2,
1343  int size2);
1344 
1358  GAIAGEO_DECLARE int gaiaGeomCollCoveredBy (gaiaGeomCollPtr geom1,
1359  gaiaGeomCollPtr geom2);
1360 
1379  GAIAGEO_DECLARE int gaiaGeomCollPreparedCoveredBy (void *p_cache,
1380  gaiaGeomCollPtr geom1,
1381  unsigned char *blob1,
1382  int size1,
1383  gaiaGeomCollPtr geom2,
1384  unsigned char *blob2,
1385  int size2);
1386 
1407  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSquareGrid (gaiaGeomCollPtr geom,
1408  double origin_x,
1409  double origin_y,
1410  double size,
1411  int only_edges);
1412 
1433  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaTriangularGrid (gaiaGeomCollPtr geom,
1434  double origin_x,
1435  double origin_y,
1436  double size,
1437  int only_edges);
1438 
1459  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaHexagonalGrid (gaiaGeomCollPtr geom,
1460  double origin_x,
1461  double origin_y,
1462  double size,
1463  int only_edges);
1464 
1465 #endif /* end GEOS advanced features */
1466 
1467 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
1468 #ifdef GEOS_TRUNK
1469 #endif
1470 
1490  geom,
1491  double tolerance,
1492  int only_edges);
1493 
1513  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaVoronojDiagram (gaiaGeomCollPtr geom,
1514  double extra_frame_size,
1515  double tolerance,
1516  int only_edges);
1517 
1545  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaConcaveHull (gaiaGeomCollPtr geom,
1546  double factor,
1547  double tolerance,
1548  int allow_holes);
1549 
1550 #endif /* end GEOS experimental features */
1551 
1552 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
1553 #ifdef ENABLE_LWGEOM
1554 #endif
1555 
1564  GAIAGEO_DECLARE void gaiaResetLwGeomMsg (void);
1565 
1577  GAIAGEO_DECLARE const char *gaiaGetLwGeomErrorMsg (void);
1578 
1590  GAIAGEO_DECLARE const char *gaiaGetLwGeomWarningMsg (void);
1591 
1602  GAIAGEO_DECLARE void gaiaSetLwGeomErrorMsg (const char *msg);
1603 
1614  GAIAGEO_DECLARE void gaiaSetLwGeomWarningMsg (const char *msg);
1615 
1634  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMakeValid (gaiaGeomCollPtr geom);
1635 
1656  geom);
1657 
1677  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSegmentize (gaiaGeomCollPtr geom,
1678  double dist);
1679 
1697  GAIAGEO_DECLARE int gaiaAzimuth (double xa, double ya, double xb,
1698  double yb, double *azimuth);
1699 
1719  GAIAGEO_DECLARE int gaiaEllipsoidAzimuth (double xa, double ya, double xb,
1720  double yb, double a, double b,
1721  double *azimuth);
1722 
1742  GAIAGEO_DECLARE int gaiaProjectedPoint (double x1, double y1, double a,
1743  double b, double distance,
1744  double azimuth, double *x2,
1745  double *y2);
1746 
1760  GAIAGEO_DECLARE char *gaiaGeoHash (gaiaGeomCollPtr geom, int precision);
1761 
1778  GAIAGEO_DECLARE char *gaiaAsX3D (gaiaGeomCollPtr geom, const char *srs,
1779  int precision, int options,
1780  const char *refid);
1781 
1797  GAIAGEO_DECLARE int gaia3DDistance (gaiaGeomCollPtr geom1,
1798  gaiaGeomCollPtr geom2, double *dist);
1799 
1815  GAIAGEO_DECLARE int gaiaMaxDistance (gaiaGeomCollPtr geom1,
1816  gaiaGeomCollPtr geom2, double *dist);
1817 
1833  GAIAGEO_DECLARE int gaia3DMaxDistance (gaiaGeomCollPtr geom1,
1834  gaiaGeomCollPtr geom2, double *dist);
1835 
1854  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSplit (gaiaGeomCollPtr input,
1855  gaiaGeomCollPtr blade);
1856 
1876  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSplitLeft (gaiaGeomCollPtr input,
1877  gaiaGeomCollPtr blade);
1878 
1898  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSplitRight (gaiaGeomCollPtr input,
1899  gaiaGeomCollPtr blade);
1900 
1917  GAIAGEO_DECLARE int gaiaGeodesicArea (gaiaGeomCollPtr geom, double a,
1918  double b, int use_ellipsoid,
1919  double *area);
1920 
1921 #endif /* end LWGEOM support */
1922 
1923 #endif /* end including GEOS */
1924 
1953  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSnapToGrid (gaiaGeomCollPtr geom,
1954  double origin_x,
1955  double origin_y,
1956  double origin_z,
1957  double origin_m,
1958  double size_x,
1959  double size_y,
1960  double size_z,
1961  double size_m);
1962 
1963 #ifdef __cplusplus
1964 }
1965 #endif
1966 
1967 #endif /* _GG_ADVANCED_H */