1 /*
2  gg_structs.h -- Gaia common support for geometries: structures
3 
4  version 5.0, 2020 August 1
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-2021
27 the Initial Developer. All Rights Reserved.
28 
29 Contributor(s):
30 
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_structs.h
49 
50  Geometry structures
51  */
52 
53 #ifndef _GG_STRUCTS_H
54 #ifndef DOXYGEN_SHOULD_SKIP_THIS
55 #define _GG_STRUCTS_H
56 #endif
57 
58 #include <sys/types.h>
59 #include <stdint.h>
60 
61 #ifdef __cplusplus
62 extern "C"
63 {
64 #endif
65 
66 /* supporting files bigger than 2 GB */
67 #ifdef _WIN32			/* windows */
68 #define gaia_off_t	__int64
69 #define gaia_fseek	_fseeki64
70 #else				/* not windows */
71 #define gaia_off_t	off_t
72 #define gaia_fseek	fseeko
73 #endif
74 
75 /**
76  Container for OGC POINT Geometry
77  */
78     typedef struct gaiaPointStruct
79     {
80 /* an OpenGis POINT */
81 /** X coordinate */
82 	double X;		/* X,Y coordinates */
83 /** Y coordinate */
84 	double Y;
85 /** Z coordinate: only for XYZ and XYZM dims */
86 	double Z;		/* Z coordinate */
87 /** M measure: only for XYM and XYZM dims */
88 	double M;		/* M measure */
89 /** one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M, GAIA_XY_ZM */
90 	int DimensionModel;	/* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */
91 /** pointer to next item [double linked list] */
92 	struct gaiaPointStruct *Next;	/* for double-linked list */
93 /** pointer to previous item [double linked list] */
94 	struct gaiaPointStruct *Prev;	/* for double-linked list */
95     } gaiaPoint;
96 /**
97  Typedef for OGC POINT structure
98 
99  \sa gaiaPoint
100  */
101     typedef gaiaPoint *gaiaPointPtr;
102 
103 /**
104  Container for dynamically growing line/ring
105  */
106     typedef struct gaiaDynamicLineStruct
107     {
108 /* a generic DYNAMIC LINE object */
109 /** invalid object */
110 	int Error;
111 /** the SRID */
112 	int Srid;
113 /** pointer to first POINT [double linked list] */
114 	gaiaPointPtr First;	/* Points linked list - first */
115 /** pointer to last POINT [double linked list] */
116 	gaiaPointPtr Last;	/* Points linked list - last */
117     } gaiaDynamicLine;
118 /**
119  Typedef for dynamically growing line/ring structure
120 
121  \sa gaiaDynamicLine
122  */
123     typedef gaiaDynamicLine *gaiaDynamicLinePtr;
124 
125 /**
126  Container for OGC LINESTRING Geometry
127  */
128     typedef struct gaiaLinestringStruct
129     {
130 /* an OpenGis LINESTRING */
131 /** number of points [aka vertices] */
132 	int Points;		/* number of vertices */
133 /** COORDs mem-array */
134 	double *Coords;		/* X,Y [vertices] array */
135 /** MBR: min X */
136 	double MinX;		/* MBR - BBOX */
137 /** MBR: min Y */
138 	double MinY;		/* MBR - BBOX */
139 /** MBR: max X */
140 	double MaxX;		/* MBR - BBOX */
141 /** MBR: max X */
142 	double MaxY;		/* MBR - BBOX */
143 /** one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M, GAIA_XY_ZM */
144 	int DimensionModel;	/* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */
145 /** pointer to next item [linked list] */
146 	struct gaiaLinestringStruct *Next;	/* for linked list */
147     } gaiaLinestring;
148 /**
149  Typedef for OGC LINESTRING structure
150 
151  \sa gaiaLinestring
152  */
153     typedef gaiaLinestring *gaiaLinestringPtr;
154 
155 /**
156  Container for OGC RING Geometry
157  */
158     typedef struct gaiaRingStruct
159     {
160 /* a GIS ring - OpenGis LINESTRING, closed */
161 /** number of points [aka vertices] */
162 	int Points;		/* number of vertices */
163 /** COORDs mem-array */
164 	double *Coords;		/* X,Y [vertices] array */
165 /** clockwise / counterclockwise */
166 	int Clockwise;		/* clockwise / counterclockwise */
167 /** MBR: min X */
168 	double MinX;		/* MBR - BBOX */
169 /** MBR: min Y */
170 	double MinY;		/* MBR - BBOX */
171 /** MBR: max X */
172 	double MaxX;		/* MBR - BBOX */
173 /** MBR: max Y */
174 	double MaxY;		/* MBR - BBOX */
175 /** one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M, GAIA_XY_ZM */
176 	int DimensionModel;	/* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */
177 /** pointer to next item [linked list] */
178 	struct gaiaRingStruct *Next;	/* for linked list */
179 /** pointer to belonging Polygon */
180 	struct gaiaPolygonStruct *Link;	/* polygon reference */
181     } gaiaRing;
182 /**
183  Typedef for OGC RING structure
184 
185  \sa gaiaRing
186  */
187     typedef gaiaRing *gaiaRingPtr;
188 
189 /**
190  Container for OGC POLYGON Geometry
191  */
192     typedef struct gaiaPolygonStruct
193     {
194 /* an OpenGis POLYGON */
195 /** the exterior ring (mandatory) */
196 	gaiaRingPtr Exterior;	/* exterior ring */
197 /** number of interior rings (may be, none) */
198 	int NumInteriors;	/* number of interior rings */
199 /** array of interior rings */
200 	gaiaRingPtr Interiors;	/* interior rings array */
201 /** index of first unused interior ring */
202 	int NextInterior;	/* first free interior ring */
203 /** MBR: min X */
204 	double MinX;		/* MBR - BBOX */
205 /** MBR: min Y */
206 	double MinY;		/* MBR - BBOX */
207 /** MBR: max X */
208 	double MaxX;		/* MBR - BBOX */
209 /** MBR: max Y */
210 	double MaxY;		/* MBR - BBOX */
211 /** one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M, GAIA_XY_ZM */
212 	int DimensionModel;	/* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */
213 /** pointer to next item [linked list] */
214 	struct gaiaPolygonStruct *Next;	/* for linked list */
215     } gaiaPolygon;
216 /**
217  Typedef for OGC POLYGON structure
218 
219  \sa gaiaPolygon
220  */
221     typedef gaiaPolygon *gaiaPolygonPtr;
222 
223 /**
224  Container for OGC GEOMETRYCOLLECTION Geometry
225  */
226     typedef struct gaiaGeomCollStruct
227     {
228 /* OpenGis GEOMETRYCOLLECTION */
229 /** the SRID */
230 	int Srid;		/* the SRID value for this GEOMETRY */
231 /** CPU endian arch */
232 	char endian_arch;	/* littleEndian - bigEndian arch for target CPU */
233 /** BLOB Geometry endian arch */
234 	char endian;		/* littleEndian - bigEndian */
235 /** BLOB-Geometry buffer */
236 	const unsigned char *blob;	/* WKB encoded buffer */
237 /** BLOB-Geometry buffer size (in bytes) */
238 	unsigned long size;	/* buffer size */
239 /** current offset [BLOB parsing] */
240 	unsigned long offset;	/* current offset [for parsing] */
241 /** pointer to first POINT [linked list]; may be NULL */
242 	gaiaPointPtr FirstPoint;	/* Points linked list - first */
243 /** pointer to last POINT [linked list]; may be NULL */
244 	gaiaPointPtr LastPoint;	/* Points linked list - last */
245 /** pointer to first LINESTRING [linked list]; may be NULL */
246 	gaiaLinestringPtr FirstLinestring;	/* Linestrings linked list - first */
247 /** pointer to last LINESTRING [linked list]; may be NULL */
248 	gaiaLinestringPtr LastLinestring;	/* Linestrings linked list - last */
249 /** pointer to first POLYGON [linked list]; may be NULL */
250 	gaiaPolygonPtr FirstPolygon;	/* Polygons linked list - first */
251 /** pointer to last POLYGON [linked list]; may be NULL */
252 	gaiaPolygonPtr LastPolygon;	/* Polygons linked list - last */
253 /** MBR: min X */
254 	double MinX;		/* MBR - BBOX */
255 /** MBR: min Y */
256 	double MinY;		/* MBR - BBOX */
257 /** MBR: max X */
258 	double MaxX;		/* MBR - BBOX */
259 /** MBR: max Y */
260 	double MaxY;		/* MBR - BBOX */
261 /** one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M, GAIA_XY_ZM */
262 	int DimensionModel;	/* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */
263 /** any valid Geometry Class type */
264 	int DeclaredType;	/* the declared TYPE for this Geometry */
265 /** pointer to next item [linked list] */
266 	struct gaiaGeomCollStruct *Next;	/* Vanuatu - used for linked list */
267     } gaiaGeomColl;
268 /**
269  Typedef for OGC GEOMETRYCOLLECTION structure
270 
271  \sa gaiaGeomCool
272  */
273     typedef gaiaGeomColl *gaiaGeomCollPtr;
274 
275 /**
276  Container similar to LINESTRING [internally used]
277  */
278     typedef struct gaiaPreRingStruct
279     {
280 /* a LINESTRING used to build rings */
281 /** pointer to LINESTRING */
282 	gaiaLinestringPtr Line;	/* a LINESTRING pointer */
283 /** already used/visited item */
284 	int AlreadyUsed;	/* a switch to mark an already used line element */
285 /** pointer to next item [linked list] */
286 	struct gaiaPreRingStruct *Next;	/* for linked list */
287     } gaiaPreRing;
288 /**
289  Typedef for gaiaPreRing structure
290 
291  \sa gaiaPreRing
292  */
293     typedef gaiaPreRing *gaiaPreRingPtr;
294 
295 /**
296  Container for variant (multi-type) value
297  */
298     typedef struct gaiaValueStruct
299     {
300 /* a DBF field multitype value */
301 /** data type: one of GAIA_NULL_VALUE, GAIA_INT_VALUE, GAIA_DOUBLE_VALUE, GAIA_TEXT_VALUE */
302 	short Type;		/* the type */
303 /** TEXT type value */
304 	char *TxtValue;		/* the text value */
305 /** INT type value */
306 	sqlite3_int64 IntValue;	/* the integer value */
307 /** DOUBLE type value */
308 	double DblValue;	/* the double value */
309     } gaiaValue;
310 /**
311  Typedef for variant (multi-type) value structure
312  */
313     typedef gaiaValue *gaiaValuePtr;
314 
315 /**
316  Container for DBF field
317  */
318     typedef struct gaiaDbfFieldStruct
319     {
320 /* a DBF field definition - shapefile attribute */
321 /** field name */
322 	char *Name;		/* field name */
323 /** DBF data type */
324 	unsigned char Type;	/* field type */
325 /** DBF buffer offset [where the field value starts] */
326 	int Offset;		/* buffer offset [this field begins at *buffer+offset* and extends for *length* bytes */
327 /** total DBF buffer field length (in bytes) */
328 	unsigned char Length;	/* field total length [in bytes] */
329 /** precision (decimal digits) */
330 	unsigned char Decimals;	/* decimal positions */
331 /** current variant [multi-type] value */
332 	gaiaValuePtr Value;	/* the current multitype value for this attribute */
333 /** pointer to next item [linked list] */
334 	struct gaiaDbfFieldStruct *Next;	/* pointer to next element in linked list */
335     } gaiaDbfField;
336 /**
337  Typedef for DBF field structure
338  */
339     typedef gaiaDbfField *gaiaDbfFieldPtr;
340 
341 /**
342  Container for a list of DBF fields
343  */
344     typedef struct gaiaDbfListStruct
345     {
346 /* a linked list to contain the DBF fields definitions - shapefile attributes */
347 /** current RowID */
348 	int RowId;		/* the current RowId */
349 /** current Geometry */
350 	gaiaGeomCollPtr Geometry;	/* geometry for current entity */
351 /** pointer to first DBF field [linked list] */
352 	gaiaDbfFieldPtr First;	/* pointer to first element in linked list */
353 /** pointer to last DBF field [linked list] */
354 	gaiaDbfFieldPtr Last;	/* pointer to last element in linker list */
355     } gaiaDbfList;
356 /**
357  Typedef for a list of DBF fields
358 
359  \sa gaiaDbfList
360  */
361     typedef gaiaDbfList *gaiaDbfListPtr;
362 
363 /**
364  A Memory based File
365  */
366     typedef struct gaiaMemFileStruct
367     {
368 /* Memory File Type */
369 	char *path;
370 	void *buf;
371 	uint64_t size;
372 	uint64_t offset;
373     } gaiaMemFile;
374 /**
375  Typedef for Memory File structure
376 
377  \sa gaiaMemFile
378  */
379     typedef gaiaMemFile *gaiaMemFilePtr;
380 
381 /**
382  Container for DBF file handling
383  */
384     typedef struct gaiaDbfStruct
385     {
386 /* DBF TYPE */
387 /** DBF endian arch */
388 	int endian_arch;
389 /** validity flag: 1 = ready to be processed */
390 	int Valid;		/* 1 = ready to process */
391 /** DBF file pathname */
392 	char *Path;		/* the DBF path */
393 /** FILE handle */
394 	FILE *flDbf;		/* the DBF file handle */
395 /** Memory based DBF file */
396 	gaiaMemFilePtr memDbf;	/* the DBF memory file */
397 /** list of DBF fields */
398 	gaiaDbfListPtr Dbf;	/* the DBF attributes list */
399 /** I/O buffer */
400 	unsigned char *BufDbf;	/* the DBF I/O buffer */
401 /** header size (in bytes) */
402 	int DbfHdsz;		/* the DBF header length */
403 /** record length (in bytes) */
404 	int DbfReclen;		/* the DBF record length */
405 /** current file size */
406 	int DbfSize;		/* current DBF size */
407 /** current Record Number */
408 	int DbfRecno;		/* current DBF record number */
409 /** handle to ICONV converter object */
410 	void *IconvObj;		/* opaque reference to ICONV converter */
411 /** last error message (may be NULL) */
412 	char *LastError;	/* last error message */
413     } gaiaDbf;
414 /**
415  Typedef for DBF file handler structure
416 
417  \sa gaiaDbf
418  */
419     typedef gaiaDbf *gaiaDbfPtr;
420 
421 /**
422  Container for SHP file handling
423  */
424     typedef struct gaiaShapefileStruct
425     {
426 /* SHAPEFILE TYPE */
427 /** SHP endian arch */
428 	int endian_arch;
429 /** validity flag: 1 = ready to be processed */
430 	int Valid;		/* 1 = ready to process */
431 /** read or write mode */
432 	int ReadOnly;		/* read or write mode */
433 /** SHP 'abstract' path (no suffixes) */
434 	char *Path;		/* the shapefile abstract path [no suffixes] */
435 /** FILE handle to SHX file */
436 	FILE *flShx;		/* the SHX file handle */
437 /** FILE handle to SHP file */
438 	FILE *flShp;		/* the SHP file handle */
439 /** FILE handle to DBF file */
440 	FILE *flDbf;		/* the DBF file handle */
441 /** Memory based SHX file */
442 	gaiaMemFilePtr memShx;	/* the SHX memory file */
443 /** Memory based SHP file */
444 	gaiaMemFilePtr memShp;	/* the SHP memory file */
445 /** Memory based DBF file */
446 	gaiaMemFilePtr memDbf;	/* the DBF memory file */
447 /** the SHP shape code */
448 	int Shape;		/* the SHAPE code for the whole shapefile */
449 /** list of DBF fields */
450 	gaiaDbfListPtr Dbf;	/* the DBF attributes list */
451 /** DBF I/O buffer */
452 	unsigned char *BufDbf;	/* the DBF I/O buffer */
453 /** DBF header size (in bytes) */
454 	int DbfHdsz;		/* the DBF header length */
455 /** DBF record length (in bytes) */
456 	int DbfReclen;		/* the DBF record length */
457 /** DBF current file size (in bytes) */
458 	int DbfSize;		/* current DBF size */
459 /** DBF current Record Number */
460 	int DbfRecno;		/* current DBF record number */
461 /** SHP I/O buffer */
462 	unsigned char *BufShp;	/* the SHP I/O buffer */
463 /** SHP current buffer size (in bytes) */
464 	int ShpBfsz;		/* the SHP buffer current size */
465 /** SHP current file size */
466 	int ShpSize;		/* current SHP size */
467 /** SHX current file size */
468 	int ShxSize;		/* current SHX size */
469 /** Total Extent: min X */
470 	double MinX;		/* the MBR/BBOX for the whole shapefile */
471 /** Total Extent: min Y */
472 	double MinY;
473 /** Total Extent: max X */
474 	double MaxX;
475 /** Total Extent: max Y */
476 	double MaxY;
477 /** handle to ICONV converter object */
478 	void *IconvObj;		/* opaque reference to ICONV converter */
479 /** last error message (may be NULL) */
480 	char *LastError;	/* last error message */
481 /** SHP actual OGC Geometry type */
482 	int EffectiveType;	/* the effective Geometry-type, as determined by gaiaShpAnalyze() */
483 /** SHP actual dims: one of GAIA_XY, GAIA_XY_Z, GAIA_XY_M, GAIA_XY_ZM */
484 	int EffectiveDims;	/* the effective Dimensions [XY, XYZ, XYM, XYZM], as determined by gaiaShpAnalyze() */
485     } gaiaShapefile;
486 /**
487  Typedef for SHP file handler structure
488 
489  \sa gaiaShapefile
490  */
491     typedef gaiaShapefile *gaiaShapefilePtr;
492 
493 /**
494  Container for dynamically growing output buffer
495  */
496     typedef struct gaiaOutBufferStruct
497     {
498 /* a struct handling a dynamically growing output buffer */
499 /** current buffer */
500 	char *Buffer;
501 /** current write offset */
502 	int WriteOffset;
503 /** current buffer size (in bytes) */
504 	int BufferSize;
505 /** validity flag */
506 	int Error;
507     } gaiaOutBuffer;
508 /**
509  Typedef for dynamically growing output buffer structure
510 
511  \sa gaiaOutBuffer
512  */
513     typedef gaiaOutBuffer *gaiaOutBufferPtr;
514 
515 #ifndef OMIT_ICONV		/* ICONV enabled: supporting text reader */
516 
517 /** Virtual Text driver: MAX number of fields */
518 #define VRTTXT_FIELDS_MAX	65535
519 /** Virtual Text driver: MAX block size (in bytes) */
520 #define VRTTXT_BLOCK_MAX 65535
521 
522 /** Virtual Text driver: TEXT value */
523 #define VRTTXT_TEXT		1
524 /** Virtual Text driver: INTEGER value */
525 #define VRTTXT_INTEGER	2
526 /** Virtual Text driver: DOUBLE value */
527 #define VRTTXT_DOUBLE	3
528 /** Virtual Text driver: NULL value */
529 #define VRTTXT_NULL	4
530 
531 /**
532  Container for Virtual Text record (line)
533  */
534     struct vrttxt_line
535     {
536 /* a struct representing a full LINE (aka Record) */
537 /** current offset (parsing) */
538 	gaia_off_t offset;
539 /** line length (in bytes) */
540 	int len;
541 /** array of field offsets (where each field starts) */
542 	int field_offsets[VRTTXT_FIELDS_MAX];
543 /** number of field into the record */
544 	int num_fields;
545 /** validity flag */
546 	int error;
547     };
548 
549 /**
550  Container for Virtual Text record (line) offsets
551  */
552     struct vrttxt_row
553     {
554 /* a struct storing Row offsets */
555 /** Line Number */
556 	int line_no;
557 /** start offset */
558 	gaia_off_t offset;
559 /** record (line) length (in bytes) */
560 	int len;
561 /** number of fields into this record */
562 	int num_fields;
563     };
564 
565 /**
566  Container for Virtual Text block of records
567  */
568     struct vrttxt_row_block
569     {
570 /*
571 / for efficiency sake, individual Row offsets
572 / are grouped in reasonably sized blocks
573 */
574 /** array of records [lines] */
575 	struct vrttxt_row rows[VRTTXT_BLOCK_MAX];
576 /** number of records into the array */
577 	int num_rows;
578 /** min Line Number */
579 	int min_line_no;
580 /** max Line Number */
581 	int max_line_no;
582 /** pointer to next item [linked list] */
583 	struct vrttxt_row_block *next;
584     };
585 
586 /**
587  Container for Virtual Text column (field) header
588  */
589     struct vrttxt_column_header
590     {
591 /* a struct representing a Column (aka Field) header */
592 /** column name */
593 	char *name;
594 /** data type: one of GAIA_NULL_VALUE, GAIA_INT_VALUE, GAIA_DOUBLE_VALUE, GAIA_TEXT_VALUE */
595 	int type;
596     };
597 
598 /**
599  Container for Virtual Text file handling
600  */
601     typedef struct vrttxt_reader
602     {
603 /* the main TXT-Reader struct */
604 /** array of columns (fields) */
605 	struct vrttxt_column_header columns[VRTTXT_FIELDS_MAX];
606 /** FILE handle */
607 	FILE *text_file;
608 /** handle to ICONV converter object */
609 	void *toUtf8;		/* the UTF-8 ICONV converter */
610 /** field separator character */
611 	char field_separator;
612 /** text separator character (quote) */
613 	char text_separator;
614 /** decimal separator */
615 	char decimal_separator;
616 /** TRUE if the first line contains column names */
617 	int first_line_titles;
618 /** validity flag */
619 	int error;
620 /** pointer to first block of records [linked list] */
621 	struct vrttxt_row_block *first;
622 /** pointer to last block of records [linked list] */
623 	struct vrttxt_row_block *last;
624 /** array of pointers to individual records [lines] */
625 	struct vrttxt_row **rows;
626 /** number of records */
627 	int num_rows;
628 /** current Line Number */
629 	int line_no;
630 /** max number of columns (fields) */
631 	int max_fields;
632 /** current buffer size */
633 	int current_buf_sz;
634 /** current buffer offset [parsing] */
635 	int current_buf_off;
636 /** I/O buffer */
637 	char *line_buffer;
638 /** current field buffer */
639 	char *field_buffer;
640 /** array of field offsets [current record] */
641 	int field_offsets[VRTTXT_FIELDS_MAX];
642 /** array of field lengths [current record] */
643 	int field_lens[VRTTXT_FIELDS_MAX];
644 /** max field [current record] */
645 	int max_current_field;
646 /** current record [line] ready for parsing */
647 	int current_line_ready;
648     } gaiaTextReader;
649 /**
650  Typedef for Virtual Text file handling structure
651 
652  \sa gaiaTextReader
653  */
654     typedef gaiaTextReader *gaiaTextReaderPtr;
655 
656 #endif				/* end ICONV (text reader) */
657 
658 /**
659  Layer Extent infos
660  */
661     typedef struct gaiaLayerExtentInfos
662     {
663 /** row count (aka feature count) */
664 	int Count;
665 /** Extent: min X */
666 	double MinX;		/* MBR - BBOX */
667 /** Extent: min Y */
668 	double MinY;		/* MBR - BBOX */
669 /** Extent: max X */
670 	double MaxX;		/* MBR - BBOX */
671 /** Extent: max Y */
672 	double MaxY;		/* MBR - BBOX */
673     } gaiaLayerExtent;
674 
675 /**
676  Typedef for Layer Extent infos
677 
678  \sa gaiaLayerExtent
679  */
680     typedef gaiaLayerExtent *gaiaLayerExtentPtr;
681 
682 /**
683  Layer Auth infos
684  */
685     typedef struct gaiaLayerAuthInfos
686     {
687 /** Read-Only layer: TRUE or FALSE */
688 	int IsReadOnly;
689 /** Hidden layer: TRUE or FALSE */
690 	int IsHidden;
691 /** Flag indicating if the Capabilities of the SpatialView supports Inserting: TRUE or FALSE */
692 	int HasTriggerInsert;
693 /** Flag indicating if the Capabilities of the SpatialView supports Updating: TRUE or FALSE */
694 	int HasTriggerUpdate;
695 /** Flag indicating if the Capabilities of the SpatialView supports Deleting: TRUE or FALSE */
696 	int HasTriggerDelete;
697     } gaiaLayerAuth;
698 
699 /**
700  Typedef for Layer Auth infos
701 
702  \sa gaiaLayerAuth
703  */
704     typedef gaiaLayerAuth *gaiaLayerAuthPtr;
705 
706 /**
707  Attribute/Field MaxSize/Length infos
708  */
709     typedef struct gaiaAttributeFieldMaxSizeInfos
710     {
711 /** MaxSize / MaxLength */
712 	int MaxSize;
713     } gaiaAttributeFieldMaxSize;
714 
715 /**
716  Typedef for Attribute/Field MaxSize/Length infos
717 
718  \sa gaiaAttributeFieldMaxSize
719  */
720     typedef gaiaAttributeFieldMaxSize *gaiaAttributeFieldMaxSizePtr;
721 
722 /**
723  Attribute/Field Integer range infos
724  */
725     typedef struct gaiaAttributeFieldIntRangeInfos
726     {
727 /** Minimum value */
728 	sqlite3_int64 MinValue;
729 /** Maximum value */
730 	sqlite3_int64 MaxValue;
731     } gaiaAttributeFieldIntRange;
732 
733 /**
734  Typedef for Attribute/Field Integer range infos
735 
736  \sa gaiaAttributeFieldIntRange
737  */
738     typedef gaiaAttributeFieldIntRange *gaiaAttributeFieldIntRangePtr;
739 
740 /**
741  Attribute/Field Double range infos
742  */
743     typedef struct gaiaAttributeFieldDoubleRangeInfos
744     {
745 /** Minimum value */
746 	double MinValue;
747 /** Maximum value */
748 	double MaxValue;
749     } gaiaAttributeFieldDoubleRange;
750 
751 /**
752  Typedef for Attribute/Field Double range infos
753 
754  \sa gaiaAttributeFieldDoubleRange
755  */
756     typedef gaiaAttributeFieldDoubleRange *gaiaAttributeFieldDoubleRangePtr;
757 
758 /**
759  LayerAttributeField infos
760  */
761     typedef struct gaiaLayerAttributeFieldInfos
762     {
763 /** ordinal position */
764 	int Ordinal;
765 /** SQL name of the corresponding column */
766 	char *AttributeFieldName;
767 /** total count of NULL values */
768 	int NullValuesCount;
769 /** total count of INTEGER values */
770 	int IntegerValuesCount;
771 /** total count of DOUBLE values */
772 	int DoubleValuesCount;
773 /** total count of TEXT values */
774 	int TextValuesCount;
775 /** total count of BLOB values */
776 	int BlobValuesCount;
777 /** pointer to MaxSize/Length infos (may be NULL) */
778 	gaiaAttributeFieldMaxSizePtr MaxSize;
779 /** pointer to range of Integer values infos (may be NULL) */
780 	gaiaAttributeFieldIntRangePtr IntRange;
781 /** pointer to range of Double values infos (may be NULL) */
782 	gaiaAttributeFieldDoubleRangePtr DoubleRange;
783 /** pointer to next item (linked list) */
784 	struct gaiaLayerAttributeFieldInfos *Next;
785     } gaiaLayerAttributeField;
786 
787 /**
788  Typedef for Layer AttributeField infos
789 
790  \sa gaiaLayerAttributeField
791  */
792     typedef gaiaLayerAttributeField *gaiaLayerAttributeFieldPtr;
793 
794 /**
795  Vector Layer item
796  */
797     typedef struct gaiaVectorLayerItem
798     {
799 /** one of GAIA_VECTOR_UNKNOWN, GAIA_VECTOR_TABLE, GAIA_VECTOR_VIEW,
800     GAIA_VECTOR_VIRTUAL */
801 	int LayerType;
802 /** SQL name of the corresponding table */
803 	char *TableName;
804 /** SQL name of the corresponding Geometry column */
805 	char *GeometryName;
806 /** SRID value */
807 	int Srid;
808 /** one of GAIA_VECTOR_UNKNOWN, GAIA_VECTOR_POINT, GAIA_VECTOR_LINESTRING,
809     GAIA_VECTOR_POLYGON, GAIA_VECTOR_MULTIPOINT, GAIA_VECTOR_MULTILINESTRING,
810     GAIA_VECTOR_MULTIPOLYGON, GAIA_VECTOR_GEOMETRYCOLLECTION, GAIA_VECTOR_GEOMETRY
811 */
812 	int GeometryType;
813 /** one of GAIA_VECTOR_UNKNOWN, GAIA_XY, GAIA_XY_Z, GAIA_XY_M, GAIA_XY_ZM */
814 	int Dimensions;
815 /** one of GAIA_VECTOR_UNKNOWN, GAIA_SPATIAL_INDEX_NONE, GAIA_SPATIAL_INDEX_RTREE,
816     GAIA_SPATIAL_INDEX_MBRCACHE
817 */
818 	int SpatialIndex;
819 /** pointer to Extent infos (may be NULL) */
820 	gaiaLayerExtentPtr ExtentInfos;
821 /** pointer to Auth infos (may be NULL) */
822 	gaiaLayerAuthPtr AuthInfos;
823 /** pointer to first Field/Attribute (linked list) */
824 	gaiaLayerAttributeFieldPtr First;
825 /** pointer to last Field/Attribute (linked list) */
826 	gaiaLayerAttributeFieldPtr Last;
827 /** pointer to next item (linked list) */
828 	struct gaiaVectorLayerItem *Next;
829     } gaiaVectorLayer;
830 
831 /**
832  Typedef for Vector Layer item
833 
834  \sa gaiaVectorLayer
835  */
836     typedef gaiaVectorLayer *gaiaVectorLayerPtr;
837 
838 /**
839  Container for Vector Layers List
840  */
841     typedef struct gaiaVectorLayersListStr
842     {
843 /** pointer to first vector layer (linked list) */
844 	gaiaVectorLayerPtr First;
845 /** pointer to last vector layer (linked list) */
846 	gaiaVectorLayerPtr Last;
847 /** pointer to currently set vector layer */
848 	gaiaVectorLayerPtr Current;
849     } gaiaVectorLayersList;
850 
851 /**
852  Typedef for Vector Layers List
853 
854  \sa gaiaVectorLayersList
855  */
856     typedef gaiaVectorLayersList *gaiaVectorLayersListPtr;
857 
858 /**
859  BBOX corresponding to PROJ.6 AREA
860  */
861     typedef struct gaiaProjAreaStr
862     {
863 	double WestLongitude;
864 	double SouthLatitude;
865 	double EastLongitude;
866 	double NorthLatitude;
867     } gaiaProjArea;
868 
869 /**
870  Typedef for BBOX corresponding to PROJ.6 AREA
871 
872  \sa gaiaProjArea
873  */
874     typedef gaiaProjArea *gaiaProjAreaPtr;
875 
876 #ifdef __cplusplus
877 }
878 #endif
879 
880 #endif				/* _GG_STRUCTS_H */
881