SpatiaLite
3.0.0-stable
|
00001 /* 00002 gg_formats.h -- Gaia common support for geometries: formats 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 Klaus Foerster klaus.foerster@svg.cc 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_FORMATS_H 00054 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00055 #define _GG_FORMATS_H 00056 #endif 00057 00058 #ifdef __cplusplus 00059 extern "C" 00060 { 00061 #endif 00062 00063 /* function prototypes */ 00064 00070 GAIAGEO_DECLARE int gaiaEndianArch (void); 00071 00087 GAIAGEO_DECLARE short gaiaImport16 (const unsigned char *p, 00088 int little_endian, 00089 int little_endian_arch); 00090 00106 GAIAGEO_DECLARE int gaiaImport32 (const unsigned char *p, int little_endian, 00107 int little_endian_arch); 00108 00124 GAIAGEO_DECLARE float gaiaImportF32 (const unsigned char *p, 00125 int little_endian, 00126 int little_endian_arch); 00127 00143 GAIAGEO_DECLARE double gaiaImport64 (const unsigned char *p, 00144 int little_endian, 00145 int little_endian_arch); 00146 00162 GAIAGEO_DECLARE sqlite3_int64 gaiaImportI64 (const unsigned char *p, 00163 int little_endian, 00164 int little_endian_arch); 00165 00180 GAIAGEO_DECLARE void gaiaExport16 (unsigned char *p, short value, 00181 int little_endian, 00182 int little_endian_arch); 00183 00198 GAIAGEO_DECLARE void gaiaExport32 (unsigned char *p, int value, 00199 int little_endian, 00200 int little_endian_arch); 00201 00216 GAIAGEO_DECLARE void gaiaExportF32 (unsigned char *p, float value, 00217 int little_endian, 00218 int little_endian_arch); 00219 00234 GAIAGEO_DECLARE void gaiaExport64 (unsigned char *p, double value, 00235 int little_endian, 00236 int little_endian_arch); 00237 00252 GAIAGEO_DECLARE void gaiaExportI64 (unsigned char *p, sqlite3_int64 value, 00253 int little_endian, 00254 int little_endian_arch); 00255 00271 GAIAGEO_DECLARE void gaiaOutBufferInitialize (gaiaOutBufferPtr buf); 00272 00284 GAIAGEO_DECLARE void gaiaOutBufferReset (gaiaOutBufferPtr buf); 00285 00299 GAIAGEO_DECLARE void gaiaAppendToOutBuffer (gaiaOutBufferPtr buf, 00300 const char *text); 00301 00318 GAIAGEO_DECLARE void gaiaMakePoint (double x, double y, int srid, 00319 unsigned char **result, int *size); 00320 00336 GAIAGEO_DECLARE void gaiaMakeLine (gaiaGeomCollPtr geom1, 00337 gaiaGeomCollPtr geom2, 00338 unsigned char **result, int *size); 00339 00355 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromSpatiaLiteBlobWkb (const unsigned 00356 char *blob, 00357 unsigned int 00358 size); 00359 00374 GAIAGEO_DECLARE void gaiaToSpatiaLiteBlobWkb (gaiaGeomCollPtr geom, 00375 unsigned char **result, 00376 int *size); 00377 00394 GAIAGEO_DECLARE void gaiaToCompressedBlobWkb (gaiaGeomCollPtr geom, 00395 unsigned char **result, 00396 int *size); 00397 00413 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromWkb (const unsigned char *blob, 00414 unsigned int size); 00415 00433 GAIAGEO_DECLARE void gaiaToWkb (gaiaGeomCollPtr geom, 00434 unsigned char **result, int *size); 00435 00450 GAIAGEO_DECLARE char *gaiaToHexWkb (gaiaGeomCollPtr geom); 00451 00463 GAIAGEO_DECLARE void gaiaToEWKB (gaiaOutBufferPtr out_buf, 00464 gaiaGeomCollPtr geom); 00465 00480 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromEWKB (const unsigned char 00481 *in_buffer); 00482 00498 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromFgf (const unsigned char *blob, 00499 unsigned int size); 00500 00516 GAIAGEO_DECLARE void gaiaToFgf (gaiaGeomCollPtr geom, 00517 unsigned char **result, int *size, 00518 int coord_dims); 00519 00537 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseWkt (const unsigned char 00538 *in_buffer, short type); 00539 00552 GAIAGEO_DECLARE void gaiaOutWkt (gaiaOutBufferPtr out_buf, 00553 gaiaGeomCollPtr geom); 00554 00568 GAIAGEO_DECLARE void gaiaOutWktStrict (gaiaOutBufferPtr out_buf, 00569 gaiaGeomCollPtr geom, int precision); 00570 00585 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseEWKT (const unsigned char 00586 *in_buffer); 00587 00598 GAIAGEO_DECLARE void gaiaToEWKT (gaiaOutBufferPtr out_buf, 00599 gaiaGeomCollPtr geom); 00600 00611 GAIAGEO_DECLARE void gaiaOutPointZ (gaiaOutBufferPtr out_buf, 00612 gaiaPointPtr point); 00613 00624 GAIAGEO_DECLARE void gaiaOutLinestringZ (gaiaOutBufferPtr out_buf, 00625 gaiaLinestringPtr linestring); 00626 00637 GAIAGEO_DECLARE void gaiaOutPolygonZ (gaiaOutBufferPtr out_buf, 00638 gaiaPolygonPtr polygon); 00653 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseKml (const unsigned char 00654 *in_buffer); 00655 00667 GAIAGEO_DECLARE void gaiaOutBareKml (gaiaOutBufferPtr out_buf, 00668 gaiaGeomCollPtr geom, int precision); 00669 00683 GAIAGEO_DECLARE void gaiaOutFullKml (gaiaOutBufferPtr out_buf, 00684 const char *name, const char *desc, 00685 gaiaGeomCollPtr geom, int precision); 00686 00702 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseGml (const unsigned char 00703 *in_buffer, 00704 sqlite3 * sqlite_handle); 00705 00719 GAIAGEO_DECLARE void gaiaOutGml (gaiaOutBufferPtr out_buf, int version, 00720 int precision, gaiaGeomCollPtr geom); 00721 00736 GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseGeoJSON (const unsigned char 00737 *in_buffer); 00738 00757 GAIAGEO_DECLARE void gaiaOutGeoJSON (gaiaOutBufferPtr out_buf, 00758 gaiaGeomCollPtr geom, int precision, 00759 int options); 00771 GAIAGEO_DECLARE void gaiaOutSvg (gaiaOutBufferPtr out_buf, 00772 gaiaGeomCollPtr geom, int relative, 00773 int precision); 00774 00788 GAIAGEO_DECLARE gaiaValuePtr gaiaCloneValue (gaiaValuePtr org); 00789 00799 GAIAGEO_DECLARE void gaiaFreeValue (gaiaValuePtr p); 00800 00824 GAIAGEO_DECLARE gaiaDbfFieldPtr gaiaAllocDbfField (char *name, 00825 unsigned char type, 00826 int offset, 00827 unsigned char length, 00828 unsigned char decimals); 00829 00839 GAIAGEO_DECLARE void gaiaFreeDbfField (gaiaDbfFieldPtr p); 00840 00855 GAIAGEO_DECLARE gaiaDbfFieldPtr gaiaCloneDbfField (gaiaDbfFieldPtr org); 00856 00866 GAIAGEO_DECLARE void gaiaSetNullValue (gaiaDbfFieldPtr field); 00867 00878 GAIAGEO_DECLARE void gaiaSetIntValue (gaiaDbfFieldPtr field, 00879 sqlite3_int64 value); 00880 00890 GAIAGEO_DECLARE void gaiaSetDoubleValue (gaiaDbfFieldPtr field, 00891 double value); 00892 00902 GAIAGEO_DECLARE void gaiaSetStrValue (gaiaDbfFieldPtr field, char *str); 00903 00916 GAIAGEO_DECLARE gaiaDbfListPtr gaiaAllocDbfList (void); 00917 00930 GAIAGEO_DECLARE void gaiaFreeDbfList (gaiaDbfListPtr list); 00931 00942 GAIAGEO_DECLARE int gaiaIsValidDbfList (gaiaDbfListPtr list); 00943 00964 GAIAGEO_DECLARE gaiaDbfFieldPtr gaiaAddDbfField (gaiaDbfListPtr list, 00965 char *name, 00966 unsigned char type, 00967 int offset, 00968 unsigned char length, 00969 unsigned char decimals); 00970 00981 GAIAGEO_DECLARE void gaiaResetDbfEntity (gaiaDbfListPtr list); 00982 00995 GAIAGEO_DECLARE gaiaDbfListPtr gaiaCloneDbfEntity (gaiaDbfListPtr org); 00996 01009 GAIAGEO_DECLARE gaiaShapefilePtr gaiaAllocShapefile (void); 01010 01023 GAIAGEO_DECLARE void gaiaFreeShapefile (gaiaShapefilePtr shp); 01024 01040 GAIAGEO_DECLARE void gaiaOpenShpRead (gaiaShapefilePtr shp, 01041 const char *path, 01042 const char *charFrom, 01043 const char *charTo); 01044 01066 GAIAGEO_DECLARE void gaiaOpenShpWrite (gaiaShapefilePtr shp, 01067 const char *path, int shape, 01068 gaiaDbfListPtr list, 01069 const char *charFrom, 01070 const char *charTo); 01071 01092 GAIAGEO_DECLARE int gaiaReadShpEntity (gaiaShapefilePtr shp, 01093 int current_row, int srid); 01094 01108 GAIAGEO_DECLARE void gaiaShpAnalyze (gaiaShapefilePtr shp); 01109 01124 GAIAGEO_DECLARE int gaiaWriteShpEntity (gaiaShapefilePtr shp, 01125 gaiaDbfListPtr entity); 01126 01139 GAIAGEO_DECLARE void gaiaFlushShpHeaders (gaiaShapefilePtr shp); 01140 01153 GAIAGEO_DECLARE gaiaDbfPtr gaiaAllocDbf (void); 01154 01167 GAIAGEO_DECLARE void gaiaFreeDbf (gaiaDbfPtr dbf); 01168 01183 GAIAGEO_DECLARE void gaiaOpenDbfRead (gaiaDbfPtr dbf, 01184 const char *path, 01185 const char *charFrom, 01186 const char *charTo); 01187 01202 GAIAGEO_DECLARE void gaiaOpenDbfWrite (gaiaDbfPtr dbf, 01203 const char *path, 01204 const char *charFrom, 01205 const char *charTo); 01206 01227 GAIAGEO_DECLARE int gaiaReadDbfEntity (gaiaDbfPtr dbf, int current_row, 01228 int *deleted); 01229 01244 GAIAGEO_DECLARE int gaiaWriteDbfEntity (gaiaDbfPtr dbf, 01245 gaiaDbfListPtr entity); 01246 01259 GAIAGEO_DECLARE void gaiaFlushDbfHeader (gaiaDbfPtr dbf); 01260 01261 01262 01263 #ifndef OMIT_ICONV /* ICONV enabled: supporting text reader */ 01264 01286 GAIAGEO_DECLARE gaiaTextReaderPtr gaiaTextReaderAlloc (const char *path, 01287 char field_separator, 01288 char text_separator, 01289 char 01290 decimal_separator, 01291 int 01292 first_line_titles, 01293 const char 01294 *encoding); 01295 01304 GAIAGEO_DECLARE void gaiaTextReaderDestroy (gaiaTextReaderPtr reader); 01305 01321 GAIAGEO_DECLARE int gaiaTextReaderParse (gaiaTextReaderPtr reader); 01322 01338 GAIAGEO_DECLARE int gaiaTextReaderGetRow (gaiaTextReaderPtr reader, 01339 int row_num); 01340 01354 GAIAGEO_DECLARE int gaiaTextReaderFetchField (gaiaTextReaderPtr reader, 01355 int field_num, int *type, 01356 const char **value); 01357 01358 #endif /* end ICONV (text reader) */ 01359 01360 #ifdef __cplusplus 01361 } 01362 #endif 01363 01364 #endif /* _GG_FORMATS_H */