SpatiaLite 4.3.0a

src/headers/spatialite/gg_core.h

Go to the documentation of this file.
00001 /*
00002  gg_core.h -- Gaia common support for geometries: core functions
00003   
00004  version 4.3, 2015 June 29
00005 
00006  Author: Sandro Furieri a.furieri@lqt.it
00007 
00008  ------------------------------------------------------------------------------
00009  
00010  Version: MPL 1.1/GPL 2.0/LGPL 2.1
00011  
00012  The contents of this file are subject to the Mozilla Public License Version
00013  1.1 (the "License"); you may not use this file except in compliance with
00014  the License. You may obtain a copy of the License at
00015  http://www.mozilla.org/MPL/
00016  
00017 Software distributed under the License is distributed on an "AS IS" basis,
00018 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00019 for the specific language governing rights and limitations under the
00020 License.
00021 
00022 The Original Code is the SpatiaLite library
00023 
00024 The Initial Developer of the Original Code is Alessandro Furieri
00025  
00026 Portions created by the Initial Developer are Copyright (C) 2008-2015
00027 the Initial Developer. All Rights Reserved.
00028 
00029 Contributor(s):
00030 
00031 
00032 Alternatively, the contents of this file may be used under the terms of
00033 either the GNU General Public License Version 2 or later (the "GPL"), or
00034 the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00035 in which case the provisions of the GPL or the LGPL are applicable instead
00036 of those above. If you wish to allow use of your version of this file only
00037 under the terms of either the GPL or the LGPL, and not to allow others to
00038 use your version of this file under the terms of the MPL, indicate your
00039 decision by deleting the provisions above and replace them with the notice
00040 and other provisions required by the GPL or the LGPL. If you do not delete
00041 the provisions above, a recipient may use your version of this file under
00042 the terms of any one of the MPL, the GPL or the LGPL.
00043  
00044 */
00045 
00046 
00053 #ifndef _GG_CORE_H
00054 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00055 #define _GG_CORE_H
00056 #endif
00057 
00058 #ifdef __cplusplus
00059 extern "C"
00060 {
00061 #endif
00062 
00063 /* function prototypes */
00064 
00075     GAIAGEO_DECLARE void gaiaFree (void *ptr);
00076 
00092     GAIAGEO_DECLARE gaiaPointPtr gaiaAllocPoint (double x, double y);
00093 
00110     GAIAGEO_DECLARE gaiaPointPtr gaiaAllocPointXYZ (double x, double y,
00111                                                     double z);
00112 
00129     GAIAGEO_DECLARE gaiaPointPtr gaiaAllocPointXYM (double x, double y,
00130                                                     double m);
00131 
00149     GAIAGEO_DECLARE gaiaPointPtr gaiaAllocPointXYZM (double x, double y,
00150                                                      double z, double m);
00151 
00163     GAIAGEO_DECLARE void gaiaFreePoint (gaiaPointPtr ptr);
00164 
00180     GAIAGEO_DECLARE gaiaLinestringPtr gaiaAllocLinestring (int vert);
00181 
00197     GAIAGEO_DECLARE gaiaLinestringPtr gaiaAllocLinestringXYZ (int vert);
00198 
00214     GAIAGEO_DECLARE gaiaLinestringPtr gaiaAllocLinestringXYM (int vert);
00215 
00231     GAIAGEO_DECLARE gaiaLinestringPtr gaiaAllocLinestringXYZM (int vert);
00232 
00245     GAIAGEO_DECLARE void gaiaFreeLinestring (gaiaLinestringPtr ptr);
00246 
00259     GAIAGEO_DECLARE void gaiaCopyLinestringCoords (gaiaLinestringPtr dst,
00260                                                    gaiaLinestringPtr src);
00261 
00274     GAIAGEO_DECLARE void gaiaCopyLinestringCoordsReverse (gaiaLinestringPtr dst,
00275                                                           gaiaLinestringPtr
00276                                                           src);
00277 
00293     GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRing (int vert);
00294 
00310     GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRingXYZ (int vert);
00311 
00327     GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRingXYM (int vert);
00328 
00344     GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRingXYZM (int vert);
00345 
00358     GAIAGEO_DECLARE void gaiaFreeRing (gaiaRingPtr ptr);
00359 
00372     GAIAGEO_DECLARE void gaiaCopyRingCoords (gaiaRingPtr dst, gaiaRingPtr src);
00373 
00386     GAIAGEO_DECLARE void gaiaCopyRingCoordsReverse (gaiaRingPtr dst,
00387                                                     gaiaRingPtr src);
00388 
00404     GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygon (int vert, int holes);
00405 
00421     GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygonXYZ (int vert, int holes);
00422 
00438     GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygonXYM (int vert, int holes);
00439 
00455     GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygonXYZM (int vert, int holes);
00456 
00475     GAIAGEO_DECLARE gaiaPolygonPtr gaiaCreatePolygon (gaiaRingPtr ring);
00476 
00492     GAIAGEO_DECLARE void gaiaFreePolygon (gaiaPolygonPtr polyg);
00493 
00506     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomColl (void);
00507 
00520     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomCollXYZ (void);
00521 
00534     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomCollXYM (void);
00535 
00548     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomCollXYZM (void);
00549 
00565     GAIAGEO_DECLARE void gaiaFreeGeomColl (gaiaGeomCollPtr geom);
00566 
00577     GAIAGEO_DECLARE void gaiaAddPointToGeomColl (gaiaGeomCollPtr p, double x,
00578                                                  double y);
00579 
00591     GAIAGEO_DECLARE void gaiaAddPointToGeomCollXYZ (gaiaGeomCollPtr p, double x,
00592                                                     double y, double z);
00593 
00605     GAIAGEO_DECLARE void gaiaAddPointToGeomCollXYM (gaiaGeomCollPtr p, double x,
00606                                                     double y, double m);
00607 
00620     GAIAGEO_DECLARE void gaiaAddPointToGeomCollXYZM (gaiaGeomCollPtr p,
00621                                                      double x, double y,
00622                                                      double z, double m);
00623 
00635     GAIAGEO_DECLARE gaiaLinestringPtr
00636         gaiaAddLinestringToGeomColl (gaiaGeomCollPtr p, int vert);
00637 
00647     GAIAGEO_DECLARE void gaiaInsertLinestringInGeomColl (gaiaGeomCollPtr p,
00648                                                          gaiaLinestringPtr
00649                                                          line);
00650 
00663     GAIAGEO_DECLARE gaiaPolygonPtr gaiaAddPolygonToGeomColl (gaiaGeomCollPtr p,
00664                                                              int vert,
00665                                                              int interiors);
00666 
00681     GAIAGEO_DECLARE gaiaPolygonPtr gaiaInsertPolygonInGeomColl (gaiaGeomCollPtr
00682                                                                 p,
00683                                                                 gaiaRingPtr
00684                                                                 ring);
00685 
00701     GAIAGEO_DECLARE gaiaRingPtr gaiaAddInteriorRing (gaiaPolygonPtr p, int pos,
00702                                                      int vert);
00703 
00717     GAIAGEO_DECLARE void gaiaInsertInteriorRing (gaiaPolygonPtr p,
00718                                                  gaiaRingPtr ring);
00719 
00732     GAIAGEO_DECLARE void gaiaAddRingToPolyg (gaiaPolygonPtr polyg,
00733                                              gaiaRingPtr ring);
00734 
00748     GAIAGEO_DECLARE gaiaLinestringPtr gaiaCloneLinestring (gaiaLinestringPtr
00749                                                            line);
00765     GAIAGEO_DECLARE gaiaLinestringPtr
00766         gaiaCloneLinestringSpecial (gaiaLinestringPtr line, int mode);
00767 
00781     GAIAGEO_DECLARE gaiaRingPtr gaiaCloneRing (gaiaRingPtr ring);
00782 
00798     GAIAGEO_DECLARE gaiaRingPtr gaiaCloneRingSpecial (gaiaRingPtr ring,
00799                                                       int mode);
00800 
00814     GAIAGEO_DECLARE gaiaPolygonPtr gaiaClonePolygon (gaiaPolygonPtr polyg);
00815 
00832     GAIAGEO_DECLARE gaiaPolygonPtr gaiaClonePolygonSpecial (gaiaPolygonPtr
00833                                                             polyg, int mode);
00834 
00851     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCloneGeomColl (gaiaGeomCollPtr geom);
00852 
00870     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCloneGeomCollSpecial (gaiaGeomCollPtr
00871                                                               geom, int mode);
00872 
00888     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCloneGeomCollPoints (gaiaGeomCollPtr
00889                                                              geom);
00890 
00905     GAIAGEO_DECLARE gaiaGeomCollPtr
00906         gaiaCloneGeomCollLinestrings (gaiaGeomCollPtr geom);
00907 
00922     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCloneGeomCollPolygons (gaiaGeomCollPtr
00923                                                                geom);
00924 
00938     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXY (gaiaGeomCollPtr geom);
00939 
00953     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXYZ (gaiaGeomCollPtr
00954                                                            geom);
00955 
00969     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXYM (gaiaGeomCollPtr
00970                                                            geom);
00971 
00985     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXYZM (gaiaGeomCollPtr
00986                                                             geom);
00987 
01012     GAIAGEO_DECLARE int gaiaLineGetPoint (gaiaLinestringPtr ln, int v,
01013                                           double *x, double *y, double *z,
01014                                           double *m);
01015 
01040     GAIAGEO_DECLARE int gaiaLineSetPoint (gaiaLinestringPtr ln, int v, double x,
01041                                           double y, double z, double m);
01042 
01067     GAIAGEO_DECLARE int gaiaRingGetPoint (gaiaRingPtr rng, int v, double *x,
01068                                           double *y, double *z, double *m);
01069 
01094     GAIAGEO_DECLARE int gaiaRingSetPoint (gaiaRingPtr rng, int v, double x,
01095                                           double y, double z, double m);
01096 
01110     GAIAGEO_DECLARE int gaiaDimension (gaiaGeomCollPtr geom);
01111 
01130     GAIAGEO_DECLARE int gaiaGeometryType (gaiaGeomCollPtr geom);
01131 
01148     GAIAGEO_DECLARE int gaiaGeometryAliasType (gaiaGeomCollPtr geom);
01149 
01160     GAIAGEO_DECLARE int gaiaIsEmpty (gaiaGeomCollPtr geom);
01161 
01179     GAIAGEO_DECLARE int gaiaIsToxic (gaiaGeomCollPtr geom);
01180 
01199     GAIAGEO_DECLARE int gaiaIsToxic_r (const void *p_cache,
01200                                        gaiaGeomCollPtr geom);
01201 
01218     GAIAGEO_DECLARE int gaiaIsNotClosedRing (gaiaRingPtr ring);
01219 
01237     GAIAGEO_DECLARE int gaiaIsNotClosedRing_r (const void *p_data,
01238                                                gaiaRingPtr ring);
01239 
01253     GAIAGEO_DECLARE int gaiaIsNotClosedGeomColl (gaiaGeomCollPtr geom);
01254 
01269     GAIAGEO_DECLARE int gaiaIsNotClosedGeomColl_r (const void *p_data,
01270                                                    gaiaGeomCollPtr geom);
01271 
01290     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSanitize (gaiaGeomCollPtr org);
01291 
01292 
01309     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaLinearize (gaiaGeomCollPtr geom,
01310                                                    int force_multi);
01311 
01328     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaDissolveSegments (gaiaGeomCollPtr geom);
01329 
01346     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaDissolvePoints (gaiaGeomCollPtr geom);
01347 
01364     GAIAGEO_DECLARE gaiaGeomCollPtr
01365         gaiaExtractPointsFromGeomColl (gaiaGeomCollPtr geom);
01366 
01383     GAIAGEO_DECLARE gaiaGeomCollPtr
01384         gaiaExtractLinestringsFromGeomColl (gaiaGeomCollPtr geom);
01385 
01402     GAIAGEO_DECLARE gaiaGeomCollPtr
01403         gaiaExtractPolygonsFromGeomColl (gaiaGeomCollPtr geom);
01404 
01421     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMergeGeometries (gaiaGeomCollPtr geom1,
01422                                                          gaiaGeomCollPtr geom2);
01423 
01441     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMergeGeometries_r (const void *p_cache,
01442                                                            gaiaGeomCollPtr
01443                                                            geom1,
01444                                                            gaiaGeomCollPtr
01445                                                            geom2);
01446 
01465     GAIAGEO_DECLARE gaiaGeomCollPtr
01466         gaiaLocateBetweenMeasures (gaiaGeomCollPtr geom, double m_start,
01467                                    double m_end);
01468 
01486     GAIAGEO_DECLARE double gaiaMeasureLength (int dims, double *coords,
01487                                               int vert);
01488 
01500     GAIAGEO_DECLARE double gaiaMeasureArea (gaiaRingPtr ring);
01501 
01513     GAIAGEO_DECLARE void gaiaRingCentroid (gaiaRingPtr ring, double *rx,
01514                                            double *ry);
01515 
01524     GAIAGEO_DECLARE void gaiaClockwise (gaiaRingPtr p);
01525 
01535     GAIAGEO_DECLARE int gaiaIsPointOnRingSurface (gaiaRingPtr ring, double pt_x,
01536                                                   double pt_y);
01537 
01547     GAIAGEO_DECLARE int gaiaIsPointOnPolygonSurface (gaiaPolygonPtr polyg,
01548                                                      double x, double y);
01549 
01565     GAIAGEO_DECLARE double gaiaMinDistance (double x0, double y0,
01566                                             int dims, double *coords, int vert);
01567 
01585     GAIAGEO_DECLARE int gaiaIntersect (double *x0, double *y0, double x1,
01586                                        double y1, double x2, double y2,
01587                                        double x3, double y3, double x4,
01588                                        double y4);
01589 
01600     GAIAGEO_DECLARE void gaiaShiftCoords (gaiaGeomCollPtr geom, double shift_x,
01601                                           double shift_y);
01602 
01614     GAIAGEO_DECLARE void gaiaShiftCoords3D (gaiaGeomCollPtr geom,
01615                                             double shift_x, double shift_y,
01616                                             double shift_z);
01617 
01631     GAIAGEO_DECLARE void gaiaShiftLongitude (gaiaGeomCollPtr geom);
01632 
01642     GAIAGEO_DECLARE void gaiaNormalizeLonLat (gaiaGeomCollPtr geom);
01643 
01644 
01654     GAIAGEO_DECLARE void gaiaScaleCoords (gaiaGeomCollPtr geom, double scale_x,
01655                                           double scale_y);
01656 
01665     GAIAGEO_DECLARE void gaiaRotateCoords (gaiaGeomCollPtr geom, double angle);
01666 
01678     GAIAGEO_DECLARE void gaiaReflectCoords (gaiaGeomCollPtr geom, int x_axis,
01679                                             int y_axis);
01680 
01690     GAIAGEO_DECLARE void gaiaSwapCoords (gaiaGeomCollPtr geom);
01691 
01706     GAIAGEO_DECLARE int gaiaLinestringEquals (gaiaLinestringPtr line1,
01707                                               gaiaLinestringPtr line2);
01708 
01724     GAIAGEO_DECLARE int gaiaPolygonEquals (gaiaPolygonPtr polyg1,
01725                                            gaiaPolygonPtr polyg2);
01726 
01746     GAIAGEO_DECLARE int gaiaEllipseParams (const char *name, double *a,
01747                                            double *b, double *rf);
01748 
01767     GAIAGEO_DECLARE double gaiaGreatCircleDistance (double a, double b,
01768                                                     double lat1, double lon1,
01769                                                     double lat2, double lon2);
01770 
01790     GAIAGEO_DECLARE double gaiaGeodesicDistance (double a, double b, double rf,
01791                                                  double lat1, double lon1,
01792                                                  double lat2, double lon2);
01793 
01814     GAIAGEO_DECLARE double gaiaGreatCircleTotalLength (double a, double b,
01815                                                        int dims, double *coords,
01816                                                        int vert);
01817 
01839     GAIAGEO_DECLARE double gaiaGeodesicTotalLength (double a, double b,
01840                                                     double rf, int dims,
01841                                                     double *coords, int vert);
01842 
01857     GAIAGEO_DECLARE int gaiaConvertLength (double value, int unit_from,
01858                                            int unit_to, double *cvt);
01859 
01873     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMakeCircle (double center_x,
01874                                                     double center_y,
01875                                                     double radius, double step);
01876 
01888     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMakeEllipse (double center_x,
01889                                                      double center_y,
01890                                                      double x_axis,
01891                                                      double y_axis,
01892                                                      double step);
01893 
01909     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMakeArc (double center_x,
01910                                                  double center_y, double radius,
01911                                                  double start, double stop,
01912                                                  double step);
01913 
01927     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMakeEllipticArc (double center_x,
01928                                                          double center_y,
01929                                                          double x_axis,
01930                                                          double y_axis,
01931                                                          double start,
01932                                                          double stop,
01933                                                          double step);
01934 
01952     GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMakePolygon (gaiaGeomCollPtr exterior,
01953                                                      gaiaGeomCollPtr interiors);
01954 
01955 #ifdef __cplusplus
01956 }
01957 #endif
01958 
01959 #endif                          /* _GG_CORE_H */
 All Data Structures Files Functions Variables Typedefs Defines