SpatiaLite
4.0.0-RC1
Main Page
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Macros
Pages
src
headers
spatialite
gg_formats.h
Go to the documentation of this file.
1
/*
2
gg_formats.h -- Gaia common support for geometries: formats
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
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
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
70
GAIAGEO_DECLARE
int
gaiaEndianArch
(
void
);
71
87
GAIAGEO_DECLARE
short
gaiaImport16
(
const
unsigned
char
*p,
88
int
little_endian,
89
int
little_endian_arch);
90
106
GAIAGEO_DECLARE
int
gaiaImport32
(
const
unsigned
char
*p,
int
little_endian,
107
int
little_endian_arch);
108
124
GAIAGEO_DECLARE
float
gaiaImportF32
(
const
unsigned
char
*p,
125
int
little_endian,
126
int
little_endian_arch);
127
143
GAIAGEO_DECLARE
double
gaiaImport64
(
const
unsigned
char
*p,
144
int
little_endian,
145
int
little_endian_arch);
146
162
GAIAGEO_DECLARE sqlite3_int64
gaiaImportI64
(
const
unsigned
char
*p,
163
int
little_endian,
164
int
little_endian_arch);
165
180
GAIAGEO_DECLARE
void
gaiaExport16
(
unsigned
char
*p,
short
value,
181
int
little_endian,
182
int
little_endian_arch);
183
198
GAIAGEO_DECLARE
void
gaiaExport32
(
unsigned
char
*p,
int
value,
199
int
little_endian,
200
int
little_endian_arch);
201
216
GAIAGEO_DECLARE
void
gaiaExportF32
(
unsigned
char
*p,
float
value,
217
int
little_endian,
218
int
little_endian_arch);
219
234
GAIAGEO_DECLARE
void
gaiaExport64
(
unsigned
char
*p,
double
value,
235
int
little_endian,
236
int
little_endian_arch);
237
252
GAIAGEO_DECLARE
void
gaiaExportI64
(
unsigned
char
*p, sqlite3_int64 value,
253
int
little_endian,
254
int
little_endian_arch);
255
271
GAIAGEO_DECLARE
void
gaiaOutBufferInitialize
(
gaiaOutBufferPtr
buf);
272
284
GAIAGEO_DECLARE
void
gaiaOutBufferReset
(
gaiaOutBufferPtr
buf);
285
299
GAIAGEO_DECLARE
void
gaiaAppendToOutBuffer
(
gaiaOutBufferPtr
buf,
300
const
char
*text);
301
318
GAIAGEO_DECLARE
void
gaiaMakePoint
(
double
x,
double
y,
int
srid,
319
unsigned
char
**result,
int
*size);
320
338
GAIAGEO_DECLARE
void
gaiaMakePointZ
(
double
x,
double
y,
double
z,
int
srid,
339
unsigned
char
**result,
int
*size);
340
358
GAIAGEO_DECLARE
void
gaiaMakePointM
(
double
x,
double
y,
double
m,
int
srid,
359
unsigned
char
**result,
int
*size);
360
379
GAIAGEO_DECLARE
void
gaiaMakePointZM
(
double
x,
double
y,
double
z,
380
double
m,
int
srid,
381
unsigned
char
**result,
int
*size);
382
398
GAIAGEO_DECLARE
void
gaiaMakeLine
(
gaiaGeomCollPtr
geom1,
399
gaiaGeomCollPtr
geom2,
400
unsigned
char
**result,
int
*size);
401
417
GAIAGEO_DECLARE
gaiaGeomCollPtr
gaiaFromSpatiaLiteBlobWkb
(
const
unsigned
418
char
*blob,
419
unsigned
int
420
size);
421
436
GAIAGEO_DECLARE
void
gaiaToSpatiaLiteBlobWkb
(
gaiaGeomCollPtr
geom,
437
unsigned
char
**result,
438
int
*size);
439
456
GAIAGEO_DECLARE
void
gaiaToCompressedBlobWkb
(
gaiaGeomCollPtr
geom,
457
unsigned
char
**result,
458
int
*size);
459
475
GAIAGEO_DECLARE
gaiaGeomCollPtr
gaiaFromWkb
(
const
unsigned
char
*blob,
476
unsigned
int
size);
477
495
GAIAGEO_DECLARE
void
gaiaToWkb
(
gaiaGeomCollPtr
geom,
496
unsigned
char
**result,
int
*size);
497
512
GAIAGEO_DECLARE
char
*
gaiaToHexWkb
(
gaiaGeomCollPtr
geom);
513
525
GAIAGEO_DECLARE
void
gaiaToEWKB
(
gaiaOutBufferPtr
out_buf,
526
gaiaGeomCollPtr
geom);
527
542
GAIAGEO_DECLARE
gaiaGeomCollPtr
gaiaFromEWKB
(
const
unsigned
char
543
*in_buffer);
544
560
GAIAGEO_DECLARE
gaiaGeomCollPtr
gaiaFromFgf
(
const
unsigned
char
*blob,
561
unsigned
int
size);
562
578
GAIAGEO_DECLARE
void
gaiaToFgf
(
gaiaGeomCollPtr
geom,
579
unsigned
char
**result,
int
*size,
580
int
coord_dims);
581
599
GAIAGEO_DECLARE
gaiaGeomCollPtr
gaiaParseWkt
(
const
unsigned
char
600
*in_buffer,
short
type);
601
614
GAIAGEO_DECLARE
void
gaiaOutWkt
(
gaiaOutBufferPtr
out_buf,
615
gaiaGeomCollPtr
geom);
616
630
GAIAGEO_DECLARE
void
gaiaOutWktStrict
(
gaiaOutBufferPtr
out_buf,
631
gaiaGeomCollPtr
geom,
int
precision);
632
647
GAIAGEO_DECLARE
gaiaGeomCollPtr
gaiaParseEWKT
(
const
unsigned
char
648
*in_buffer);
649
660
GAIAGEO_DECLARE
void
gaiaToEWKT
(
gaiaOutBufferPtr
out_buf,
661
gaiaGeomCollPtr
geom);
662
673
GAIAGEO_DECLARE
void
gaiaOutPointZ
(
gaiaOutBufferPtr
out_buf,
674
gaiaPointPtr
point);
675
686
GAIAGEO_DECLARE
void
gaiaOutLinestringZ
(
gaiaOutBufferPtr
out_buf,
687
gaiaLinestringPtr
linestring);
688
699
GAIAGEO_DECLARE
void
gaiaOutPolygonZ
(
gaiaOutBufferPtr
out_buf,
700
gaiaPolygonPtr
polygon);
715
GAIAGEO_DECLARE
gaiaGeomCollPtr
gaiaParseKml
(
const
unsigned
char
716
*in_buffer);
717
729
GAIAGEO_DECLARE
void
gaiaOutBareKml
(
gaiaOutBufferPtr
out_buf,
730
gaiaGeomCollPtr
geom,
int
precision);
731
745
GAIAGEO_DECLARE
void
gaiaOutFullKml
(
gaiaOutBufferPtr
out_buf,
746
const
char
*name,
const
char
*desc,
747
gaiaGeomCollPtr
geom,
int
precision);
748
764
GAIAGEO_DECLARE
gaiaGeomCollPtr
gaiaParseGml
(
const
unsigned
char
765
*in_buffer,
766
sqlite3 * sqlite_handle);
767
781
GAIAGEO_DECLARE
void
gaiaOutGml
(
gaiaOutBufferPtr
out_buf,
int
version,
782
int
precision,
gaiaGeomCollPtr
geom);
783
798
GAIAGEO_DECLARE
gaiaGeomCollPtr
gaiaParseGeoJSON
(
const
unsigned
char
799
*in_buffer);
800
819
GAIAGEO_DECLARE
void
gaiaOutGeoJSON
(
gaiaOutBufferPtr
out_buf,
820
gaiaGeomCollPtr
geom,
int
precision,
821
int
options);
833
GAIAGEO_DECLARE
void
gaiaOutSvg
(
gaiaOutBufferPtr
out_buf,
834
gaiaGeomCollPtr
geom,
int
relative,
835
int
precision);
836
850
GAIAGEO_DECLARE
gaiaValuePtr
gaiaCloneValue
(
gaiaValuePtr
org);
851
861
GAIAGEO_DECLARE
void
gaiaFreeValue
(
gaiaValuePtr
p);
862
886
GAIAGEO_DECLARE
gaiaDbfFieldPtr
gaiaAllocDbfField
(
char
*name,
887
unsigned
char
type,
888
int
offset,
889
unsigned
char
length,
890
unsigned
char
decimals);
891
901
GAIAGEO_DECLARE
void
gaiaFreeDbfField
(
gaiaDbfFieldPtr
p);
902
917
GAIAGEO_DECLARE
gaiaDbfFieldPtr
gaiaCloneDbfField
(
gaiaDbfFieldPtr
org);
918
928
GAIAGEO_DECLARE
void
gaiaSetNullValue
(
gaiaDbfFieldPtr
field);
929
940
GAIAGEO_DECLARE
void
gaiaSetIntValue
(
gaiaDbfFieldPtr
field,
941
sqlite3_int64 value);
942
952
GAIAGEO_DECLARE
void
gaiaSetDoubleValue
(
gaiaDbfFieldPtr
field,
953
double
value);
954
964
GAIAGEO_DECLARE
void
gaiaSetStrValue
(
gaiaDbfFieldPtr
field,
char
*str);
965
978
GAIAGEO_DECLARE
gaiaDbfListPtr
gaiaAllocDbfList
(
void
);
979
992
GAIAGEO_DECLARE
void
gaiaFreeDbfList
(
gaiaDbfListPtr
list);
993
1004
GAIAGEO_DECLARE
int
gaiaIsValidDbfList
(
gaiaDbfListPtr
list);
1005
1026
GAIAGEO_DECLARE
gaiaDbfFieldPtr
gaiaAddDbfField
(
gaiaDbfListPtr
list,
1027
char
*name,
1028
unsigned
char
type,
1029
int
offset,
1030
unsigned
char
length,
1031
unsigned
char
decimals);
1032
1043
GAIAGEO_DECLARE
void
gaiaResetDbfEntity
(
gaiaDbfListPtr
list);
1044
1057
GAIAGEO_DECLARE
gaiaDbfListPtr
gaiaCloneDbfEntity
(
gaiaDbfListPtr
org);
1058
1071
GAIAGEO_DECLARE
gaiaShapefilePtr
gaiaAllocShapefile
(
void
);
1072
1085
GAIAGEO_DECLARE
void
gaiaFreeShapefile
(
gaiaShapefilePtr
shp);
1086
1102
GAIAGEO_DECLARE
void
gaiaOpenShpRead
(
gaiaShapefilePtr
shp,
1103
const
char
*path,
1104
const
char
*charFrom,
1105
const
char
*charTo);
1106
1128
GAIAGEO_DECLARE
void
gaiaOpenShpWrite
(
gaiaShapefilePtr
shp,
1129
const
char
*path,
int
shape,
1130
gaiaDbfListPtr
list,
1131
const
char
*charFrom,
1132
const
char
*charTo);
1133
1154
GAIAGEO_DECLARE
int
gaiaReadShpEntity
(
gaiaShapefilePtr
shp,
1155
int
current_row,
int
srid);
1156
1170
GAIAGEO_DECLARE
void
gaiaShpAnalyze
(
gaiaShapefilePtr
shp);
1171
1186
GAIAGEO_DECLARE
int
gaiaWriteShpEntity
(
gaiaShapefilePtr
shp,
1187
gaiaDbfListPtr
entity);
1188
1201
GAIAGEO_DECLARE
void
gaiaFlushShpHeaders
(
gaiaShapefilePtr
shp);
1202
1215
GAIAGEO_DECLARE
gaiaDbfPtr
gaiaAllocDbf
(
void
);
1216
1229
GAIAGEO_DECLARE
void
gaiaFreeDbf
(
gaiaDbfPtr
dbf);
1230
1245
GAIAGEO_DECLARE
void
gaiaOpenDbfRead
(
gaiaDbfPtr
dbf,
1246
const
char
*path,
1247
const
char
*charFrom,
1248
const
char
*charTo);
1249
1264
GAIAGEO_DECLARE
void
gaiaOpenDbfWrite
(
gaiaDbfPtr
dbf,
1265
const
char
*path,
1266
const
char
*charFrom,
1267
const
char
*charTo);
1268
1289
GAIAGEO_DECLARE
int
gaiaReadDbfEntity
(
gaiaDbfPtr
dbf,
int
current_row,
1290
int
*deleted);
1291
1306
GAIAGEO_DECLARE
int
gaiaWriteDbfEntity
(
gaiaDbfPtr
dbf,
1307
gaiaDbfListPtr
entity);
1308
1321
GAIAGEO_DECLARE
void
gaiaFlushDbfHeader
(
gaiaDbfPtr
dbf);
1322
1323
1324
1325
#ifndef OMIT_ICONV
/* ICONV enabled: supporting text reader */
1326
1348
GAIAGEO_DECLARE
gaiaTextReaderPtr
gaiaTextReaderAlloc
(
const
char
*path,
1349
char
field_separator,
1350
char
text_separator,
1351
char
1352
decimal_separator,
1353
int
1354
first_line_titles,
1355
const
char
1356
*encoding);
1357
1366
GAIAGEO_DECLARE
void
gaiaTextReaderDestroy
(
gaiaTextReaderPtr
reader);
1367
1383
GAIAGEO_DECLARE
int
gaiaTextReaderParse
(
gaiaTextReaderPtr
reader);
1384
1400
GAIAGEO_DECLARE
int
gaiaTextReaderGetRow
(
gaiaTextReaderPtr
reader,
1401
int
row_num);
1402
1416
GAIAGEO_DECLARE
int
gaiaTextReaderFetchField
(
gaiaTextReaderPtr
reader,
1417
int
field_num,
int
*type,
1418
const
char
**value);
1419
1420
#endif
/* end ICONV (text reader) */
1421
1422
#ifdef __cplusplus
1423
}
1424
#endif
1425
1426
#endif
/* _GG_FORMATS_H */
Generated on Wed Sep 5 2012 10:45:33 for SpatiaLite by
1.8.1.1