gaiaaux.h | gaiaaux.h | |||
---|---|---|---|---|
/* | /* | |||
gaiaaux.h -- Gaia common utility functions | gaiaaux.h -- Gaia common utility functions | |||
version 2.4, 2009 September 17 | version 3.0, 2011 July 20 | |||
Author: Sandro Furieri a.furieri@lqt.it | Author: Sandro Furieri a.furieri@lqt.it | |||
-------------------------------------------------------------------------- ---- | -------------------------------------------------------------------------- ---- | |||
Version: MPL 1.1/GPL 2.0/LGPL 2.1 | Version: MPL 1.1/GPL 2.0/LGPL 2.1 | |||
The contents of this file are subject to the Mozilla Public License Versio n | The contents of this file are subject to the Mozilla Public License Versio n | |||
1.1 (the "License"); you may not use this file except in compliance with | 1.1 (the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | the License. You may obtain a copy of the License at | |||
skipping to change at line 45 | skipping to change at line 45 | |||
of those above. If you wish to allow use of your version of this file only | of those above. If you wish to allow use of your version of this file only | |||
under the terms of either the GPL or the LGPL, and not to allow others to | under the terms of either the GPL or the LGPL, and not to allow others to | |||
use your version of this file under the terms of the MPL, indicate your | use your version of this file under the terms of the MPL, indicate your | |||
decision by deleting the provisions above and replace them with the notice | decision by deleting the provisions above and replace them with the notice | |||
and other provisions required by the GPL or the LGPL. If you do not delete | and other provisions required by the GPL or the LGPL. If you do not delete | |||
the provisions above, a recipient may use your version of this file under | the provisions above, a recipient may use your version of this file under | |||
the terms of any one of the MPL, the GPL or the LGPL. | the terms of any one of the MPL, the GPL or the LGPL. | |||
*/ | */ | |||
/** | ||||
\file gaiaaux.h | ||||
Auxiliary/helper functions | ||||
*/ | ||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS | ||||
#ifdef DLL_EXPORT | #ifdef DLL_EXPORT | |||
#define GAIAAUX_DECLARE __declspec(dllexport) | #define GAIAAUX_DECLARE __declspec(dllexport) | |||
#else | #else | |||
#define GAIAAUX_DECLARE extern | #define GAIAAUX_DECLARE extern | |||
#endif | #endif | |||
#endif | ||||
#ifndef _GAIAAUX_H | #ifndef _GAIAAUX_H | |||
#ifndef DOXYGEN_SHOULD_SKIP_THIS | ||||
#define _GAIAAUX_H | #define _GAIAAUX_H | |||
#endif | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" | extern "C" | |||
{ | { | |||
#endif | #endif | |||
/* constants */ | ||||
/** SQL single quoted string (text constant) */ | ||||
#define GAIA_SQL_SINGLE_QUOTE 1001 | ||||
/** SQL double quoted string (SQL name) */ | ||||
#define GAIA_SQL_DOUBLE_QUOTE 1002 | ||||
/* function prototipes */ | /* function prototipes */ | |||
/** | ||||
Retrieves the Locale Charset | ||||
\return the GNU ICONV name identifying the locale charset | ||||
*/ | ||||
GAIAAUX_DECLARE const char *gaiaGetLocaleCharset (void); | GAIAAUX_DECLARE const char *gaiaGetLocaleCharset (void); | |||
/** | ||||
Converts a text string from one charset to another | ||||
\param buf the text string to be converted | ||||
\param fromCs the GNU ICONV name identifying the input charset | ||||
\param toCs the GNU ICONV name identifying the output charset | ||||
\return 0 on failure, any other value on success. | ||||
\note this function uses an internal buffer limited to 64KB; | ||||
so it's not safe passing extremely huge-sized text string. | ||||
*/ | ||||
GAIAAUX_DECLARE int gaiaConvertCharset (char **buf, const char *fromCs, | GAIAAUX_DECLARE int gaiaConvertCharset (char **buf, const char *fromCs, | |||
const char *toCs); | const char *toCs); | |||
/** | ||||
Creates a persistent UTF8 converter object | ||||
\param fromCS the GNU ICONV name identifying the input charset | ||||
\return the handle of the converter object, or NULL on failure | ||||
\sa gaiaFreeUTF8Converter | ||||
\note you must properly destroy the converter object | ||||
when it isn't any longer used. | ||||
*/ | ||||
GAIAAUX_DECLARE void *gaiaCreateUTF8Converter (const char *fromCS); | GAIAAUX_DECLARE void *gaiaCreateUTF8Converter (const char *fromCS); | |||
/** | ||||
Destroys an UTF8 converter object | ||||
\param cvtCS the handle identifying the UTF8 convert object | ||||
(returned by a previous call to gaiaCreateUTF8Converter). | ||||
\sa gaiaCreateUTF8Converter | ||||
*/ | ||||
GAIAAUX_DECLARE void gaiaFreeUTF8Converter (void *cvtCS); | GAIAAUX_DECLARE void gaiaFreeUTF8Converter (void *cvtCS); | |||
/** | ||||
Converts a text string to UTF8 | ||||
\param cvtCS the handle identifying the UTF8 convert object | ||||
(returned by a previous call to gaiaCreateUTF8Converter). | ||||
\param buf the input text string | ||||
\param len length (in bytes) of input string | ||||
\param err on completion will contain 0 on success, any other value on fai | ||||
lure | ||||
\return the null-terminated UTF8 encoded string: NULL on failure | ||||
\sa gaiaCreateUTF8Converter, gaiaFreeUTF8Converter | ||||
\note this function can safely handle strings of arbitrary length, | ||||
and will return the converted string into a dynamically allocated buffer | ||||
created by malloc(). | ||||
You are required to explicitly free() any string returned by this function | ||||
. | ||||
*/ | ||||
GAIAAUX_DECLARE char *gaiaConvertToUTF8 (void *cvtCS, const char *buf, | GAIAAUX_DECLARE char *gaiaConvertToUTF8 (void *cvtCS, const char *buf, | |||
int len, int *err); | int len, int *err); | |||
/** | ||||
Checks if a name is a reserved SQLite name | ||||
\param name the name to be checked | ||||
\return 0 if no: any other value if yes | ||||
\sa gaiaIsReservedSqlName, gaiaIllegalSqlName | ||||
*/ | ||||
GAIAAUX_DECLARE int gaiaIsReservedSqliteName (const char *name); | GAIAAUX_DECLARE int gaiaIsReservedSqliteName (const char *name); | |||
/** | ||||
Checks if a name is a reserved SQL name | ||||
\param name the name to be checked | ||||
\return 0 if no: any other value if yes | ||||
\sa gaiaIsReservedSqliteName, gaiaIllegalSqlName | ||||
*/ | ||||
GAIAAUX_DECLARE int gaiaIsReservedSqlName (const char *name); | GAIAAUX_DECLARE int gaiaIsReservedSqlName (const char *name); | |||
/** | ||||
Checks if a name is an illegal SQL name | ||||
\param name the name to be checked | ||||
\return 0 if no: any other value if yes | ||||
\sa gaiaIsReservedSqliteName, gaiaIsReservedSqlName | ||||
*/ | ||||
GAIAAUX_DECLARE int gaiaIllegalSqlName (const char *name); | GAIAAUX_DECLARE int gaiaIllegalSqlName (const char *name); | |||
/** | ||||
Properly formats an SQL text constant | ||||
\param value the text string to be formatted | ||||
\return the formatted string: NULL on failure | ||||
\sa gaiaQuotedSql | ||||
\note this function simply is a convenience method corresponding to: | ||||
gaiaQuotedSQL(value, GAIA_SQL_SINGLE_QUOTE); | ||||
\remark passing a string like "Sant'Andrea" will return 'Sant''Andrea' | ||||
*/ | ||||
GAIAAUX_DECLARE char *gaiaSingleQuotedSql (const char *value); | ||||
/** | ||||
Properly formats an SQL name | ||||
\param value the SQL name to be formatted | ||||
\return the formatted string: NULL on failure | ||||
\sa gaiaQuotedSql | ||||
\note this function simply is a convenience method corresponding to: | ||||
gaiaQuotedSQL(value, GAIA_SQL_DOUBLE_QUOTE); | ||||
\remark passing a string like "Sant\"Andrea" will return "Sant""Andrea" | ||||
*/ | ||||
GAIAAUX_DECLARE char *gaiaDoubleQuotedSql (const char *value); | ||||
/** | ||||
Properly formats an SQL generic string | ||||
\param value the string to be formatted | ||||
\param quote GAIA_SQL_SINGLE_QUOTE or GAIA_SQL_DOUBLE_QUOTE | ||||
\return the formatted string: NULL on failure | ||||
\sa gaiaSingleQuotedSql, gaiaDoubleQuotedSql | ||||
\note this function can safely handle strings of arbitrary length, | ||||
and will return the formatted string into a dynamically allocated buffer | ||||
created by malloc(). | ||||
You are required to explicitly free() any string returned by this function | ||||
. | ||||
*/ | ||||
GAIAAUX_DECLARE char *gaiaQuotedSql (const char *value, int quote); | ||||
/* | ||||
/ DEPRECATED FUNCTION: gaiaCleanSqlString() | ||||
/ this function must not be used for any new project | ||||
/ it's still maintained for backward compatibility, | ||||
/ but will be probably removed in future versions | ||||
*/ | ||||
/** | ||||
deprecated function | ||||
\param value the string to be formatted | ||||
\sa gaiaQuotedSql | ||||
\note this function is still supported simply for backward compatibility. | ||||
it's intrinsically unsafe (passing huge strings potentially leads to | ||||
buffer overflows) and you are strongly encouraged to use gaiaQuotedSql() | ||||
as a safest replacement. | ||||
*/ | ||||
GAIAAUX_DECLARE void gaiaCleanSqlString (char *value); | GAIAAUX_DECLARE void gaiaCleanSqlString (char *value); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* _GAIAAUX_H */ | #endif /* _GAIAAUX_H */ | |||
End of changes. 15 change blocks. | ||||
1 lines changed or deleted | 177 lines changed or added | |||
gaiaexif.h | gaiaexif.h | |||
---|---|---|---|---|
/* | /* | |||
gaiaexif.h -- Gaia common EXIF Metadata reading functions | gaiaexif.h -- Gaia common EXIF Metadata reading functions | |||
version 2.4, 2009 September 17 | version 3.0, 2011 July 20 | |||
Author: Sandro Furieri a.furieri@lqt.it | Author: Sandro Furieri a.furieri@lqt.it | |||
-------------------------------------------------------------------------- ---- | -------------------------------------------------------------------------- ---- | |||
Version: MPL 1.1/GPL 2.0/LGPL 2.1 | Version: MPL 1.1/GPL 2.0/LGPL 2.1 | |||
The contents of this file are subject to the Mozilla Public License Versio n | The contents of this file are subject to the Mozilla Public License Versio n | |||
1.1 (the "License"); you may not use this file except in compliance with | 1.1 (the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | the License. You may obtain a copy of the License at | |||
skipping to change at line 45 | skipping to change at line 45 | |||
of those above. If you wish to allow use of your version of this file only | of those above. If you wish to allow use of your version of this file only | |||
under the terms of either the GPL or the LGPL, and not to allow others to | under the terms of either the GPL or the LGPL, and not to allow others to | |||
use your version of this file under the terms of the MPL, indicate your | use your version of this file under the terms of the MPL, indicate your | |||
decision by deleting the provisions above and replace them with the notice | decision by deleting the provisions above and replace them with the notice | |||
and other provisions required by the GPL or the LGPL. If you do not delete | and other provisions required by the GPL or the LGPL. If you do not delete | |||
the provisions above, a recipient may use your version of this file under | the provisions above, a recipient may use your version of this file under | |||
the terms of any one of the MPL, the GPL or the LGPL. | the terms of any one of the MPL, the GPL or the LGPL. | |||
*/ | */ | |||
/** | ||||
\file gaiaexif.h | ||||
EXIF/image: supporting functions and constants | ||||
*/ | ||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS | ||||
#ifdef DLL_EXPORT | #ifdef DLL_EXPORT | |||
#define GAIAEXIF_DECLARE __declspec(dllexport) | #define GAIAEXIF_DECLARE __declspec(dllexport) | |||
#else | #else | |||
#define GAIAEXIF_DECLARE extern | #define GAIAEXIF_DECLARE extern | |||
#endif | #endif | |||
#endif | ||||
#ifndef _GAIAEXIF_H | #ifndef _GAIAEXIF_H | |||
#ifndef DOXYGEN_SHOULD_SKIP_THIS | ||||
#define _GAIAEXIF_H | #define _GAIAEXIF_H | |||
#endif | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" | extern "C" | |||
{ | { | |||
#endif | #endif | |||
/* constants used for BLOB value types */ | /* constants used for BLOB value types */ | |||
/** generic hexadecimal BLOB */ | ||||
#define GAIA_HEX_BLOB 0 | #define GAIA_HEX_BLOB 0 | |||
/** this BLOB does actually contain a GIF image */ | ||||
#define GAIA_GIF_BLOB 1 | #define GAIA_GIF_BLOB 1 | |||
/** this BLOB does actually containt a PNG image */ | ||||
#define GAIA_PNG_BLOB 2 | #define GAIA_PNG_BLOB 2 | |||
/** this BLOB does actually contain a generic JPEG image */ | ||||
#define GAIA_JPEG_BLOB 3 | #define GAIA_JPEG_BLOB 3 | |||
/** this BLOB does actually contain a JPEG-EXIF image */ | ||||
#define GAIA_EXIF_BLOB 4 | #define GAIA_EXIF_BLOB 4 | |||
/** this BLOB does actually contain a JPEG-EXIF image including GPS data */ | ||||
#define GAIA_EXIF_GPS_BLOB 5 | #define GAIA_EXIF_GPS_BLOB 5 | |||
/** this BLOB does actually contain a ZIP compressed file */ | ||||
#define GAIA_ZIP_BLOB 6 | #define GAIA_ZIP_BLOB 6 | |||
/** this BLOB does actually contain a PDF document */ | ||||
#define GAIA_PDF_BLOB 7 | #define GAIA_PDF_BLOB 7 | |||
/** this BLOB does actually contain a SpatiaLite Geometry */ | ||||
#define GAIA_GEOMETRY_BLOB 8 | #define GAIA_GEOMETRY_BLOB 8 | |||
/** this BLOB does actually contain a TIFF image */ | ||||
#define GAIA_TIFF_BLOB 9 | #define GAIA_TIFF_BLOB 9 | |||
/* constants used for EXIF value types */ | /* constants used for EXIF value types */ | |||
/** unrecognized EXIF value */ | ||||
#define GAIA_EXIF_NONE 0 | #define GAIA_EXIF_NONE 0 | |||
/** EXIF value of the BYTE type */ | ||||
#define GAIA_EXIF_BYTE 1 | #define GAIA_EXIF_BYTE 1 | |||
/** EXIF value of the SHORT type */ | ||||
#define GAIA_EXIF_SHORT 2 | #define GAIA_EXIF_SHORT 2 | |||
/** EXIF value of the STRING type */ | ||||
#define GAIA_EXIF_STRING 3 | #define GAIA_EXIF_STRING 3 | |||
/** EXIF value of the LONG type */ | ||||
#define GAIA_EXIF_LONG 4 | #define GAIA_EXIF_LONG 4 | |||
/** EXIF value of the RATIONAL type */ | ||||
#define GAIA_EXIF_RATIONAL 5 | #define GAIA_EXIF_RATIONAL 5 | |||
/** EXIF value of the SLONG type */ | ||||
#define GAIA_EXIF_SLONG 9 | #define GAIA_EXIF_SLONG 9 | |||
/** EXIF value of the SRATIONAL type */ | ||||
#define GAIA_EXIF_SRATIONAL 10 | #define GAIA_EXIF_SRATIONAL 10 | |||
/** | ||||
Container for an EXIF tag | ||||
*/ | ||||
typedef struct gaiaExifTagStruct | typedef struct gaiaExifTagStruct | |||
{ | { | |||
/* an EXIF TAG */ | /* an EXIF TAG */ | |||
/** GPS data included (0/1) */ | ||||
char Gps; | char Gps; | |||
/** EXIF tag ID */ | ||||
unsigned short TagId; | unsigned short TagId; | |||
/** EXIF value type */ | ||||
unsigned short Type; | unsigned short Type; | |||
/** number of values */ | ||||
unsigned short Count; | unsigned short Count; | |||
/** tag offset [big- little-endian encoded] */ | ||||
unsigned char TagOffset[4]; | unsigned char TagOffset[4]; | |||
/** array of BYTE values */ | ||||
unsigned char *ByteValue; | unsigned char *ByteValue; | |||
/** array of STRING values */ | ||||
char *StringValue; | char *StringValue; | |||
/** array of SHORT values */ | ||||
unsigned short *ShortValues; | unsigned short *ShortValues; | |||
/** array of LONG values ] */ | ||||
unsigned int *LongValues; | unsigned int *LongValues; | |||
/** array of RATIONAL values [numerators] */ | ||||
unsigned int *LongRationals1; | unsigned int *LongRationals1; | |||
/** array of RATIONAL values [denominators] */ | ||||
unsigned int *LongRationals2; | unsigned int *LongRationals2; | |||
/** array of Signed SHORT values */ | ||||
short *SignedShortValues; | short *SignedShortValues; | |||
/** array of Signed LONG values */ | ||||
int *SignedLongValues; | int *SignedLongValues; | |||
/** array of Signed RATIONAL values [numerators] */ | ||||
int *SignedLongRationals1; | int *SignedLongRationals1; | |||
/** array of Signed RATIONAL values [denominators] */ | ||||
int *SignedLongRationals2; | int *SignedLongRationals2; | |||
/** array of FLOAT values */ | ||||
float *FloatValues; | float *FloatValues; | |||
/** array of DOUBLE values */ | ||||
double *DoubleValues; | double *DoubleValues; | |||
/** pointer to next item into the linked list */ | ||||
struct gaiaExifTagStruct *Next; | struct gaiaExifTagStruct *Next; | |||
} gaiaExifTag; | } gaiaExifTag; | |||
/** | ||||
Typedef for EXIF tag structure. | ||||
\sa gaiaExifTagStruct | ||||
*/ | ||||
typedef gaiaExifTag *gaiaExifTagPtr; | typedef gaiaExifTag *gaiaExifTagPtr; | |||
/** | ||||
Container for a list of EXIF tags | ||||
*/ | ||||
typedef struct gaiaExifTagListStruct | typedef struct gaiaExifTagListStruct | |||
{ | { | |||
/* an EXIF TAG LIST */ | /* an EXIF TAG LIST */ | |||
/** pointer to first item into the linked list */ | ||||
gaiaExifTagPtr First; | gaiaExifTagPtr First; | |||
/** pointer to the last item into the linked list */ | ||||
gaiaExifTagPtr Last; | gaiaExifTagPtr Last; | |||
/** number of items */ | ||||
int NumTags; | int NumTags; | |||
/** an array of pointers to items */ | ||||
gaiaExifTagPtr *TagsArray; | gaiaExifTagPtr *TagsArray; | |||
} gaiaExifTagList; | } gaiaExifTagList; | |||
/** | ||||
Typedef for EXIF tag structure | ||||
\sa gaiaExifTagListStruct | ||||
*/ | ||||
typedef gaiaExifTagList *gaiaExifTagListPtr; | typedef gaiaExifTagList *gaiaExifTagListPtr; | |||
/* function prototipes */ | /* function prototipes */ | |||
/** | ||||
Creates a list of EXIF tags by parsing a BLOB of the JPEG-EXIF type | ||||
\param blob the BLOB to be parsed | ||||
\param size the BLOB size (in bytes) | ||||
\return a list of EXIF tags: or NULL if any error is encountered | ||||
\sa gaiaExifTagsFree | ||||
\note you must explicitly destroy the list when it's any longer used. | ||||
*/ | ||||
GAIAEXIF_DECLARE gaiaExifTagListPtr gaiaGetExifTags (const unsigned cha r | GAIAEXIF_DECLARE gaiaExifTagListPtr gaiaGetExifTags (const unsigned cha r | |||
*blob, int size); | *blob, int size); | |||
/** | ||||
Destroy a list of EXIF tags | ||||
\param tag_list the list to be destroied | ||||
\sa gaiaGetExifTags | ||||
\note the pointer passed to this function must be one returned by a | ||||
previous call to gaiaGetExifTags | ||||
*/ | ||||
GAIAEXIF_DECLARE void gaiaExifTagsFree (gaiaExifTagListPtr tag_list); | GAIAEXIF_DECLARE void gaiaExifTagsFree (gaiaExifTagListPtr tag_list); | |||
/** | ||||
Return the total number of EXIF tags into the list | ||||
\param tag_list pointer to an EXIF tag list. | ||||
\return the EXIF tag count. | ||||
\sa gaiaGetExifTags, gaiaExifTagsFree | ||||
*/ | ||||
GAIAEXIF_DECLARE int gaiaGetExifTagsCount (gaiaExifTagListPtr tag_list) ; | GAIAEXIF_DECLARE int gaiaGetExifTagsCount (gaiaExifTagListPtr tag_list) ; | |||
/** | ||||
Retrieves an EXIF tag by its relative position into the list | ||||
\param tag_list pointer to an EXIF tag list. | ||||
\param pos relative item position [first item is 0] | ||||
\return a pointer to the corresponding EXIF tag: NULL if not found | ||||
\sa gaiaGetExifTags, gaiaExifTagsFree, gaiaExifTagsCount | ||||
*/ | ||||
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifTagByPos (gaiaExifTagListPtr | GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifTagByPos (gaiaExifTagListPtr | |||
tag_list, | tag_list, | |||
const int pos); | const int pos); | |||
/** | ||||
Return the total number of EXIF tags into the list | ||||
\param tag_list pointer to an EXIF tag list. | ||||
\return the EXIF tag count. | ||||
\sa gaiaGetExifTags, gaiaExifTagsFree | ||||
*/ | ||||
GAIAEXIF_DECLARE int gaiaGetExifTagsCount (gaiaExifTagListPtr tag_list) | ||||
; | ||||
/** | ||||
Retrieves an EXIF tag by its Tag ID | ||||
\param tag_list pointer to an EXIF tag list. | ||||
\param tag_id the Tag ID to be found | ||||
\return a pointer to the corresponding EXIF tag: NULL if not found | ||||
\sa gaiaGetExifTags, gaiaExifTagsFree | ||||
*/ | ||||
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifTagById (const gaiaExifTagLi stPtr | GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifTagById (const gaiaExifTagLi stPtr | |||
tag_list, | tag_list, | |||
const unsigned short | const unsigned short | |||
tag_id); | tag_id); | |||
/** | ||||
Retrieves an EXIF-GPS tag by its Tag ID | ||||
\param tag_list pointer to an EXIF tag list. | ||||
\param tag_id the GPS Tag ID to be found | ||||
\return a pointer to the corresponding EXIF tag: NULL if not found | ||||
\sa gaiaGetExifTags, gaiaExifTagsFree | ||||
*/ | ||||
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifGpsTagById (const | GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifGpsTagById (const | |||
gaiaExifTagListPt r | gaiaExifTagListPt r | |||
tag_list, | tag_list, | |||
const unsigned sh ort | const unsigned sh ort | |||
tag_id); | tag_id); | |||
/** | ||||
Retrieves an EXIF tag by its name | ||||
\param tag_list pointer to an EXIF tag list. | ||||
\param tag_name the Tag Name to be found | ||||
\return a pointer to the corresponding EXIF tag: NULL if not found | ||||
\sa gaiaGetExifTags, gaiaExifTagsFree | ||||
*/ | ||||
GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifTagByName (const | GAIAEXIF_DECLARE gaiaExifTagPtr gaiaGetExifTagByName (const | |||
gaiaExifTagListPtr | gaiaExifTagListPtr | |||
tag_list, | tag_list, | |||
const char *tag_na me); | const char *tag_na me); | |||
/** | ||||
Return the Tag ID from an EXIF tag | ||||
\param tag pointer to an EXIF tag | ||||
\return the Tag ID | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName | ||||
*/ | ||||
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetId (const gaiaExifTagPtr tag); | GAIAEXIF_DECLARE unsigned short gaiaExifTagGetId (const gaiaExifTagPtr tag); | |||
/** | ||||
Return the Tag Name from an EXIF tag | ||||
\param tag pointer to an EXIF tag | ||||
\param tag_name receiving buffer: the Tag Name will be copied here | ||||
\param len length of the receiving buffer | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName | ||||
*/ | ||||
GAIAEXIF_DECLARE void gaiaExifTagGetName (const gaiaExifTagPtr tag, | GAIAEXIF_DECLARE void gaiaExifTagGetName (const gaiaExifTagPtr tag, | |||
char *tag_name, int len); | char *tag_name, int len); | |||
/** | ||||
Checks if an EXIF tag actually is an EXIF-GPS tag | ||||
\param tag pointer to an EXIF tag | ||||
\return 0 if false: any other value if true | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName | ||||
*/ | ||||
GAIAEXIF_DECLARE int gaiaIsExifGpsTag (const gaiaExifTagPtr tag); | GAIAEXIF_DECLARE int gaiaIsExifGpsTag (const gaiaExifTagPtr tag); | |||
/** | ||||
Return the value type for an EXIF tag | ||||
\param tag pointer to an EXIF tag | ||||
\return the value type: one of GAIA_EXIF_NONE, GAIA_EXIF_BYTE, | ||||
GAIA_EXIF_SHORT, GAIA_EXIF_STRING, GAIA_EXIF_LONG, GAIA_EXIF_RATIONAL, | ||||
GAIA_EXIF_SLONG, GAIA_EXIF_SRATIONAL | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName | ||||
*/ | ||||
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetValueType (const | GAIAEXIF_DECLARE unsigned short gaiaExifTagGetValueType (const | |||
gaiaExifTagPtr | gaiaExifTagPtr | |||
tag); | tag); | |||
/** | ||||
Return the total count of values from an EXIF tag | ||||
\param tag pointer to an EXIF tag | ||||
\return the number of available values | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName | ||||
*/ | ||||
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetNumValues (const | GAIAEXIF_DECLARE unsigned short gaiaExifTagGetNumValues (const | |||
gaiaExifTagPtr | gaiaExifTagPtr | |||
tag); | tag); | |||
/** | ||||
Return a BYTE value from an EXIF tag | ||||
\param tag pointer to an EXIF tag. | ||||
\param ind value index [first value has index 0]. | ||||
\param ok on completion will contain 0 on failure: any other value on succ | ||||
ess. | ||||
\return the BYTE value | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaExifTagGetValueType, gaiaExifTagGetNumValues | ||||
*/ | ||||
GAIAEXIF_DECLARE unsigned char gaiaExifTagGetByteValue (const gaiaExifT agPtr | GAIAEXIF_DECLARE unsigned char gaiaExifTagGetByteValue (const gaiaExifT agPtr | |||
tag, const int i nd, | tag, const int i nd, | |||
int *ok); | int *ok); | |||
/** | ||||
Return a STRING value from an EXIF tag | ||||
\param tag pointer to an EXIF tag. | ||||
\param str receiving buffer: the STRING value will be copied here. | ||||
\param len length of the receiving buffer | ||||
\param ok on completion will contain 0 on failure: any other value on succ | ||||
ess. | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaExifTagGetValueType, gaiaExifTagGetNumValues | ||||
*/ | ||||
GAIAEXIF_DECLARE void gaiaExifTagGetStringValue (const gaiaExifTagPtr t ag, | GAIAEXIF_DECLARE void gaiaExifTagGetStringValue (const gaiaExifTagPtr t ag, | |||
char *str, int len, | char *str, int len, | |||
int *ok); | int *ok); | |||
/** | ||||
Return a SHORT value from an EXIF tag | ||||
\param tag pointer to an EXIF tag. | ||||
\param ind value index [first value has index 0]. | ||||
\param ok on completion will contain 0 on failure: any other value on succ | ||||
ess. | ||||
\return the SHORT value | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaExifTagGetValueType, gaiaExifTagGetNumValues | ||||
*/ | ||||
GAIAEXIF_DECLARE unsigned short gaiaExifTagGetShortValue (const | GAIAEXIF_DECLARE unsigned short gaiaExifTagGetShortValue (const | |||
gaiaExifTagPtr | gaiaExifTagPtr | |||
tag, | tag, | |||
const int ind, | const int ind, | |||
int *ok); | int *ok); | |||
/** | ||||
Return a LONG value from an EXIF tag | ||||
\param tag pointer to an EXIF tag. | ||||
\param ind value index [first value has index 0]. | ||||
\param ok on completion will contain 0 on failure: any other value on succ | ||||
ess. | ||||
\return the LONG value | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaExifTagGetValueType, gaiaExifTagGetNumValues | ||||
*/ | ||||
GAIAEXIF_DECLARE unsigned int gaiaExifTagGetLongValue (const gaiaExifTa gPtr | GAIAEXIF_DECLARE unsigned int gaiaExifTagGetLongValue (const gaiaExifTa gPtr | |||
tag, const int in d, | tag, const int in d, | |||
int *ok); | int *ok); | |||
/** | ||||
Return a RATIONAL [numerator] value from an EXIF tag | ||||
\param tag pointer to an EXIF tag. | ||||
\param ind value index [first value has index 0]. | ||||
\param ok on completion will contain 0 on failure: any other value on succ | ||||
ess. | ||||
\return the RATIONAL [numerator] value | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaExifTagGetValueType, gaiaExifTagGetNumValues | ||||
*/ | ||||
GAIAEXIF_DECLARE unsigned int gaiaExifTagGetRational1Value (const | GAIAEXIF_DECLARE unsigned int gaiaExifTagGetRational1Value (const | |||
gaiaExifTagP tr | gaiaExifTagP tr | |||
tag, | tag, | |||
const int in d, | const int in d, | |||
int *ok); | int *ok); | |||
/** | ||||
Return a RATIONAL [denominator] value from an EXIF tag | ||||
\param tag pointer to an EXIF tag. | ||||
\param ind value index [first value has index 0]. | ||||
\param ok on completion will contain 0 on failure: any other value on succ | ||||
ess. | ||||
\return the RATIONAL [denominator] value | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaExifTagGetValueType, gaiaExifTagGetNumValues | ||||
*/ | ||||
GAIAEXIF_DECLARE unsigned int gaiaExifTagGetRational2Value (const | GAIAEXIF_DECLARE unsigned int gaiaExifTagGetRational2Value (const | |||
gaiaExifTagP tr | gaiaExifTagP tr | |||
tag, | tag, | |||
const int in d, | const int in d, | |||
int *ok); | int *ok); | |||
/** | ||||
Return a RATIONAL value from an EXIF tag | ||||
\param tag pointer to an EXIF tag. | ||||
\param ind value index [first value has index 0]. | ||||
\param ok on completion will contain 0 on failure: any other value on succ | ||||
ess. | ||||
\return the RATIONAL value | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaExifTagGetValueType, gaiaExifTagGetNumValues | ||||
*/ | ||||
GAIAEXIF_DECLARE double gaiaExifTagGetRationalValue (const gaiaExifTagP tr | GAIAEXIF_DECLARE double gaiaExifTagGetRationalValue (const gaiaExifTagP tr | |||
tag, const int ind, | tag, const int ind, | |||
int *ok); | int *ok); | |||
/** | ||||
Return a Signed SHORT value from an EXIF tag | ||||
\param tag pointer to an EXIF tag. | ||||
\param ind value index [first value has index 0]. | ||||
\param ok on completion will contain 0 on failure: any other value on succ | ||||
ess. | ||||
\return the Signed SHORT value | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaExifTagGetValueType, gaiaExifTagGetNumValues | ||||
*/ | ||||
GAIAEXIF_DECLARE short gaiaExifTagGetSignedShortValue (const gaiaExifTa gPtr | GAIAEXIF_DECLARE short gaiaExifTagGetSignedShortValue (const gaiaExifTa gPtr | |||
tag, const int in d, | tag, const int in d, | |||
int *ok); | int *ok); | |||
/** | ||||
Return a Signed LONG value from an EXIF tag | ||||
\param tag pointer to an EXIF tag. | ||||
\param ind value index [first value has index 0]. | ||||
\param ok on completion will contain 0 on failure: any other value on succ | ||||
ess. | ||||
\return the Signed LONG value | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaExifTagGetValueType, gaiaExifTagGetNumValues | ||||
*/ | ||||
GAIAEXIF_DECLARE int gaiaExifTagGetSignedLongValue (const gaiaExifTagPt r | GAIAEXIF_DECLARE int gaiaExifTagGetSignedLongValue (const gaiaExifTagPt r | |||
tag, const int ind, | tag, const int ind, | |||
int *ok); | int *ok); | |||
/** | ||||
Return a SRATIONAL [numerator] value from an EXIF tag | ||||
\param tag pointer to an EXIF tag. | ||||
\param ind value index [first value has index 0]. | ||||
\param ok on completion will contain 0 on failure: any other value on succ | ||||
ess. | ||||
\return the SRATIONAL [numerator] value | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaExifTagGetValueType, gaiaExifTagGetNumValues | ||||
*/ | ||||
GAIAEXIF_DECLARE int gaiaExifTagGetSignedRational1Value (const | GAIAEXIF_DECLARE int gaiaExifTagGetSignedRational1Value (const | |||
gaiaExifTagPtr tag, | gaiaExifTagPtr tag, | |||
const int ind, | const int ind, | |||
int *ok); | int *ok); | |||
/** | ||||
Return a SRATIONAL [denominator] value from an EXIF tag | ||||
\param tag pointer to an EXIF tag. | ||||
\param ind value index [first value has index 0]. | ||||
\param ok on completion will contain 0 on failure: any other value on succ | ||||
ess. | ||||
\return the SRATIONAL [denominator] value | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaExifTagGetValueType, gaiaExifTagGetNumValues | ||||
*/ | ||||
GAIAEXIF_DECLARE int gaiaExifTagGetSignedRational2Value (const | GAIAEXIF_DECLARE int gaiaExifTagGetSignedRational2Value (const | |||
gaiaExifTagPtr tag, | gaiaExifTagPtr tag, | |||
const int ind, | const int ind, | |||
int *ok); | int *ok); | |||
/** | ||||
Return a Signed RATIONAL value from an EXIF tag | ||||
\param tag pointer to an EXIF tag. | ||||
\param ind value index [first value has index 0]. | ||||
\param ok on completion will contain 0 on failure: any other value on succ | ||||
ess. | ||||
\return the Signed RATIONAL value | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaExifTagGetValueType, gaiaExifTagGetNumValues | ||||
*/ | ||||
GAIAEXIF_DECLARE double gaiaExifTagGetSignedRationalValue (const | GAIAEXIF_DECLARE double gaiaExifTagGetSignedRationalValue (const | |||
gaiaExifTagPt r | gaiaExifTagPt r | |||
tag, | tag, | |||
const int ind , | const int ind , | |||
int *ok); | int *ok); | |||
/** | ||||
Return a FLOAT value from an EXIF tag | ||||
\param tag pointer to an EXIF tag. | ||||
\param ind value index [first value has index 0]. | ||||
\param ok on completion will contain 0 on failure: any other value on succ | ||||
ess. | ||||
\return the FLOAT value | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaExifTagGetValueType, gaiaExifTagGetNumValues | ||||
*/ | ||||
GAIAEXIF_DECLARE float gaiaExifTagGetFloatValue (const gaiaExifTagPtr t ag, | GAIAEXIF_DECLARE float gaiaExifTagGetFloatValue (const gaiaExifTagPtr t ag, | |||
const int ind, int *ok) ; | const int ind, int *ok) ; | |||
/** | ||||
Return a DOUBLE value from an EXIF tag | ||||
\param tag pointer to an EXIF tag. | ||||
\param ind value index [first value has index 0]. | ||||
\param ok on completion will contain 0 on failure: any other value on succ | ||||
ess. | ||||
\return the DOUBLE value | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaExifTagGetValueType, gaiaExifTagGetNumValues | ||||
*/ | ||||
GAIAEXIF_DECLARE double gaiaExifTagGetDoubleValue (const gaiaExifTagPtr tag, | GAIAEXIF_DECLARE double gaiaExifTagGetDoubleValue (const gaiaExifTagPtr tag, | |||
const int ind, int *o k); | const int ind, int *o k); | |||
/** | ||||
Return a human readable description from an EXIF tag | ||||
\param tag pointer to an EXIF tag. | ||||
\param str receiving buffer: the STRING value will be copied here. | ||||
\param len length of the receiving buffer | ||||
\param ok on completion will contain 0 on failure: any other value on succ | ||||
ess. | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName | ||||
*/ | ||||
GAIAEXIF_DECLARE void gaiaExifTagGetHumanReadable (const gaiaExifTagPtr tag, | GAIAEXIF_DECLARE void gaiaExifTagGetHumanReadable (const gaiaExifTagPtr tag, | |||
char *str, int len, | char *str, int len, | |||
int *ok); | int *ok); | |||
/** | ||||
Attempts to guess the actual content-type of some BLOB | ||||
\param blob the BLOB to be parsed | ||||
\param size length of the BLOB (in bytes) | ||||
\return the BLOB type: one of GAIA_HEX_BLOB, GAIA_GIF_BLOB, GAIA_PNG_BLOB, | ||||
GAIA_JPEG_BLOB, GAIA_EXIF_BLOB, GAIA_EXIF_GPS_BLOB, GAIA_ZIP_BLOB, | ||||
GAIA_PDF_BLOB, GAIA_GEOMETRY_BLOB, GAIA_TIFF_BLOB | ||||
*/ | ||||
GAIAEXIF_DECLARE int gaiaGuessBlobType (const unsigned char *blob, | GAIAEXIF_DECLARE int gaiaGuessBlobType (const unsigned char *blob, | |||
int size); | int size); | |||
/** | ||||
Return longitude and latitude from an EXIF-GPS tag | ||||
\param blob the BLOB to be parsed | ||||
\param size length of the BLOB (in bytes) | ||||
\param longitude on success will contain the longitude coordinate | ||||
\param latitude on success will contain the latitude coordinate | ||||
\return 0 on failure: any other value on success | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaIsExifGpsTag | ||||
*/ | ||||
GAIAEXIF_DECLARE int gaiaGetGpsCoords (const unsigned char *blob, int s ize, | GAIAEXIF_DECLARE int gaiaGetGpsCoords (const unsigned char *blob, int s ize, | |||
double *longitude, double *latitu de); | double *longitude, double *latitu de); | |||
/** | ||||
Return a text string representing DMS coordinates from an EXIF-GPS tag | ||||
\param blob the BLOB to be parsed | ||||
\param size length of the BLOB (in bytes) | ||||
\param latlong receiving buffer: the text string will be copied here. | ||||
\param ll_size length of the receiving buffer | ||||
\return 0 on failure: any other value on success | ||||
\sa gaiaGetExifTagById, gaiaGetExifGpsTagById, gaiaGetExifTagByName, | ||||
gaiaIsExifGpsTag | ||||
*/ | ||||
GAIAEXIF_DECLARE int gaiaGetGpsLatLong (const unsigned char *blob, int size, | GAIAEXIF_DECLARE int gaiaGetGpsLatLong (const unsigned char *blob, int size, | |||
char *latlong, int ll_size); | char *latlong, int ll_size); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* _GAIAEXIF_H */ | #endif /* _GAIAEXIF_H */ | |||
End of changes. 79 change blocks. | ||||
1 lines changed or deleted | 452 lines changed or added | |||
gaiageo.h | gaiageo.h | |||
---|---|---|---|---|
/* | /* | |||
gaiageo.h -- Gaia common support for geometries | gaiageo.h -- Gaia common support for geometries | |||
version 2.4, 2009 September 17 | version 3.0, 2011 July 20 | |||
Author: Sandro Furieri a.furieri@lqt.it | Author: Sandro Furieri a.furieri@lqt.it | |||
-------------------------------------------------------------------------- ---- | -------------------------------------------------------------------------- ---- | |||
Version: MPL 1.1/GPL 2.0/LGPL 2.1 | Version: MPL 1.1/GPL 2.0/LGPL 2.1 | |||
The contents of this file are subject to the Mozilla Public License Versio n | The contents of this file are subject to the Mozilla Public License Versio n | |||
1.1 (the "License"); you may not use this file except in compliance with | 1.1 (the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | the License. You may obtain a copy of the License at | |||
skipping to change at line 46 | skipping to change at line 46 | |||
of those above. If you wish to allow use of your version of this file only | of those above. If you wish to allow use of your version of this file only | |||
under the terms of either the GPL or the LGPL, and not to allow others to | under the terms of either the GPL or the LGPL, and not to allow others to | |||
use your version of this file under the terms of the MPL, indicate your | use your version of this file under the terms of the MPL, indicate your | |||
decision by deleting the provisions above and replace them with the notice | decision by deleting the provisions above and replace them with the notice | |||
and other provisions required by the GPL or the LGPL. If you do not delete | and other provisions required by the GPL or the LGPL. If you do not delete | |||
the provisions above, a recipient may use your version of this file under | the provisions above, a recipient may use your version of this file under | |||
the terms of any one of the MPL, the GPL or the LGPL. | the terms of any one of the MPL, the GPL or the LGPL. | |||
*/ | */ | |||
/** | ||||
\file gaiageo.h | ||||
Geometry handling functions and constants | ||||
*/ | ||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS | ||||
/* stdio.h included for FILE objects. */ | /* stdio.h included for FILE objects. */ | |||
#include <stdio.h> | #include <stdio.h> | |||
#ifdef DLL_EXPORT | #ifdef DLL_EXPORT | |||
#define GAIAGEO_DECLARE __declspec(dllexport) | #define GAIAGEO_DECLARE __declspec(dllexport) | |||
#else | #else | |||
#define GAIAGEO_DECLARE extern | #define GAIAGEO_DECLARE extern | |||
#endif | #endif | |||
#endif | ||||
#ifndef _GAIAGEO_H | #ifndef _GAIAGEO_H | |||
#ifndef DOXYGEN_SHOULD_SKIP_THIS | ||||
#define _GAIAGEO_H | #define _GAIAGEO_H | |||
#ifdef __cplusplus | ||||
extern "C" | ||||
{ | ||||
#endif | #endif | |||
/* constant values for generic geometry classes */ | #include "gg_const.h" | |||
#define GAIA_TYPE_NONE 0 | #include "gg_structs.h" | |||
#define GAIA_TYPE_POINT 1 | #include "gg_core.h" | |||
#define GAIA_TYPE_LINESTRING 2 | #include "gg_mbr.h" | |||
#define GAIA_TYPE_POLYGON 3 | #include "gg_formats.h" | |||
#include "gg_dynamic.h" | ||||
/* constants that defines byte storage order */ | #include "gg_advanced.h" | |||
#define GAIA_BIG_ENDIAN 0 | ||||
#define GAIA_LITTLE_ENDIAN 1 | ||||
/* constants that defines special markers used for encoding of SpatiaLite i | ||||
nternal BLOB geometries */ | ||||
#define GAIA_MARK_START 0x00 | ||||
#define GAIA_MARK_END 0xFE | ||||
#define GAIA_MARK_MBR 0x7C | ||||
#define GAIA_MARK_ENTITY 0x69 | ||||
/* constants that defines GEOMETRY CLASSes */ | ||||
#define GAIA_UNKNOWN 0 | ||||
#define GAIA_POINT 1 | ||||
#define GAIA_LINESTRING 2 | ||||
#define GAIA_POLYGON 3 | ||||
#define GAIA_MULTIPOINT 4 | ||||
#define GAIA_MULTILINESTRING 5 | ||||
#define GAIA_MULTIPOLYGON 6 | ||||
#define GAIA_GEOMETRYCOLLECTION 7 | ||||
#define GAIA_POINTZ 1001 | ||||
#define GAIA_LINESTRINGZ 1002 | ||||
#define GAIA_POLYGONZ 1003 | ||||
#define GAIA_MULTIPOINTZ 1004 | ||||
#define GAIA_MULTILINESTRINGZ 1005 | ||||
#define GAIA_MULTIPOLYGONZ 1006 | ||||
#define GAIA_GEOMETRYCOLLECTIONZ 1007 | ||||
#define GAIA_POINTM 2001 | ||||
#define GAIA_LINESTRINGM 2002 | ||||
#define GAIA_POLYGONM 2003 | ||||
#define GAIA_MULTIPOINTM 2004 | ||||
#define GAIA_MULTILINESTRINGM 2005 | ||||
#define GAIA_MULTIPOLYGONM 2006 | ||||
#define GAIA_GEOMETRYCOLLECTIONM 2007 | ||||
#define GAIA_POINTZM 3001 | ||||
#define GAIA_LINESTRINGZM 3002 | ||||
#define GAIA_POLYGONZM 3003 | ||||
#define GAIA_MULTIPOINTZM 3004 | ||||
#define GAIA_MULTILINESTRINGZM 3005 | ||||
#define GAIA_MULTIPOLYGONZM 3006 | ||||
#define GAIA_GEOMETRYCOLLECTIONZM 3007 | ||||
/* constants that defines Compressed GEOMETRY CLASSes */ | ||||
#define GAIA_COMPRESSED_LINESTRING 1000002 | ||||
#define GAIA_COMPRESSED_POLYGON 1000003 | ||||
#define GAIA_COMPRESSED_LINESTRINGZ 1001002 | ||||
#define GAIA_COMPRESSED_POLYGONZ 1001003 | ||||
#define GAIA_COMPRESSED_LINESTRINGM 1002002 | ||||
#define GAIA_COMPRESSED_POLYGONM 1002003 | ||||
#define GAIA_COMPRESSED_LINESTRINGZM 1003002 | ||||
#define GAIA_COMPRESSED_POLYGONZM 1003003 | ||||
/* constants that defines token codes for WKT parsing */ | ||||
#define GAIA_COORDINATE 8 | ||||
#define GAIA_OPENED 9 | ||||
#define GAIA_CLOSED 10 | ||||
#define GAIA_COMMA 11 | ||||
#define GAIA_SPACE 12 | ||||
/* constants that defines multitype values */ | ||||
#define GAIA_NULL_VALUE 0 | ||||
#define GAIA_TEXT_VALUE 1 | ||||
#define GAIA_INT_VALUE 2 | ||||
#define GAIA_DOUBLE_VALUE 3 | ||||
/* constants that defines POINT index for LINESTRING */ | ||||
#define GAIA_START_POINT 1 | ||||
#define GAIA_END_POINT 2 | ||||
#define GAIA_POINTN 3 | ||||
/* constants that defines MBRs spatial relationships */ | ||||
#define GAIA_MBR_CONTAINS 1 | ||||
#define GAIA_MBR_DISJOINT 2 | ||||
#define GAIA_MBR_EQUAL 3 | ||||
#define GAIA_MBR_INTERSECTS 4 | ||||
#define GAIA_MBR_OVERLAPS 5 | ||||
#define GAIA_MBR_TOUCHES 6 | ||||
#define GAIA_MBR_WITHIN 7 | ||||
/* constants used for FilterMBR */ | ||||
#define GAIA_FILTER_MBR_WITHIN 74 | ||||
#define GAIA_FILTER_MBR_CONTAINS 77 | ||||
#define GAIA_FILTER_MBR_INTERSECTS 79 | ||||
#define GAIA_FILTER_MBR_DECLARE 89 | ||||
/* constants defining SVG default values */ | ||||
#define GAIA_SVG_DEFAULT_RELATIVE 0 | ||||
#define GAIA_SVG_DEFAULT_PRECISION 6 | ||||
#define GAIA_SVG_DEFAULT_MAX_PRECISION 15 | ||||
/* constants used for VirtualNetwork */ | ||||
#define GAIA_NET_START 0x67 | ||||
#define GAIA_NET64_START 0x68 | ||||
#define GAIA_NET64_A_STAR_START 0x69 | ||||
#define GAIA_NET_END 0x87 | ||||
#define GAIA_NET_HEADER 0xc0 | ||||
#define GAIA_NET_CODE 0xa6 | ||||
#define GAIA_NET_ID 0xb5 | ||||
#define GAIA_NET_NODE 0xde | ||||
#define GAIA_NET_ARC 0x54 | ||||
#define GAIA_NET_TABLE 0xa0 | ||||
#define GAIA_NET_FROM 0xa1 | ||||
#define GAIA_NET_TO 0xa2 | ||||
#define GAIA_NET_GEOM 0xa3 | ||||
#define GAIA_NET_NAME 0xa4 | ||||
#define GAIA_NET_A_STAR_COEFF 0xa5 | ||||
#define GAIA_NET_BLOCK 0xed | ||||
/* constants used for Coordinate Dimensions */ | ||||
#define GAIA_XY 0x00 | ||||
#define GAIA_XY_Z 0x01 | ||||
#define GAIA_XY_M 0x02 | ||||
#define GAIA_XY_Z_M 0x03 | ||||
/* constants used for length unit conversion */ | ||||
#define GAIA_KM 0 | ||||
#define GAIA_M 1 | ||||
#define GAIA_DM 2 | ||||
#define GAIA_CM 3 | ||||
#define GAIA_MM 4 | ||||
#define GAIA_KMI 5 | ||||
#define GAIA_IN 6 | ||||
#define GAIA_FT 7 | ||||
#define GAIA_YD 8 | ||||
#define GAIA_MI 9 | ||||
#define GAIA_FATH 10 | ||||
#define GAIA_CH 11 | ||||
#define GAIA_LINK 12 | ||||
#define GAIA_US_IN 13 | ||||
#define GAIA_US_FT 14 | ||||
#define GAIA_US_YD 15 | ||||
#define GAIA_US_CH 16 | ||||
#define GAIA_US_MI 17 | ||||
#define GAIA_IND_YD 18 | ||||
#define GAIA_IND_FT 19 | ||||
#define GAIA_IND_CH 20 | ||||
#define GAIA_MIN_UNIT GAIA_KM | ||||
#define GAIA_MAX_UNIT GAIA_IND_CH | ||||
/* constants used for SHAPES */ | ||||
#define GAIA_SHP_NULL 0 | ||||
#define GAIA_SHP_POINT 1 | ||||
#define GAIA_SHP_POLYLINE 3 | ||||
#define GAIA_SHP_POLYGON 5 | ||||
#define GAIA_SHP_MULTIPOINT 8 | ||||
#define GAIA_SHP_POINTZ 11 | ||||
#define GAIA_SHP_POLYLINEZ 13 | ||||
#define GAIA_SHP_POLYGONZ 15 | ||||
#define GAIA_SHP_MULTIPOINTZ 18 | ||||
#define GAIA_SHP_POINTM 21 | ||||
#define GAIA_SHP_POLYLINEM 23 | ||||
#define GAIA_SHP_POLYGONM 25 | ||||
#define GAIA_SHP_MULTIPOINTM 28 | ||||
/* macros */ | ||||
#define gaiaGetPoint(xy,v,x,y) \ | ||||
{*x = xy[(v) * 2]; \ | ||||
*y = xy[(v) * 2 + 1];} | ||||
#define gaiaSetPoint(xy,v,x,y) \ | ||||
{xy[(v) * 2] = x; \ | ||||
xy[(v) * 2 + 1] = y;} | ||||
#define gaiaGetPointXYZ(xyz,v,x,y,z) \ | ||||
{*x = xyz[(v) * 3]; \ | ||||
*y = xyz[(v) * 3 + 1]; \ | ||||
*z = xyz[(v) * 3 + 2];} | ||||
#define gaiaSetPointXYZ(xyz,v,x,y,z) \ | ||||
{xyz[(v) * 3] = x; \ | ||||
xyz[(v) * 3 + 1] = y; \ | ||||
xyz[(v) * 3 + 2] = z;} | ||||
#define gaiaGetPointXYM(xym,v,x,y,m) \ | ||||
{*x = xym[(v) * 3]; \ | ||||
*y = xym[(v) * 3 + 1]; \ | ||||
*m = xym[(v) * 3 + 2];} | ||||
#define gaiaSetPointXYM(xym,v,x,y,m) \ | ||||
{xym[(v) * 3] = x; \ | ||||
xym[(v) * 3 + 1] = y; \ | ||||
xym[(v) * 3 + 2] = m;} | ||||
#define gaiaGetPointXYZM(xyzm,v,x,y,z,m) \ | ||||
{*x = xyzm[(v) * 4]; \ | ||||
*y = xyzm[(v) * 4 + 1]; \ | ||||
*z = xyzm[(v) * 4 + 2]; \ | ||||
*m = xyzm[(v) * 4 + 3];} | ||||
#define gaiaSetPointXYZM(xyzm,v,x,y,z,m) \ | ||||
{xyzm[(v) * 4] = x; \ | ||||
xyzm[(v) * 4 + 1] = y; \ | ||||
xyzm[(v) * 4 + 2] = z; \ | ||||
xyzm[(v) * 4 + 3] = m;} | ||||
typedef struct gaiaPointStruct | ||||
{ | ||||
/* an OpenGis POINT */ | ||||
double X; /* X,Y coordinates */ | ||||
double Y; | ||||
double Z; /* Z coordinate */ | ||||
double M; /* M measure */ | ||||
int DimensionModel; /* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */ | ||||
struct gaiaPointStruct *Next; /* for double-linked list */ | ||||
struct gaiaPointStruct *Prev; /* for double-linked list */ | ||||
} gaiaPoint; | ||||
typedef gaiaPoint *gaiaPointPtr; | ||||
typedef struct gaiaDynamicLineStruct | ||||
{ | ||||
/* a generic DYNAMIC LINE object */ | ||||
int Error; | ||||
int Srid; | ||||
gaiaPointPtr First; /* Points linked list - first */ | ||||
gaiaPointPtr Last; /* Points linked list - last */ | ||||
} gaiaDynamicLine; | ||||
typedef gaiaDynamicLine *gaiaDynamicLinePtr; | ||||
typedef struct gaiaLinestringStruct | ||||
{ | ||||
/* an OpenGis LINESTRING */ | ||||
int Points; /* number of vertices */ | ||||
double *Coords; /* X,Y [vertices] array */ | ||||
double MinX; /* MBR - BBOX */ | ||||
double MinY; /* MBR - BBOX */ | ||||
double MaxX; /* MBR - BBOX */ | ||||
double MaxY; /* MBR - BBOX */ | ||||
int DimensionModel; /* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */ | ||||
struct gaiaLinestringStruct *Next; /* for linked list */ | ||||
} gaiaLinestring; | ||||
typedef gaiaLinestring *gaiaLinestringPtr; | ||||
typedef struct gaiaRingStruct | ||||
{ | ||||
/* a GIS ring - OpenGis LINESTRING, closed */ | ||||
int Points; /* number of vertices */ | ||||
double *Coords; /* X,Y [vertices] array */ | ||||
int Clockwise; /* clockwise / counterclockwise */ | ||||
double MinX; /* MBR - BBOX */ | ||||
double MinY; /* MBR - BBOX */ | ||||
double MaxX; /* MBR - BBOX */ | ||||
double MaxY; /* MBR - BBOX */ | ||||
int DimensionModel; /* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */ | ||||
struct gaiaRingStruct *Next; /* for linked list */ | ||||
struct gaiaPolygonStruct *Link; /* polygon reference */ | ||||
} gaiaRing; | ||||
typedef gaiaRing *gaiaRingPtr; | ||||
typedef struct gaiaPolygonStruct | ||||
{ | ||||
/* an OpenGis POLYGON */ | ||||
gaiaRingPtr Exterior; /* exterior ring */ | ||||
int NumInteriors; /* number of interior rings */ | ||||
gaiaRingPtr Interiors; /* interior rings array */ | ||||
int NextInterior; /* first free interior ring */ | ||||
double MinX; /* MBR - BBOX */ | ||||
double MinY; /* MBR - BBOX */ | ||||
double MaxX; /* MBR - BBOX */ | ||||
double MaxY; /* MBR - BBOX */ | ||||
int DimensionModel; /* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */ | ||||
struct gaiaPolygonStruct *Next; /* for linked list */ | ||||
} gaiaPolygon; | ||||
typedef gaiaPolygon *gaiaPolygonPtr; | ||||
typedef struct gaiaGeomCollStruct | ||||
{ | ||||
/* OpenGis GEOMETRYCOLLECTION */ | ||||
int Srid; /* the SRID value for this GEOMETRY */ | ||||
char endian_arch; /* littleEndian - bigEndian arch for targer | ||||
CPU */ | ||||
char endian; /* littleEndian - bigEndian */ | ||||
const unsigned char *blob; /* WKB encoded buffer */ | ||||
unsigned long size; /* buffer size */ | ||||
unsigned long offset; /* current offset [for parsing] */ | ||||
gaiaPointPtr FirstPoint; /* Points linked list - first */ | ||||
gaiaPointPtr LastPoint; /* Points linked list - last */ | ||||
gaiaLinestringPtr FirstLinestring; /* Linestrings linked list - | ||||
first */ | ||||
gaiaLinestringPtr LastLinestring; /* Linestrings linked list - | ||||
last */ | ||||
gaiaPolygonPtr FirstPolygon; /* Polygons linked list - first */ | ||||
gaiaPolygonPtr LastPolygon; /* Polygons linked list - last */ | ||||
double MinX; /* MBR - BBOX */ | ||||
double MinY; /* MBR - BBOX */ | ||||
double MaxX; /* MBR - BBOX */ | ||||
double MaxY; /* MBR - BBOX */ | ||||
int DimensionModel; /* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */ | ||||
int DeclaredType; /* the declared TYPE for this Geometry */ | ||||
struct gaiaGeomCollStruct *Next; /* Vanuatu - used for linked | ||||
list */ | ||||
} gaiaGeomColl; | ||||
typedef gaiaGeomColl *gaiaGeomCollPtr; | ||||
typedef struct gaiaPreRingStruct | ||||
{ | ||||
/* a LINESTRING used to build rings */ | ||||
gaiaLinestringPtr Line; /* a LINESTRING pointer */ | ||||
int AlreadyUsed; /* a switch to mark an already used line ele | ||||
ment */ | ||||
struct gaiaPreRingStruct *Next; /* for linked list */ | ||||
} gaiaPreRing; | ||||
typedef gaiaPreRing *gaiaPreRingPtr; | ||||
typedef struct gaiaValueStruct | ||||
{ | ||||
/* a DBF field multitype value */ | ||||
short Type; /* the type */ | ||||
char *TxtValue; /* the text value */ | ||||
sqlite3_int64 IntValue; /* the integer value */ | ||||
double DblValue; /* the double value */ | ||||
} gaiaValue; | ||||
typedef gaiaValue *gaiaValuePtr; | ||||
typedef struct gaiaDbfFieldStruct | ||||
{ | ||||
/* a DBF field definition - shapefile attribute */ | ||||
char *Name; /* field name */ | ||||
unsigned char Type; /* field type */ | ||||
int Offset; /* buffer offset [this field begins at *buff | ||||
er+offset* and extends for *length* bytes */ | ||||
unsigned char Length; /* field total lenght [in bytes] */ | ||||
unsigned char Decimals; /* decimal positions */ | ||||
gaiaValuePtr Value; /* the current multitype value for this attr | ||||
ibute */ | ||||
struct gaiaDbfFieldStruct *Next; /* pointer to next element i | ||||
n linked list */ | ||||
} gaiaDbfField; | ||||
typedef gaiaDbfField *gaiaDbfFieldPtr; | ||||
typedef struct gaiaDbfListStruct | ||||
{ | ||||
/* a linked list to containt the DBF fields definitions - shapefile attribu | ||||
tes */ | ||||
int RowId; /* the current RowId */ | ||||
gaiaGeomCollPtr Geometry; /* geometry for current entity */ | ||||
gaiaDbfFieldPtr First; /* pointer to first element in linked list * | ||||
/ | ||||
gaiaDbfFieldPtr Last; /* pointer to last element in linker list */ | ||||
} gaiaDbfList; | ||||
typedef gaiaDbfList *gaiaDbfListPtr; | ||||
typedef struct gaiaDbfStruct | ||||
{ | ||||
/* DBF TYPE */ | ||||
int endian_arch; | ||||
int Valid; /* 1 = ready to process */ | ||||
char *Path; /* the DBF path */ | ||||
FILE *flDbf; /* the DBF file handle */ | ||||
gaiaDbfListPtr Dbf; /* the DBF attributes list */ | ||||
unsigned char *BufDbf; /* the DBF I/O buffer */ | ||||
int DbfHdsz; /* the DBF header length */ | ||||
int DbfReclen; /* the DBF record length */ | ||||
int DbfSize; /* current DBF size */ | ||||
int DbfRecno; /* current DBF record number */ | ||||
void *IconvObj; /* opaque reference to ICONV converter */ | ||||
char *LastError; /* last error message */ | ||||
} gaiaDbf; | ||||
typedef gaiaDbf *gaiaDbfPtr; | ||||
typedef struct gaiaShapefileStruct | ||||
{ | ||||
/* SHAPEFILE TYPE */ | ||||
int endian_arch; | ||||
int Valid; /* 1 = ready to process */ | ||||
int ReadOnly; /* read or write mode */ | ||||
char *Path; /* the shapefile abstract path [no suffixes] | ||||
*/ | ||||
FILE *flShx; /* the SHX file handle */ | ||||
FILE *flShp; /* the SHP file handle */ | ||||
FILE *flDbf; /* the DBF file handle */ | ||||
int Shape; /* the SHAPE code for the whole shapefile */ | ||||
gaiaDbfListPtr Dbf; /* the DBF attributes list */ | ||||
unsigned char *BufDbf; /* the DBF I/O buffer */ | ||||
int DbfHdsz; /* the DBF header length */ | ||||
int DbfReclen; /* the DBF record length */ | ||||
int DbfSize; /* current DBF size */ | ||||
int DbfRecno; /* current DBF record number */ | ||||
unsigned char *BufShp; /* the SHP I/O buffer */ | ||||
int ShpBfsz; /* the SHP buffer current size */ | ||||
int ShpSize; /* current SHP size */ | ||||
int ShxSize; /* current SHX size */ | ||||
double MinX; /* the MBR/BBOX for the whole shapefile */ | ||||
double MinY; | ||||
double MaxX; | ||||
double MaxY; | ||||
void *IconvObj; /* opaque reference to ICONV converter */ | ||||
char *LastError; /* last error message */ | ||||
int EffectiveType; /* the effective Geometry-type, as determine | ||||
d by gaiaShpAnalyze() */ | ||||
int EffectiveDims; /* the effective Dimensions [XY, XYZ, XYM, X | ||||
YZM], as determined by gaiaShpAnalyze() */ | ||||
} gaiaShapefile; | ||||
typedef gaiaShapefile *gaiaShapefilePtr; | ||||
typedef struct gaiaOutBufferStruct | ||||
{ | ||||
/* a struct handling a dynamically growing output buffer */ | ||||
char *Buffer; | ||||
int WriteOffset; | ||||
int BufferSize; | ||||
int Error; | ||||
} gaiaOutBuffer; | ||||
typedef gaiaOutBuffer *gaiaOutBufferPtr; | ||||
#ifndef OMIT_ICONV /* ICONV enabled: supporting text reader */ | ||||
#define VRTTXT_FIELDS_MAX 65535 | ||||
#define VRTTXT_BLOCK_MAX 65535 | ||||
#define VRTTXT_TEXT 1 | ||||
#define VRTTXT_INTEGER 2 | ||||
#define VRTTXT_DOUBLE 3 | ||||
#define VRTTXT_NULL 4 | ||||
struct vrttxt_line | ||||
{ | ||||
/* a struct representing a full LINE (aka Record) */ | ||||
off_t offset; | ||||
int len; | ||||
int field_offsets[VRTTXT_FIELDS_MAX]; | ||||
int num_fields; | ||||
int error; | ||||
}; | ||||
struct vrttxt_row | ||||
{ | ||||
/* a struct storing Row offsets */ | ||||
int line_no; | ||||
off_t offset; | ||||
int len; | ||||
int num_fields; | ||||
}; | ||||
struct vrttxt_row_block | ||||
{ | ||||
/* | ||||
/ for efficiency sake, individuale Row offsets | ||||
/ are grouped in reasonably sized blocks | ||||
*/ | ||||
struct vrttxt_row rows[VRTTXT_BLOCK_MAX]; | ||||
int num_rows; | ||||
int min_line_no; | ||||
int max_line_no; | ||||
struct vrttxt_row_block *next; | ||||
}; | ||||
struct vrttxt_column_header | ||||
{ | ||||
/* a struct representing a Column (aka Field) header */ | ||||
char *name; | ||||
int type; | ||||
}; | ||||
typedef struct vrttxt_reader | ||||
{ | ||||
/* the main TXT-Reader struct */ | ||||
struct vrttxt_column_header columns[VRTTXT_FIELDS_MAX]; | ||||
FILE *text_file; | ||||
void *toUtf8; /* the UTF-8 ICONV converter */ | ||||
char field_separator; | ||||
char text_separator; | ||||
char decimal_separator; | ||||
int first_line_titles; | ||||
int error; | ||||
struct vrttxt_row_block *first; | ||||
struct vrttxt_row_block *last; | ||||
struct vrttxt_row **rows; | ||||
int num_rows; | ||||
int line_no; | ||||
int max_fields; | ||||
int current_buf_sz; | ||||
int current_buf_off; | ||||
char *line_buffer; | ||||
char *field_buffer; | ||||
int field_offsets[VRTTXT_FIELDS_MAX]; | ||||
int field_lens[VRTTXT_FIELDS_MAX]; | ||||
int max_current_field; | ||||
int current_line_ready; | ||||
} gaiaTextReader; | ||||
typedef gaiaTextReader *gaiaTextReaderPtr; | ||||
#endif /* end ICONV (text reader) */ | ||||
/* function prototipes */ | ||||
GAIAGEO_DECLARE int gaiaEndianArch (void); | ||||
GAIAGEO_DECLARE short gaiaImport16 (const unsigned char *p, | ||||
int little_endian, | ||||
int little_endian_arch); | ||||
GAIAGEO_DECLARE int gaiaImport32 (const unsigned char *p, int little_en | ||||
dian, | ||||
int little_endian_arch); | ||||
GAIAGEO_DECLARE float gaiaImportF32 (const unsigned char *p, | ||||
int little_endian, | ||||
int little_endian_arch); | ||||
GAIAGEO_DECLARE double gaiaImport64 (const unsigned char *p, | ||||
int little_endian, | ||||
int little_endian_arch); | ||||
GAIAGEO_DECLARE sqlite3_int64 gaiaImportI64 (const unsigned char *p, | ||||
int little_endian, | ||||
int little_endian_arch); | ||||
GAIAGEO_DECLARE void gaiaExport16 (unsigned char *p, short value, | ||||
int little_endian, | ||||
int little_endian_arch); | ||||
GAIAGEO_DECLARE void gaiaExport32 (unsigned char *p, int value, | ||||
int little_endian, | ||||
int little_endian_arch); | ||||
GAIAGEO_DECLARE void gaiaExportF32 (unsigned char *p, float value, | ||||
int little_endian, | ||||
int little_endian_arch); | ||||
GAIAGEO_DECLARE void gaiaExport64 (unsigned char *p, double value, | ||||
int little_endian, | ||||
int little_endian_arch); | ||||
GAIAGEO_DECLARE void gaiaExportI64 (unsigned char *p, sqlite3_int64 val | ||||
ue, | ||||
int little_endian, | ||||
int little_endian_arch); | ||||
GAIAGEO_DECLARE gaiaPointPtr gaiaAllocPoint (double x, double y); | ||||
GAIAGEO_DECLARE gaiaPointPtr gaiaAllocPointXYZ (double x, double y, | ||||
double z); | ||||
GAIAGEO_DECLARE gaiaPointPtr gaiaAllocPointXYM (double x, double y, | ||||
double m); | ||||
GAIAGEO_DECLARE gaiaPointPtr gaiaAllocPointXYZM (double x, double y, | ||||
double z, double m); | ||||
GAIAGEO_DECLARE void gaiaFreePoint (gaiaPointPtr ptr); | ||||
GAIAGEO_DECLARE gaiaLinestringPtr gaiaAllocLinestring (int vert); | ||||
GAIAGEO_DECLARE gaiaLinestringPtr gaiaAllocLinestringXYZ (int vert); | ||||
GAIAGEO_DECLARE gaiaLinestringPtr gaiaAllocLinestringXYM (int vert); | ||||
GAIAGEO_DECLARE gaiaLinestringPtr gaiaAllocLinestringXYZM (int vert); | ||||
GAIAGEO_DECLARE void gaiaFreeLinestring (gaiaLinestringPtr ptr); | ||||
GAIAGEO_DECLARE void gaiaCopyLinestringCoords (gaiaLinestringPtr dst, | ||||
gaiaLinestringPtr src); | ||||
GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRing (int vert); | ||||
GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRingXYZ (int vert); | ||||
GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRingXYM (int vert); | ||||
GAIAGEO_DECLARE gaiaRingPtr gaiaAllocRingXYZM (int vert); | ||||
GAIAGEO_DECLARE void gaiaFreeRing (gaiaRingPtr ptr); | ||||
GAIAGEO_DECLARE void gaiaCopyRingCoords (gaiaRingPtr dst, gaiaRingPtr s | ||||
rc); | ||||
GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygon (int vert, int excl); | ||||
GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygonXYZ (int vert, int excl) | ||||
; | ||||
GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygonXYM (int vert, int excl) | ||||
; | ||||
GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygonXYZM (int vert, int excl | ||||
); | ||||
GAIAGEO_DECLARE gaiaPolygonPtr gaiaCreatePolygon (gaiaRingPtr ring); | ||||
GAIAGEO_DECLARE void gaiaFreePolygon (gaiaPolygonPtr p); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomColl (void); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomCollXYZ (void); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomCollXYM (void); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaAllocGeomCollXYZM (void); | ||||
GAIAGEO_DECLARE void gaiaFreeGeomColl (gaiaGeomCollPtr p); | ||||
GAIAGEO_DECLARE void gaiaAddPointToGeomColl (gaiaGeomCollPtr p, double | ||||
x, | ||||
double y); | ||||
GAIAGEO_DECLARE void gaiaAddPointToGeomCollXYZ (gaiaGeomCollPtr p, doub | ||||
le x, | ||||
double y, double z); | ||||
GAIAGEO_DECLARE void gaiaAddPointToGeomCollXYM (gaiaGeomCollPtr p, doub | ||||
le x, | ||||
double y, double m); | ||||
GAIAGEO_DECLARE void gaiaAddPointToGeomCollXYZM (gaiaGeomCollPtr p, | ||||
double x, double y, | ||||
double z, double m); | ||||
GAIAGEO_DECLARE void gaiaMbrLinestring (gaiaLinestringPtr line); | ||||
GAIAGEO_DECLARE void gaiaMbrRing (gaiaRingPtr rng); | ||||
GAIAGEO_DECLARE void gaiaMbrPolygon (gaiaPolygonPtr polyg); | ||||
GAIAGEO_DECLARE void gaiaMbrGeometry (gaiaGeomCollPtr geom); | ||||
GAIAGEO_DECLARE void gaiaZRangeLinestring (gaiaLinestringPtr line, | ||||
double *min, double *max); | ||||
GAIAGEO_DECLARE void gaiaZRangeRing (gaiaRingPtr rng, double *min, | ||||
double *max); | ||||
GAIAGEO_DECLARE void gaiaZRangePolygon (gaiaPolygonPtr polyg, double *m | ||||
in, | ||||
double *max); | ||||
GAIAGEO_DECLARE void gaiaZRangeGeometry (gaiaGeomCollPtr geom, double * | ||||
min, | ||||
double *max); | ||||
GAIAGEO_DECLARE void gaiaMRangeLinestring (gaiaLinestringPtr line, | ||||
double *min, double *max); | ||||
GAIAGEO_DECLARE void gaiaMRangeRing (gaiaRingPtr rng, double *min, | ||||
double *max); | ||||
GAIAGEO_DECLARE void gaiaMRangePolygon (gaiaPolygonPtr polyg, double *m | ||||
in, | ||||
double *max); | ||||
GAIAGEO_DECLARE void gaiaMRangeGeometry (gaiaGeomCollPtr geom, double * | ||||
min, | ||||
double *max); | ||||
GAIAGEO_DECLARE gaiaLinestringPtr | ||||
gaiaAddLinestringToGeomColl (gaiaGeomCollPtr p, int vert); | ||||
GAIAGEO_DECLARE void gaiaInsertLinestringInGeomColl (gaiaGeomCollPtr p, | ||||
gaiaLinestringPtr | ||||
line); | ||||
GAIAGEO_DECLARE gaiaPolygonPtr gaiaAddPolygonToGeomColl (gaiaGeomCollPt | ||||
r p, | ||||
int vert, | ||||
int interiors); | ||||
GAIAGEO_DECLARE gaiaPolygonPtr gaiaInsertPolygonInGeomColl (gaiaGeomCol | ||||
lPtr | ||||
p, | ||||
gaiaRingPtr | ||||
ring); | ||||
GAIAGEO_DECLARE gaiaRingPtr gaiaAddInteriorRing (gaiaPolygonPtr p, int | ||||
pos, | ||||
int vert); | ||||
GAIAGEO_DECLARE void gaiaInsertInteriorRing (gaiaPolygonPtr p, | ||||
gaiaRingPtr ring); | ||||
GAIAGEO_DECLARE void gaiaAddRingToPolyg (gaiaPolygonPtr polyg, | ||||
gaiaRingPtr ring); | ||||
GAIAGEO_DECLARE gaiaDynamicLinePtr gaiaAllocDynamicLine (void); | ||||
GAIAGEO_DECLARE void gaiaFreeDynamicLine (gaiaDynamicLinePtr p); | ||||
GAIAGEO_DECLARE gaiaPointPtr | ||||
gaiaAppendPointToDynamicLine (gaiaDynamicLinePtr p, double x, double | ||||
y); | ||||
GAIAGEO_DECLARE gaiaPointPtr | ||||
gaiaAppendPointZToDynamicLine (gaiaDynamicLinePtr p, double x, doubl | ||||
e y, | ||||
double z); | ||||
GAIAGEO_DECLARE gaiaPointPtr | ||||
gaiaAppendPointMToDynamicLine (gaiaDynamicLinePtr p, double x, doubl | ||||
e y, | ||||
double m); | ||||
GAIAGEO_DECLARE gaiaPointPtr | ||||
gaiaAppendPointZMToDynamicLine (gaiaDynamicLinePtr p, double x, | ||||
double y, double z, double m); | ||||
GAIAGEO_DECLARE gaiaPointPtr | ||||
gaiaPrependPointToDynamicLine (gaiaDynamicLinePtr p, double x, | ||||
double y); | ||||
GAIAGEO_DECLARE gaiaPointPtr | ||||
gaiaPrependPointZToDynamicLine (gaiaDynamicLinePtr p, double x, | ||||
double y, double z); | ||||
GAIAGEO_DECLARE gaiaPointPtr | ||||
gaiaPrependPointMToDynamicLine (gaiaDynamicLinePtr p, double x, | ||||
double y, double m); | ||||
GAIAGEO_DECLARE gaiaPointPtr | ||||
gaiaPrependPointZMToDynamicLine (gaiaDynamicLinePtr p, double x, | ||||
double y, double z, double m); | ||||
GAIAGEO_DECLARE gaiaPointPtr gaiaDynamicLineInsertAfter (gaiaDynamicLin | ||||
ePtr | ||||
p, gaiaPointPtr | ||||
pt, | ||||
double x, | ||||
double y); | ||||
GAIAGEO_DECLARE gaiaPointPtr gaiaDynamicLineInsertBefore (gaiaDynamicLi | ||||
nePtr | ||||
p, | ||||
gaiaPointPtr p | ||||
t, | ||||
double x, | ||||
double y); | ||||
GAIAGEO_DECLARE void gaiaDynamicLineDeletePoint (gaiaDynamicLinePtr p, | ||||
gaiaPointPtr pt); | ||||
GAIAGEO_DECLARE gaiaDynamicLinePtr gaiaCloneDynamicLine (gaiaDynamicLin | ||||
ePtr | ||||
org); | ||||
GAIAGEO_DECLARE gaiaDynamicLinePtr | ||||
gaiaReverseDynamicLine (gaiaDynamicLinePtr org); | ||||
GAIAGEO_DECLARE gaiaDynamicLinePtr | ||||
gaiaDynamicLineSplitBefore (gaiaDynamicLinePtr org, gaiaPointPtr poi | ||||
nt); | ||||
GAIAGEO_DECLARE gaiaDynamicLinePtr | ||||
gaiaDynamicLineSplitAfter (gaiaDynamicLinePtr org, gaiaPointPtr poin | ||||
t); | ||||
GAIAGEO_DECLARE gaiaDynamicLinePtr | ||||
gaiaDynamicLineJoinAfter (gaiaDynamicLinePtr org, gaiaPointPtr point | ||||
, | ||||
gaiaDynamicLinePtr toJoin); | ||||
GAIAGEO_DECLARE gaiaDynamicLinePtr | ||||
gaiaDynamicLineJoinBefore (gaiaDynamicLinePtr org, gaiaPointPtr poin | ||||
t, | ||||
gaiaDynamicLinePtr toJoin); | ||||
GAIAGEO_DECLARE gaiaPointPtr gaiaDynamicLineFindByCoords (gaiaDynamicLi | ||||
nePtr | ||||
p, double x, | ||||
double y); | ||||
GAIAGEO_DECLARE gaiaPointPtr gaiaDynamicLineFindByPos (gaiaDynamicLineP | ||||
tr p, | ||||
int pos); | ||||
GAIAGEO_DECLARE gaiaDynamicLinePtr gaiaCreateDynamicLine (double *coord | ||||
s, | ||||
int points); | ||||
GAIAGEO_DECLARE double gaiaMeasureLength (int dims, double *coords, | ||||
int vert); | ||||
GAIAGEO_DECLARE double gaiaMeasureArea (gaiaRingPtr ring); | ||||
GAIAGEO_DECLARE void gaiaRingCentroid (gaiaRingPtr ring, double *rx, | ||||
double *ry); | ||||
GAIAGEO_DECLARE void gaiaClockwise (gaiaRingPtr p); | ||||
GAIAGEO_DECLARE int gaiaIsPointOnRingSurface (gaiaRingPtr ring, double | ||||
pt_x, | ||||
double pt_y); | ||||
GAIAGEO_DECLARE double gaiaMinDistance (double x0, double y0, | ||||
int dims, double *coords, | ||||
int n_vert); | ||||
GAIAGEO_DECLARE int gaiaIsPointOnPolygonSurface (gaiaPolygonPtr polyg, | ||||
double x, double y); | ||||
GAIAGEO_DECLARE int gaiaIntersect (double *x0, double *y0, double x1, | ||||
double y1, double x2, double y2, | ||||
double x3, double y3, double x4, | ||||
double y4); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromSpatiaLiteBlobWkb (const unsign | ||||
ed | ||||
char *blob, | ||||
unsigned int | ||||
size); | ||||
GAIAGEO_DECLARE void gaiaToSpatiaLiteBlobWkb (gaiaGeomCollPtr geom, | ||||
unsigned char **result, | ||||
int *size); | ||||
GAIAGEO_DECLARE void gaiaToCompressedBlobWkb (gaiaGeomCollPtr geom, | ||||
unsigned char **result, | ||||
int *size); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromSpatiaLiteBlobMbr (const unsign | ||||
ed | ||||
char *blob, | ||||
unsigned int | ||||
size); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromWkb (const unsigned char *blob, | ||||
unsigned int size); | ||||
GAIAGEO_DECLARE void gaiaToWkb (gaiaGeomCollPtr geom, | ||||
unsigned char **result, int *size); | ||||
GAIAGEO_DECLARE char *gaiaToHexWkb (gaiaGeomCollPtr geom); | ||||
GAIAGEO_DECLARE void gaiaFreeValue (gaiaValuePtr p); | ||||
GAIAGEO_DECLARE void gaiaSetNullValue (gaiaDbfFieldPtr field); | ||||
GAIAGEO_DECLARE void gaiaSetIntValue (gaiaDbfFieldPtr field, | ||||
sqlite3_int64 value); | ||||
GAIAGEO_DECLARE void gaiaSetDoubleValue (gaiaDbfFieldPtr field, | ||||
double value); | ||||
GAIAGEO_DECLARE void gaiaSetStrValue (gaiaDbfFieldPtr field, char *str) | ||||
; | ||||
GAIAGEO_DECLARE gaiaDbfFieldPtr gaiaAllocDbfField (char *name, | ||||
unsigned char type, | ||||
int offset, | ||||
unsigned char length, | ||||
unsigned char decimal | ||||
s); | ||||
GAIAGEO_DECLARE void gaiaFreeDbfField (gaiaDbfFieldPtr p); | ||||
GAIAGEO_DECLARE gaiaDbfFieldPtr gaiaCloneDbfField (gaiaDbfFieldPtr org) | ||||
; | ||||
GAIAGEO_DECLARE gaiaDbfListPtr gaiaAllocDbfList (void); | ||||
GAIAGEO_DECLARE void gaiaFreeDbfList (gaiaDbfListPtr list); | ||||
GAIAGEO_DECLARE int gaiaIsValidDbfList (gaiaDbfListPtr list); | ||||
GAIAGEO_DECLARE gaiaDbfFieldPtr gaiaAddDbfField (gaiaDbfListPtr list, | ||||
char *name, | ||||
unsigned char type, | ||||
int offset, | ||||
unsigned char length, | ||||
unsigned char decimals) | ||||
; | ||||
GAIAGEO_DECLARE void gaiaResetDbfEntity (gaiaDbfListPtr list); | ||||
GAIAGEO_DECLARE gaiaValuePtr gaiaCloneValue (gaiaValuePtr org); | ||||
GAIAGEO_DECLARE gaiaDbfListPtr gaiaCloneDbfEntity (gaiaDbfListPtr org); | ||||
GAIAGEO_DECLARE gaiaShapefilePtr gaiaAllocShapefile (void); | ||||
GAIAGEO_DECLARE void gaiaFreeShapefile (gaiaShapefilePtr shp); | ||||
GAIAGEO_DECLARE void gaiaOpenShpRead (gaiaShapefilePtr shp, | ||||
const char *path, | ||||
const char *charFrom, | ||||
const char *charTo); | ||||
GAIAGEO_DECLARE void gaiaOpenShpWrite (gaiaShapefilePtr shp, | ||||
const char *path, int shape, | ||||
gaiaDbfListPtr list, | ||||
const char *charFrom, | ||||
const char *charTo); | ||||
GAIAGEO_DECLARE int gaiaReadShpEntity (gaiaShapefilePtr shp, | ||||
int current_row, int srid); | ||||
GAIAGEO_DECLARE void gaiaShpAnalyze (gaiaShapefilePtr shp); | ||||
GAIAGEO_DECLARE int gaiaWriteShpEntity (gaiaShapefilePtr shp, | ||||
gaiaDbfListPtr entity); | ||||
GAIAGEO_DECLARE void gaiaFlushShpHeaders (gaiaShapefilePtr shp); | ||||
GAIAGEO_DECLARE gaiaDbfPtr gaiaAllocDbf (void); | ||||
GAIAGEO_DECLARE void gaiaFreeDbf (gaiaDbfPtr dbf); | ||||
GAIAGEO_DECLARE void gaiaOpenDbfRead (gaiaDbfPtr dbf, | ||||
const char *path, | ||||
const char *charFrom, | ||||
const char *charTo); | ||||
GAIAGEO_DECLARE int gaiaReadDbfEntity (gaiaDbfPtr shp, int current_row, | ||||
int *deleted); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaParseWkt (const unsigned char | ||||
*dirty_buffer, short type) | ||||
; | ||||
GAIAGEO_DECLARE void gaiaOutWkt (gaiaOutBufferPtr out_buf, | ||||
gaiaGeomCollPtr geom); | ||||
GAIAGEO_DECLARE void gaiaOutSvg (gaiaOutBufferPtr out_buf, | ||||
gaiaGeomCollPtr geom, int relative, | ||||
int precision); | ||||
GAIAGEO_DECLARE void gaiaOutBareKml (gaiaOutBufferPtr out_buf, | ||||
gaiaGeomCollPtr geom, int precision | ||||
); | ||||
GAIAGEO_DECLARE void gaiaOutFullKml (gaiaOutBufferPtr out_buf, | ||||
const char *name, const char *desc, | ||||
gaiaGeomCollPtr geom, int precision | ||||
); | ||||
GAIAGEO_DECLARE void gaiaOutGml (gaiaOutBufferPtr out_buf, int version, | ||||
int precision, gaiaGeomCollPtr geom); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromFgf (const unsigned char *blob, | ||||
unsigned int size); | ||||
GAIAGEO_DECLARE void gaiaToFgf (gaiaGeomCollPtr geom, | ||||
unsigned char **result, int *size, | ||||
int coord_dims); | ||||
GAIAGEO_DECLARE int gaiaDimension (gaiaGeomCollPtr geom); | ||||
GAIAGEO_DECLARE int gaiaGeometryType (gaiaGeomCollPtr geom); | ||||
GAIAGEO_DECLARE int gaiaGeometryAliasType (gaiaGeomCollPtr geom); | ||||
GAIAGEO_DECLARE int gaiaIsEmpty (gaiaGeomCollPtr geom); | ||||
GAIAGEO_DECLARE int gaiaMbrsContains (gaiaGeomCollPtr mbr1, | ||||
gaiaGeomCollPtr mbr2); | ||||
GAIAGEO_DECLARE int gaiaMbrsDisjoint (gaiaGeomCollPtr mbr1, | ||||
gaiaGeomCollPtr mbr2); | ||||
GAIAGEO_DECLARE int gaiaMbrsEqual (gaiaGeomCollPtr mbr1, | ||||
gaiaGeomCollPtr mbr2); | ||||
GAIAGEO_DECLARE int gaiaMbrsIntersects (gaiaGeomCollPtr mbr1, | ||||
gaiaGeomCollPtr mbr2); | ||||
GAIAGEO_DECLARE int gaiaMbrsOverlaps (gaiaGeomCollPtr mbr1, | ||||
gaiaGeomCollPtr mbr2); | ||||
GAIAGEO_DECLARE int gaiaMbrsTouches (gaiaGeomCollPtr mbr1, | ||||
gaiaGeomCollPtr mbr2); | ||||
GAIAGEO_DECLARE int gaiaMbrsWithin (gaiaGeomCollPtr mbr1, | ||||
gaiaGeomCollPtr mbr2); | ||||
GAIAGEO_DECLARE void gaiaShiftCoords (gaiaGeomCollPtr geom, double shif | ||||
t_x, | ||||
double shift_y); | ||||
GAIAGEO_DECLARE void gaiaScaleCoords (gaiaGeomCollPtr geom, double scal | ||||
e_x, | ||||
double scale_y); | ||||
GAIAGEO_DECLARE void gaiaRotateCoords (gaiaGeomCollPtr geom, double ang | ||||
le); | ||||
GAIAGEO_DECLARE void gaiaReflectCoords (gaiaGeomCollPtr geom, int x_axi | ||||
s, | ||||
int y_axis); | ||||
GAIAGEO_DECLARE void gaiaSwapCoords (gaiaGeomCollPtr geom); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXY (gaiaGeomCollPtr g | ||||
eom); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXYZ (gaiaGeomCollPtr | ||||
geom); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXYM (gaiaGeomCollPtr | ||||
geom); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCastGeomCollToXYZM (gaiaGeomCollPtr | ||||
geom); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCloneGeomColl (gaiaGeomCollPtr geom | ||||
); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCloneGeomCollPoints (gaiaGeomCollPt | ||||
r | ||||
geom); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr | ||||
gaiaCloneGeomCollLinestrings (gaiaGeomCollPtr geom); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaCloneGeomCollPolygons (gaiaGeomColl | ||||
Ptr | ||||
geom); | ||||
GAIAGEO_DECLARE gaiaLinestringPtr gaiaCloneLinestring (gaiaLinestringPt | ||||
r | ||||
line); | ||||
GAIAGEO_DECLARE gaiaRingPtr gaiaCloneRing (gaiaRingPtr ring); | ||||
GAIAGEO_DECLARE gaiaPolygonPtr gaiaClonePolygon (gaiaPolygonPtr polyg); | ||||
GAIAGEO_DECLARE int gaiaLinestringEquals (gaiaLinestringPtr line1, | ||||
gaiaLinestringPtr line2); | ||||
GAIAGEO_DECLARE int gaiaPolygonEquals (gaiaPolygonPtr geom1, | ||||
gaiaPolygonPtr geom2); | ||||
GAIAGEO_DECLARE void gaiaMakePoint (double x, double y, int srid, | ||||
unsigned char **result, int *size); | ||||
GAIAGEO_DECLARE void gaiaMakeLine (gaiaGeomCollPtr geom1, | ||||
gaiaGeomCollPtr geom2, | ||||
unsigned char **result, int *size); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaMergeGeometries (gaiaGeomCollPtr ge | ||||
om1, | ||||
gaiaGeomCollPtr geo | ||||
m2); | ||||
GAIAGEO_DECLARE void gaiaBuildMbr (double x1, double y1, double x2, | ||||
double y2, int srid, | ||||
unsigned char **result, int *size); | ||||
GAIAGEO_DECLARE void gaiaBuildFilterMbr (double x1, double y1, double x | ||||
2, | ||||
double y2, int mode, | ||||
unsigned char **result, int *si | ||||
ze); | ||||
GAIAGEO_DECLARE int gaiaParseFilterMbr (unsigned char *result, int size | ||||
, | ||||
double *minx, double *miny, | ||||
double *maxx, double *maxy, | ||||
int *mode); | ||||
GAIAGEO_DECLARE void gaiaBuildCircleMbr (double x, double y, double rad | ||||
ius, | ||||
int srid, unsigned char **resul | ||||
t, | ||||
int *size); | ||||
GAIAGEO_DECLARE int gaiaGetMbrMinX (const unsigned char *blob, | ||||
unsigned int size, double *minx); | ||||
GAIAGEO_DECLARE int gaiaGetMbrMaxX (const unsigned char *blob, | ||||
unsigned int size, double *maxx); | ||||
GAIAGEO_DECLARE int gaiaGetMbrMinY (const unsigned char *blob, | ||||
unsigned int size, double *miny); | ||||
GAIAGEO_DECLARE int gaiaGetMbrMaxY (const unsigned char *blob, | ||||
unsigned int size, double *maxy); | ||||
GAIAGEO_DECLARE void gaiaFree (void *ptr); | ||||
GAIAGEO_DECLARE int gaiaEllipseParams (const char *name, double *a, | ||||
double *b, double *rf); | ||||
GAIAGEO_DECLARE double gaiaGreatCircleDistance (double a, double b, | ||||
double lat1, double lon1 | ||||
, | ||||
double lat2, double lon2 | ||||
); | ||||
GAIAGEO_DECLARE double gaiaGeodesicDistance (double a, double b, double | ||||
rf, | ||||
double lat1, double lon1, | ||||
double lat2, double lon2); | ||||
GAIAGEO_DECLARE double gaiaGreatCircleTotalLength (double a, double b, | ||||
int dims, double *coo | ||||
rds, | ||||
int vert); | ||||
GAIAGEO_DECLARE double gaiaGeodesicTotalLength (double a, double b, | ||||
double rf, int dims, | ||||
double *coords, int vert | ||||
); | ||||
GAIAGEO_DECLARE int gaiaConvertLength (double value, int unit_from, | ||||
int unit_to, double *cvt); | ||||
GAIAGEO_DECLARE int gaiaLineGetPoint (gaiaLinestringPtr ln, int v, | ||||
double *x, double *y, double *z, | ||||
double *m); | ||||
GAIAGEO_DECLARE int gaiaLineSetPoint (gaiaLinestringPtr ln, int v, doub | ||||
le x, | ||||
double y, double z, double m); | ||||
GAIAGEO_DECLARE int gaiaRingGetPoint (gaiaRingPtr rng, int v, double *x | ||||
, | ||||
double *y, double *z, double *m); | ||||
GAIAGEO_DECLARE int gaiaRingSetPoint (gaiaRingPtr rng, int v, double x, | ||||
double y, double z, double m); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSanitize (gaiaGeomCollPtr org); | ||||
GAIAGEO_DECLARE int gaiaIsToxic (gaiaGeomCollPtr org); | ||||
GAIAGEO_DECLARE void gaiaOutBufferInitialize (gaiaOutBufferPtr buf); | ||||
GAIAGEO_DECLARE void gaiaOutBufferReset (gaiaOutBufferPtr buf); | ||||
GAIAGEO_DECLARE void gaiaAppendToOutBuffer (gaiaOutBufferPtr buf, | ||||
const char *text); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaLinearize (gaiaGeomCollPtr geom, | ||||
int force_multi); | ||||
#ifndef OMIT_PROJ /* including PROJ.4 */ | ||||
GAIAGEO_DECLARE double gaiaRadsToDegs (double rads); | ||||
GAIAGEO_DECLARE double gaiaDegsToRads (double degs); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaTransform (gaiaGeomCollPtr org, | ||||
char *proj_from, | ||||
char *proj_to); | ||||
#endif /* end including PROJ.4 */ | ||||
#ifndef OMIT_GEOS /* including GEOS */ | ||||
GAIAGEO_DECLARE void gaiaResetGeosMsg (void); | ||||
GAIAGEO_DECLARE const char *gaiaGetGeosErrorMsg (void); | ||||
GAIAGEO_DECLARE const char *gaiaGetGeosWarningMsg (void); | ||||
GAIAGEO_DECLARE void gaiaSetGeosErrorMsg (const char *msg); | ||||
GAIAGEO_DECLARE void gaiaSetGeosWarningMsg (const char *msg); | ||||
GAIAGEO_DECLARE int gaiaGeomCollEquals (gaiaGeomCollPtr geom1, | ||||
gaiaGeomCollPtr geom2); | ||||
GAIAGEO_DECLARE int gaiaGeomCollDisjoint (gaiaGeomCollPtr geom1, | ||||
gaiaGeomCollPtr geom2); | ||||
GAIAGEO_DECLARE int gaiaGeomCollIntersects (gaiaGeomCollPtr geom1, | ||||
gaiaGeomCollPtr geom2); | ||||
GAIAGEO_DECLARE int gaiaGeomCollOverlaps (gaiaGeomCollPtr geom1, | ||||
gaiaGeomCollPtr geom2); | ||||
GAIAGEO_DECLARE int gaiaGeomCollCrosses (gaiaGeomCollPtr geom1, | ||||
gaiaGeomCollPtr geom2); | ||||
GAIAGEO_DECLARE int gaiaGeomCollContains (gaiaGeomCollPtr geom1, | ||||
gaiaGeomCollPtr geom2); | ||||
GAIAGEO_DECLARE int gaiaGeomCollWithin (gaiaGeomCollPtr geom1, | ||||
gaiaGeomCollPtr geom2); | ||||
GAIAGEO_DECLARE int gaiaGeomCollTouches (gaiaGeomCollPtr geom1, | ||||
gaiaGeomCollPtr geom2); | ||||
GAIAGEO_DECLARE int gaiaGeomCollRelate (gaiaGeomCollPtr geom1, | ||||
gaiaGeomCollPtr geom2, | ||||
const char *pattern); | ||||
GAIAGEO_DECLARE int gaiaGeomCollDistance (gaiaGeomCollPtr geom1, | ||||
gaiaGeomCollPtr geom2, | ||||
double *dist); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaGeometryIntersection (gaiaGeomCollP | ||||
tr | ||||
geom1, | ||||
gaiaGeomCollPt | ||||
r | ||||
geom2); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaGeometryUnion (gaiaGeomCollPtr geom | ||||
1, | ||||
gaiaGeomCollPtr geom2 | ||||
); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaGeometryDifference (gaiaGeomCollPtr | ||||
geom1, | ||||
gaiaGeomCollPtr | ||||
geom2); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaGeometrySymDifference (gaiaGeomColl | ||||
Ptr | ||||
geom1, | ||||
gaiaGeomCollP | ||||
tr | ||||
geom2); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaBoundary (gaiaGeomCollPtr geom); | ||||
GAIAGEO_DECLARE int gaiaGeomCollCentroid (gaiaGeomCollPtr geom, double | ||||
*x, | ||||
double *y); | ||||
GAIAGEO_DECLARE int gaiaGetPointOnSurface (gaiaGeomCollPtr geom, double | ||||
*x, | ||||
double *y); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaGeomCollSimplify (gaiaGeomCollPtr g | ||||
eom, | ||||
double tolerance); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr | ||||
gaiaGeomCollSimplifyPreserveTopology (gaiaGeomCollPtr geom, | ||||
double tolerance); | ||||
GAIAGEO_DECLARE int gaiaGeomCollLength (gaiaGeomCollPtr geom, | ||||
double *length); | ||||
GAIAGEO_DECLARE int gaiaGeomCollArea (gaiaGeomCollPtr geom, double *are | ||||
a); | ||||
GAIAGEO_DECLARE int gaiaIsSimple (gaiaGeomCollPtr geom); | ||||
GAIAGEO_DECLARE int gaiaIsClosed (gaiaLinestringPtr line); | ||||
GAIAGEO_DECLARE int gaiaIsRing (gaiaLinestringPtr line); | ||||
GAIAGEO_DECLARE int gaiaIsValid (gaiaGeomCollPtr geom); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaConvexHull (gaiaGeomCollPtr geom); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaGeomCollBuffer (gaiaGeomCollPtr geo | ||||
m, | ||||
double radius, | ||||
int points); | ||||
GAIAGEO_DECLARE void *gaiaToGeos (const gaiaGeomCollPtr gaia); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromGeos_XY (const void *geos); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromGeos_XYZ (const void *geos); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromGeos_XYM (const void *geos); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromGeos_XYZM (const void *geos); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaPolygonize (gaiaGeomCollPtr geom, | ||||
int force_multi); | ||||
#ifdef GEOS_ADVANCED | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaOffsetCurve (gaiaGeomCollPtr geom, | ||||
double radius, int poin | ||||
ts, | ||||
int left_right); | ||||
GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSharedPaths (gaiaGeomCollPtr geom1, | ||||
gaiaGeomCollPtr geom2); | ||||
GAIAGEO_DECLARE int gaiaGeomCollCovers (gaiaGeomCollPtr geom1, | ||||
gaiaGeomCollPtr geom2); | ||||
GAIAGEO_DECLARE int gaiaGeomCollCoveredBy (gaiaGeomCollPtr geom1, | ||||
gaiaGeomCollPtr geom2); | ||||
#endif /* end GEOS advanced and experimental featur | ||||
es */ | ||||
#endif /* end including GEOS */ | ||||
#ifndef OMIT_ICONV /* ICONV enabled: supporting text reader */ | ||||
GAIAGEO_DECLARE gaiaTextReaderPtr gaiaTextReaderAlloc (const char *path | ||||
, | ||||
char field_separa | ||||
tor, | ||||
char text_separat | ||||
or, | ||||
char | ||||
decimal_separator | ||||
, | ||||
int | ||||
first_line_titles | ||||
, | ||||
const char | ||||
*encoding); | ||||
GAIAGEO_DECLARE void gaiaTextReaderDestroy (gaiaTextReaderPtr reader); | ||||
GAIAGEO_DECLARE int gaiaTextReaderParse (gaiaTextReaderPtr reader); | ||||
GAIAGEO_DECLARE int gaiaTextReaderGetRow (gaiaTextReaderPtr reader, | ||||
int row_num); | ||||
GAIAGEO_DECLARE int gaiaTextReaderFetchField (gaiaTextReaderPtr reader, | ||||
int field_num, int *type, | ||||
const char **value); | ||||
#endif /* end ICONV (text reader) */ | ||||
#ifdef __cplusplus | ||||
} | ||||
#endif | ||||
#endif /* _GAIAGEO_H */ | #endif /* _GAIAGEO_H */ | |||
End of changes. 8 change blocks. | ||||
1081 lines changed or deleted | 17 lines changed or added | |||
spatialite.h | spatialite.h | |||
---|---|---|---|---|
/* | /* | |||
spatialite.h -- Gaia spatial support for SQLite | spatialite.h -- Gaia spatial support for SQLite | |||
version 2.4, 2009 September 17 | version 3.0, 2011 July 20 | |||
Author: Sandro Furieri a.furieri@lqt.it | Author: Sandro Furieri a.furieri@lqt.it | |||
-------------------------------------------------------------------------- ---- | -------------------------------------------------------------------------- ---- | |||
Version: MPL 1.1/GPL 2.0/LGPL 2.1 | Version: MPL 1.1/GPL 2.0/LGPL 2.1 | |||
The contents of this file are subject to the Mozilla Public License Versio n | The contents of this file are subject to the Mozilla Public License Versio n | |||
1.1 (the "License"); you may not use this file except in compliance with | 1.1 (the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | the License. You may obtain a copy of the License at | |||
skipping to change at line 45 | skipping to change at line 45 | |||
of those above. If you wish to allow use of your version of this file only | of those above. If you wish to allow use of your version of this file only | |||
under the terms of either the GPL or the LGPL, and not to allow others to | under the terms of either the GPL or the LGPL, and not to allow others to | |||
use your version of this file under the terms of the MPL, indicate your | use your version of this file under the terms of the MPL, indicate your | |||
decision by deleting the provisions above and replace them with the notice | decision by deleting the provisions above and replace them with the notice | |||
and other provisions required by the GPL or the LGPL. If you do not delete | and other provisions required by the GPL or the LGPL. If you do not delete | |||
the provisions above, a recipient may use your version of this file under | the provisions above, a recipient may use your version of this file under | |||
the terms of any one of the MPL, the GPL or the LGPL. | the terms of any one of the MPL, the GPL or the LGPL. | |||
*/ | */ | |||
/** | ||||
\file spatialite.h | ||||
Main SpatiaLite header file | ||||
*/ | ||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS | ||||
#ifdef DLL_EXPORT | #ifdef DLL_EXPORT | |||
#define SPATIALITE_DECLARE __declspec(dllexport) | #define SPATIALITE_DECLARE __declspec(dllexport) | |||
#else | #else | |||
#define SPATIALITE_DECLARE extern | #define SPATIALITE_DECLARE extern | |||
#endif | #endif | |||
#endif | ||||
#ifndef _SPATIALITE_H | #ifndef _SPATIALITE_H | |||
#ifndef DOXYGEN_SHOULD_SKIP_THIS | ||||
#define _SPATIALITE_H | #define _SPATIALITE_H | |||
#endif | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" | extern "C" | |||
{ | { | |||
#endif | #endif | |||
/** | ||||
Return the current library version. | ||||
*/ | ||||
SPATIALITE_DECLARE const char *spatialite_version (void); | SPATIALITE_DECLARE const char *spatialite_version (void); | |||
/** | ||||
Initializes the library. | ||||
\param verbose if TRUE a short start-up message is shown on stderr | ||||
\note You absolutely must invoke this function before attempting to perfor | ||||
m | ||||
any other SpatiaLite's call. | ||||
*/ | ||||
SPATIALITE_DECLARE void spatialite_init (int verbose); | SPATIALITE_DECLARE void spatialite_init (int verbose); | |||
/** | ||||
Cleanup spatialite | ||||
This function performs general cleanup, essentially undoing the effect | ||||
of spatialite_init(). | ||||
\sa spatialite_init | ||||
*/ | ||||
SPATIALITE_DECLARE void spatialite_cleanup (); | ||||
/** | ||||
Dumps a full geometry-table into an external Shapefile | ||||
\param sqlite handle to current DB connection | ||||
\param table the name of the table to be exported | ||||
\param column the name of the geometry column | ||||
\param shp_path pathname of the Shapefile to be exported (no suffix) | ||||
\param charset a valid GNU ICONV charset to be used for DBF text strings | ||||
\param geom_type "POINT", "LINESTRING", "POLYGON", "MULTIPOLYGON" or NULL | ||||
\param verbose if TRUE a short report is shown on stderr | ||||
\param rows on completion will contain the total number of actually export | ||||
ed rows | ||||
\param err_msg on completion will contain an error message (if any) | ||||
\return 0 on failure, any other value on success | ||||
*/ | ||||
SPATIALITE_DECLARE int dump_shapefile (sqlite3 * sqlite, char *table, | SPATIALITE_DECLARE int dump_shapefile (sqlite3 * sqlite, char *table, | |||
char *column, char *charset, | char *column, char *shp_path, | |||
char *shp_path, char *geom_type, | char *charset, char *geom_type, | |||
int verbose, int *rows); | int verbose, int *rows, | |||
char *err_msg); | ||||
/** | ||||
Loads an external Shapefile into a newly created table | ||||
\param sqlite handle to current DB connection | ||||
\param shp_path pathname of the Shapefile to be imported (no suffix) | ||||
\param table the name of the table to be created | ||||
\param charset a valid GNU ICONV charset to be used for DBF text strings | ||||
\param srid the SRID to be set for Geometries | ||||
\param column the name of the geometry column | ||||
\param coerce2d if TRUE any Geometry will be casted to 2D [XY] | ||||
\param compressed if TRUE compressed Geometries will be created | ||||
\param verbose if TRUE a short report is shown on stderr | ||||
\param spatial_index if TRUE an R*Tree Spatial Index will be created | ||||
\param rows on completion will contain the total number of actually export | ||||
ed rows | ||||
\param err_msg on completion will contain an error message (if any) | ||||
\return 0 on failure, any other value on success | ||||
*/ | ||||
SPATIALITE_DECLARE int load_shapefile (sqlite3 * sqlite, char *shp_path , | SPATIALITE_DECLARE int load_shapefile (sqlite3 * sqlite, char *shp_path , | |||
char *table, char *charset, int s rid, | char *table, char *charset, int s rid, | |||
char *column, int coerce2d, | char *column, int coerce2d, | |||
int compressed, int verbose, | int compressed, int verbose, | |||
int *rows); | int spatial_index, int *rows, | |||
SPATIALITE_DECLARE int load_dbf (sqlite3 * sqlite, char *shp_path, | char *err_msg); | |||
/** | ||||
Loads an external DBF file into a newly created table | ||||
\param sqlite handle to current DB connection | ||||
\param dbf_path pathname of the DBF file to be imported | ||||
\param table the name of the table to be created | ||||
\param charset a valid GNU ICONV charset to be used for DBF text strings | ||||
\param verbose if TRUE a short report is shown on stderr | ||||
\param rows on completion will contain the total number of actually export | ||||
ed rows | ||||
\param err_msg on completion will contain an error message (if any) | ||||
\return 0 on failure, any other value on success | ||||
*/ | ||||
SPATIALITE_DECLARE int load_dbf (sqlite3 * sqlite, char *dbf_path, | ||||
char *table, char *charset, int verbose , | char *table, char *charset, int verbose , | |||
int *rows); | int *rows, char *err_msg); | |||
/** | ||||
Dumps a full table into an external DBF file | ||||
\param sqlite handle to current DB connection | ||||
\param table the name of the table to be exported | ||||
\param dbf_path pathname of the DBF to be exported | ||||
\param charset a valid GNU ICONV charset to be used for DBF text strings | ||||
\param err_msg on completion will contain an error message (if any) | ||||
\return 0 on failure, any other value on success | ||||
*/ | ||||
SPATIALITE_DECLARE int dump_dbf (sqlite3 * sqlite, char *table, | ||||
char *dbf_path, char *charset, | ||||
char *err_msg); | ||||
/** | ||||
Loads an external spreadsheet (.xls) file into a newly created table | ||||
\param sqlite handle to current DB connection | ||||
\param path pathname of the spreadsheet file to be imported | ||||
\param table the name of the table to be created | ||||
\param worksheetIndex the index identifying the worksheet to be imported | ||||
\param first_titles if TRUE the first line is assumed to contain column na | ||||
mes | ||||
\param rows on completion will contain the total number of actually export | ||||
ed rows | ||||
\param err_msg on completion will contain an error message (if any) | ||||
\return 0 on failure, any other value on success | ||||
*/ | ||||
SPATIALITE_DECLARE int load_XL (sqlite3 * sqlite, const char *path, | ||||
const char *table, | ||||
unsigned int worksheetIndex, | ||||
int first_titles, unsigned int *rows, | ||||
char *err_msg); | ||||
/** | ||||
A portable replacement for C99 round() | ||||
\param value a double value | ||||
\return the nearest integeral value | ||||
*/ | ||||
SPATIALITE_DECLARE double math_round (double value); | SPATIALITE_DECLARE double math_round (double value); | |||
/** | ||||
A portable replacement for C99 llabs() | ||||
\param value a 64 bit integer value | ||||
\return the corresponding absolute value | ||||
*/ | ||||
SPATIALITE_DECLARE sqlite3_int64 math_llabs (sqlite3_int64 value); | SPATIALITE_DECLARE sqlite3_int64 math_llabs (sqlite3_int64 value); | |||
/** | ||||
Inserts the inlined EPSG dataset into the "spatial_ref_sys" table | ||||
\param sqlite handle to current DB connection | ||||
\param verbose if TRUE a short report is shown on stderr | ||||
\return 0 on failure, any other value on success | ||||
\note this function is internally invoked by the SQL function | ||||
InitSpatialMetadata(), and is not usually intended for direct use. | ||||
*/ | ||||
SPATIALITE_DECLARE int spatial_ref_sys_init (sqlite3 * sqlite, int verb ose); | SPATIALITE_DECLARE int spatial_ref_sys_init (sqlite3 * sqlite, int verb ose); | |||
/** | ||||
Checks if a column is actually defined into the given table | ||||
\param sqlite handle to current DB connection | ||||
\param table the table to be checked | ||||
\param column the column to be checked | ||||
\return 0 on success, any other value on success | ||||
\note internally used to detect if some KML attribute defaults to a consta | ||||
nt value | ||||
*/ | ||||
SPATIALITE_DECLARE int | ||||
is_kml_constant (sqlite3 * sqlite, char *table, char *column); | ||||
/** | ||||
Dumps a full geometry-table into an external KML file | ||||
\param sqlite handle to current DB connection | ||||
\param table the name of the table to be exported | ||||
\param geom_col the name of the geometry column | ||||
\param kml_path pathname of the KML file to be exported | ||||
\param name_col column to be used for KML "name" (may be null) | ||||
\param desc_col column to be used for KML "description" (may be null) | ||||
\param precision number of decimal digits for coordinates | ||||
\return 0 on failure, any other value on success | ||||
*/ | ||||
SPATIALITE_DECLARE int dump_kml (sqlite3 * sqlite, char *table, | SPATIALITE_DECLARE int dump_kml (sqlite3 * sqlite, char *table, | |||
char *geom_col, char *kml_path, | char *geom_col, char *kml_path, | |||
char *name_col, char *desc_col, | char *name_col, char *desc_col, | |||
int precision); | int precision); | |||
/** | ||||
Checks for duplicated rows into the same table | ||||
\param sqlite handle to current DB connection | ||||
\param table name of the table to be checked | ||||
\param dupl_count on completion will contain the number of duplicated rows | ||||
found | ||||
\sa remove_duplicated_rows | ||||
\note two (or more) rows are assumed to be duplicated if any column | ||||
value (excluding any Primary Key column) is exacly the same | ||||
*/ | ||||
SPATIALITE_DECLARE void check_duplicated_rows (sqlite3 * sqlite, | SPATIALITE_DECLARE void check_duplicated_rows (sqlite3 * sqlite, | |||
char *table); | char *table, | |||
int *dupl_count); | ||||
/** | ||||
Remove duplicated rows from a table | ||||
\param sqlite handle to current DB connection | ||||
\param table name of the table to be cleaned | ||||
\sa check_duplicated_rows | ||||
\note when two (or more) duplicated rows exist, only the first occurence | ||||
will be preserved, then deleting any further occurrence. | ||||
*/ | ||||
SPATIALITE_DECLARE void remove_duplicated_rows (sqlite3 * sqlite, | SPATIALITE_DECLARE void remove_duplicated_rows (sqlite3 * sqlite, | |||
char *table); | char *table); | |||
/** | ||||
Creates a derived table surely containing elementary Geometries | ||||
\param sqlite handle to current DB connection | ||||
\param inTable name of the input table | ||||
\param geometry name of the Geometry column | ||||
\param outTable name of the output table to be created | ||||
\param pKey name of the Primary Key column in the output table | ||||
\param multiId name of the column identifying origins in the output table | ||||
\note if the input table contains some kind of complex Geometry | ||||
(MULTIPOINT, MULTILINESTRING, MULTIPOLYGON or GEOMETRYCOLLECTION), | ||||
then many rows are inserted into the output table: each single | ||||
row will contain the same attributes and an elementaty Geometry. | ||||
All the rows created by expanding the same input row will expose | ||||
the same value in the "multiId" column. | ||||
*/ | ||||
SPATIALITE_DECLARE void elementary_geometries (sqlite3 * sqlite, | ||||
char *inTable, | ||||
char *geometry, | ||||
char *outTable, char *pKe | ||||
y, | ||||
char *multiId); | ||||
/** | ||||
Dumps a full geometry-table into an external GeoJSON file | ||||
\param sqlite handle to current DB connection | ||||
\param table the name of the table to be exported | ||||
\param geom_col the name of the geometry column | ||||
\param outfile_path pathname for the GeoJSON file to be written to | ||||
\param precision number of decimal digits for coordinates | ||||
\param option the format to use for output | ||||
\note valid values for option are: | ||||
- 0 no option | ||||
- 1 GeoJSON MBR | ||||
- 2 GeoJSON Short CRS (e.g EPSG:4326) | ||||
- 3 MBR + Short CRS | ||||
- 4 GeoJSON Long CRS (e.g urn:ogc:def:crs:EPSG::4326) | ||||
- 5 MBR + Long CRS | ||||
\return 0 on failure, any other value on success | ||||
*/ | ||||
SPATIALITE_DECLARE int dump_geojson (sqlite3 * sqlite, char *table, | ||||
char *geom_col, char *outfile_path, | ||||
int precision, int option); | ||||
/** | ||||
Updates the LAYER_STATICS metadata table | ||||
\param sqlite handle to current DB connection | ||||
\param table name of the table to be processed | ||||
\param column name of the geometry to be processed | ||||
\note this function will explore the given table/geometry determining | ||||
the number of rows and the full layer extent; a corresponding table/geomet | ||||
ry | ||||
entry is expected to be already declared in the GEOMETRY_COLUMNS table. | ||||
These informations will be permanently stored into the LAYER_STATISTICS | ||||
table; if such table does not yet exists will be implicitly created. | ||||
- if table is NULL, any entry found within GEOMETRY_COLUMNS | ||||
will be processed. | ||||
- if table is not NULL and column is NULL, any geometry | ||||
belonging to the given table will be processed. | ||||
- if both table and column are not NULL, then only the | ||||
given entry will be processed. | ||||
\return 0 on failure, the total count of processed entries on success | ||||
*/ | ||||
SPATIALITE_DECLARE int update_layer_statistics (sqlite3 * sqlite, | ||||
const char *table, | ||||
const char *column); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* _SPATIALITE_H */ | #endif /* _SPATIALITE_H */ | |||
End of changes. 17 change blocks. | ||||
8 lines changed or deleted | 289 lines changed or added | |||