SpatiaLite
4.0.0
Main Page
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Macros
Pages
src
headers
spatialite
gg_structs.h
Go to the documentation of this file.
1
/*
2
gg_structs.h -- Gaia common support for geometries: structures
3
4
version 4.0, 2012 August 6
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-2012
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
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
60
#ifdef __cplusplus
61
extern
"C"
62
{
63
#endif
64
68
typedef
struct
gaiaPointStruct
69
{
70
/* an OpenGis POINT */
72
double
X
;
/* X,Y coordinates */
74
double
Y
;
76
double
Z
;
/* Z coordinate */
78
double
M
;
/* M measure */
80
int
DimensionModel
;
/* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */
82
struct
gaiaPointStruct
*
Next
;
/* for double-linked list */
84
struct
gaiaPointStruct
*
Prev
;
/* for double-linked list */
85
}
gaiaPoint
;
91
typedef
gaiaPoint
*
gaiaPointPtr
;
92
96
typedef
struct
gaiaDynamicLineStruct
97
{
98
/* a generic DYNAMIC LINE object */
100
int
Error
;
102
int
Srid
;
104
gaiaPointPtr
First
;
/* Points linked list - first */
106
gaiaPointPtr
Last
;
/* Points linked list - last */
107
}
gaiaDynamicLine
;
113
typedef
gaiaDynamicLine
*
gaiaDynamicLinePtr
;
114
118
typedef
struct
gaiaLinestringStruct
119
{
120
/* an OpenGis LINESTRING */
122
int
Points
;
/* number of vertices */
124
double
*
Coords
;
/* X,Y [vertices] array */
126
double
MinX
;
/* MBR - BBOX */
128
double
MinY
;
/* MBR - BBOX */
130
double
MaxX
;
/* MBR - BBOX */
132
double
MaxY
;
/* MBR - BBOX */
134
int
DimensionModel
;
/* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */
136
struct
gaiaLinestringStruct
*
Next
;
/* for linked list */
137
}
gaiaLinestring
;
143
typedef
gaiaLinestring
*
gaiaLinestringPtr
;
144
148
typedef
struct
gaiaRingStruct
149
{
150
/* a GIS ring - OpenGis LINESTRING, closed */
152
int
Points
;
/* number of vertices */
154
double
*
Coords
;
/* X,Y [vertices] array */
156
int
Clockwise
;
/* clockwise / counterclockwise */
158
double
MinX
;
/* MBR - BBOX */
160
double
MinY
;
/* MBR - BBOX */
162
double
MaxX
;
/* MBR - BBOX */
164
double
MaxY
;
/* MBR - BBOX */
166
int
DimensionModel
;
/* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */
168
struct
gaiaRingStruct
*
Next
;
/* for linked list */
170
struct
gaiaPolygonStruct
*
Link
;
/* polygon reference */
171
}
gaiaRing
;
177
typedef
gaiaRing
*
gaiaRingPtr
;
178
182
typedef
struct
gaiaPolygonStruct
183
{
184
/* an OpenGis POLYGON */
186
gaiaRingPtr
Exterior
;
/* exterior ring */
188
int
NumInteriors
;
/* number of interior rings */
190
gaiaRingPtr
Interiors
;
/* interior rings array */
192
int
NextInterior
;
/* first free interior ring */
194
double
MinX
;
/* MBR - BBOX */
196
double
MinY
;
/* MBR - BBOX */
198
double
MaxX
;
/* MBR - BBOX */
200
double
MaxY
;
/* MBR - BBOX */
202
int
DimensionModel
;
/* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */
204
struct
gaiaPolygonStruct
*
Next
;
/* for linked list */
205
}
gaiaPolygon
;
211
typedef
gaiaPolygon
*
gaiaPolygonPtr
;
212
216
typedef
struct
gaiaGeomCollStruct
217
{
218
/* OpenGis GEOMETRYCOLLECTION */
220
int
Srid
;
/* the SRID value for this GEOMETRY */
222
char
endian_arch
;
/* littleEndian - bigEndian arch for target CPU */
224
char
endian
;
/* littleEndian - bigEndian */
226
const
unsigned
char
*
blob
;
/* WKB encoded buffer */
228
unsigned
long
size
;
/* buffer size */
230
unsigned
long
offset
;
/* current offset [for parsing] */
232
gaiaPointPtr
FirstPoint
;
/* Points linked list - first */
234
gaiaPointPtr
LastPoint
;
/* Points linked list - last */
236
gaiaLinestringPtr
FirstLinestring
;
/* Linestrings linked list - first */
238
gaiaLinestringPtr
LastLinestring
;
/* Linestrings linked list - last */
240
gaiaPolygonPtr
FirstPolygon
;
/* Polygons linked list - first */
242
gaiaPolygonPtr
LastPolygon
;
/* Polygons linked list - last */
244
double
MinX
;
/* MBR - BBOX */
246
double
MinY
;
/* MBR - BBOX */
248
double
MaxX
;
/* MBR - BBOX */
250
double
MaxY
;
/* MBR - BBOX */
252
int
DimensionModel
;
/* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */
254
int
DeclaredType
;
/* the declared TYPE for this Geometry */
256
struct
gaiaGeomCollStruct
*
Next
;
/* Vanuatu - used for linked list */
257
}
gaiaGeomColl
;
263
typedef
gaiaGeomColl
*
gaiaGeomCollPtr
;
264
268
typedef
struct
gaiaPreRingStruct
269
{
270
/* a LINESTRING used to build rings */
272
gaiaLinestringPtr
Line
;
/* a LINESTRING pointer */
274
int
AlreadyUsed
;
/* a switch to mark an already used line element */
276
struct
gaiaPreRingStruct
*
Next
;
/* for linked list */
277
}
gaiaPreRing
;
283
typedef
gaiaPreRing
*
gaiaPreRingPtr
;
284
288
typedef
struct
gaiaValueStruct
289
{
290
/* a DBF field multitype value */
292
short
Type
;
/* the type */
294
char
*
TxtValue
;
/* the text value */
296
sqlite3_int64
IntValue
;
/* the integer value */
298
double
DblValue
;
/* the double value */
299
}
gaiaValue
;
303
typedef
gaiaValue
*
gaiaValuePtr
;
304
308
typedef
struct
gaiaDbfFieldStruct
309
{
310
/* a DBF field definition - shapefile attribute */
312
char
*
Name
;
/* field name */
314
unsigned
char
Type
;
/* field type */
316
int
Offset
;
/* buffer offset [this field begins at *buffer+offset* and extends for *length* bytes */
318
unsigned
char
Length
;
/* field total length [in bytes] */
320
unsigned
char
Decimals
;
/* decimal positions */
322
gaiaValuePtr
Value
;
/* the current multitype value for this attribute */
324
struct
gaiaDbfFieldStruct
*
Next
;
/* pointer to next element in linked list */
325
}
gaiaDbfField
;
329
typedef
gaiaDbfField
*
gaiaDbfFieldPtr
;
330
334
typedef
struct
gaiaDbfListStruct
335
{
336
/* a linked list to contain the DBF fields definitions - shapefile attributes */
338
int
RowId
;
/* the current RowId */
340
gaiaGeomCollPtr
Geometry
;
/* geometry for current entity */
342
gaiaDbfFieldPtr
First
;
/* pointer to first element in linked list */
344
gaiaDbfFieldPtr
Last
;
/* pointer to last element in linker list */
345
}
gaiaDbfList
;
351
typedef
gaiaDbfList
*
gaiaDbfListPtr
;
352
356
typedef
struct
gaiaDbfStruct
357
{
358
/* DBF TYPE */
360
int
endian_arch
;
362
int
Valid
;
/* 1 = ready to process */
364
char
*
Path
;
/* the DBF path */
366
FILE *
flDbf
;
/* the DBF file handle */
368
gaiaDbfListPtr
Dbf
;
/* the DBF attributes list */
370
unsigned
char
*
BufDbf
;
/* the DBF I/O buffer */
372
int
DbfHdsz
;
/* the DBF header length */
374
int
DbfReclen
;
/* the DBF record length */
376
int
DbfSize
;
/* current DBF size */
378
int
DbfRecno
;
/* current DBF record number */
380
void
*
IconvObj
;
/* opaque reference to ICONV converter */
382
char
*
LastError
;
/* last error message */
383
}
gaiaDbf
;
389
typedef
gaiaDbf
*
gaiaDbfPtr
;
390
394
typedef
struct
gaiaShapefileStruct
395
{
396
/* SHAPEFILE TYPE */
398
int
endian_arch
;
400
int
Valid
;
/* 1 = ready to process */
402
int
ReadOnly
;
/* read or write mode */
404
char
*
Path
;
/* the shapefile abstract path [no suffixes] */
406
FILE *
flShx
;
/* the SHX file handle */
408
FILE *
flShp
;
/* the SHP file handle */
410
FILE *
flDbf
;
/* the DBF file handle */
412
int
Shape
;
/* the SHAPE code for the whole shapefile */
414
gaiaDbfListPtr
Dbf
;
/* the DBF attributes list */
416
unsigned
char
*
BufDbf
;
/* the DBF I/O buffer */
418
int
DbfHdsz
;
/* the DBF header length */
420
int
DbfReclen
;
/* the DBF record length */
422
int
DbfSize
;
/* current DBF size */
424
int
DbfRecno
;
/* current DBF record number */
426
unsigned
char
*
BufShp
;
/* the SHP I/O buffer */
428
int
ShpBfsz
;
/* the SHP buffer current size */
430
int
ShpSize
;
/* current SHP size */
432
int
ShxSize
;
/* current SHX size */
434
double
MinX
;
/* the MBR/BBOX for the whole shapefile */
436
double
MinY
;
438
double
MaxX
;
440
double
MaxY
;
442
void
*
IconvObj
;
/* opaque reference to ICONV converter */
444
char
*
LastError
;
/* last error message */
446
int
EffectiveType
;
/* the effective Geometry-type, as determined by gaiaShpAnalyze() */
448
int
EffectiveDims
;
/* the effective Dimensions [XY, XYZ, XYM, XYZM], as determined by gaiaShpAnalyze() */
449
}
gaiaShapefile
;
455
typedef
gaiaShapefile
*
gaiaShapefilePtr
;
456
460
typedef
struct
gaiaOutBufferStruct
461
{
462
/* a struct handling a dynamically growing output buffer */
464
char
*
Buffer
;
466
int
WriteOffset
;
468
int
BufferSize
;
470
int
Error
;
471
}
gaiaOutBuffer
;
477
typedef
gaiaOutBuffer
*
gaiaOutBufferPtr
;
478
479
#ifndef OMIT_ICONV
/* ICONV enabled: supporting text reader */
480
482
#define VRTTXT_FIELDS_MAX 65535
483
484
#define VRTTXT_BLOCK_MAX 65535
485
487
#define VRTTXT_TEXT 1
488
489
#define VRTTXT_INTEGER 2
490
491
#define VRTTXT_DOUBLE 3
492
493
#define VRTTXT_NULL 4
494
498
struct
vrttxt_line
499
{
500
/* a struct representing a full LINE (aka Record) */
502
off_t
offset
;
504
int
len
;
506
int
field_offsets
[
VRTTXT_FIELDS_MAX
];
508
int
num_fields
;
510
int
error
;
511
};
512
516
struct
vrttxt_row
517
{
518
/* a struct storing Row offsets */
520
int
line_no
;
522
off_t
offset
;
524
int
len
;
526
int
num_fields
;
527
};
528
532
struct
vrttxt_row_block
533
{
534
/*
535
/ for efficiency sake, individual Row offsets
536
/ are grouped in reasonably sized blocks
537
*/
539
struct
vrttxt_row
rows
[
VRTTXT_BLOCK_MAX
];
541
int
num_rows
;
543
int
min_line_no
;
545
int
max_line_no
;
547
struct
vrttxt_row_block
*
next
;
548
};
549
553
struct
vrttxt_column_header
554
{
555
/* a struct representing a Column (aka Field) header */
557
char
*
name
;
559
int
type
;
560
};
561
565
typedef
struct
vrttxt_reader
566
{
567
/* the main TXT-Reader struct */
569
struct
vrttxt_column_header
columns
[
VRTTXT_FIELDS_MAX
];
571
FILE *
text_file
;
573
void
*
toUtf8
;
/* the UTF-8 ICONV converter */
575
char
field_separator
;
577
char
text_separator
;
579
char
decimal_separator
;
581
int
first_line_titles
;
583
int
error
;
585
struct
vrttxt_row_block
*
first
;
587
struct
vrttxt_row_block
*
last
;
589
struct
vrttxt_row
**
rows
;
591
int
num_rows
;
593
int
line_no
;
595
int
max_fields
;
597
int
current_buf_sz
;
599
int
current_buf_off
;
601
char
*
line_buffer
;
603
char
*
field_buffer
;
605
int
field_offsets
[
VRTTXT_FIELDS_MAX
];
607
int
field_lens
[
VRTTXT_FIELDS_MAX
];
609
int
max_current_field
;
611
int
current_line_ready
;
612
}
gaiaTextReader
;
618
typedef
gaiaTextReader
*
gaiaTextReaderPtr
;
619
620
#endif
/* end ICONV (text reader) */
621
625
typedef
struct
gaiaLayerExtentInfos
626
{
628
int
Count
;
630
double
MinX
;
/* MBR - BBOX */
632
double
MinY
;
/* MBR - BBOX */
634
double
MaxX
;
/* MBR - BBOX */
636
double
MaxY
;
/* MBR - BBOX */
637
}
gaiaLayerExtent
;
638
644
typedef
gaiaLayerExtent
*
gaiaLayerExtentPtr
;
645
649
typedef
struct
gaiaLayerAuthInfos
650
{
652
int
IsReadOnly
;
654
int
IsHidden
;
655
}
gaiaLayerAuth
;
656
662
typedef
gaiaLayerAuth
*
gaiaLayerAuthPtr
;
663
667
typedef
struct
gaiaAttributeFieldMaxSizeInfos
668
{
670
int
MaxSize
;
671
}
gaiaAttributeFieldMaxSize
;
672
678
typedef
gaiaAttributeFieldMaxSize
*
gaiaAttributeFieldMaxSizePtr
;
679
683
typedef
struct
gaiaAttributeFieldIntRangeInfos
684
{
686
sqlite3_int64
MinValue
;
688
sqlite3_int64
MaxValue
;
689
}
gaiaAttributeFieldIntRange
;
690
696
typedef
gaiaAttributeFieldIntRange
*
gaiaAttributeFieldIntRangePtr
;
697
701
typedef
struct
gaiaAttributeFieldDoubleRangeInfos
702
{
704
double
MinValue
;
706
double
MaxValue
;
707
}
gaiaAttributeFieldDoubleRange
;
708
714
typedef
gaiaAttributeFieldDoubleRange
*
gaiaAttributeFieldDoubleRangePtr
;
715
719
typedef
struct
gaiaLayerAttributeFieldInfos
720
{
722
int
Ordinal
;
724
char
*
AttributeFieldName
;
726
int
NullValuesCount
;
728
int
IntegerValuesCount
;
730
int
DoubleValuesCount
;
732
int
TextValuesCount
;
734
int
BlobValuesCount
;
736
gaiaAttributeFieldMaxSizePtr
MaxSize
;
738
gaiaAttributeFieldIntRangePtr
IntRange
;
740
gaiaAttributeFieldDoubleRangePtr
DoubleRange
;
742
struct
gaiaLayerAttributeFieldInfos
*
Next
;
743
}
gaiaLayerAttributeField
;
744
750
typedef
gaiaLayerAttributeField
*
gaiaLayerAttributeFieldPtr
;
751
755
typedef
struct
gaiaVectorLayerItem
756
{
759
int
LayerType
;
761
char
*
TableName
;
763
char
*
GeometryName
;
765
int
Srid
;
770
int
GeometryType
;
772
int
Dimensions
;
776
int
SpatialIndex
;
778
gaiaLayerExtentPtr
ExtentInfos
;
780
gaiaLayerAuthPtr
AuthInfos
;
782
gaiaLayerAttributeFieldPtr
First
;
784
gaiaLayerAttributeFieldPtr
Last
;
786
struct
gaiaVectorLayerItem
*
Next
;
787
}
gaiaVectorLayer
;
788
794
typedef
gaiaVectorLayer
*
gaiaVectorLayerPtr
;
795
799
typedef
struct
gaiaVectorLayersListStr
800
{
802
gaiaVectorLayerPtr
First
;
804
gaiaVectorLayerPtr
Last
;
806
gaiaVectorLayerPtr
Current
;
807
}
gaiaVectorLayersList
;
808
814
typedef
gaiaVectorLayersList
*
gaiaVectorLayersListPtr
;
815
816
#ifdef __cplusplus
817
}
818
#endif
819
820
#endif
/* _GG_STRUCTS_H */
Generated on Sun Nov 25 2012 12:49:07 for SpatiaLite by
1.8.1.1