SpatiaLite  4.0.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.0, 2012 August 6
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-2012
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 
68 #define GAIA2GEOS_ALL 0
69 #define GAIA2GEOS_ONLY_POINTS 1
70 #define GAIA2GEOS_ONLY_LINESTRINGS 2
71 #define GAIA2GEOS_ONLY_POLYGONS 3
72 
73 #ifdef __cplusplus
74 extern "C"
75 {
76 #endif
77 
78 #ifndef OMIT_PROJ /* including PROJ.4 */
79 
90  GAIAGEO_DECLARE double gaiaRadsToDegs (double rads);
91 
102  GAIAGEO_DECLARE double gaiaDegsToRads (double degs);
103 
121  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaTransform (gaiaGeomCollPtr org,
122  char *proj_from,
123  char *proj_to);
124 
125 #endif /* end including PROJ.4 */
126 
127 #ifndef OMIT_GEOS /* including GEOS */
128 
137  GAIAGEO_DECLARE void gaiaResetGeosMsg (void);
138 
150  GAIAGEO_DECLARE const char *gaiaGetGeosErrorMsg (void);
151 
163  GAIAGEO_DECLARE const char *gaiaGetGeosWarningMsg (void);
164 
175  GAIAGEO_DECLARE void gaiaSetGeosErrorMsg (const char *msg);
176 
187  GAIAGEO_DECLARE void gaiaSetGeosWarningMsg (const char *msg);
188 
203  GAIAGEO_DECLARE void *gaiaToGeos (const gaiaGeomCollPtr gaia);
204 
221  GAIAGEO_DECLARE void *gaiaToGeosSelective (const gaiaGeomCollPtr gaia,
222  int mode);
223 
238  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromGeos_XY (const void *geos);
239 
254  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromGeos_XYZ (const void *geos);
255 
270  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromGeos_XYM (const void *geos);
271 
286  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromGeos_XYZM (const void *geos);
287 
299  GAIAGEO_DECLARE int gaiaIsSimple (gaiaGeomCollPtr geom);
300 
316  GAIAGEO_DECLARE int gaiaIsClosed (gaiaLinestringPtr line);
317 
329  GAIAGEO_DECLARE int gaiaIsClosedGeom (gaiaGeomCollPtr geom);
330 
342  GAIAGEO_DECLARE int gaiaIsRing (gaiaLinestringPtr line);
343 
355  GAIAGEO_DECLARE int gaiaIsValid (gaiaGeomCollPtr geom);
356 
369  GAIAGEO_DECLARE int gaiaGeomCollLength (gaiaGeomCollPtr geom,
370  double *length);
371 
387  GAIAGEO_DECLARE int gaiaGeomCollLengthOrPerimeter (gaiaGeomCollPtr geom,
388  int perimeter,
389  double *length);
402  GAIAGEO_DECLARE int gaiaGeomCollArea (gaiaGeomCollPtr geom, double *area);
403 
404 
422  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaPolygonize (gaiaGeomCollPtr geom,
423  int force_multi);
438  GAIAGEO_DECLARE int gaiaGeomCollEquals (gaiaGeomCollPtr geom1,
439  gaiaGeomCollPtr geom2);
440 
455  GAIAGEO_DECLARE int gaiaGeomCollDisjoint (gaiaGeomCollPtr geom1,
456  gaiaGeomCollPtr geom2);
457 
472  GAIAGEO_DECLARE int gaiaGeomCollIntersects (gaiaGeomCollPtr geom1,
473  gaiaGeomCollPtr geom2);
474 
489  GAIAGEO_DECLARE int gaiaGeomCollOverlaps (gaiaGeomCollPtr geom1,
490  gaiaGeomCollPtr geom2);
491 
506  GAIAGEO_DECLARE int gaiaGeomCollCrosses (gaiaGeomCollPtr geom1,
507  gaiaGeomCollPtr geom2);
508 
523  GAIAGEO_DECLARE int gaiaGeomCollContains (gaiaGeomCollPtr geom1,
524  gaiaGeomCollPtr geom2);
525 
540  GAIAGEO_DECLARE int gaiaGeomCollWithin (gaiaGeomCollPtr geom1,
541  gaiaGeomCollPtr geom2);
542 
557  GAIAGEO_DECLARE int gaiaGeomCollTouches (gaiaGeomCollPtr geom1,
558  gaiaGeomCollPtr geom2);
559 
575  GAIAGEO_DECLARE int gaiaGeomCollRelate (gaiaGeomCollPtr geom1,
576  gaiaGeomCollPtr geom2,
577  const char *pattern);
578 
594  GAIAGEO_DECLARE int gaiaGeomCollDistance (gaiaGeomCollPtr geom1,
595  gaiaGeomCollPtr geom2,
596  double *dist);
597 
616  geom1,
618  geom2);
619 
636  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaGeometryUnion (gaiaGeomCollPtr geom1,
637  gaiaGeomCollPtr geom2);
638 
656  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaUnionCascaded (gaiaGeomCollPtr geom);
657 
675  geom1,
677  geom2);
678 
696  geom1,
698  geom2);
699 
715  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaBoundary (gaiaGeomCollPtr geom);
716 
730  GAIAGEO_DECLARE int gaiaGeomCollCentroid (gaiaGeomCollPtr geom, double *x,
731  double *y);
732 
744  GAIAGEO_DECLARE int gaiaGetPointOnSurface (gaiaGeomCollPtr geom, double *x,
745  double *y);
746 
764  double tolerance);
765 
782  GAIAGEO_DECLARE gaiaGeomCollPtr
784  double tolerance);
785 
801  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaConvexHull (gaiaGeomCollPtr geom);
802 
821  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaGeomCollBuffer (gaiaGeomCollPtr geom,
822  double radius,
823  int points);
824 
825 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
826 #ifdef GEOS_ADVANCED
827 #endif
828 
841  GAIAGEO_DECLARE int gaiaHausdorffDistance (gaiaGeomCollPtr geom1,
842  gaiaGeomCollPtr geom2,
843  double *dist);
844 
865  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaOffsetCurve (gaiaGeomCollPtr geom,
866  double radius, int points,
867  int left_right);
868 
890  double radius,
891  int points,
892  int left_right);
893 
910  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSharedPaths (gaiaGeomCollPtr geom1,
911  gaiaGeomCollPtr geom2);
912 
932  ln_geom,
933  double fraction);
934 
955  GAIAGEO_DECLARE gaiaGeomCollPtr
957  double distance);
958 
979  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaLineSubstring (gaiaGeomCollPtr ln_geom,
980  double start_fraction,
981  double end_fraction);
982 
1001  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaShortestLine (gaiaGeomCollPtr geom1,
1002  gaiaGeomCollPtr geom2);
1003 
1022  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSnap (gaiaGeomCollPtr geom1,
1023  gaiaGeomCollPtr geom2,
1024  double tolerance);
1025 
1041  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaLineMerge (gaiaGeomCollPtr geom);
1042 
1060  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaLinesCutAtNodes (gaiaGeomCollPtr geom1,
1061  gaiaGeomCollPtr geom2);
1062 
1080  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaUnaryUnion (gaiaGeomCollPtr geom);
1081 
1095  GAIAGEO_DECLARE double gaiaLineLocatePoint (gaiaGeomCollPtr ln_geom,
1096  gaiaGeomCollPtr pt_geom);
1097 
1110  GAIAGEO_DECLARE int gaiaGeomCollCovers (gaiaGeomCollPtr geom1,
1111  gaiaGeomCollPtr geom2);
1112 
1126  GAIAGEO_DECLARE int gaiaGeomCollCoveredBy (gaiaGeomCollPtr geom1,
1127  gaiaGeomCollPtr geom2);
1128 
1149  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSquareGrid (gaiaGeomCollPtr geom,
1150  double origin_x,
1151  double origin_y,
1152  double size,
1153  int only_edges);
1154 
1175  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaTriangularGrid (gaiaGeomCollPtr geom,
1176  double origin_x,
1177  double origin_y,
1178  double size,
1179  int only_edges);
1180 
1201  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaHexagonalGrid (gaiaGeomCollPtr geom,
1202  double origin_x,
1203  double origin_y,
1204  double size,
1205  int only_edges);
1206 
1207 #endif /* end GEOS advanced features */
1208 
1209 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
1210 #ifdef GEOS_TRUNK
1211 #endif
1212 
1232  geom,
1233  double tolerance,
1234  int only_edges);
1235 
1255  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaVoronojDiagram (gaiaGeomCollPtr geom,
1256  double extra_frame_size,
1257  double tolerance,
1258  int only_edges);
1259 
1287  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaConcaveHull (gaiaGeomCollPtr geom,
1288  double factor,
1289  double tolerance,
1290  int allow_holes);
1291 
1292 #endif /* end GEOS experimental features */
1293 
1294 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
1295 #ifdef ENABLE_LWGEOM
1296 #endif
1297 
1316  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMakeValid (gaiaGeomCollPtr geom);
1317 
1338  geom);
1339 
1359  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSegmentize (gaiaGeomCollPtr geom,
1360  double dist);
1361 
1377  GAIAGEO_DECLARE int gaiaAzimuth (double xa, double ya, double xb,
1378  double yb, double *azimuth);
1379 
1393  GAIAGEO_DECLARE char *gaiaGeoHash (gaiaGeomCollPtr geom, int precision);
1394 
1411  GAIAGEO_DECLARE char *gaiaAsX3D (gaiaGeomCollPtr geom, const char *srs,
1412  int precision, int options,
1413  const char *defid);
1414 
1430  GAIAGEO_DECLARE int gaia3DDistance (gaiaGeomCollPtr geom1,
1431  gaiaGeomCollPtr geom2, double *dist);
1432 
1448  GAIAGEO_DECLARE int gaiaMaxDistance (gaiaGeomCollPtr geom1,
1449  gaiaGeomCollPtr geom2, double *dist);
1450 
1466  GAIAGEO_DECLARE int gaia3DMaxDistance (gaiaGeomCollPtr geom1,
1467  gaiaGeomCollPtr geom2, double *dist);
1468 
1487  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSplit (gaiaGeomCollPtr input,
1488  gaiaGeomCollPtr blade);
1489 
1509  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSplitLeft (gaiaGeomCollPtr input,
1510  gaiaGeomCollPtr blade);
1511 
1531  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSplitRight (gaiaGeomCollPtr input,
1532  gaiaGeomCollPtr blade);
1533 
1534 
1535 #endif /* end LWGEOM support */
1536 
1537 #endif /* end including GEOS */
1538 
1564  GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSnapToGrid (gaiaGeomCollPtr geom,
1565  double origin_x,
1566  double origin_y,
1567  double origin_z,
1568  double origin_m,
1569  double size_x,
1570  double size_y,
1571  double size_z,
1572  double size_m);
1573 
1574 #ifdef __cplusplus
1575 }
1576 #endif
1577 
1578 #endif /* _GG_ADVANCED_H */