SpatiaLite
3.0.0-stable
|
00001 /* 00002 gg_core.h -- Gaia common support for geometries: core functions 00003 00004 version 3.0, 2011 July 20 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 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 00257 GAIAGEO_DECLARE void gaiaCopyLinestringCoords (gaiaLinestringPtr dst, 00258 gaiaLinestringPtr src); 00259 00275 GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRing (int vert); 00276 00292 GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRingXYZ (int vert); 00293 00309 GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRingXYM (int vert); 00310 00326 GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRingXYZM (int vert); 00327 00340 GAIAGEO_DECLARE void gaiaFreeRing (gaiaRingPtr ptr); 00341 00352 GAIAGEO_DECLARE void gaiaCopyRingCoords (gaiaRingPtr dst, gaiaRingPtr src); 00353 00369 GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygon (int vert, int holes); 00370 00386 GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygonXYZ (int vert, int holes); 00387 00403 GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygonXYM (int vert, int holes); 00404 00420 GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygonXYZM (int vert, int holes); 00421 00440 GAIAGEO_DECLARE gaiaPolygonPtr gaiaCreatePolygon (gaiaRingPtr ring); 00441 00457 GAIAGEO_DECLARE void gaiaFreePolygon (gaiaPolygonPtr polyg); 00458 00471 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomColl (void); 00472 00485 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomCollXYZ (void); 00486 00499 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomCollXYM (void); 00500 00513 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomCollXYZM (void); 00514 00530 GAIAGEO_DECLARE void gaiaFreeGeomColl (gaiaGeomCollPtr geom); 00531 00542 GAIAGEO_DECLARE void gaiaAddPointToGeomColl (gaiaGeomCollPtr p, double x, 00543 double y); 00544 00556 GAIAGEO_DECLARE void gaiaAddPointToGeomCollXYZ (gaiaGeomCollPtr p, double x, 00557 double y, double z); 00558 00570 GAIAGEO_DECLARE void gaiaAddPointToGeomCollXYM (gaiaGeomCollPtr p, double x, 00571 double y, double m); 00572 00585 GAIAGEO_DECLARE void gaiaAddPointToGeomCollXYZM (gaiaGeomCollPtr p, 00586 double x, double y, 00587 double z, double m); 00588 00600 GAIAGEO_DECLARE gaiaLinestringPtr 00601 gaiaAddLinestringToGeomColl (gaiaGeomCollPtr p, int vert); 00602 00612 GAIAGEO_DECLARE void gaiaInsertLinestringInGeomColl (gaiaGeomCollPtr p, 00613 gaiaLinestringPtr 00614 line); 00615 00628 GAIAGEO_DECLARE gaiaPolygonPtr gaiaAddPolygonToGeomColl (gaiaGeomCollPtr p, 00629 int vert, 00630 int interiors); 00631 00646 GAIAGEO_DECLARE gaiaPolygonPtr gaiaInsertPolygonInGeomColl (gaiaGeomCollPtr 00647 p, 00648 gaiaRingPtr 00649 ring); 00650 00666 GAIAGEO_DECLARE gaiaRingPtr gaiaAddInteriorRing (gaiaPolygonPtr p, int pos, 00667 int vert); 00668 00682 GAIAGEO_DECLARE void gaiaInsertInteriorRing (gaiaPolygonPtr p, 00683 gaiaRingPtr ring); 00684 00697 GAIAGEO_DECLARE void gaiaAddRingToPolyg (gaiaPolygonPtr polyg, 00698 gaiaRingPtr ring); 00699 00713 GAIAGEO_DECLARE gaiaLinestringPtr gaiaCloneLinestring (gaiaLinestringPtr 00714 line); 00715 00729 GAIAGEO_DECLARE gaiaRingPtr gaiaCloneRing (gaiaRingPtr ring); 00730 00744 GAIAGEO_DECLARE gaiaPolygonPtr gaiaClonePolygon (gaiaPolygonPtr polyg); 00745 00762 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCloneGeomColl (gaiaGeomCollPtr geom); 00763 00779 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCloneGeomCollPoints (gaiaGeomCollPtr 00780 geom); 00781 00796 GAIAGEO_DECLARE gaiaGeomCollPtr 00797 gaiaCloneGeomCollLinestrings (gaiaGeomCollPtr geom); 00798 00813 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCloneGeomCollPolygons (gaiaGeomCollPtr 00814 geom); 00815 00829 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXY (gaiaGeomCollPtr geom); 00830 00844 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXYZ (gaiaGeomCollPtr 00845 geom); 00846 00860 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXYM (gaiaGeomCollPtr 00861 geom); 00862 00876 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXYZM (gaiaGeomCollPtr 00877 geom); 00878 00903 GAIAGEO_DECLARE int gaiaLineGetPoint (gaiaLinestringPtr ln, int v, 00904 double *x, double *y, double *z, 00905 double *m); 00906 00931 GAIAGEO_DECLARE int gaiaLineSetPoint (gaiaLinestringPtr ln, int v, double x, 00932 double y, double z, double m); 00933 00958 GAIAGEO_DECLARE int gaiaRingGetPoint (gaiaRingPtr rng, int v, double *x, 00959 double *y, double *z, double *m); 00960 00985 GAIAGEO_DECLARE int gaiaRingSetPoint (gaiaRingPtr rng, int v, double x, 00986 double y, double z, double m); 00987 01001 GAIAGEO_DECLARE int gaiaDimension (gaiaGeomCollPtr geom); 01002 01021 GAIAGEO_DECLARE int gaiaGeometryType (gaiaGeomCollPtr geom); 01022 01039 GAIAGEO_DECLARE int gaiaGeometryAliasType (gaiaGeomCollPtr geom); 01040 01051 GAIAGEO_DECLARE int gaiaIsEmpty (gaiaGeomCollPtr geom); 01052 01067 GAIAGEO_DECLARE int gaiaIsToxic (gaiaGeomCollPtr geom); 01068 01087 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSanitize (gaiaGeomCollPtr org); 01088 01089 01106 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaLinearize (gaiaGeomCollPtr geom, 01107 int force_multi); 01108 01125 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaDissolveSegments (gaiaGeomCollPtr geom); 01126 01143 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaDissolvePoints (gaiaGeomCollPtr geom); 01144 01161 GAIAGEO_DECLARE gaiaGeomCollPtr 01162 gaiaExtractPointsFromGeomColl (gaiaGeomCollPtr geom); 01163 01180 GAIAGEO_DECLARE gaiaGeomCollPtr 01181 gaiaExtractLinestringsFromGeomColl (gaiaGeomCollPtr geom); 01182 01199 GAIAGEO_DECLARE gaiaGeomCollPtr 01200 gaiaExtractPolygonsFromGeomColl (gaiaGeomCollPtr geom); 01201 01217 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMergeGeometries (gaiaGeomCollPtr geom1, 01218 gaiaGeomCollPtr geom2); 01219 01237 GAIAGEO_DECLARE double gaiaMeasureLength (int dims, double *coords, 01238 int vert); 01239 01251 GAIAGEO_DECLARE double gaiaMeasureArea (gaiaRingPtr ring); 01252 01264 GAIAGEO_DECLARE void gaiaRingCentroid (gaiaRingPtr ring, double *rx, 01265 double *ry); 01266 01275 GAIAGEO_DECLARE void gaiaClockwise (gaiaRingPtr p); 01276 01286 GAIAGEO_DECLARE int gaiaIsPointOnRingSurface (gaiaRingPtr ring, double pt_x, 01287 double pt_y); 01288 01298 GAIAGEO_DECLARE int gaiaIsPointOnPolygonSurface (gaiaPolygonPtr polyg, 01299 double x, double y); 01300 01316 GAIAGEO_DECLARE double gaiaMinDistance (double x0, double y0, 01317 int dims, double *coords, int vert); 01318 01336 GAIAGEO_DECLARE int gaiaIntersect (double *x0, double *y0, double x1, 01337 double y1, double x2, double y2, 01338 double x3, double y3, double x4, 01339 double y4); 01340 01350 GAIAGEO_DECLARE void gaiaShiftCoords (gaiaGeomCollPtr geom, double shift_x, 01351 double shift_y); 01352 01362 GAIAGEO_DECLARE void gaiaScaleCoords (gaiaGeomCollPtr geom, double scale_x, 01363 double scale_y); 01364 01373 GAIAGEO_DECLARE void gaiaRotateCoords (gaiaGeomCollPtr geom, double angle); 01374 01386 GAIAGEO_DECLARE void gaiaReflectCoords (gaiaGeomCollPtr geom, int x_axis, 01387 int y_axis); 01388 01398 GAIAGEO_DECLARE void gaiaSwapCoords (gaiaGeomCollPtr geom); 01399 01414 GAIAGEO_DECLARE int gaiaLinestringEquals (gaiaLinestringPtr line1, 01415 gaiaLinestringPtr line2); 01416 01432 GAIAGEO_DECLARE int gaiaPolygonEquals (gaiaPolygonPtr polyg1, 01433 gaiaPolygonPtr polyg2); 01434 01454 GAIAGEO_DECLARE int gaiaEllipseParams (const char *name, double *a, 01455 double *b, double *rf); 01456 01475 GAIAGEO_DECLARE double gaiaGreatCircleDistance (double a, double b, 01476 double lat1, double lon1, 01477 double lat2, double lon2); 01478 01498 GAIAGEO_DECLARE double gaiaGeodesicDistance (double a, double b, double rf, 01499 double lat1, double lon1, 01500 double lat2, double lon2); 01501 01522 GAIAGEO_DECLARE double gaiaGreatCircleTotalLength (double a, double b, 01523 int dims, double *coords, 01524 int vert); 01525 01547 GAIAGEO_DECLARE double gaiaGeodesicTotalLength (double a, double b, 01548 double rf, int dims, 01549 double *coords, int vert); 01550 01565 GAIAGEO_DECLARE int gaiaConvertLength (double value, int unit_from, 01566 int unit_to, double *cvt); 01567 01568 #ifdef __cplusplus 01569 } 01570 #endif 01571 01572 #endif /* _GG_CORE_H */