@crossbind/port-spatialite-wasi 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 (45) hide show
  1. package/LICENSE +35 -0
  2. package/README.md +11 -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/wasi-wasm32-st-release/crossbind-emccflags.fingerprint +1 -0
  9. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/control_points.h +259 -0
  10. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/debug.h +77 -0
  11. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gaia_network.h +627 -0
  12. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gaia_topology.h +1221 -0
  13. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gaiaaux.h +540 -0
  14. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gaiaconfig-msvc.h +56 -0
  15. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gaiaconfig-msvc.h.in +55 -0
  16. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gaiaconfig.h +68 -0
  17. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gaiaconfig.h.in +67 -0
  18. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gaiaexif.h +669 -0
  19. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gaiageo.h +77 -0
  20. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gaiamatrix.h +277 -0
  21. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/geojson.h +586 -0
  22. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/geopackage.h +198 -0
  23. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gg_advanced.h +5184 -0
  24. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gg_const.h +606 -0
  25. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gg_core.h +2294 -0
  26. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gg_dxf.h +993 -0
  27. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gg_dynamic.h +416 -0
  28. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gg_formats.h +2056 -0
  29. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gg_mbr.h +606 -0
  30. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gg_sequence.h +173 -0
  31. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gg_structs.h +880 -0
  32. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gg_wfs.h +581 -0
  33. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/gg_xml.h +818 -0
  34. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/spatialite_ext.h +64 -0
  35. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/sqlite.h +70 -0
  36. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite/stored_procedures.h +641 -0
  37. package/dist/prebuilt/wasi-wasm32-st-release/include/spatialite.h +2098 -0
  38. package/dist/prebuilt/wasi-wasm32-st-release/lib/libspatialite.a +0 -0
  39. package/dist/prebuilt/wasi-wasm32-st-release/lib/libspatialite.la +41 -0
  40. package/dist/prebuilt/wasi-wasm32-st-release/lib/mod_spatialite.a +0 -0
  41. package/dist/prebuilt/wasi-wasm32-st-release/lib/mod_spatialite.la +41 -0
  42. package/dist/prebuilt/wasi-wasm32-st-release/lib/pkgconfig/spatialite.pc +12 -0
  43. package/e2e/main.c +38 -0
  44. package/e2e/run.mjs +89 -0
  45. package/package.json +40 -0
@@ -0,0 +1,993 @@
1
+ /*
2
+ gg_dxf.h -- Gaia common support for DXF files
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
+
31
+ Alternatively, the contents of this file may be used under the terms of
32
+ either the GNU General Public License Version 2 or later (the "GPL"), or
33
+ the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
34
+ in which case the provisions of the GPL or the LGPL are applicable instead
35
+ of those above. If you wish to allow use of your version of this file only
36
+ under the terms of either the GPL or the LGPL, and not to allow others to
37
+ use your version of this file under the terms of the MPL, indicate your
38
+ decision by deleting the provisions above and replace them with the notice
39
+ and other provisions required by the GPL or the LGPL. If you do not delete
40
+ the provisions above, a recipient may use your version of this file under
41
+ the terms of any one of the MPL, the GPL or the LGPL.
42
+
43
+ */
44
+
45
+
46
+ /**
47
+ \file gg_dxf.h
48
+
49
+ Geometry handling functions: DXF files
50
+ */
51
+
52
+ #ifndef _GG_DXF_H
53
+ #ifndef DOXYGEN_SHOULD_SKIP_THIS
54
+ #define _GG_DXF_H
55
+ #endif
56
+
57
+ #ifdef __cplusplus
58
+ extern "C"
59
+ {
60
+ #endif
61
+
62
+ /* constant values for DXF */
63
+
64
+ /** import distinct layers */
65
+ #define GAIA_DXF_IMPORT_BY_LAYER 1
66
+ /** import layers mixed altogether by type */
67
+ #define GAIA_DXF_IMPORT_MIXED 2
68
+ /** auto-selects 2D or 3D */
69
+ #define GAIA_DXF_AUTO_2D_3D 3
70
+ /** always force 2D */
71
+ #define GAIA_DXF_FORCE_2D 4
72
+ /** always force 3D */
73
+ #define GAIA_DXF_FORCE_3D 5
74
+ /** don't apply any special Ring handling */
75
+ #define GAIA_DXF_RING_NONE 6
76
+ /** apply special "linked rings" handling */
77
+ #define GAIA_DXF_RING_LINKED 7
78
+ /** apply special "unlinked rings" handling */
79
+ #define GAIA_DXF_RING_UNLINKED 8
80
+
81
+
82
+ /** DXF version [Writer] */
83
+ #define GAIA_DXF_V12 1000
84
+
85
+ /* data structs */
86
+
87
+
88
+ /**
89
+ wrapper for DXF Extra Attribute object
90
+ */
91
+ typedef struct gaia_dxf_extra_attr
92
+ {
93
+ /** pointer to Extra Attribute Key value */
94
+ char *key;
95
+ /** pointer to Extra Attribute Value string */
96
+ char *value;
97
+ /** pointer to next item [linked list] */
98
+ struct gaia_dxf_extra_attr *next;
99
+ } gaiaDxfExtraAttr;
100
+ /**
101
+ Typedef for DXF Extra Attribute object
102
+
103
+ \sa gaiaDxfExtraAttr
104
+ */
105
+ typedef gaiaDxfExtraAttr *gaiaDxfExtraAttrPtr;
106
+
107
+ /**
108
+ wrapper for DXF Insert object
109
+ */
110
+ typedef struct gaia_dxf_insert
111
+ {
112
+ /** pointer to Block ID string */
113
+ char *block_id;
114
+ /** X coordinate */
115
+ double x;
116
+ /** Y coordinate */
117
+ double y;
118
+ /** Z coordinate */
119
+ double z;
120
+ /** X scale factor */
121
+ double scale_x;
122
+ /** Y scale factor */
123
+ double scale_y;
124
+ /** Z scale factor */
125
+ double scale_z;
126
+ /** rotation angle */
127
+ double angle;
128
+ /** boolean flag: contains Text objects */
129
+ int hasText;
130
+ /** boolean flag: contains Point objects */
131
+ int hasPoint;
132
+ /** boolean flag: contains Polyline (Linestring) objects */
133
+ int hasLine;
134
+ /** boolean flag: contains Polyline (Polygon) objects */
135
+ int hasPolyg;
136
+ /** boolean flag: contains Hatch objects */
137
+ int hasHatch;
138
+ /** boolean flag: contains 3d Text objects */
139
+ int is3Dtext;
140
+ /** boolean flag: contains 3d Point objects */
141
+ int is3Dpoint;
142
+ /** boolean flag: contains 3d Polyline (Linestring) objects */
143
+ int is3Dline;
144
+ /** boolean flag: contains 3d Polyline (Polygon) objects */
145
+ int is3Dpolyg;
146
+ /** pointer to first Extra Attribute [linked list] */
147
+ gaiaDxfExtraAttrPtr first;
148
+ /** pointer to last Extra Attribute [linked list] */
149
+ gaiaDxfExtraAttrPtr last;
150
+ /** pointer to next item [linked list] */
151
+ struct gaia_dxf_insert *next;
152
+ } gaiaDxfInsert;
153
+ /**
154
+ Typedef for DXF Insert object
155
+
156
+ \sa gaiaDxfText
157
+ */
158
+ typedef gaiaDxfInsert *gaiaDxfInsertPtr;
159
+
160
+ /**
161
+ wrapper for DXF Text object
162
+ */
163
+ typedef struct gaia_dxf_text
164
+ {
165
+ /** pointer to Label string */
166
+ char *label;
167
+ /** X coordinate */
168
+ double x;
169
+ /** Y coordinate */
170
+ double y;
171
+ /** Z coordinate */
172
+ double z;
173
+ /** label rotation angle */
174
+ double angle;
175
+ /** pointer to first Extra Attribute [linked list] */
176
+ gaiaDxfExtraAttrPtr first;
177
+ /** pointer to last Extra Attribute [linked list] */
178
+ gaiaDxfExtraAttrPtr last;
179
+ /** pointer to next item [linked list] */
180
+ struct gaia_dxf_text *next;
181
+ } gaiaDxfText;
182
+ /**
183
+ Typedef for DXF Text object
184
+
185
+ \sa gaiaDxfText
186
+ */
187
+ typedef gaiaDxfText *gaiaDxfTextPtr;
188
+
189
+ /**
190
+ wrapper for DXF Point object
191
+ */
192
+ typedef struct gaia_dxf_point
193
+ {
194
+ /** X coordinate */
195
+ double x;
196
+ /** Y coordinate */
197
+ double y;
198
+ /** Z coordinate */
199
+ double z;
200
+ /** pointer to first Extra Attribute [linked list] */
201
+ gaiaDxfExtraAttrPtr first;
202
+ /** pointer to last Extra Attribute [linked list] */
203
+ gaiaDxfExtraAttrPtr last;
204
+ /** pointer to next item [linked list] */
205
+ struct gaia_dxf_point *next;
206
+ } gaiaDxfPoint;
207
+ /**
208
+ Typedef for DXF Point object
209
+
210
+ \sa gaiaDxfPoint
211
+ */
212
+ typedef gaiaDxfPoint *gaiaDxfPointPtr;
213
+
214
+ /**
215
+ wrapper for DXF Circle object
216
+ */
217
+ typedef struct gaia_dxf_circle
218
+ {
219
+ /** Center X coordinate */
220
+ double cx;
221
+ /** Center Y coordinate */
222
+ double cy;
223
+ /** Center Z coordinate */
224
+ double cz;
225
+ /** radius */
226
+ double radius;
227
+ } gaiaDxfCircle;
228
+ /**
229
+ Typedef for DXF Circle object
230
+
231
+ \sa gaiaDxfCircle
232
+ */
233
+ typedef gaiaDxfCircle *gaiaDxfCirclePtr;
234
+
235
+ /**
236
+ wrapper for DXF Arc object
237
+ */
238
+ typedef struct gaia_dxf_arc
239
+ {
240
+ /** Center X coordinate */
241
+ double cx;
242
+ /** Center Y coordinate */
243
+ double cy;
244
+ /** Center Z coordinate */
245
+ double cz;
246
+ /** radius */
247
+ double radius;
248
+ /** start angle */
249
+ double start;
250
+ /** stop angle */
251
+ double stop;
252
+ } gaiaDxfArc;
253
+ /**
254
+ Typedef for DXF Arc object
255
+
256
+ \sa gaiaDxfArc
257
+ */
258
+ typedef gaiaDxfArc *gaiaDxfArcPtr;
259
+
260
+ /**
261
+ wrapper for DXF Polygon interior hole object
262
+ */
263
+ typedef struct gaia_dxf_hole
264
+ {
265
+ /** total count of points */
266
+ int points;
267
+ /** array of X coordinates */
268
+ double *x;
269
+ /** array of Y coordinates */
270
+ double *y;
271
+ /** array of Z coordinates */
272
+ double *z;
273
+ /** pointer to next item [linked list] */
274
+ struct gaia_dxf_hole *next;
275
+ } gaiaDxfHole;
276
+ /**
277
+ Typedef for DXF Point object
278
+
279
+ \sa gaiaDxfHole
280
+ */
281
+ typedef gaiaDxfHole *gaiaDxfHolePtr;
282
+
283
+ /**
284
+ wrapper for DXF Polyline object
285
+ could be a Linestring or a Polygon depending on the is_closed flag
286
+ */
287
+ typedef struct gaia_dxf_polyline
288
+ {
289
+ /** open (Linestring) or closed (Polygon exterior ring) */
290
+ int is_closed;
291
+ /** total count of points */
292
+ int points;
293
+ /** array of X coordinates */
294
+ double *x;
295
+ /** array of Y coordinates */
296
+ double *y;
297
+ /** array of Z coordinates */
298
+ double *z;
299
+ /** pointer to first Polygon hole [linked list] */
300
+ gaiaDxfHolePtr first_hole;
301
+ /** pointer to last Polygon hole [linked list] */
302
+ gaiaDxfHolePtr last_hole;
303
+ /** pointer to first Extra Attribute [linked list] */
304
+ gaiaDxfExtraAttrPtr first;
305
+ /** pointer to last Extra Attribute [linked list] */
306
+ gaiaDxfExtraAttrPtr last;
307
+ /** pointer to next item [linked list] */
308
+ struct gaia_dxf_polyline *next;
309
+ } gaiaDxfPolyline;
310
+ /**
311
+ Typedef for DXF Polyline object
312
+
313
+ \sa gaiaDxfPolyline
314
+ */
315
+ typedef gaiaDxfPolyline *gaiaDxfPolylinePtr;
316
+ /**
317
+ wrapper for DXF Pattern Segment object
318
+ */
319
+ typedef struct gaia_dxf_hatch_segm
320
+ {
321
+ /** start X */
322
+ double x0;
323
+ /** start Y */
324
+ double y0;
325
+ /** end X */
326
+ double x1;
327
+ /** end Y */
328
+ double y1;
329
+ /** pointer to next item [linked list] */
330
+ struct gaia_dxf_hatch_segm *next;
331
+ } gaiaDxfHatchSegm;
332
+ /**
333
+ Typedef for DXF Hatch Segment object
334
+
335
+ \sa gaiaDxfHatch
336
+ */
337
+ typedef gaiaDxfHatchSegm *gaiaDxfHatchSegmPtr;
338
+
339
+ /**
340
+ wrapper for DXF Boundary Path object
341
+ */
342
+ typedef struct gaia_dxf_boundary_path
343
+ {
344
+ /** pointer to first segment */
345
+ gaiaDxfHatchSegmPtr first;
346
+ /** pointer to last segment */
347
+ gaiaDxfHatchSegmPtr last;
348
+ /** pointer to next item [linked list] */
349
+ struct gaia_dxf_boundary_path *next;
350
+ } gaiaDxfBoundaryPath;
351
+ /**
352
+ Typedef for DXF Boundary Path object
353
+
354
+ \sa gaiaDxfBoundaryPath
355
+ */
356
+ typedef gaiaDxfBoundaryPath *gaiaDxfBoundaryPathPtr;
357
+
358
+ /**
359
+ wrapper for DXF Pattern Hatch object
360
+ */
361
+ typedef struct gaia_dxf_hatch
362
+ {
363
+ /** hatch pattern spacing */
364
+ double spacing;
365
+ /** hatch line angle */
366
+ double angle;
367
+ /** hatch line base X */
368
+ double base_x;
369
+ /** hatch line base Y */
370
+ double base_y;
371
+ /** hatch line offset X */
372
+ double offset_x;
373
+ /** hatch line offset Y */
374
+ double offset_y;
375
+ /** pointer to first Boundary */
376
+ gaiaDxfBoundaryPathPtr first;
377
+ /** pointer to last Boundary */
378
+ gaiaDxfBoundaryPathPtr last;
379
+ /** pointer to Boundary geometry */
380
+ gaiaGeomCollPtr boundary;
381
+ /** pointer to first Pattern segment */
382
+ gaiaDxfHatchSegmPtr first_out;
383
+ /** pointer to last Pattern segment */
384
+ gaiaDxfHatchSegmPtr last_out;
385
+ /** pointer to next item [linked list] */
386
+ struct gaia_dxf_hatch *next;
387
+ } gaiaDxfHatch;
388
+ /**
389
+ Typedef for DXF Hatch object
390
+
391
+ \sa gaiaDxfHatch
392
+ */
393
+ typedef gaiaDxfHatch *gaiaDxfHatchPtr;
394
+
395
+ /**
396
+ wrapper for DXF Block object
397
+ */
398
+ typedef struct gaia_dxf_block
399
+ {
400
+ /** Boolean flag: this block is referenced by some Insert */
401
+ int hasInsert;
402
+ /** pointer to Layer Name string */
403
+ char *layer_name;
404
+ /** pointer to Block ID string */
405
+ char *block_id;
406
+ /** pointer to first DXF Text object [linked list] */
407
+ gaiaDxfTextPtr first_text;
408
+ /** pointer to last DXF Text object [linked list] */
409
+ gaiaDxfTextPtr last_text;
410
+ /** pointer to first DXF Point object [linked list] */
411
+ gaiaDxfPointPtr first_point;
412
+ /** pointer to last DXF Point object [linked list] */
413
+ gaiaDxfPointPtr last_point;
414
+ /** pointer to first DXF Polyline (Linestring) object [linked list] */
415
+ gaiaDxfPolylinePtr first_line;
416
+ /** pointer to last DXF Polyline (Linestring) object [linked list] */
417
+ gaiaDxfPolylinePtr last_line;
418
+ /** pointer to first DXF Polyline (Polygon) object [linked list] */
419
+ gaiaDxfPolylinePtr first_polyg;
420
+ /** pointer to last DXF Polyline (Polygon) object [linked list] */
421
+ gaiaDxfPolylinePtr last_polyg;
422
+ /** pointer to first DXF Hatch object [linked list] */
423
+ gaiaDxfHatchPtr first_hatch;
424
+ /** pointer to last DXF Hatch object [linked list] */
425
+ gaiaDxfHatchPtr last_hatch;
426
+ /** boolean flag: contains 3d Text objects */
427
+ int is3Dtext;
428
+ /** boolean flag: contains 3d Point objects */
429
+ int is3Dpoint;
430
+ /** boolean flag: contains 3d Polyline (Linestring) objects */
431
+ int is3Dline;
432
+ /** boolean flag: contains 3d Polyline (Polygon) objects */
433
+ int is3Dpolyg;
434
+ /** pointer to next item [linked list] */
435
+ struct gaia_dxf_block *next;
436
+ } gaiaDxfBlock;
437
+ /**
438
+ Typedef for DXF Block object
439
+
440
+ \sa gaiaDxfBlock
441
+ */
442
+ typedef gaiaDxfBlock *gaiaDxfBlockPtr;
443
+
444
+ /**
445
+ wrapper for DXF Layer object
446
+ */
447
+ typedef struct gaia_dxf_layer
448
+ {
449
+ /** pointer to Layer Name string */
450
+ char *layer_name;
451
+ /** pointer to first DXF Text object [linked list] */
452
+ gaiaDxfTextPtr first_text;
453
+ /** pointer to last DXF Text object [linked list] */
454
+ gaiaDxfTextPtr last_text;
455
+ /** pointer to first DXF Point object [linked list] */
456
+ gaiaDxfPointPtr first_point;
457
+ /** pointer to lasst DXF Point object [linked list] */
458
+ gaiaDxfPointPtr last_point;
459
+ /** pointer to first DXF Polyline (Linestring) object [linked list] */
460
+ gaiaDxfPolylinePtr first_line;
461
+ /** pointer to last DXF Polyline (Linestring) object [linked list] */
462
+ gaiaDxfPolylinePtr last_line;
463
+ /** pointer to first DXF Polyline (Polygon) object [linked list] */
464
+ gaiaDxfPolylinePtr first_polyg;
465
+ /** pointer to last DXF Polyline (Polygon) object [linked list] */
466
+ gaiaDxfPolylinePtr last_polyg;
467
+ /** pointer to first DXF Hatch object [linked list] */
468
+ gaiaDxfHatchPtr first_hatch;
469
+ /** pointer to last DXF Hatch object [linked list] */
470
+ gaiaDxfHatchPtr last_hatch;
471
+ /** pointer to first DXF Insert Text object [linked list] */
472
+ gaiaDxfInsertPtr first_ins_text;
473
+ /** pointer to last DXF Insert Text object [linked list] */
474
+ gaiaDxfInsertPtr last_ins_text;
475
+ /** pointer to first DXF Insert Point object [linked list] */
476
+ gaiaDxfInsertPtr first_ins_point;
477
+ /** pointer to last DXF Insert Point object [linked list] */
478
+ gaiaDxfInsertPtr last_ins_point;
479
+ /** pointer to first DXF Insert Polyline (Linestring) object [linked list] */
480
+ gaiaDxfInsertPtr first_ins_line;
481
+ /** pointer to last DXF Insert Polyline (Linestring) object [linked list] */
482
+ gaiaDxfInsertPtr last_ins_line;
483
+ /** pointer to first DXF Insert Polyline (Polygon) object [linked list] */
484
+ gaiaDxfInsertPtr first_ins_polyg;
485
+ /** pointer to last DXF Insert Polyline (Polygon) object [linked list] */
486
+ gaiaDxfInsertPtr last_ins_polyg;
487
+ /** pointer to first DXF Insert Hatch object [linked list] */
488
+ gaiaDxfInsertPtr first_ins_hatch;
489
+ /** pointer to last DXF Insert Hatch object [linked list] */
490
+ gaiaDxfInsertPtr last_ins_hatch;
491
+ /** boolean flag: contains 3d Text objects */
492
+ int is3Dtext;
493
+ /** boolean flag: contains 3d Point objects */
494
+ int is3Dpoint;
495
+ /** boolean flag: contains 3d Polyline (Linestring) objects */
496
+ int is3Dline;
497
+ /** boolean flag: contains 3d Polyline (Polygon) objects */
498
+ int is3Dpolyg;
499
+ /** boolean flag: contains 3d Insert Text objects */
500
+ int is3DinsText;
501
+ /** boolean flag: contains 3d Insert Point objects */
502
+ int is3DinsPoint;
503
+ /** boolean flag: contains 3d Insert Polyline (Linestring) objects */
504
+ int is3DinsLine;
505
+ /** boolean flag: contains 3d Insert Polyline (Polygon) objects */
506
+ int is3DinsPolyg;
507
+ /** boolean flag: contains Text Extra Attributes */
508
+ int hasExtraText;
509
+ /** boolean flag: contains Point Extra Attributes */
510
+ int hasExtraPoint;
511
+ /** boolean flag: contains Polyline (Linestring) Extra Attributes */
512
+ int hasExtraLine;
513
+ /** boolean flag: contains Polyline (Polygon) Extra Attributes */
514
+ int hasExtraPolyg;
515
+ /** boolean flag: contains Insert Text Extra Attributes */
516
+ int hasExtraInsText;
517
+ /** boolean flag: contains Insert Text Extra Attributes */
518
+ int hasExtraInsPoint;
519
+ /** boolean flag: contains Insert Polyline (Linestring) Extra Attributes */
520
+ int hasExtraInsLine;
521
+ /** boolean flag: contains Insert Polyline (Polygon) Extra Attributes */
522
+ int hasExtraInsPolyg;
523
+ /** pointer to next item [linked list] */
524
+ struct gaia_dxf_layer *next;
525
+ } gaiaDxfLayer;
526
+ /**
527
+ Typedef for DXF Layer object
528
+
529
+ \sa gaiaDxfLayer
530
+ */
531
+ typedef gaiaDxfLayer *gaiaDxfLayerPtr;
532
+
533
+ /**
534
+ wrapper for DXF Parser object
535
+ */
536
+ typedef struct gaia_dxf_parser
537
+ {
538
+ /** OUT: origin/input filename */
539
+ char *filename;
540
+ /** OUT: pointer to first DXF Layer object [linked list] */
541
+ gaiaDxfLayerPtr first_layer;
542
+ /** OUT: pointer to last DXF Layer object [linked list] */
543
+ gaiaDxfLayerPtr last_layer;
544
+ /** OUT: pointer to first DXF Block object [linked list] */
545
+ gaiaDxfBlockPtr first_block;
546
+ /** OUT: pointer to last DXF Block object [linked list] */
547
+ gaiaDxfBlockPtr last_block;
548
+ /** IN: parser option - dimension handlig */
549
+ int force_dims;
550
+ /** IN: parser option - the SRID */
551
+ int srid;
552
+ /** IN: parser option - pointer the single Layer Name string */
553
+ const char *selected_layer;
554
+ /** IN: parser option - pointer to prefix string for DB tables */
555
+ const char *prefix;
556
+ /** IN: parser option - linked rings special handling */
557
+ int linked_rings;
558
+ /** IN: parser option - unlinked rings special handling */
559
+ int unlinked_rings;
560
+ /** internal parser variable */
561
+ int line_no;
562
+ /** internal parser variable */
563
+ int op_code_line;
564
+ /** internal parser variable */
565
+ int op_code;
566
+ /** internal parser variable */
567
+ int section;
568
+ /** internal parser variable */
569
+ int tables;
570
+ /** internal parser variable */
571
+ int blocks;
572
+ /** internal parser variable */
573
+ int entities;
574
+ /** internal parser variable */
575
+ int is_layer;
576
+ /** internal parser variable */
577
+ int is_block;
578
+ /** internal parser variable */
579
+ int is_text;
580
+ /** internal parser variable */
581
+ int is_point;
582
+ /** internal parser variable */
583
+ int is_polyline;
584
+ /** internal parser variable */
585
+ int is_lwpolyline;
586
+ /** internal parser variable */
587
+ int is_line;
588
+ /** internal parser variable */
589
+ int is_circle;
590
+ /** internal parser variable */
591
+ int is_arc;
592
+ /** internal parser variable */
593
+ int is_vertex;
594
+ /** internal parser variable */
595
+ int is_hatch;
596
+ /** internal parser variable */
597
+ int is_hatch_boundary;
598
+ /** internal parser variable */
599
+ int is_insert;
600
+ /** internal parser variable */
601
+ int eof;
602
+ /** internal parser variable */
603
+ int error;
604
+ /** internal parser variable */
605
+ char *curr_layer_name;
606
+ /** internal parser variable */
607
+ gaiaDxfText curr_text;
608
+ /** internal parser variable */
609
+ gaiaDxfInsert curr_insert;
610
+ /** internal parser variable */
611
+ gaiaDxfBlock curr_block;
612
+ /** internal parser variable */
613
+ gaiaDxfPoint curr_point;
614
+ /** internal parser variable */
615
+ gaiaDxfPoint curr_end_point;
616
+ /** internal parser variable */
617
+ gaiaDxfCircle curr_circle;
618
+ /** internal parser variable */
619
+ gaiaDxfArc curr_arc;
620
+ /** internal parser variable */
621
+ int is_closed_polyline;
622
+ /** internal parser variable */
623
+ gaiaDxfPointPtr first_pt;
624
+ /** internal parser variable */
625
+ gaiaDxfPointPtr last_pt;
626
+ /** internal parser variable */
627
+ char *extra_key;
628
+ /** internal parser variable */
629
+ char *extra_value;
630
+ /** internal parser variable */
631
+ gaiaDxfExtraAttrPtr first_ext;
632
+ /** internal parser variable */
633
+ gaiaDxfExtraAttrPtr last_ext;
634
+ /** internal parser variable */
635
+ gaiaDxfHatchPtr curr_hatch;
636
+ /** internal parser variable */
637
+ int undeclared_layers;
638
+ } gaiaDxfParser;
639
+ /**
640
+ Typedef for DXF Layer object
641
+
642
+ \sa gaiaDxfParser
643
+ */
644
+ typedef gaiaDxfParser *gaiaDxfParserPtr;
645
+
646
+ /**
647
+ wrapper for DXF Write object
648
+ */
649
+ typedef struct gaia_dxf_write
650
+ {
651
+ /** IN: output DXF file handle */
652
+ FILE *out;
653
+ /** IN: coord's precision (number of decimal digits) */
654
+ int precision;
655
+ /** IN: DXF version number */
656
+ int version;
657
+ /** OUT: count of exported geometries */
658
+ int count;
659
+ /** OUT: error flag */
660
+ int error;
661
+ } gaiaDxfWriter;
662
+ /**
663
+ Typedef for DXF Writer object
664
+ */
665
+ typedef gaiaDxfWriter *gaiaDxfWriterPtr;
666
+
667
+
668
+ /* function prototypes */
669
+
670
+
671
+ /**
672
+ Creates a DXF Parser object
673
+
674
+ \param srid the SRID value to be used for all Geometries
675
+ \param force_dims should be one of GAIA_DXF_AUTO_2D_3D, GAIA_DXF_FORCE_2D
676
+ or GAIA_DXF_FORCE_3D
677
+ \param prefix an optional prefix to be used for DB target tables
678
+ (could be NULL)
679
+ \param selected_layers if set, only the DXF Layer of corresponding name will
680
+ be imported (could be NULL)
681
+ \param special_rings rings handling: should be one of GAIA_DXF_RING_NONE,
682
+ GAIA_DXF_RING_LINKED of GAIA_DXF_RING_UNLINKED
683
+
684
+ \return the pointer to a DXF Parser object
685
+
686
+ \sa gaiaDestroyDxfParser, gaiaParseDxfFile, gaiaLoadFromDxfParser
687
+
688
+ \note the DXF Parser object corresponds to dynamically allocated memory:
689
+ so you are responsible to destroy this object before or later by invoking
690
+ gaiaDestroyDxfParser().
691
+ */
692
+ GAIAGEO_DECLARE gaiaDxfParserPtr gaiaCreateDxfParser (int srid,
693
+ int force_dims,
694
+ const char *prefix,
695
+ const char
696
+ *selected_layer,
697
+ int special_rings);
698
+
699
+ /**
700
+ Destroying a DXF Parser object
701
+
702
+ \param parser pointer to DXF Parser object
703
+
704
+ \sa gaiaCreateDxfParser
705
+
706
+ \note the pointer to the DXF Parser object to be finalized is expected
707
+ to be the one returned by a previous call to gaiaCreateDxfParser.
708
+ */
709
+ GAIAGEO_DECLARE void gaiaDestroyDxfParser (gaiaDxfParserPtr parser);
710
+
711
+ /**
712
+ Parsing a DXF file
713
+
714
+ \param parser pointer to DXF Parser object
715
+ \param dxf_path pathname of the DXF external file to be parsed
716
+
717
+ \return 0 on failure, any other value on success
718
+
719
+ \sa gaiaParseDxfFile_r,
720
+ gaiaCreateDxfParser, gaiaDestroyDxfParser, gaiaLoadFromDxfParser
721
+
722
+ \note the pointer to the DXF Parser object is expected to be the one
723
+ returned by a previous call to gaiaCreateDxfParser.
724
+ A DXF Parser object can be used only a single time to parse a DXF file.\n
725
+ not reentrant and thread unsafe.
726
+ */
727
+ GAIAGEO_DECLARE int gaiaParseDxfFile (gaiaDxfParserPtr parser,
728
+ const char *dxf_path);
729
+
730
+ /**
731
+ Parsing a DXF file
732
+
733
+ \param p_cache a memory pointer returned by spatialite_alloc_connection()
734
+ \param parser pointer to DXF Parser object
735
+ \param dxf_path pathname of the DXF external file to be parsed
736
+
737
+ \return 0 on failure, any other value on success
738
+
739
+ \sa gaiaParseDxfFile,
740
+ gaiaCreateDxfParser, gaiaDestroyDxfParser, gaiaLoadFromDxfParser
741
+
742
+ \note the pointer to the DXF Parser object is expected to be the one
743
+ returned by a previous call to gaiaCreateDxfParser.
744
+ A DXF Parser object can be used only a single time to parse a DXF file.\n
745
+ reentrant and thread-safe.
746
+ */
747
+ GAIAGEO_DECLARE int gaiaParseDxfFile_r (const void *p_cache,
748
+ gaiaDxfParserPtr parser,
749
+ const char *dxf_path);
750
+
751
+ /**
752
+ Populating a DB so to permanently store all Geometries from a DXF Parser
753
+
754
+ \param db_handle handle to a valid DB connection
755
+ \param parser pointer to DXF Parser object
756
+ \param mode should be one of GAIA_DXF_IMPORT_BY_LAYER or GAIA_DXF_IMPORT_MIXED
757
+ \param append boolean flag: if set and some required DB table already exists
758
+ will attempt to append further rows into the existing table.
759
+ otherwise an error will be returned.
760
+
761
+ \return 0 on failure, any other value on success
762
+
763
+ \sa gaiaCreateDxfParser, gaiaDestroyDxfParser, gaiaParseDxfFile
764
+
765
+ \note the pointer to the DXF Parser object is expected to be the one
766
+ returned by a previous call to gaiaCreateDxfParser and previously used
767
+ for a succesfull call to gaiaParseDxfFile
768
+ */
769
+ GAIAGEO_DECLARE int gaiaLoadFromDxfParser (sqlite3 * db_handle,
770
+ gaiaDxfParserPtr parser,
771
+ int mode, int append);
772
+
773
+ /**
774
+ Initializing a DXF Writer Object
775
+
776
+ \param writer pointer to the gaiaDxfWriter object to be initialized
777
+ \param out file handle to DXF output file
778
+ \param precision number of decimal digits for any coordinate
779
+ \param version currently always expected to be GAIA_DXF_V12
780
+
781
+ \return 0 on failure, any other value on success
782
+
783
+ \sa gaiaDxfWriteHeader, gaiaExportDxf
784
+ */
785
+ GAIAGEO_DECLARE int gaiaDxfWriterInit (gaiaDxfWriterPtr dxf,
786
+ FILE * out, int precision,
787
+ int version);
788
+
789
+ /**
790
+ Writing the DXF Header
791
+
792
+ \param dxf pointer to a properly initialized gaiaDxfWriter object
793
+ \param minx the minimum X coordinate contained within the DXF
794
+ \param minx the minimum Y coordinate contained within the DXF
795
+ \param minx the minimum Z coordinate contained within the DXF
796
+ \param minx the maximum X coordinate contained within the DXF
797
+ \param minx the maximum Y coordinate contained within the DXF
798
+ \param minx the maximum Z coordinate contained within the DXF
799
+
800
+ \return 0 on failure, any other value on success
801
+
802
+ \sa gaiaDxfWriterInit, gaiaDxfWriteFooter, gaiaDxfWriteTables, gaiaDxfWriteEntities
803
+ */
804
+ GAIAGEO_DECLARE int
805
+ gaiaDxfWriteHeader (gaiaDxfWriterPtr dxf, double minx, double miny,
806
+ double minz, double maxx, double maxy, double maxz);
807
+
808
+ /**
809
+ Writing a DXF Entities Section Header
810
+
811
+ \param dxf pointer to a properly initialized gaiaDxfWriter object
812
+
813
+ \return 0 on failure, any other value on success
814
+
815
+ \sa gaiaDxfWriteHeader
816
+ */
817
+ GAIAGEO_DECLARE int gaiaDxfWriteFooter (gaiaDxfWriterPtr dxf);
818
+
819
+ /**
820
+ Writing the DXF Tables Section Header
821
+
822
+ \param dxf pointer to a properly initialized gaiaDxfWriter object
823
+
824
+ \return 0 on failure, any other value on success
825
+
826
+ \sa gaiaDxfWriteHeader, gaiaDxfWriteEndSection
827
+ */
828
+ GAIAGEO_DECLARE int gaiaDxfWriteTables (gaiaDxfWriterPtr dxf);
829
+
830
+ /**
831
+ Writing a DXF Table/Layer definition
832
+
833
+ \param dxf pointer to a properly initialized gaiaDxfWriter object
834
+ \param layer_name name of the layer
835
+
836
+ \return 0 on failure, any other value on success
837
+
838
+ \sa gaiaDxfWriteTables, gaiaDxfWriteEndSection
839
+ */
840
+ GAIAGEO_DECLARE int gaiaDxfWriteLayer (gaiaDxfWriterPtr dxf,
841
+ const char *layer_name);
842
+
843
+ /**
844
+ Writing a DXF Entities Section Header
845
+
846
+ \param dxf pointer to a properly initialized gaiaDxfWriter object
847
+
848
+ \return 0 on failure, any other value on success
849
+
850
+ \sa gaiaDxfWriteHeader, gaiaDxfWriteEndSection, gaiaDxfWritePoint,
851
+ gaiaDxfWriteText, gaiaDxfWriteLine, gaiaDxfWriteRing, gaiaDxfWriteGeometry
852
+ */
853
+ GAIAGEO_DECLARE int gaiaDxfWriteEntities (gaiaDxfWriterPtr dxf);
854
+
855
+ /**
856
+ Writing a DXF Entities Section Header
857
+
858
+ \param dxf pointer to a properly initialized gaiaDxfWriter object
859
+
860
+ \return 0 on failure, any other value on success
861
+
862
+ \sa gaiaDxfWriteTables, gaiaDxfWriteEntities
863
+ */
864
+ GAIAGEO_DECLARE int gaiaDxfWriteEndSection (gaiaDxfWriterPtr dxf);
865
+
866
+ /**
867
+ Writing a DXF Point Entity
868
+
869
+ \param dxf pointer to a properly initialized gaiaDxfWriter object
870
+ \param layer_name name of the corresponding layer
871
+ \param x X coordinate value
872
+ \param y Y coordinate value
873
+ \param z Z coordinate value
874
+
875
+ \return 0 on failure, any other value on success
876
+
877
+ \sa gaiaDxfWriteEntities, gaiaDxfWriteEndSection, gaiaDxfWriteText,
878
+ gaiaDxfWriteLine, gaiaDxfWriteRing, gaiaDxfWriteGeometry
879
+ */
880
+ GAIAGEO_DECLARE int gaiaDxfWritePoint (gaiaDxfWriterPtr dxf,
881
+ const char *layer_name, double x,
882
+ double y, double z);
883
+
884
+ /**
885
+ Writing a DXF Text Entity
886
+
887
+ \param dxf pointer to a properly initialized gaiaDxfWriter object
888
+ \param layer_name name of the corresponding layer
889
+ \param x X coordinate value
890
+ \param y Y coordinate value
891
+ \param z Z coordinate value
892
+ \param label text string containing the label value
893
+ \param text_height height of the text in map units
894
+ \param angle text rotation angle
895
+
896
+ \return 0 on failure, any other value on success
897
+
898
+ \sa gaiaDxfWriteEntities, gaiaDxfWriteEndSection, gaiaDxfWritePoint,
899
+ gaiaDxfWriteLine, gaiaDxfWriteRing, gaiaDxfWriteGeometry
900
+ */
901
+ GAIAGEO_DECLARE int gaiaDxfWriteText (gaiaDxfWriterPtr dxf,
902
+ const char *layer_name, double x,
903
+ double y, double z,
904
+ const char *label,
905
+ double text_height, double angle);
906
+
907
+ /**
908
+ Writing a DXF Polyline (opened) Entity
909
+
910
+ \param dxf pointer to a properly initialized gaiaDxfWriter object
911
+ \param layer_name name of the corresponding layer
912
+ \param line pointer to the internal Linestring to be exported into the DXF
913
+
914
+ \return 0 on failure, any other value on success
915
+
916
+ \sa gaiaDxfWriteEntities, gaiaDxfWriteEndSection, gaiaDxfWritePoint,
917
+ gaiaDxfWriteText, gaiaDxfWriteRing, gaiaDxfWriteGeometry
918
+ */
919
+ GAIAGEO_DECLARE int
920
+ gaiaDxfWriteLine (gaiaDxfWriterPtr dxf, const char *layer_name,
921
+ gaiaLinestringPtr line);
922
+
923
+ /**
924
+ Writing a DXF Polyline (closed) Entity
925
+
926
+ \param dxf pointer to a properly initialized gaiaDxfWriter object
927
+ \param layer_name name of the corresponding layer
928
+ \param line pointer to the internal Ring to be exported into the DXF
929
+
930
+ \return 0 on failure, any other value on success
931
+
932
+ \sa gaiaDxfWriteEntities, gaiaDxfWriteEndSection, gaiaDxfWritePoint,
933
+ gaiaDxfWriteText, gaiaDxfWriteLine, gaiaDxfWriteGeometry
934
+ */
935
+ GAIAGEO_DECLARE int
936
+ gaiaDxfWriteRing (gaiaDxfWriterPtr dxf, const char *layer_name,
937
+ gaiaRingPtr ring);
938
+
939
+ /**
940
+ Writing a DXF generic Entity
941
+
942
+ \param dxf pointer to a properly initialized gaiaDxfWriter object
943
+ \param layer_name name of the corresponding layer
944
+ \param line pointer to the internal Ring to be exported into the DXF
945
+ \param label text string containing the label value (could be NULL)
946
+ \param text_height only for Text Labels: ingnored in any other case.
947
+ \param text_rotation only for Text Labels: ingnored in any other case.
948
+
949
+ \return 0 on failure, any other value on success
950
+
951
+ \sa gaiaDxfWriteEntities, gaiaDxfWriteEndSection, gaiaDxfWritePoint,
952
+ gaiaDxfWriteText, gaiaDxfWriteLine, gaiaDxfWriteRing
953
+ */
954
+ GAIAGEO_DECLARE int
955
+ gaiaDxfWriteGeometry (gaiaDxfWriterPtr dxf, const char *layer_name,
956
+ const char *label, double text_height,
957
+ double text_rotation, gaiaGeomCollPtr geometry);
958
+
959
+ /**
960
+ Exporting a complex DXF file
961
+
962
+ \param dxf pointer to a properly initialized gaiaDxfWriter object
963
+ \param db_hanlde handle to the current DB connection
964
+ \param sql a text string defining the SQL query to be used for
965
+ extracting all geometries/entities to be exported into the output DXF
966
+ \param layer_col_name name of the SQL resultset column containing the Layer name
967
+ \param geom_col_name name of the SQL resultset column containing Geometries
968
+ \param label_col_name name of the SQL resultset column containing Label values
969
+ (could be NULL)
970
+ \param text_height_col_name name of the SQL resultset column containing Text Height values
971
+ (could be NULL)
972
+ \param text_rotation_col_name name of the SQL resultset column containing Text Rotation values
973
+ (could be NULL)
974
+ \param geom_filter an optional arbitrary Geometry to be used as a Spatial Filter
975
+ (could be NULL)
976
+
977
+ \return 0 on failure; the total count of exported entities on success
978
+
979
+ \sa gaiaDxfWriterInit
980
+ */
981
+ GAIAGEO_DECLARE int
982
+ gaiaExportDxf (gaiaDxfWriterPtr dxf, sqlite3 * db_handle,
983
+ const char *sql, const char *layer_col_name,
984
+ const char *geom_col_name, const char *label_col_name,
985
+ const char *text_height_col_name,
986
+ const char *text_rotation_col_name,
987
+ gaiaGeomCollPtr geom_filter);
988
+
989
+ #ifdef __cplusplus
990
+ }
991
+ #endif
992
+
993
+ #endif /* _GG_DXF_H */