@crossbind/port-spatialite-wasm 2.0.0-beta.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/LICENSE +35 -0
  2. package/README.md +12 -0
  3. package/config.guess +1823 -0
  4. package/config.sub +1885 -0
  5. package/crossbind.build.js +1 -0
  6. package/crossbind.config.js +11 -0
  7. package/dist/prebuilt/CMakeLists.txt +57 -0
  8. package/dist/prebuilt/wasm-wasm32-mt-release/crossbind-emccflags.fingerprint +1 -0
  9. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/control_points.h +259 -0
  10. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/debug.h +77 -0
  11. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gaia_network.h +627 -0
  12. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gaia_topology.h +1221 -0
  13. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gaiaaux.h +540 -0
  14. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gaiaconfig-msvc.h +56 -0
  15. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gaiaconfig-msvc.h.in +55 -0
  16. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gaiaconfig.h +68 -0
  17. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gaiaconfig.h.in +67 -0
  18. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gaiaexif.h +669 -0
  19. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gaiageo.h +77 -0
  20. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gaiamatrix.h +277 -0
  21. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/geojson.h +586 -0
  22. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/geopackage.h +198 -0
  23. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gg_advanced.h +5184 -0
  24. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gg_const.h +606 -0
  25. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gg_core.h +2294 -0
  26. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gg_dxf.h +993 -0
  27. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gg_dynamic.h +416 -0
  28. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gg_formats.h +2056 -0
  29. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gg_mbr.h +606 -0
  30. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gg_sequence.h +173 -0
  31. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gg_structs.h +880 -0
  32. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gg_wfs.h +581 -0
  33. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/gg_xml.h +818 -0
  34. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/spatialite_ext.h +64 -0
  35. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/sqlite.h +70 -0
  36. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite/stored_procedures.h +641 -0
  37. package/dist/prebuilt/wasm-wasm32-mt-release/include/spatialite.h +2098 -0
  38. package/dist/prebuilt/wasm-wasm32-mt-release/lib/libspatialite.a +0 -0
  39. package/dist/prebuilt/wasm-wasm32-mt-release/lib/libspatialite.la +41 -0
  40. package/dist/prebuilt/wasm-wasm32-mt-release/lib/mod_spatialite.a +0 -0
  41. package/dist/prebuilt/wasm-wasm32-mt-release/lib/mod_spatialite.la +41 -0
  42. package/dist/prebuilt/wasm-wasm32-mt-release/lib/pkgconfig/spatialite.pc +12 -0
  43. package/dist/prebuilt/wasm-wasm32-st-release/crossbind-emccflags.fingerprint +1 -0
  44. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/control_points.h +259 -0
  45. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/debug.h +77 -0
  46. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gaia_network.h +627 -0
  47. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gaia_topology.h +1221 -0
  48. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gaiaaux.h +540 -0
  49. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gaiaconfig-msvc.h +56 -0
  50. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gaiaconfig-msvc.h.in +55 -0
  51. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gaiaconfig.h +68 -0
  52. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gaiaconfig.h.in +67 -0
  53. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gaiaexif.h +669 -0
  54. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gaiageo.h +77 -0
  55. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gaiamatrix.h +277 -0
  56. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/geojson.h +586 -0
  57. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/geopackage.h +198 -0
  58. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gg_advanced.h +5184 -0
  59. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gg_const.h +606 -0
  60. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gg_core.h +2294 -0
  61. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gg_dxf.h +993 -0
  62. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gg_dynamic.h +416 -0
  63. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gg_formats.h +2056 -0
  64. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gg_mbr.h +606 -0
  65. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gg_sequence.h +173 -0
  66. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gg_structs.h +880 -0
  67. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gg_wfs.h +581 -0
  68. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/gg_xml.h +818 -0
  69. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/spatialite_ext.h +64 -0
  70. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/sqlite.h +70 -0
  71. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite/stored_procedures.h +641 -0
  72. package/dist/prebuilt/wasm-wasm32-st-release/include/spatialite.h +2098 -0
  73. package/dist/prebuilt/wasm-wasm32-st-release/lib/libspatialite.a +0 -0
  74. package/dist/prebuilt/wasm-wasm32-st-release/lib/libspatialite.la +41 -0
  75. package/dist/prebuilt/wasm-wasm32-st-release/lib/mod_spatialite.a +0 -0
  76. package/dist/prebuilt/wasm-wasm32-st-release/lib/mod_spatialite.la +41 -0
  77. package/dist/prebuilt/wasm-wasm32-st-release/lib/pkgconfig/spatialite.pc +12 -0
  78. package/package.json +39 -0
@@ -0,0 +1,2056 @@
1
+ /*
2
+ gg_formats.h -- Gaia common support for geometries: formats
3
+
4
+ version 5.1.0, 2023 August 4
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-2023
27
+ the Initial Developer. All Rights Reserved.
28
+
29
+ Contributor(s):
30
+ Klaus Foerster klaus.foerster@svg.cc
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
+ \file gg_formats.h
49
+
50
+ Geometry handling functions: formats
51
+ */
52
+
53
+ #ifndef _GG_FORMATS_H
54
+ #ifndef DOXYGEN_SHOULD_SKIP_THIS
55
+ #define _GG_FORMATS_H
56
+ #endif
57
+
58
+ #ifdef __cplusplus
59
+ extern "C"
60
+ {
61
+ #endif
62
+
63
+ /* function prototypes */
64
+
65
+ /**
66
+ Test CPU endianness
67
+
68
+ \return 0 if big-endian: any other value if little-endian
69
+ */
70
+ GAIAGEO_DECLARE int gaiaEndianArch (void);
71
+
72
+ /**
73
+ Import an INT-16 value in endian-aware fashion
74
+
75
+ \param p endian-dependent representation (input buffer).
76
+ \param little_endian 0 if the input buffer is big-endian: any other value
77
+ for little-endian.
78
+ \param little_endian_arch the value returned by gaiaEndianArch()
79
+
80
+ \return the internal SHORT value
81
+
82
+ \sa gaiaEndianArch, gaiaExport16
83
+
84
+ \note you are expected to pass an input buffer corresponding to an
85
+ allocation size of (at least) 2 bytes.
86
+ */
87
+ GAIAGEO_DECLARE short gaiaImport16 (const unsigned char *p,
88
+ int little_endian,
89
+ int little_endian_arch);
90
+
91
+ /**
92
+ Import an INT-32 value in endian-aware fashion
93
+
94
+ \param p endian-dependent representation (input buffer).
95
+ \param little_endian 0 if the input buffer is big-endian: any other value
96
+ for little-endian.
97
+ \param little_endian_arch the value returned by gaiaEndianArch()
98
+
99
+ \return the internal INT value
100
+
101
+ \sa gaiaEndianArch, gaiaExport32
102
+
103
+ \note you are expected to pass an input buffer corresponding to an
104
+ allocation size of (at least) 4 bytes.
105
+ */
106
+ GAIAGEO_DECLARE int gaiaImport32 (const unsigned char *p,
107
+ int little_endian,
108
+ int little_endian_arch);
109
+
110
+ /**
111
+ Import an UINT-32 value in endian-aware fashion
112
+
113
+ \param p endian-dependent representation (input buffer).
114
+ \param little_endian 0 if the input buffer is big-endian: any other value
115
+ for little-endian.
116
+ \param little_endian_arch the value returned by gaiaEndianArch()
117
+
118
+ \return the internal UINT value
119
+
120
+ \sa gaiaEndianArch, gaiaExportU32
121
+
122
+ \note you are expected to pass an input buffer corresponding to an
123
+ allocation size of (at least) 4 bytes.
124
+ */
125
+ GAIAGEO_DECLARE unsigned int gaiaImportU32 (const unsigned char *p,
126
+ int little_endian,
127
+ int little_endian_arch);
128
+
129
+ /**
130
+ Import a FLOAT-32 value in endian-aware fashion
131
+
132
+ \param p endian-dependent representation (input buffer).
133
+ \param little_endian 0 if the input buffer is big-endian: any other value
134
+ for little-endian.
135
+ \param little_endian_arch the value returned by gaiaEndianArch()
136
+
137
+ \return the internal FLOAT value
138
+
139
+ \sa gaiaEndianArch, gaiaExportF32
140
+
141
+ \note you are expected to pass an input buffer corresponding to an
142
+ allocation size of (at least) 4 bytes.
143
+ */
144
+ GAIAGEO_DECLARE float gaiaImportF32 (const unsigned char *p,
145
+ int little_endian,
146
+ int little_endian_arch);
147
+
148
+ /**
149
+ Import an DOUBLE-64 in endian-aware fashion
150
+
151
+ \param p endian-dependent representation (input buffer).
152
+ \param little_endian 0 if the input buffer is big-endian: any other value
153
+ for little-endian.
154
+ \param little_endian_arch the value returned by gaiaEndianArch()
155
+
156
+ \return the internal DOUBLE value
157
+
158
+ \sa gaiaEndianArch, gaiaExport64
159
+
160
+ \note you are expected to pass an input buffer corresponding to an
161
+ allocation size of (at least) 8 bytes.
162
+ */
163
+ GAIAGEO_DECLARE double gaiaImport64 (const unsigned char *p,
164
+ int little_endian,
165
+ int little_endian_arch);
166
+
167
+ /**
168
+ Import an INT-64 in endian-aware fashion
169
+
170
+ \param p endian-dependent representation (input buffer).
171
+ \param little_endian 0 if the input buffer is big-endian: any other value
172
+ for little-endian.
173
+ \param little_endian_arch the value returned by gaiaEndianArch()
174
+
175
+ \return the internal INT-64 value
176
+
177
+ \sa gaiaEndianArch, gaiaExportI64
178
+
179
+ \note you are expected to pass an input buffer corresponding to an
180
+ allocation size of (at least) 8 bytes.
181
+ */
182
+ GAIAGEO_DECLARE sqlite3_int64 gaiaImportI64 (const unsigned char *p,
183
+ int little_endian,
184
+ int little_endian_arch);
185
+
186
+ /**
187
+ Export an INT-16 value in endian-aware fashion
188
+
189
+ \param p endian-dependent representation (output buffer).
190
+ \param value the internal value to be exported.
191
+ \param little_endian 0 if the output buffer has to be big-endian: any other value
192
+ for little-endian.
193
+ \param little_endian_arch the value returned by gaiaEndianArch()
194
+
195
+ \sa gaiaEndianArch, gaiaImport16
196
+
197
+ \note you are expected to pass an output buffer corresponding to an
198
+ allocation size of (at least) 2 bytes.
199
+ */
200
+ GAIAGEO_DECLARE void gaiaExport16 (unsigned char *p, short value,
201
+ int little_endian,
202
+ int little_endian_arch);
203
+
204
+ /**
205
+ Export an INT-32 value in endian-aware fashion
206
+
207
+ \param p endian-dependent representation (output buffer).
208
+ \param value the internal value to be exported.
209
+ \param little_endian 0 if the output buffer has to be big-endian: any other value
210
+ for little-endian.
211
+ \param little_endian_arch the value returned by gaiaEndianArch()
212
+
213
+ \sa gaiaEndianArch, gaiaImport32
214
+
215
+ \note you are expected to pass an output buffer corresponding to an
216
+ allocation size of (at least) 4 bytes.
217
+ */
218
+ GAIAGEO_DECLARE void gaiaExport32 (unsigned char *p, int value,
219
+ int little_endian,
220
+ int little_endian_arch);
221
+
222
+ /**
223
+ Export an UINT-32 value in endian-aware fashion
224
+
225
+ \param p endian-dependent representation (output buffer).
226
+ \param value the internal value to be exported.
227
+ \param little_endian 0 if the output buffer has to be big-endian: any other value
228
+ for little-endian.
229
+ \param little_endian_arch the value returned by gaiaEndianArch()
230
+
231
+ \sa gaiaEndianArch, gaiaImportU32
232
+
233
+ \note you are expected to pass an output buffer corresponding to an
234
+ allocation size of (at least) 4 bytes.
235
+ */
236
+ GAIAGEO_DECLARE void gaiaExportU32 (unsigned char *p, unsigned int value,
237
+ int little_endian,
238
+ int little_endian_arch);
239
+
240
+ /**
241
+ Export a FLOAT-32 value in endian-aware fashion
242
+
243
+ \param p endian-dependent representation (output buffer).
244
+ \param value the internal value to be exported.
245
+ \param little_endian 0 if the output buffer has to be big-endian: any other value
246
+ for little-endian.
247
+ \param little_endian_arch the value returned by gaiaEndianArch()
248
+
249
+ \sa gaiaEndianArch, gaiaImportF32
250
+
251
+ \note you are expected to pass an output buffer corresponding to an
252
+ allocation size of (at least) 4 bytes.
253
+ */
254
+ GAIAGEO_DECLARE void gaiaExportF32 (unsigned char *p, float value,
255
+ int little_endian,
256
+ int little_endian_arch);
257
+
258
+ /**
259
+ Export a DOUBLE value in endian-aware fashion
260
+
261
+ \param p endian-dependent representation (output buffer).
262
+ \param value the internal value to be exported.
263
+ \param little_endian 0 if the output buffer has to be big-endian: any other value
264
+ for little-endian.
265
+ \param little_endian_arch the value returned by gaiaEndianArch()
266
+
267
+ \sa gaiaEndianArch, gaiaImport64
268
+
269
+ \note you are expected to pass an output buffer corresponding to an
270
+ allocation size of (at least) 8 bytes.
271
+ */
272
+ GAIAGEO_DECLARE void gaiaExport64 (unsigned char *p, double value,
273
+ int little_endian,
274
+ int little_endian_arch);
275
+
276
+ /**
277
+ Export an INT-64 value in endian-aware fashion
278
+
279
+ \param p endian-dependent representation (output buffer).
280
+ \param value the internal value to be exported.
281
+ \param little_endian 0 if the output buffer has to be big-endian: any other value
282
+ for little-endian.
283
+ \param little_endian_arch the value returned by gaiaEndianArch()
284
+
285
+ \sa gaiaEndianArch, gaiaImportI64
286
+
287
+ \note you are expected to pass an output buffer corresponding to an
288
+ allocation size of (at least) 8 bytes.
289
+ */
290
+ GAIAGEO_DECLARE void gaiaExportI64 (unsigned char *p, sqlite3_int64 value,
291
+ int little_endian,
292
+ int little_endian_arch);
293
+
294
+ /**
295
+ Initializes a dynamically growing Text output buffer
296
+
297
+ \param buf pointer to gaiaOutBufferStruct structure
298
+
299
+ \sa gaiaOutBufferReset, gaiaAppendToOutBuffer
300
+
301
+ \note Text notations representing Geometry objects may easily require
302
+ a huge storage amount: the gaiaOutBufferStruct automatically supports
303
+ a dynamically growing output buffer.
304
+ \n You are required to initialize this structure before attempting
305
+ any further operation;
306
+ and you are responsible to cleanup any related memory allocation
307
+ when it's any longer required.
308
+ */
309
+ GAIAGEO_DECLARE void gaiaOutBufferInitialize (gaiaOutBufferPtr buf);
310
+
311
+ /**
312
+ Resets a dynamically growing Text output buffer to its initial (empty) state
313
+
314
+ \param buf pointer to gaiaOutBufferStruct structure
315
+
316
+ \sa gaiaOutBufferInitialize, gaiaAppendToOutBuffer
317
+
318
+ \note You are required to initialize this structure before attempting
319
+ any further operation:
320
+ this function will release any related memory allocation.
321
+ */
322
+ GAIAGEO_DECLARE void gaiaOutBufferReset (gaiaOutBufferPtr buf);
323
+
324
+ /**
325
+ Appends a text string at the end of Text output buffer
326
+
327
+ \param buf pointer to gaiaOutBufferStruct structure.
328
+ \param text the text string to be appended.
329
+
330
+ \sa gaiaOutBufferInitialize, gaiaOutBufferReset
331
+
332
+ \note You are required to initialize this structure before attempting
333
+ any further operation:
334
+ the dynamically growing Text buffer will be automatically allocated
335
+ and/or extended as required.
336
+ */
337
+ GAIAGEO_DECLARE void gaiaAppendToOutBuffer (gaiaOutBufferPtr buf,
338
+ const char *text);
339
+
340
+ /**
341
+ Creates a BLOB-Geometry representing a Point (BLOB-Geometry)
342
+
343
+ \param x Point X coordinate.
344
+ \param y Point Y coordinate.
345
+ \param srid the SRID to be set for the Point.
346
+ \param result on completion will containt a pointer to BLOB-Geometry:
347
+ NULL on failure.
348
+ \param size on completion this variable will contain the BLOB's size (in bytes)
349
+
350
+ \sa gaiaFromSpatiaLiteBlobWkb, gaiaMakePointEx
351
+
352
+ \note the BLOB buffer corresponds to dynamically allocated memory:
353
+ so you are responsible to free() it [unless SQLite will take care
354
+ of memory cleanup via buffer binding].
355
+ */
356
+ GAIAGEO_DECLARE void gaiaMakePoint (double x, double y, int srid,
357
+ unsigned char **result, int *size);
358
+
359
+ /**
360
+ Creates a BLOB-Geometry representing a PointZ (BLOB-Geometry)
361
+
362
+ \param x Point X coordinate.
363
+ \param y Point Y coordinate.
364
+ \param z Point Z coordinate.
365
+ \param srid the SRID to be set for the Point.
366
+ \param result on completion will containt a pointer to BLOB-Geometry:
367
+ NULL on failure.
368
+ \param size on completion this variable will contain the BLOB's size (in bytes)
369
+
370
+ \sa gaiaFromSpatiaLiteBlobWkb, gaiaMakePointZEx
371
+
372
+ \note the BLOB buffer corresponds to dynamically allocated memory:
373
+ so you are responsible to free() it [unless SQLite will take care
374
+ of memory cleanup via buffer binding].
375
+ */
376
+ GAIAGEO_DECLARE void gaiaMakePointZ (double x, double y, double z,
377
+ int srid, unsigned char **result,
378
+ int *size);
379
+
380
+ /**
381
+ Creates a BLOB-Geometry representing a PointM (BLOB-Geometry)
382
+
383
+ \param x Point X coordinate.
384
+ \param y Point Y coordinate.
385
+ \param m Point M coordinate.
386
+ \param srid the SRID to be set for the Point.
387
+ \param result on completion will containt a pointer to BLOB-Geometry:
388
+ NULL on failure.
389
+ \param size on completion this variable will contain the BLOB's size (in bytes)
390
+
391
+ \sa gaiaFromSpatiaLiteBlobWkb, gaiaMakePointMEx
392
+
393
+ \note the BLOB buffer corresponds to dynamically allocated memory:
394
+ so you are responsible to free() it [unless SQLite will take care
395
+ of memory cleanup via buffer binding].
396
+ */
397
+ GAIAGEO_DECLARE void gaiaMakePointM (double x, double y, double m,
398
+ int srid, unsigned char **result,
399
+ int *size);
400
+
401
+ /**
402
+ Creates a BLOB-Geometry representing a PointZM (BLOB-Geometry)
403
+
404
+ \param x Point X coordinate.
405
+ \param y Point Y coordinate.
406
+ \param z Point Z coordinate.
407
+ \param m Point M coordinate.
408
+ \param srid the SRID to be set for the Point.
409
+ \param result on completion will containt a pointer to BLOB-Geometry:
410
+ NULL on failure.
411
+ \param size on completion this variable will contain the BLOB's size (in bytes)
412
+
413
+ \sa gaiaFromSpatiaLiteBlobWkb, gaiaMakePointZMEx
414
+
415
+ \note the BLOB buffer corresponds to dynamically allocated memory:
416
+ so you are responsible to free() it [unless SQLite will take care
417
+ of memory cleanup via buffer binding].
418
+ */
419
+ GAIAGEO_DECLARE void gaiaMakePointZM (double x, double y, double z,
420
+ double m, int srid,
421
+ unsigned char **result, int *size);
422
+
423
+ /**
424
+ Creates a BLOB-Geometry representing a Point (BLOB-Geometry or BLOB-TinyPoint)
425
+
426
+ \param tiny_point if set to TRUE the POINT Geometry will be encoded
427
+ by using the TinyPoint BLOB format.
428
+ \param x Point X coordinate.
429
+ \param y Point Y coordinate.
430
+ \param srid the SRID to be set for the Point.
431
+ \param result on completion will containt a pointer to BLOB-Geometry:
432
+ NULL on failure.
433
+ \param size on completion this variable will contain the BLOB's size (in bytes)
434
+
435
+ \sa gaiaFromSpatiaLiteBlobWkb, gaiaMakePoint
436
+
437
+ \note the BLOB buffer corresponds to dynamically allocated memory:
438
+ so you are responsible to free() it [unless SQLite will take care
439
+ of memory cleanup via buffer binding].
440
+ */
441
+ GAIAGEO_DECLARE void gaiaMakePointEx (int tiny_point, double x, double y,
442
+ int srid, unsigned char **result,
443
+ int *size);
444
+
445
+ /**
446
+ Creates a BLOB-Geometry representing a PointZ (BLOB-Geometry or BLOB-TinyPoint)
447
+
448
+ \param tiny_point if set to TRUE the POINT Geometry will be encoded
449
+ by using the TinyPoint BLOB format.
450
+ \param x Point X coordinate.
451
+ \param y Point Y coordinate.
452
+ \param z Point Z coordinate.
453
+ \param srid the SRID to be set for the Point.
454
+ \param result on completion will containt a pointer to BLOB-Geometry:
455
+ NULL on failure.
456
+ \param size on completion this variable will contain the BLOB's size (in bytes)
457
+
458
+ \sa gaiaFromSpatiaLiteBlobWkb, gaiaMakePointZ
459
+
460
+ \note the BLOB buffer corresponds to dynamically allocated memory:
461
+ so you are responsible to free() it [unless SQLite will take care
462
+ of memory cleanup via buffer binding].
463
+ */
464
+ GAIAGEO_DECLARE void gaiaMakePointZEx (int tiny_point, double x, double y,
465
+ double z, int srid,
466
+ unsigned char **result, int *size);
467
+
468
+ /**
469
+ Creates a BLOB-Geometry representing a PointM (BLOB-Geometry or BLOB-TinyPoint)
470
+
471
+ \param tiny_point if set to TRUE the POINT Geometry will be encoded
472
+ by using the TinyPoint BLOB format.
473
+ \param x Point X coordinate.
474
+ \param y Point Y coordinate.
475
+ \param m Point M coordinate.
476
+ \param srid the SRID to be set for the Point.
477
+ \param result on completion will containt a pointer to BLOB-Geometry:
478
+ NULL on failure.
479
+ \param size on completion this variable will contain the BLOB's size (in bytes)
480
+
481
+ \sa gaiaFromSpatiaLiteBlobWkb, gaiaMakePointM
482
+
483
+ \note the BLOB buffer corresponds to dynamically allocated memory:
484
+ so you are responsible to free() it [unless SQLite will take care
485
+ of memory cleanup via buffer binding].
486
+ */
487
+ GAIAGEO_DECLARE void gaiaMakePointMEx (int tiny_point, double x, double y,
488
+ double m, int srid,
489
+ unsigned char **result, int *size);
490
+
491
+ /**
492
+ Creates a BLOB-Geometry representing a PointZM (BLOB-Geometry or BLOB-TinyPoint)
493
+
494
+ \param tiny_point if set to TRUE the POINT Geometry will be encoded
495
+ by using the TinyPoint BLOB format.
496
+ \param x Point X coordinate.
497
+ \param y Point Y coordinate.
498
+ \param z Point Z coordinate.
499
+ \param m Point M coordinate.
500
+ \param srid the SRID to be set for the Point.
501
+ \param result on completion will containt a pointer to BLOB-Geometry:
502
+ NULL on failure.
503
+ \param size on completion this variable will contain the BLOB's size (in bytes)
504
+
505
+ \sa gaiaFromSpatiaLiteBlobWkb, gaiaMakePointZM
506
+
507
+ \note the BLOB buffer corresponds to dynamically allocated memory:
508
+ so you are responsible to free() it [unless SQLite will take care
509
+ of memory cleanup via buffer binding].
510
+ */
511
+ GAIAGEO_DECLARE void gaiaMakePointZMEx (int tiny_point, double x, double y,
512
+ double z, double m, int srid,
513
+ unsigned char **result, int *size);
514
+
515
+ /**
516
+ Creates a BLOB-Geometry representing a Segment (2-Points Linestring)
517
+
518
+ \param geom1 pointer to first Geometry object (expected to represent a Point).
519
+ \param geom2 pointer to second Geometry object (expected to represent a Point).
520
+ \param result on completion will containt a pointer to BLOB-Geometry:
521
+ NULL on failure.
522
+ \param size on completion this variable will contain the BLOB's size (in bytes)
523
+
524
+ \sa gaiaFromSpatiaLiteBlobWkb
525
+
526
+ \note the BLOB buffer corresponds to dynamically allocated memory:
527
+ so you are responsible to free() it [unless SQLite will take care
528
+ of memory cleanup via buffer binding].
529
+ */
530
+ GAIAGEO_DECLARE void gaiaMakeLine (gaiaGeomCollPtr geom1,
531
+ gaiaGeomCollPtr geom2,
532
+ unsigned char **result, int *size);
533
+
534
+ /**
535
+ Creates a Geometry object from the corresponding BLOB-Geometry
536
+
537
+ \param blob pointer to BLOB-Geometry
538
+ \param size the BLOB's size
539
+
540
+ \return the pointer to the newly created Geometry object: NULL on failure
541
+
542
+ \sa gaiaFreeGeomColl, gaiaToSpatiaLiteBlobWkb, gaiaToCompressedBlobWkb,
543
+ gaiaFromSpatiaLiteBlobWkbEx
544
+
545
+ \note you are responsible to destroy (before or after) any allocated Geometry,
546
+ unless you've passed ownership of the Geometry object to some further object:
547
+ in this case destroying the higher order object will implicitly destroy any
548
+ contained child object.
549
+ */
550
+ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromSpatiaLiteBlobWkb (const unsigned
551
+ char *blob,
552
+ unsigned int
553
+ size);
554
+
555
+ /**
556
+ Creates a Geometry object from the corresponding BLOB-Geometry
557
+
558
+ \param blob pointer to BLOB-Geometry
559
+ \param size the BLOB's size
560
+ \param gpkg_mode is set to TRUE will accept only GPKG Geometry-BLOBs
561
+ \param gpkg_amphibious is set to TRUE will indifferenctly accept
562
+ either SpatiaLite Geometry-BLOBs or GPKG Geometry-BLOBs
563
+
564
+ \return the pointer to the newly created Geometry object: NULL on failure
565
+
566
+ \sa gaiaFreeGeomColl, gaiaToSpatiaLiteBlobWkb, gaiaToCompressedBlobWkb
567
+
568
+ \note you are responsible to destroy (before or after) any allocated Geometry,
569
+ unless you've passed ownership of the Geometry object to some further object:
570
+ in this case destroying the higher order object will implicitly destroy any
571
+ contained child object.
572
+ */
573
+ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromSpatiaLiteBlobWkbEx (const
574
+ unsigned char
575
+ *blob,
576
+ unsigned int
577
+ size,
578
+ int
579
+ gpkg_mode,
580
+ int
581
+ gpkg_amphibious);
582
+
583
+ /**
584
+ Creates a BLOB-Geometry corresponding to a Geometry object
585
+
586
+ \param geom pointer to the Geometry object.
587
+ \param result on completion will containt a pointer to BLOB-Geometry:
588
+ NULL on failure.
589
+ \param size on completion this variable will contain the BLOB's size (in bytes)
590
+
591
+ \sa gaiaFromSpatiaLiteBlobWkb, gaiaToCompressedBlobWkb
592
+
593
+ \note the BLOB buffer corresponds to dynamically allocated memory:
594
+ so you are responsible to free() it [unless SQLite will take care
595
+ of memory cleanup via buffer binding].
596
+ */
597
+ GAIAGEO_DECLARE void gaiaToSpatiaLiteBlobWkb (gaiaGeomCollPtr geom,
598
+ unsigned char **result,
599
+ int *size);
600
+
601
+ /**
602
+ Creates a BLOB-Geometry corresponding to a Geometry object
603
+
604
+ \param geom pointer to the Geometry object.
605
+ \param result on completion will containt a pointer to BLOB-Geometry:
606
+ NULL on failure.
607
+ \param size on completion this variable will contain the BLOB's size (in bytes)
608
+ \param gpkg_mode if set to TRUE will always return GPKG Geometry-BLOBs
609
+
610
+ \sa gaiaFromSpatiaLiteBlobWkb, gaiaToCompressedBlobWkb,
611
+ gaiaToSpatiaLiteBlobWkbEx2
612
+
613
+ \note the BLOB buffer corresponds to dynamically allocated memory:
614
+ so you are responsible to free() it [unless SQLite will take care
615
+ of memory cleanup via buffer binding].
616
+ */
617
+ GAIAGEO_DECLARE void gaiaToSpatiaLiteBlobWkbEx (gaiaGeomCollPtr geom,
618
+ unsigned char **result,
619
+ int *size, int gpkg_mode);
620
+
621
+ /**
622
+ Creates a BLOB-Geometry corresponding to a Geometry object
623
+
624
+ \param geom pointer to the Geometry object.
625
+ \param result on completion will containt a pointer to BLOB-Geometry:
626
+ NULL on failure.
627
+ \param size on completion this variable will contain the BLOB's size (in bytes)
628
+ \param gpkg_mode if set to TRUE will always return GPKG Geometry-BLOBs
629
+ \param tiny_point if set to TRUE all POINT Geometries will be encoded
630
+ by using the TinyPoint BLOB format.
631
+
632
+ \sa gaiaFromSpatiaLiteBlobWkb, gaiaToCompressedBlobWkb,
633
+ gaiaToSpatiaLiteBlobWkbEx
634
+
635
+ \note the BLOB buffer corresponds to dynamically allocated memory:
636
+ so you are responsible to free() it [unless SQLite will take care
637
+ of memory cleanup via buffer binding].
638
+ */
639
+ GAIAGEO_DECLARE void gaiaToSpatiaLiteBlobWkbEx2 (gaiaGeomCollPtr geom,
640
+ unsigned char **result,
641
+ int *size, int gpkg_mode,
642
+ int tiny_point);
643
+
644
+ /**
645
+ Creates a Compressed BLOB-Geometry corresponding to a Geometry object
646
+
647
+ \param geom pointer to the Geometry object.
648
+ \param result on completion will containt a pointer to Compressed BLOB-Geometry:
649
+ NULL on failure.
650
+ \param size on completion this variable will contain the BLOB's size (in bytes)
651
+
652
+ \sa gaiaFromSpatiaLiteBlobWkb, gaiaToSpatiaLiteBlobWkb
653
+
654
+ \note this function will apply compression to any Linestring / Ring found
655
+ within the Geometry to be encoded.
656
+ \n the returned BLOB buffer corresponds to dynamically allocated memory:
657
+ so you are responsible to free() it [unless SQLite will take care
658
+ of memory cleanup via buffer binding].
659
+ */
660
+ GAIAGEO_DECLARE void gaiaToCompressedBlobWkb (gaiaGeomCollPtr geom,
661
+ unsigned char **result,
662
+ int *size);
663
+
664
+ /**
665
+ Creates a Geometry object from WKB notation
666
+
667
+ \param blob pointer to WKB buffer
668
+ \param size the BLOB's size (in bytes)
669
+
670
+ \return the pointer to the newly created Geometry object: NULL on failure.
671
+
672
+ \sa gaiaToWkb, gaiaToHexWkb, gaiaFromEWKB, gaiaToEWKB
673
+
674
+ \note you are responsible to destroy (before or after) any allocated Geometry,
675
+ unless you've passed ownership of the Geometry object to some further object:
676
+ in this case destroying the higher order object will implicitly destroy any
677
+ contained child object.
678
+ */
679
+ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromWkb (const unsigned char *blob,
680
+ unsigned int size);
681
+
682
+ /**
683
+ Encodes a Geometry object into WKB notation
684
+
685
+ \param geom pointer to Geometry object
686
+ \param result on completion will containt a pointer to the WKB buffer [BLOB]:
687
+ NULL on failure.
688
+ \param size on completion this variable will contain the BLOB's size (in bytes)
689
+
690
+ \sa gaiaFromWkb, gaiaToHexWkb, gaiaFromEWKB, gaiaToEWKB
691
+
692
+ \note this function will apply 3D WKB encoding as internally intended by
693
+ SpatiaLite: not necessarily intended by other OGC-like implementations.
694
+ \n Anyway, 2D WKB is surely standard and safely interoperable.
695
+ \n the returned BLOB buffer corresponds to dynamically allocated memory:
696
+ so you are responsible to free() it [unless SQLite will take care
697
+ of memory cleanup via buffer binding].
698
+ */
699
+ GAIAGEO_DECLARE void gaiaToWkb (gaiaGeomCollPtr geom,
700
+ unsigned char **result, int *size);
701
+
702
+ /**
703
+ Encodes a Geometry object into (hex) WKB notation
704
+
705
+ \param geom pointer to Geometry object
706
+
707
+ \return the pointer to a text buffer containing WKB translated into plain
708
+ hexadecimal: NULL on failure.
709
+
710
+ \sa gaiaFromWkb, gaiaToWkb, gaiaFromEWKB, gaiaToEWKB
711
+
712
+ \note the returned buffer corresponds to dynamically allocated memory:
713
+ so you are responsible to free() it [unless SQLite will take care
714
+ of memory cleanup via buffer binding].
715
+ */
716
+ GAIAGEO_DECLARE char *gaiaToHexWkb (gaiaGeomCollPtr geom);
717
+
718
+ /**
719
+ Encodes a Geometry object into EWKB notation
720
+
721
+ \param out_buf pointer to dynamically growing Text buffer
722
+ \param geom pointer to Geometry object
723
+
724
+ \sa gaiaFromWkb, gaiaToWkb, gaiaToHexWkb, gaiaFromEWKB, gaiaToEWKB
725
+
726
+ \note this function will produce strictly conformat EWKB; you can
727
+ safely use this for PostGIS data exchange.
728
+ */
729
+ GAIAGEO_DECLARE void gaiaToEWKB (gaiaOutBufferPtr out_buf,
730
+ gaiaGeomCollPtr geom);
731
+
732
+ /**
733
+ Creates a Geometry object from EWKB notation
734
+
735
+ \param in_buffer pointer to EWKB buffer
736
+
737
+ \return the pointer to the newly created Geometry object: NULL on failure.
738
+
739
+ \sa gaiaToWkb, gaiaToHexWkb, gaiaParseHexEWKB, gaiaToEWKB, gaiaEwkbGetPoint,
740
+ gaiaEwkbGetLinestring, gaiaEwkbGetPolygon, gaiaEwkbGetMultiGeometry
741
+
742
+ \note you are responsible to destroy (before or after) any allocated Geometry,
743
+ unless you've passed ownership of the Geometry object to some further object:
744
+ in this case destroying the higher order object will implicitly destroy any
745
+ contained child object.
746
+ */
747
+ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromEWKB (const unsigned char
748
+ *in_buffer);
749
+
750
+ /**
751
+ Translates an EWKB notation from hexadecimal into binary
752
+
753
+ \param blob_hex pointer to EWKB input buffer (hexadecimal text string)
754
+ \param blob_size lenght (in bytes) of the input buffer; if succesfull will
755
+ contain the lenght of the returned output buffer.
756
+
757
+ \return the pointer to the newly created EWKB binary buffer: NULL on failure.
758
+
759
+ \sa gaiaToWkb, gaiaToHexWkb, gaiaFromEWKB, gaiaToEWKB
760
+
761
+ \note you are responsible to destroy (before or after) any buffer allocated by
762
+ gaiaParseHexEWKB()
763
+ */
764
+ GAIAGEO_DECLARE unsigned char *gaiaParseHexEWKB (const unsigned char
765
+ *blob_hex, int *blob_size);
766
+
767
+ /**
768
+ Attempts to decode a Point from within an EWKB binary buffer
769
+
770
+ \param geom pointer to an existing Geometry object; if succesfull the parsed Point
771
+ will be inserted into this Geometry
772
+ \param blob pointer to EWKB input buffer
773
+ \param offset the offset (in bytes) on the input buffer where the Point definition is expected to start.
774
+ \param blob_size lenght (in bytes) of the input buffer.
775
+ \param endian (boolean) states if the EWKB input buffer is little- or big-endian encode.
776
+ \param endian_arch (boolean) states if the target CPU has a little- or big-endian architecture.
777
+ \param dims dimensions: one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M or GAIA_XY_Z_M
778
+
779
+ \return -1 on failure; otherwise the offset where the next object starts.
780
+
781
+ \sa gaiaEwkbGetLinestring, gaiaEwkbGetPolygon, gaiaEwkbGetMultiGeometry
782
+
783
+ \note these functions are mainly intended for internal usage.
784
+ */
785
+ GAIAGEO_DECLARE int
786
+ gaiaEwkbGetPoint (gaiaGeomCollPtr geom, unsigned char *blob,
787
+ int offset, int blob_size, int endian,
788
+ int endian_arch, int dims);
789
+
790
+ /**
791
+ Attempts to decode a Point from within an EWKB binary buffer
792
+
793
+ \param geom pointer to an existing Geometry object; if succesfull the parsed Linestring
794
+ will be inserted into this Geometry
795
+ \param blob pointer to EWKB input buffer
796
+ \param offset the offset (in bytes) on the input buffer where the Point definition is expected to start.
797
+ \param blob_size lenght (in bytes) of the input buffer.
798
+ \param endian (boolean) states if the EWKB input buffer is little- or big-endian encode.
799
+ \param endian_arch (boolean) states if the target CPU has a little- or big-endian architecture.
800
+ \param dims dimensions: one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M or GAIA_XY_Z_M
801
+
802
+ \return -1 on failure; otherwise the offset where the next object starts.
803
+
804
+ \sa gaiaEwkbGetPoint, gaiaEwkbGetPolygon, gaiaEwkbGetMultiGeometry
805
+
806
+ \note these functions are mainly intended for internal usage.
807
+ */
808
+ GAIAGEO_DECLARE int
809
+ gaiaEwkbGetLinestring (gaiaGeomCollPtr geom, unsigned char *blob,
810
+ int offset, int blob_size, int endian,
811
+ int endian_arch, int dims);
812
+
813
+ /**
814
+ Attempts to decode a Polygon from within an EWKB binary buffer
815
+
816
+ \param geom pointer to an existing Geometry object; if succesfull the parsed Polygon
817
+ will be inserted into this Geometry
818
+ \param blob pointer to EWKB input buffer
819
+ \param offset the offset (in bytes) on the input buffer where the Point definition is expected to start.
820
+ \param blob_size lenght (in bytes) of the input buffer.
821
+ \param endian (boolean) states if the EWKB input buffer is little- or big-endian encode.
822
+ \param endian_arch (boolean) states if the target CPU has a little- or big-endian architecture.
823
+ \param dims dimensions: one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M or GAIA_XY_Z_M
824
+
825
+ \return -1 on failure; otherwise the offset where the next object starts.
826
+
827
+ \sa gaiaEwkbGetPoint, gaiaEwkbGetPolygon, gaiaEwkbGetMultiGeometry
828
+ */
829
+ GAIAGEO_DECLARE int
830
+ gaiaEwkbGetPolygon (gaiaGeomCollPtr geom, unsigned char *blob,
831
+ int offset, int blob_size, int endian,
832
+ int endian_arch, int dims);
833
+
834
+ /**
835
+ Attempts to decode a MultiGeometry from within an EWKB binary buffer
836
+
837
+ \param geom pointer to an existing Geometry object; if succesfull the parsed MultiGeometry
838
+ will be inserted into this Geometry
839
+ \param blob pointer to EWKB input buffer
840
+ \param offset the offset (in bytes) on the input buffer where the Point definition is expected to start.
841
+ \param blob_size lenght (in bytes) of the input buffer.
842
+ \param endian (boolean) states if the EWKB input buffer is little- or big-endian encode.
843
+ \param endian_arch (boolean) states if the target CPU has a little- or big-endian architecture.
844
+ \param dims dimensions: one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M or GAIA_XY_Z_M
845
+
846
+ \return -1 on failure; otherwise the offset where the next object starts.
847
+
848
+ \sa gaiaEwkbGetPoint, gaiaEwkbGetLinestring, gaiaEwkbGetPolygon
849
+
850
+ \note these functions are mainly intended for internal usage.
851
+ */
852
+ GAIAGEO_DECLARE int
853
+ gaiaEwkbGetMultiGeometry (gaiaGeomCollPtr geom, unsigned char *blob,
854
+ int offset, int blob_size, int endian,
855
+ int endian_arch, int dims);
856
+
857
+ /**
858
+ Creates a Geometry object from FGF notation
859
+
860
+ \param blob pointer to FGF buffer
861
+ \param size the BLOB's size (in bytes)
862
+
863
+ \return the pointer to the newly created Geometry object: NULL on failure.
864
+
865
+ \sa gaiaToFgf
866
+
867
+ \note you are responsible to destroy (before or after) any allocated Geometry,
868
+ unless you've passed ownership of the Geometry object to some further object:
869
+ in this case destroying the higher order object will implicitly destroy any
870
+ contained child object.
871
+ */
872
+ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromFgf (const unsigned char *blob,
873
+ unsigned int size);
874
+
875
+ /**
876
+ Encodes a Geometry object into FGF notation
877
+
878
+ \param geom pointer to Geometry object
879
+ \param result on completion will containt a pointer to the FGF buffer [BLOB]:
880
+ NULL on failure.
881
+ \param size on completion this variable will contain the BLOB's size (in bytes)
882
+ \param coord_dims one of: GAIA_XY, GAIA_XY_Z, GAIA_XY_M, GAIA_XY_ZM
883
+
884
+ \sa gaiaFromFgf
885
+
886
+ \note the returned BLOB buffer corresponds to dynamically allocated memory:
887
+ so you are responsible to free() it [unless SQLite will take care
888
+ of memory cleanup via buffer binding].
889
+ */
890
+ GAIAGEO_DECLARE void gaiaToFgf (gaiaGeomCollPtr geom,
891
+ unsigned char **result, int *size,
892
+ int coord_dims);
893
+
894
+ /**
895
+ Creates a Geometry object from WKT notation
896
+
897
+ \param in_buffer pointer to WKT buffer
898
+ \param type the expected Geometry Class Type
899
+ \n if actual type defined in WKT doesn't corresponds to this, an error will
900
+ be raised.
901
+
902
+ \return the pointer to the newly created Geometry object: NULL on failure
903
+
904
+ \sa gaiaOutWkt, gaiaOutWktStrict, gaiaParseEWKT, gaiaToEWKT
905
+
906
+ \note you are responsible to destroy (before or after) any allocated Geometry,
907
+ unless you've passed ownership of the Geometry object to some further object:
908
+ in this case destroying the higher order object will implicitly destroy any
909
+ contained child object.
910
+ */
911
+ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseWkt (const unsigned char
912
+ *in_buffer, short type);
913
+
914
+ /**
915
+ Encodes a Geometry object into WKT notation
916
+
917
+ \param out_buf pointer to dynamically growing Text buffer
918
+ \param geom pointer to Geometry object
919
+
920
+ \sa gaiaParseWkt, gaiaOutWktStrict, gaiaParseEWKT, gaiaToEWKT,
921
+ gaiaOutWktEx
922
+
923
+ \note this function will apply 3D WKT encoding as internally intended by
924
+ SpatiaLite: not necessarily intended by other OGC-like implementations.
925
+ \n Anyway, 2D WKT is surely standard and safely interoperable.
926
+ */
927
+ GAIAGEO_DECLARE void gaiaOutWkt (gaiaOutBufferPtr out_buf,
928
+ gaiaGeomCollPtr geom);
929
+
930
+ /**
931
+ Encodes a Geometry object into WKT notation
932
+
933
+ \param out_buf pointer to dynamically growing Text buffer
934
+ \param geom pointer to Geometry object
935
+ \param precision decimal digits to be used for coordinates
936
+
937
+ \sa gaiaParseWkt, gaiaOutWktStrict, gaiaParseEWKT, gaiaToEWKT
938
+
939
+ \note this function will apply 3D WKT encoding as internally intended by
940
+ SpatiaLite: not necessarily intended by other OGC-like implementations.
941
+ \n Anyway, 2D WKT is surely standard and safely interoperable.
942
+ */
943
+ GAIAGEO_DECLARE void gaiaOutWktEx (gaiaOutBufferPtr out_buf,
944
+ gaiaGeomCollPtr geom, int precision);
945
+
946
+ /**
947
+ Encodes a Geometry object into strict 2D WKT notation
948
+
949
+ \param out_buf pointer to dynamically growing Text buffer
950
+ \param geom pointer to Geometry object
951
+ \param precision decimal digits to be used for coordinates
952
+
953
+ \sa gaiaParseWkt, gaiaOutWkt, gaiaParseEWKT, gaiaToEWKT
954
+
955
+ \note this function will apply strict 2D WKT encoding, so to be surely
956
+ standard and safely interoperable.
957
+ \n Dimensions will be automatically casted to 2D [XY] when required.
958
+ */
959
+ GAIAGEO_DECLARE void gaiaOutWktStrict (gaiaOutBufferPtr out_buf,
960
+ gaiaGeomCollPtr geom, int precision);
961
+
962
+ /**
963
+ Creates a Geometry object from EWKT notation
964
+
965
+ \param in_buffer pointer to EWKT buffer
966
+
967
+ \return the pointer to the newly created Geometry object: NULL on failure
968
+
969
+ \sa gaiaParseWkt, gaiaOutWkt, gaiaOutWktStrict, gaiaToEWKT
970
+
971
+ \note you are responsible to destroy (before or after) any allocated Geometry,
972
+ unless you've passed ownership of the Geometry object to some further object:
973
+ in this case destroying the higher order object will implicitly destroy any
974
+ contained child object.
975
+ */
976
+ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseEWKT (const unsigned char
977
+ *in_buffer);
978
+
979
+ /**
980
+ Encodes a Geometry object into EWKT notation
981
+
982
+ \param out_buf pointer to dynamically growing Text buffer
983
+ \param geom pointer to Geometry object
984
+
985
+ \sa gaiaParseWkt, gaiaOutWkt, gaiaOutWktStrict, gaiaParseEWKT
986
+
987
+ \note this function will apply PostGIS own EWKT encoding.
988
+ */
989
+ GAIAGEO_DECLARE void gaiaToEWKT (gaiaOutBufferPtr out_buf,
990
+ gaiaGeomCollPtr geom);
991
+
992
+ /**
993
+ Encodes a WKT 3D Point [XYZ]
994
+
995
+ \param out_buf pointer to dynamically growing Text buffer
996
+ \param point pointer to Point object
997
+
998
+ \sa gaiaOutLinestringZ, gaiaOutPolygonZ, gaiaOutPointZex
999
+
1000
+ \remark mainly intended for internal usage.
1001
+ */
1002
+ GAIAGEO_DECLARE void gaiaOutPointZ (gaiaOutBufferPtr out_buf,
1003
+ gaiaPointPtr point);
1004
+
1005
+ /**
1006
+ Encodes a WKT 3D Point [XYZ]
1007
+
1008
+ \param out_buf pointer to dynamically growing Text buffer
1009
+ \param point pointer to Point object
1010
+ \param precision decimal digits to be used for coordinates
1011
+
1012
+ \sa gaiaOutLinestringZ, gaiaOutPolygonZ
1013
+
1014
+ \remark mainly intended for internal usage.
1015
+ */
1016
+ GAIAGEO_DECLARE void gaiaOutPointZex (gaiaOutBufferPtr out_buf,
1017
+ gaiaPointPtr point, int precision);
1018
+
1019
+ /**
1020
+ Encodes a WKT 3D Linestring [XYZ]
1021
+
1022
+ \param out_buf pointer to dynamically growing Text buffer
1023
+ \param linestring pointer to Linestring object
1024
+
1025
+ \sa gaiaOutPointZ, gaiaOutPolygonZ, gaiaOutLinestringZex
1026
+
1027
+ \remark mainly intended for internal usage.
1028
+ */
1029
+ GAIAGEO_DECLARE void gaiaOutLinestringZ (gaiaOutBufferPtr out_buf,
1030
+ gaiaLinestringPtr linestring);
1031
+
1032
+ /**
1033
+ Encodes a WKT 3D Linestring [XYZ]
1034
+
1035
+ \param out_buf pointer to dynamically growing Text buffer
1036
+ \param linestring pointer to Linestring object
1037
+ \param precision decimal digits to be used for coordinates
1038
+
1039
+ \sa gaiaOutPointZ, gaiaOutPolygonZ
1040
+
1041
+ \remark mainly intended for internal usage.
1042
+ */
1043
+ GAIAGEO_DECLARE void gaiaOutLinestringZex (gaiaOutBufferPtr out_buf,
1044
+ gaiaLinestringPtr linestring,
1045
+ int precision);
1046
+
1047
+ /**
1048
+ Encodes a WKT 3D Polygon [XYZ]
1049
+
1050
+ \param out_buf pointer to dynamically growing Text buffer
1051
+ \param polygon pointer to Point object
1052
+
1053
+ \sa gaiaOutPointZ, gaiaOutLinestringZ, gaiaOutPolygonZex
1054
+
1055
+ \remark mainly intended for internal usage.
1056
+ */
1057
+ GAIAGEO_DECLARE void gaiaOutPolygonZ (gaiaOutBufferPtr out_buf,
1058
+ gaiaPolygonPtr polygon);
1059
+
1060
+ /**
1061
+ Encodes a WKT 3D Polygon [XYZ]
1062
+
1063
+ \param out_buf pointer to dynamically growing Text buffer
1064
+ \param polygon pointer to Point object
1065
+ \param precision decimal digits to be used for coordinates
1066
+
1067
+ \sa gaiaOutPointZ, gaiaOutLinestringZ
1068
+
1069
+ \remark mainly intended for internal usage.
1070
+ */
1071
+ GAIAGEO_DECLARE void gaiaOutPolygonZex (gaiaOutBufferPtr out_buf,
1072
+ gaiaPolygonPtr polygon,
1073
+ int precision);
1074
+
1075
+ /**
1076
+ Creates a Geometry object from KML notation
1077
+
1078
+ \param in_buffer pointer to KML buffer
1079
+
1080
+ \return the pointer to the newly created Geometry object: NULL on failure
1081
+
1082
+ \sa gaiaOutBareKml, gaiaOutFullKml
1083
+
1084
+ \note you are responsible to destroy (before or after) any allocated Geometry,
1085
+ unless you've passed ownership of the Geometry object to some further object:
1086
+ in this case destroying the higher order object will implicitly destroy any
1087
+ contained child object.
1088
+ */
1089
+ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseKml (const unsigned char
1090
+ *in_buffer);
1091
+
1092
+ /**
1093
+ Encodes a Geometry object into KML notation
1094
+
1095
+ \param out_buf pointer to dynamically growing Text buffer
1096
+ \param geom pointer to Geometry object
1097
+ \param precision decimal digits to be used for coordinates
1098
+
1099
+ \sa gaiaParseKml, gaiaOutFullKml
1100
+
1101
+ \note this function will export the simplest KML notation (no descriptions).
1102
+ */
1103
+ GAIAGEO_DECLARE void gaiaOutBareKml (gaiaOutBufferPtr out_buf,
1104
+ gaiaGeomCollPtr geom, int precision);
1105
+
1106
+ /**
1107
+ Encodes a Geometry object into KML notation
1108
+
1109
+ \param out_buf pointer to dynamically growing Text buffer
1110
+ \param name text string to be set as KML \e name
1111
+ \param desc text string to se set as KML \e description
1112
+ \param geom pointer to Geometry object
1113
+ \param precision decimal digits to be used for coordinates
1114
+
1115
+ \sa gaiaParseKml, gaiaOutBareKml
1116
+
1117
+ \note this function will export the simplest KML notation (no descriptions).
1118
+ */
1119
+ GAIAGEO_DECLARE void gaiaOutFullKml (gaiaOutBufferPtr out_buf,
1120
+ const char *name, const char *desc,
1121
+ gaiaGeomCollPtr geom, int precision);
1122
+
1123
+ /**
1124
+ Creates a Geometry object from GML notation
1125
+
1126
+ \param in_buffer pointer to GML buffer
1127
+ \param sqlite_handle handle to current DB connection
1128
+
1129
+ \return the pointer to the newly created Geometry object: NULL on failure
1130
+
1131
+ \sa gaiaParseGml_r, gaiaOutGml
1132
+
1133
+ \note you are responsible to destroy (before or after) any allocated Geometry,
1134
+ unless you've passed ownership of the Geometry object to some further object:
1135
+ in this case destroying the higher order object will implicitly destroy any
1136
+ contained child object.\n
1137
+ not reentrant and thread unsafe.
1138
+ */
1139
+ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseGml (const unsigned char
1140
+ *in_buffer,
1141
+ sqlite3 * sqlite_handle);
1142
+
1143
+ /**
1144
+ Creates a Geometry object from GML notation
1145
+
1146
+ \param p_cache a memory pointer returned by spatialite_alloc_connection()
1147
+ \param in_buffer pointer to GML buffer
1148
+ \param sqlite_handle handle to current DB connection
1149
+
1150
+ \return the pointer to the newly created Geometry object: NULL on failure
1151
+
1152
+ \sa gaiaParseGml, gaiaOutGml
1153
+
1154
+ \note you are responsible to destroy (before or after) any allocated Geometry,
1155
+ unless you've passed ownership of the Geometry object to some further object:
1156
+ in this case destroying the higher order object will implicitly destroy any
1157
+ contained child object.\n
1158
+ reentrant and thread-safe.
1159
+ */
1160
+ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseGml_r (const void *p_cache,
1161
+ const unsigned char
1162
+ *in_buffer,
1163
+ sqlite3 * sqlite_handle);
1164
+
1165
+ /**
1166
+ Encodes a Geometry object into GML notation
1167
+
1168
+ \param out_buf pointer to dynamically growing Text buffer
1169
+ \param version GML version
1170
+ \params flippd if TURE the X and Y axes order will be: Y first, X second
1171
+ \param precision decimal digits to be used for coordinates
1172
+ \param geom pointer to Geometry object
1173
+
1174
+ \sa gaiaParseGml. gaiaOutGml
1175
+
1176
+ \note if \e version is set to \b 3, then GMLv3 will be used;
1177
+ in any other case GMLv2 will be assumed by default.
1178
+ */
1179
+ GAIAGEO_DECLARE void gaiaOutGml_ex (gaiaOutBufferPtr out_buf, int version,
1180
+ int flipped, int precision,
1181
+ gaiaGeomCollPtr geom);
1182
+
1183
+ /**
1184
+ Encodes a Geometry object into GML notation
1185
+
1186
+ \param out_buf pointer to dynamically growing Text buffer
1187
+ \param version GML version
1188
+ \param precision decimal digits to be used for coordinates
1189
+ \param geom pointer to Geometry object
1190
+
1191
+ \sa gaiaParseGml, gaiaOutGml_ex
1192
+
1193
+ \note it's simply an alias for gaiaOutGml_ex with FLIPPED set to FALSE.
1194
+ */
1195
+ GAIAGEO_DECLARE void gaiaOutGml (gaiaOutBufferPtr out_buf, int version,
1196
+ int precision, gaiaGeomCollPtr geom);
1197
+
1198
+ /**
1199
+ Creates a Geometry object from GeoJSON notation
1200
+
1201
+ \param in_buffer pointer to GeoJSON buffer
1202
+
1203
+ \return the pointer to the newly created Geometry object: NULL on failure
1204
+
1205
+ \sa gaiaOutGeoJSON
1206
+
1207
+ \note you are responsible to destroy (before or after) any allocated Geometry,
1208
+ unless you've passed ownership of the Geometry object to some further object:
1209
+ in this case destroying the higher order object will implicitly destroy any
1210
+ contained child object.
1211
+ */
1212
+ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseGeoJSON (const unsigned char
1213
+ *in_buffer);
1214
+
1215
+ /**
1216
+ Encodes a Geometry object into GeoJSON notation
1217
+
1218
+ \param out_buf pointer to dynamically growing Text buffer
1219
+ \param geom pointer to Geometry object
1220
+ \param precision decimal digits to be used for coordinates
1221
+ \param options GeoJSON specific options
1222
+
1223
+ \sa gaiaParseGeoJSON
1224
+
1225
+ \note \e options can assume the following values:
1226
+ \li 1 = BBOX, no CRS
1227
+ \li 2 = no BBOX, short form CRS
1228
+ \li 3 = BBOX, short form CRS
1229
+ \li 4 = no BBOX, long form CRS
1230
+ \li 5 = BBOX, long form CRS
1231
+ \li any other value: no BBOX and no CRS
1232
+ */
1233
+ GAIAGEO_DECLARE void gaiaOutGeoJSON (gaiaOutBufferPtr out_buf,
1234
+ gaiaGeomCollPtr geom, int precision,
1235
+ int options);
1236
+ /**
1237
+ Encodes a Geometry object into SVG notation
1238
+
1239
+ \param out_buf pointer to dynamically growing Text buffer
1240
+ \param geom pointer to Geometry object
1241
+ \param relative flag: relative or absolute coordinates
1242
+ \param precision decimal digits to be used for coordinates
1243
+
1244
+ \note if \e relative is set to \b 1, then SVG relative coords will be used:
1245
+ in any other case SVG absolute coords will be assumed by default.
1246
+ */
1247
+ GAIAGEO_DECLARE void gaiaOutSvg (gaiaOutBufferPtr out_buf,
1248
+ gaiaGeomCollPtr geom, int relative,
1249
+ int precision);
1250
+
1251
+ /**
1252
+ Allocates a new DBF Field Value object [duplicating an existing one]
1253
+
1254
+ \param org pointer to input DBF Field Value object.
1255
+
1256
+ \return the pointer to newly created DBF Field object.
1257
+
1258
+ \sa gaiaAllocDbfField, gaiaFreeDbfField, gaiaCloneDbfField, gaiaCloneValue,
1259
+ gaiaSetNullValue, gaiaSetIntValue, gaiaSetDoubleValue,
1260
+ gaiaSetStrValue
1261
+
1262
+ \note the newly created object is an exact copy of the original one.
1263
+ */
1264
+ GAIAGEO_DECLARE gaiaValuePtr gaiaCloneValue (gaiaValuePtr org);
1265
+
1266
+ /**
1267
+ Resets a DBF Field Value object to its initial empty state
1268
+
1269
+ \param p pointer to DBF Field Value object
1270
+
1271
+ \sa gaiaAllocDbfField, gaiaCloneDbfField, gaiaCloneValue,
1272
+ gaiaSetNullValue, gaiaSetIntValue, gaiaSetDoubleValue,
1273
+ gaiaSetStrValue, gaiaResetDbfEntity
1274
+ */
1275
+ GAIAGEO_DECLARE void gaiaFreeValue (gaiaValuePtr p);
1276
+
1277
+ /**
1278
+ Allocates a new DBF Field object
1279
+
1280
+ \param name text string: DBF Field name.
1281
+ \param type identifier of the corresponding DBF data type.
1282
+ \param offset corresponding offset into the DBF I/O buffer.
1283
+ \param length max field length (in bytes).
1284
+ \param decimals precision: number of decimal digits.
1285
+
1286
+ \return the pointer to newly created DBF Field object.
1287
+
1288
+ \sa gaiaFreeDbfField, gaiaCloneDbfField, gaiaFreeValue,
1289
+ gaiaSetNullValue, gaiaSetIntValue, gaiaSetDoubleValue,
1290
+ gaiaSetStrValue
1291
+
1292
+ \note you are responsible to destroy (before or after) any allocated DBF Field,
1293
+ unless you've passed ownership to some further object: in this case destroying the higher order object will implicitly destroy any contained child object.
1294
+ \n supported DBF data types are:
1295
+ \li 'C' text string [default]
1296
+ \li 'N' numeric
1297
+ \li 'D' date
1298
+ \li 'L' boolean
1299
+ */
1300
+ GAIAGEO_DECLARE gaiaDbfFieldPtr gaiaAllocDbfField (char *name,
1301
+ unsigned char type,
1302
+ int offset,
1303
+ unsigned char length,
1304
+ unsigned char decimals);
1305
+
1306
+ /**
1307
+ Destroys a DBF Field object
1308
+
1309
+ \param p pointer to DBF Field object
1310
+
1311
+ \sa gaiaAllocDbfField, gaiaCloneDbfField, gaiaCloneValue,
1312
+ gaiaFreeValue, gaiaSetNullValue, gaiaSetIntValue, gaiaSetDoubleValue,
1313
+ gaiaSetStrValue
1314
+ */
1315
+ GAIAGEO_DECLARE void gaiaFreeDbfField (gaiaDbfFieldPtr p);
1316
+
1317
+ /**
1318
+ Allocates a new DBF Field object [duplicating an existing one]
1319
+
1320
+ \param org pointer to input DBF Field object.
1321
+
1322
+ \return the pointer to newly created DBF Field object.
1323
+
1324
+ \sa gaiaAllocDbfField, gaiaFreeDbfField, gaiaCloneDbfField,
1325
+ gaiaFreeValue, gaiaSetNullValue, gaiaSetIntValue, gaiaSetDoubleValue,
1326
+ gaiaSetStrValue
1327
+
1328
+ \note the newly created object is an exact copy of the original one
1329
+ [this including an evantual Field Value].
1330
+ */
1331
+ GAIAGEO_DECLARE gaiaDbfFieldPtr gaiaCloneDbfField (gaiaDbfFieldPtr org);
1332
+
1333
+ /**
1334
+ Sets a NULL current value for a DBF Field object
1335
+
1336
+ \param field pointer to DBF Field object
1337
+
1338
+ \sa gaiaAllocDbfField, gaiaFreeDbfField, gaiaCloneDbfField,
1339
+ gaiaFreeValue, gaiaSetIntValue, gaiaSetDoubleValue,
1340
+ gaiaSetStrValue
1341
+ */
1342
+ GAIAGEO_DECLARE void gaiaSetNullValue (gaiaDbfFieldPtr field);
1343
+
1344
+ /**
1345
+ Sets an INTEGER current value for a DBF Field object
1346
+
1347
+ \param field pointer to DBF Field object.
1348
+ \param value integer value to be set.
1349
+
1350
+ \sa gaiaAllocDbfField, gaiaFreeDbfField, gaiaCloneDbfField,
1351
+ gaiaFreeValue, gaiaSetNullValue, gaiaSetDoubleValue,
1352
+ gaiaSetStrValue
1353
+ */
1354
+ GAIAGEO_DECLARE void gaiaSetIntValue (gaiaDbfFieldPtr field,
1355
+ sqlite3_int64 value);
1356
+
1357
+ /**
1358
+ Sets a DOUBLE current value for a DBF Field object
1359
+
1360
+ \param field pointer to DBF Field object.
1361
+ \param value double value to be set.
1362
+
1363
+ \sa gaiaAllocDbfField, gaiaFreeDbfField, gaiaCloneDbfField,
1364
+ gaiaFreeValue, gaiaSetNullValue, gaiaSetIntValue, gaiaSetStrValue
1365
+ */
1366
+ GAIAGEO_DECLARE void gaiaSetDoubleValue (gaiaDbfFieldPtr field,
1367
+ double value);
1368
+
1369
+ /**
1370
+ Sets a TEXT current value for a DBF Field object
1371
+
1372
+ \param field pointer to DBF Field object.
1373
+ \param str text string value to be set.
1374
+
1375
+ \sa gaiaAllocDbfField, gaiaFreeDbfField, gaiaCloneDbfField,
1376
+ gaiaFreeValue, gaiaSetNullValue, gaiaSetIntValue, gaiaSetDoubleValue
1377
+ */
1378
+ GAIAGEO_DECLARE void gaiaSetStrValue (gaiaDbfFieldPtr field, char *str);
1379
+
1380
+ /**
1381
+ Creates an initially empty DBF List object
1382
+
1383
+ \return the pointer to newly allocated DBF List object: NULL on failure.
1384
+
1385
+ \sa gaiaFreeDbfList, gaiaIsValidDbfList,
1386
+ gaiaResetDbfEntity, gaiaCloneDbfEntity, gaiaAddDbfField
1387
+
1388
+ \note you are responsible to destroy (before or after) any allocated DBF List,
1389
+ unless you've passed ownership to some further object: in this case destroying
1390
+ the higher order object will implicitly destroy any contained child object.
1391
+ */
1392
+ GAIAGEO_DECLARE gaiaDbfListPtr gaiaAllocDbfList (void);
1393
+
1394
+ /**
1395
+ Destroys a DBF List object
1396
+
1397
+ \param list pointer to the DBF List object
1398
+
1399
+ \sa gaiaAllocDbfList, gaiaIsValidDbfList,
1400
+ gaiaResetDbfEntity, gaiaCloneDbfEntity, gaiaAddDbfField
1401
+
1402
+ \note attempting to destroy any DBF List object whose ownnership has already
1403
+ been transferred to some other (higher order) object is a serious error,
1404
+ and will easily cause severe memory corruption.
1405
+ */
1406
+ GAIAGEO_DECLARE void gaiaFreeDbfList (gaiaDbfListPtr list);
1407
+
1408
+ /**
1409
+ Checks a DBF List object for validity
1410
+
1411
+ \param list pointer to the DBF List object.
1412
+
1413
+ \return 0 if not valid: any other value if valid.
1414
+
1415
+ \sa gaiaAllocDbfList, gaiaFreeDbfList, gaiaIsValidDbfList,
1416
+ gaiaResetDbfEntity, gaiaCloneDbfEntity, gaiaAddDbfField
1417
+ */
1418
+ GAIAGEO_DECLARE int gaiaIsValidDbfList (gaiaDbfListPtr list);
1419
+
1420
+ /**
1421
+ Inserts a further DBF Field object into a DBF List object
1422
+
1423
+ \param list pointer to the DBF List object.
1424
+ \param name text string: DBF Field name.
1425
+ \param type identifier of the corresponding DBF data type.
1426
+ \param offset corresponding offset into the DBF I/O buffer.
1427
+ \param length max field length (in bytes).
1428
+ \param decimals precision: number of decimal digits.
1429
+
1430
+ \return the pointer to newly created DBF Field object.
1431
+
1432
+ \sa gaiaAllocDbfField
1433
+
1434
+ \note supported DBF data types are:
1435
+ \li 'C' text string [default]
1436
+ \li 'N' numeric
1437
+ \li 'D' date
1438
+ \li 'L' boolean
1439
+ */
1440
+ GAIAGEO_DECLARE gaiaDbfFieldPtr gaiaAddDbfField (gaiaDbfListPtr list,
1441
+ char *name,
1442
+ unsigned char type,
1443
+ int offset,
1444
+ unsigned char length,
1445
+ unsigned char decimals);
1446
+
1447
+ /**
1448
+ Resets a DBF List object to its initial empty state
1449
+
1450
+ \param list pointer to the DBF List object.
1451
+
1452
+ \sa gaiaFreeValue
1453
+
1454
+ \note any DBF Field associated to the List object will be reset to its
1455
+ initial empty state (i.e. \e no \e value at all).
1456
+ */
1457
+ GAIAGEO_DECLARE void gaiaResetDbfEntity (gaiaDbfListPtr list);
1458
+
1459
+ /**
1460
+ Allocates a new DBF List object [duplicating an existing one]
1461
+
1462
+ \param org pointer to input DBF List object.
1463
+
1464
+ \return the pointer to newly created DBF List object.
1465
+
1466
+ \sa gaiaCloneDbfField, gaiaCloneValue,
1467
+
1468
+ \note the newly created object is an exact copy of the original one.
1469
+ \n this including any currently set Field Value.
1470
+ */
1471
+ GAIAGEO_DECLARE gaiaDbfListPtr gaiaCloneDbfEntity (gaiaDbfListPtr org);
1472
+
1473
+ /**
1474
+ Allocates a new Shapefile object.
1475
+
1476
+ \return the pointer to newly created Shapefile object.
1477
+
1478
+ \sa gaiaFreeShapefile, gaiaOpenShpRead, gaiaOpenShpWrite,
1479
+ gaiaReadShpEntity, gaiaShpAnalyze, gaiaWriteShpEntity, gaiaFlushShpHeaders
1480
+
1481
+ \note you are responsible to destroy (before or after) any allocated Shapefile.
1482
+ \n you should phisically open the Shapefile in \e read or \e write mode
1483
+ before performing any actual I/O operation.
1484
+ */
1485
+ GAIAGEO_DECLARE gaiaShapefilePtr gaiaAllocShapefile (void);
1486
+
1487
+ /**
1488
+ Destroys a Shapefile object
1489
+
1490
+ \param shp pointer to the Shapefile object.
1491
+
1492
+ \sa gaiaAllocShapefile, gaiaOpenShpRead, gaiaOpenShpWrite,
1493
+ gaiaReadShpEntity, gaiaShpAnalyze, gaiaWriteShpEntity, gaiaFlushShpHeaders
1494
+
1495
+ \note destroying the Shapefile object will close any related file:
1496
+ anyway you a responsible to explicitly call gaiaFlushShpHeader
1497
+ before destroyng a Shapefile opened in \e write mode.
1498
+ */
1499
+ GAIAGEO_DECLARE void gaiaFreeShapefile (gaiaShapefilePtr shp);
1500
+
1501
+ /**
1502
+ Open a Shapefile in read mode
1503
+
1504
+ \param shp pointer to the Shapefile object.
1505
+ \param path \e abstract pathname to the corresponding file-system files.
1506
+ \param charFrom GNU ICONV name identifying the input charset encoding.
1507
+ \param charTo GNU ICONV name identifying the output charset encoding.
1508
+
1509
+ \sa gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpWrite,
1510
+ gaiaReadShpEntity, gaiaShpAnalyze, gaiaWriteShpEntity, gaiaFlushShpHeaders
1511
+
1512
+ \note on failure the object member \e Valid will be set to 0; and the
1513
+ object member \e LastError will contain the appropriate error message.
1514
+ \n the \e abstract pathname should not contain any suffix at all.
1515
+ */
1516
+ GAIAGEO_DECLARE void gaiaOpenShpRead (gaiaShapefilePtr shp,
1517
+ const char *path,
1518
+ const char *charFrom,
1519
+ const char *charTo);
1520
+
1521
+ /**
1522
+ Open a Shapefile in write mode - extended
1523
+
1524
+ \param shp pointer to the Shapefile object.
1525
+ \param path \e abstract pathname to the corresponding file-system files.
1526
+ \param shape the SHAPE code; expected to be one of GAIA_SHP_POINT,
1527
+ GAIA_SHP_POLYLINE, GAIA_SHP_POLYGON, GAIA_SHP_MULTIPOINT, GAIA_SHP_POINTZ,
1528
+ GAIA_SHP_POLYLINEZ, GAIA_SHP_POLYGONZ, GAIA_SHP_MULTIPOINTZ,
1529
+ GAIA_SHP_POINTM, GAIA_SHP_POLYLINEM, GAIA_SHP_POLYGONM, GAIA_SHP_MULTIPOINTM
1530
+ \param list pointer to DBF List object representing the corresponding
1531
+ data attributes.
1532
+ \param charFrom GNU ICONV name identifying the input charset encoding.
1533
+ \param charTo GNU ICONV name identifying the output charset encoding.
1534
+ \param colname_case one between GAIA_DBF_COLNAME_LOWERCASE,
1535
+ GAIA_DBF_COLNAME_UPPERCASE or GAIA_DBF_COLNAME_CASE_IGNORE.
1536
+
1537
+ \sa gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpRead,
1538
+ gaiaReadShpEntity, gaiaShpAnalyze, gaiaWriteShpEntity, gaiaFlushShpHeaders,
1539
+ gaiaOpenShpWrite
1540
+
1541
+ \note on failure the object member \e Valid will be set to 0; and the
1542
+ object member \e LastError will contain the appropriate error message.
1543
+ \n the \e abstract pathname should not contain any suffix at all.
1544
+ */
1545
+ GAIAGEO_DECLARE void gaiaOpenShpWriteEx (gaiaShapefilePtr shp,
1546
+ const char *path, int shape,
1547
+ gaiaDbfListPtr list,
1548
+ const char *charFrom,
1549
+ const char *charTo,
1550
+ int colname_case);
1551
+
1552
+ /**
1553
+ Open a Shapefile in write mode
1554
+
1555
+ \param shp pointer to the Shapefile object.
1556
+ \param path \e abstract pathname to the corresponding file-system files.
1557
+ \param shape the SHAPE code; expected to be one of GAIA_SHP_POINT,
1558
+ GAIA_SHP_POLYLINE, GAIA_SHP_POLYGON, GAIA_SHP_MULTIPOINT, GAIA_SHP_POINTZ,
1559
+ GAIA_SHP_POLYLINEZ, GAIA_SHP_POLYGONZ, GAIA_SHP_MULTIPOINTZ,
1560
+ GAIA_SHP_POINTM, GAIA_SHP_POLYLINEM, GAIA_SHP_POLYGONM, GAIA_SHP_MULTIPOINTM
1561
+ \param list pointer to DBF List object representing the corresponding
1562
+ data attributes.
1563
+ \param charFrom GNU ICONV name identifying the input charset encoding.
1564
+ \param charTo GNU ICONV name identifying the output charset encoding.
1565
+
1566
+ \sa gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpRead,
1567
+ gaiaReadShpEntity, gaiaShpAnalyze, gaiaWriteShpEntity, gaiaFlushShpHeaders,
1568
+ gaiaOpenShpWriteEx
1569
+
1570
+ \note simply calls gaiaOpenShpWriteEx() by specifying GAIA_DBF_COLNAME_LOWERCASE
1571
+ */
1572
+ GAIAGEO_DECLARE void gaiaOpenShpWrite (gaiaShapefilePtr shp,
1573
+ const char *path, int shape,
1574
+ gaiaDbfListPtr list,
1575
+ const char *charFrom,
1576
+ const char *charTo);
1577
+
1578
+ /**
1579
+ Reads a feature from a Shapefile object
1580
+
1581
+ \param shp pointer to the Shapefile object.
1582
+ \param current_row the row number identifying the feature to be read.
1583
+ \param srid feature's SRID
1584
+
1585
+ \return 0 on failure: any other value on success.
1586
+ -1 when the corresponding DBF record is marked as DELETED.
1587
+
1588
+ \sa gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpRead, gaiaOpenShpWrite,
1589
+ gaiaShpAnalyze, gaiaWriteShpEntity, gaiaFlushShpHeaders
1590
+
1591
+ \note on completion the Shapefile's \e Dbf member will contain the feature
1592
+ read:
1593
+ \li the \e Dbf->Geometry member will contain the corresponding Geometry
1594
+ \li and the \e Dbf->First member will point to the linked list containing
1595
+ the corresponding data attributes [both data formats and values].
1596
+
1597
+ \remark the Shapefile object should be opened in \e read mode.
1598
+ */
1599
+ GAIAGEO_DECLARE int gaiaReadShpEntity (gaiaShapefilePtr shp,
1600
+ int current_row, int srid);
1601
+
1602
+ /**
1603
+ Reads a feature from a Shapefile object
1604
+
1605
+ \param shp pointer to the Shapefile object.
1606
+ \param current_row the row number identifying the feature to be read.
1607
+ \param srid feature's SRID
1608
+ \param text_dates is TRUE all DBF dates will be considered as TEXT
1609
+
1610
+ \return 0 on failure: any other value on success.
1611
+
1612
+ \sa gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpRead, gaiaOpenShpWrite,
1613
+ gaiaShpAnalyze, gaiaWriteShpEntity, gaiaFlushShpHeaders
1614
+
1615
+ \note on completion the Shapefile's \e Dbf member will contain the feature
1616
+ read:
1617
+ \li the \e Dbf->Geometry member will contain the corresponding Geometry
1618
+ \li and the \e Dbf->First member will point to the linked list containing
1619
+ the corresponding data attributes [both data formats and values].
1620
+
1621
+ \remark the Shapefile object should be opened in \e read mode.
1622
+ */
1623
+ GAIAGEO_DECLARE int gaiaReadShpEntity_ex (gaiaShapefilePtr shp,
1624
+ int current_row, int srid,
1625
+ int text_dates);
1626
+
1627
+ /**
1628
+ Prescans a Shapefile object gathering informations
1629
+
1630
+ \param shp pointer to the Shapefile object.
1631
+
1632
+ \sa gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpRead, gaiaOpenShpWrite,
1633
+ gaiaReadShpEntity, gaiaWriteShpEntity, gaiaFlushShpHeaders
1634
+
1635
+ \note on completion the Shapefile's \e EffectiveType will containt the
1636
+ Geometry type corresponding to features actually found.
1637
+
1638
+ \remark the Shapefile object should be opened in \e read mode.
1639
+ */
1640
+ GAIAGEO_DECLARE void gaiaShpAnalyze (gaiaShapefilePtr shp);
1641
+
1642
+ /**
1643
+ Writes a feature into a Shapefile object
1644
+
1645
+ \param shp pointer to the Shapefile object.
1646
+ \param entity pointer to DBF List object containing both Geometry and Field
1647
+ values.
1648
+
1649
+ \return 0 on failure: any other value on success.
1650
+
1651
+ \sa gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpRead, gaiaOpenShpWrite,
1652
+ gaiaReadShpEntity, gaiaShpAnalyze, gaiaFlushShpHeaders
1653
+
1654
+ \remark the Shapefile object should be opened in \e write mode.
1655
+ */
1656
+ GAIAGEO_DECLARE int gaiaWriteShpEntity (gaiaShapefilePtr shp,
1657
+ gaiaDbfListPtr entity);
1658
+
1659
+ /**
1660
+ Writes into an output Shapefile any required header / footer
1661
+
1662
+ \param shp pointer to the Shapefile object.
1663
+
1664
+ \sa gaiaAllocShapefile, gaiaFreeShapefile, gaiaOpenShpRead, gaiaOpenShpWrite,
1665
+ gaiaReadShpEntity, gaiaShpAnalyze, gaiaWriteShpEntity
1666
+
1667
+ \note forgetting to call gaiaFlushShpHeader for any Shapefile opened in
1668
+ \e write mode immediately before destroying the object, will surely
1669
+ cause severe file corruption.
1670
+ */
1671
+ GAIAGEO_DECLARE void gaiaFlushShpHeaders (gaiaShapefilePtr shp);
1672
+
1673
+ /**
1674
+ Allocates a new DBF File object.
1675
+
1676
+ \return the pointer to newly created DBF File object.
1677
+
1678
+ \sa gaiaFreeDbf, gaiaOpenDbfRead, gaiaOpenDbfWrite,
1679
+ gaiaReadDbfEntity, gaiaWriteDbfEntity, gaiaFlushDbfHeader
1680
+
1681
+ \note you are responsible to destroy (before or after) any allocated DBF File.
1682
+ \n you should phisically open the DBF File in \e read or \e write mode
1683
+ before performing any actual I/O operation.
1684
+ */
1685
+ GAIAGEO_DECLARE gaiaDbfPtr gaiaAllocDbf (void);
1686
+
1687
+ /**
1688
+ Destroys a DBF File object
1689
+
1690
+ \param dbf pointer to the DBF File object.
1691
+
1692
+ \sa gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfWrite,
1693
+ gaiaReadDbfEntity, gaiaWriteDbfEntity, gaiaFlushDbfHeader
1694
+
1695
+ \note destroying the Shapefile object will close any related file:
1696
+ anyway you a responsible to explicitly call gaiaFlushShpHeader
1697
+ before destroyng a Shapefile opened in \e write mode.
1698
+ */
1699
+ GAIAGEO_DECLARE void gaiaFreeDbf (gaiaDbfPtr dbf);
1700
+
1701
+ /**
1702
+ Open a DBF File in read mode
1703
+
1704
+ \param dbf pointer to the DBF File object.
1705
+ \param path pathname to the corresponding file-system file.
1706
+ \param charFrom GNU ICONV name identifying the input charset encoding.
1707
+ \param charTo GNU ICONV name identifying the output charset encoding.
1708
+
1709
+ \sa gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfWrite, gaiaOpenZipDbf,
1710
+ gaiaReadDbfEntity, gaiaWriteDbfEntity, gaiaFlushDbfHeader
1711
+
1712
+ \note on failure the object member \e Valid will be set to 0; and the
1713
+ object member \e LastError will contain the appropriate error message.
1714
+ */
1715
+ GAIAGEO_DECLARE void gaiaOpenDbfRead (gaiaDbfPtr dbf,
1716
+ const char *path,
1717
+ const char *charFrom,
1718
+ const char *charTo);
1719
+
1720
+ /**
1721
+ Open a DBF File contained within a Zipfile (just for checking its fields)
1722
+
1723
+ \param zip_path path of the Zipfile.
1724
+ \param filename filename of the DB file within the Zipfile.
1725
+ \param charFrom GNU ICONV name identifying the input charset encoding.
1726
+ \param charTo GNU ICONV name identifying the output charset encoding.
1727
+
1728
+ \return dbf pointer to the DBF File object. NULL on error.
1729
+
1730
+ \sa gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfWrite,
1731
+ gaiaReadDbfEntity, gaiaWriteDbfEntity, gaiaFlushDbfHeader
1732
+
1733
+ \note you are responsible to destroy (before or after) any allocated DBF File.
1734
+ \n you should phisically open the DBF File in \e read or \e write mode
1735
+ before performing any actual I/O operation.
1736
+ */
1737
+ GAIAGEO_DECLARE gaiaDbfPtr gaiaOpenZipDbf (const char *zip_path,
1738
+ const char *filename,
1739
+ const char *charFrom,
1740
+ const char *charTo);
1741
+
1742
+ /**
1743
+ Open a DBF File in write mode,- extended
1744
+
1745
+ \param dbf pointer to the DBF File object.
1746
+ \param path pathname to the corresponding file-system file.
1747
+ \param charFrom GNU ICONV name identifying the input charset encoding.
1748
+ \param charTo GNU ICONV name identifying the output charset encoding.
1749
+ \param colname_case one between GAIA_DBF_COLNAME_LOWERCASE,
1750
+ GAIA_DBF_COLNAME_UPPERCASE or GAIA_DBF_COLNAME_CASE_IGNORE.
1751
+
1752
+ \sa gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfRead,
1753
+ gaiaReadDbfEntity, gaiaWriteDbfEntity, gaiaFlushDbfHeader,
1754
+ gaiaOpenDbfWrite
1755
+
1756
+ \note on failure the object member \e Valid will be set to 0; and the
1757
+ object member \e LastError will contain the appropriate error message.
1758
+ */
1759
+ GAIAGEO_DECLARE void gaiaOpenDbfWriteEx (gaiaDbfPtr dbf,
1760
+ const char *path,
1761
+ const char *charFrom,
1762
+ const char *charTo,
1763
+ int colname_case);
1764
+
1765
+ /**
1766
+ Open a DBF File in write mode
1767
+
1768
+ \param dbf pointer to the DBF File object.
1769
+ \param path pathname to the corresponding file-system file.
1770
+ \param charFrom GNU ICONV name identifying the input charset encoding.
1771
+ \param charTo GNU ICONV name identifying the output charset encoding.
1772
+
1773
+ \sa gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfRead,
1774
+ gaiaReadDbfEntity, gaiaWriteDbfEntity, gaiaFlushDbfHeader,
1775
+ gaiaOpenDbfWriteEx
1776
+
1777
+
1778
+ \note simply calls gaiaOpenDbfWriteEx() by specifying GAIA_DBF_COLNAME_LOWERCASE
1779
+ */
1780
+ GAIAGEO_DECLARE void gaiaOpenDbfWrite (gaiaDbfPtr dbf,
1781
+ const char *path,
1782
+ const char *charFrom,
1783
+ const char *charTo);
1784
+
1785
+ /**
1786
+ Reads a record from a DBF File object
1787
+
1788
+ \param dbf pointer to the DBF File object.
1789
+ \param current_row the row number identifying the record to be read.
1790
+ \param deleted on completion this variable will contain 0 if the record
1791
+ just read is valid: any other value if the record just read is marked as
1792
+ \e logically \e deleted.
1793
+
1794
+ \return 0 on failure: any other value on success.
1795
+
1796
+ \sa gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfRead, gaiaOpenDbfWrite,
1797
+ gaiaFlushDbfHeader
1798
+
1799
+ \note on completion the DBF File \e First member will point to the
1800
+ linked list containing the corresponding data attributes [both data
1801
+ formats and values].
1802
+
1803
+ \remark the DBF File object should be opened in \e read mode.
1804
+ */
1805
+ GAIAGEO_DECLARE int gaiaReadDbfEntity (gaiaDbfPtr dbf, int current_row,
1806
+ int *deleted);
1807
+
1808
+ /**
1809
+ Reads a record from a DBF File object
1810
+
1811
+ \param dbf pointer to the DBF File object.
1812
+ \param current_row the row number identifying the record to be read.
1813
+ \param deleted on completion this variable will contain 0 if the record
1814
+ \param text_dates is TRUE all DBF dates will be considered as TEXT
1815
+ just read is valid: any other value if the record just read is marked as
1816
+ \e logically \e deleted.
1817
+
1818
+ \return 0 on failure: any other value on success.
1819
+
1820
+ \sa gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfRead, gaiaOpenDbfWrite,
1821
+ gaiaFlushDbfHeader
1822
+
1823
+ \note on completion the DBF File \e First member will point to the
1824
+ linked list containing the corresponding data attributes [both data
1825
+ formats and values].
1826
+
1827
+ \remark the DBF File object should be opened in \e read mode.
1828
+ */
1829
+ GAIAGEO_DECLARE int gaiaReadDbfEntity_ex (gaiaDbfPtr dbf, int current_row,
1830
+ int *deleted, int text_dates);
1831
+
1832
+ /**
1833
+ Writes a record into a DBF File object
1834
+
1835
+ \param dbf pointer to the DBF File object.
1836
+ \param entity pointer to DBF List object containing Fields and corresponding
1837
+ values.
1838
+
1839
+ \return 0 on failure: any other value on success.
1840
+
1841
+ \sa gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfRead, gaiaOpenDbfWrite,
1842
+ gaiaReadDbfEntity, gaiaFlushDbfHeader
1843
+
1844
+ \remark the DBF File object should be opened in \e write mode.
1845
+ */
1846
+ GAIAGEO_DECLARE int gaiaWriteDbfEntity (gaiaDbfPtr dbf,
1847
+ gaiaDbfListPtr entity);
1848
+
1849
+ /**
1850
+ Writes into an output DBF File any required header / footer
1851
+
1852
+ \param dbf pointer to the DBF File object.
1853
+
1854
+ \sa gaiaAllocDbf, gaiaFreeDbf, gaiaOpenDbfRead, gaiaOpenDbfWrite,
1855
+ gaiaReadDbfEntity, gaiaWriteDbfEntity
1856
+
1857
+ \note forgetting to call gaiaFlushDbfHeader for any DBF File opened in
1858
+ \e write mode immediately before destroying the object, will surely
1859
+ cause severe file corruption.
1860
+ */
1861
+ GAIAGEO_DECLARE void gaiaFlushDbfHeader (gaiaDbfPtr dbf);
1862
+
1863
+ /**
1864
+ Reads from a Memory File
1865
+
1866
+ \param ptr pointer to the output buffer.
1867
+ \param bytes numeber of bytes to read.
1868
+ \param mem pointer to the Memory File object.
1869
+
1870
+ \return the number of bytes read.
1871
+
1872
+ \sa gaiaMemFseek
1873
+ */
1874
+ GAIAGEO_DECLARE size_t gaiaMemRead (void *ptr, size_t bytes,
1875
+ gaiaMemFilePtr mem);
1876
+
1877
+ /**
1878
+ Repositioning a Memory File
1879
+
1880
+ \param mem pointer to the Memry File object.
1881
+ \param offset file offset relative to the start of file
1882
+
1883
+ \return 0 on success; -1 on failure.
1884
+
1885
+ \sa gaiaFseek
1886
+ */
1887
+ GAIAGEO_DECLARE int gaiaMemFseek (gaiaMemFilePtr mem, off_t offset);
1888
+
1889
+ /**
1890
+ Attempting to get a WKT from the .PRJ member of a given zipped Shapefile
1891
+
1892
+ \param zip_path absolute or relativ pathname leading to the Zipfile.
1893
+ \param basename name of the Shapefile (excluding any .shp, .shx or .dbf suffix)
1894
+
1895
+ \return the returned WKT expression from the .prj member of the zipped Shapefile
1896
+ or NULL on failure
1897
+
1898
+ \note the WKT expression corresponds to dynamically allocated memory:
1899
+ so you are responsible to free() it before or after.
1900
+ */
1901
+ GAIAGEO_DECLARE char *gaiaReadWktFromZipShp (const char *zip_path,
1902
+ const char *basename);
1903
+
1904
+ /**
1905
+ Will return the number of Shapefiles from within a given Zipfile
1906
+
1907
+ \param zip_path absolute or relativ pathname leading to the Zipfile.
1908
+ \param count on success will contain the number of Shapefiles
1909
+
1910
+ \return 0 on failure; any other value on success.
1911
+ */
1912
+ GAIAGEO_DECLARE int gaiaZipfileNumSHP (const char *zip_path, int *count);
1913
+
1914
+ /**
1915
+ Will return the basename of the Nth Shapefile from within a given Zipfile
1916
+
1917
+ \param zip_path absolute or relativ pathname leading to the Zipfile.
1918
+ \param idx index (1-based) of the Shapefile
1919
+
1920
+ \return the basename of the Nth Shapefile
1921
+ or NULL on failure
1922
+
1923
+ \note the returned basename corresponds to dynamically allocated memory:
1924
+ so you are responsible to free() it before or after.
1925
+ */
1926
+ GAIAGEO_DECLARE char *gaiaZipfileShpN (const char *zip_path, int idx);
1927
+
1928
+ /**
1929
+ Will return the number of DBF files from within a given Zipfile
1930
+
1931
+ \param zip_path absolute or relativ pathname leading to the Zipfile.
1932
+ \param count on success will contain the number of DBF files
1933
+
1934
+ \return 0 on failure; any other value on success.
1935
+ */
1936
+ GAIAGEO_DECLARE int gaiaZipfileNumDBF (const char *zip_path, int *count);
1937
+
1938
+ /**
1939
+ Will return the filename of the Nth DBF file from within a given Zipfile
1940
+
1941
+ \param zip_path absolute or relativ pathname leading to the Zipfile.
1942
+ \param idx index (1-based) of the DBF file
1943
+
1944
+ \return the filename of the Nth DBF file
1945
+ or NULL on failure
1946
+
1947
+ \note the returned filename corresponds to dynamically allocated memory:
1948
+ so you are responsible to free() it before or after.
1949
+ */
1950
+ GAIAGEO_DECLARE char *gaiaZipfileDbfN (const char *zip_path, int idx);
1951
+
1952
+
1953
+ #ifndef OMIT_ICONV /* ICONV enabled: supporting text reader */
1954
+
1955
+ /**
1956
+ Creates a Text Reader object
1957
+
1958
+ \param path to the corresponding file-system file.
1959
+ \param field_separator the character acting as a separator between adjacent
1960
+ fields.
1961
+ \param text_separator the character used to quote text strings.
1962
+ \param decimal_separator the character used as a separator between integer
1963
+ and decimal digits for real numeric values.
1964
+ \param first_line_titles 0 if the first line contains regular values:
1965
+ any other value if the first line contains column names.
1966
+ \param encoding GNU ICONV name identifying the input charset encoding.
1967
+
1968
+ \return the pointer to the newly created Text Reader object: NULL on failure
1969
+
1970
+ \sa gaiaTextReaderDestroy, gaiaTextReaderParse,
1971
+ gaiaTextReaderGetRow, gaiaTextReaderFetchField
1972
+
1973
+ \note you are responsible to destroy (before or after) any allocated Text
1974
+ Reader object.
1975
+ */
1976
+ GAIAGEO_DECLARE gaiaTextReaderPtr gaiaTextReaderAlloc (const char *path,
1977
+ char
1978
+ field_separator,
1979
+ char
1980
+ text_separator,
1981
+ char
1982
+ decimal_separator,
1983
+ int
1984
+ first_line_titles,
1985
+ const char
1986
+ *encoding);
1987
+
1988
+ /**
1989
+ Destroys a Text Reader object
1990
+
1991
+ \param reader pointer to Text Reader object.
1992
+
1993
+ \sa gaiaTextReaderAlloc, gaiaTextReaderParse,
1994
+ gaiaTextReaderGetRow, gaiaTextReaderFetchField
1995
+ */
1996
+ GAIAGEO_DECLARE void gaiaTextReaderDestroy (gaiaTextReaderPtr reader);
1997
+
1998
+ /**
1999
+ Prescans the external file associated to a Text Reade object
2000
+
2001
+ \param reader pointer to Text Reader object.
2002
+
2003
+ \return 0 on failure: any other value on success.
2004
+
2005
+ \sa gaiaTextReaderAlloc, gaiaTextReaderDestroy,
2006
+ gaiaTextReaderGetRow, gaiaTextReaderFetchField
2007
+
2008
+ \note this preliminary step is required so to ensure:
2009
+ \li file consistency: checking expected formatting rules.
2010
+ \li identifying the number / type / name of fields [aka columns].
2011
+ \li identifying the actual number of lines within the file.
2012
+ */
2013
+ GAIAGEO_DECLARE int gaiaTextReaderParse (gaiaTextReaderPtr reader);
2014
+
2015
+ /**
2016
+ Reads a line from a Text Reader object
2017
+
2018
+ \param reader pointer to Text Reader object.
2019
+ \param row_num the Line Number identifying the Line to be read.
2020
+
2021
+ \return 0 on failure: any other value on success.
2022
+
2023
+ \sa gaiaTextReaderAlloc, gaiaTextReaderDestroy, gaiaTextReaderParse,
2024
+ gaiaTextReaderFetchField
2025
+
2026
+ \note this function will load the requested Line into the current buffer:
2027
+ you can then use gaiaTextReaderFetchField in order to retrieve
2028
+ any individual field [aka column] value.
2029
+ */
2030
+ GAIAGEO_DECLARE int gaiaTextReaderGetRow (gaiaTextReaderPtr reader,
2031
+ int row_num);
2032
+
2033
+ /**
2034
+ Retrieves an individual field value from the current Line
2035
+
2036
+ \param reader pointer to Text Reader object.
2037
+ \param field_num relative field [aka column] index: first field has index 0.
2038
+ \param type on completion this variable will contain the value type.
2039
+ \param value on completion this variable will contain the current field value.
2040
+
2041
+ \return 0 on failure: any other value on success.
2042
+
2043
+ \sa gaiaTextReaderAlloc, gaiaTextReaderDestroy, gaiaTextReaderParse,
2044
+ gaiaTextReaderGetRow
2045
+ */
2046
+ GAIAGEO_DECLARE int gaiaTextReaderFetchField (gaiaTextReaderPtr reader,
2047
+ int field_num, int *type,
2048
+ const char **value);
2049
+
2050
+ #endif /* end ICONV (text reader) */
2051
+
2052
+ #ifdef __cplusplus
2053
+ }
2054
+ #endif
2055
+
2056
+ #endif /* _GG_FORMATS_H */