OGR
ogr_p.h
1 /******************************************************************************
2  * $Id: ogr_p.h 28900 2015-04-14 09:40:34Z rouault $
3  *
4  * Project: OpenGIS Simple Features Reference Implementation
5  * Purpose: Some private helper functions and stuff for OGR implementation.
6  * Author: Frank Warmerdam, warmerdam@pobox.com
7  *
8  ******************************************************************************
9  * Copyright (c) 1999, Frank Warmerdam
10  * Copyright (c) 2008-2014, Even Rouault <even dot rouault at mines-paris dot org>
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be included
20  * in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28  * DEALINGS IN THE SOFTWARE.
29  ****************************************************************************/
30 
31 #ifndef OGR_P_H_INCLUDED
32 #define OGR_P_H_INCLUDED
33 
34 /* -------------------------------------------------------------------- */
35 /* Include the common portability library ... lets us do lots */
36 /* of stuff easily. */
37 /* -------------------------------------------------------------------- */
38 
39 #include "cpl_string.h"
40 #include "cpl_conv.h"
41 #include "cpl_minixml.h"
42 
43 #include "ogr_core.h"
44 #include "ogr_geometry.h"
45 
46 /* A default name for the default geometry column, instead of '' */
47 #define OGR_GEOMETRY_DEFAULT_NON_EMPTY_NAME "_ogr_geometry_"
48 
49 #ifdef CPL_MSB
50 # define OGR_SWAP(x) (x == wkbNDR)
51 #else
52 # define OGR_SWAP(x) (x == wkbXDR)
53 #endif
54 
55 /* PostGIS 1.X has non standard codes for the following geometry types */
56 #define POSTGIS15_CURVEPOLYGON 13 /* instead of 10 */
57 #define POSTGIS15_MULTICURVE 14 /* instead of 11 */
58 #define POSTGIS15_MULTISURFACE 15 /* instead of 12 */
59 
60 /* Has been deprecated. Can only be used in very specific circumstances */
61 #ifdef GDAL_COMPILATION
62 #define wkb25DBitInternalUse 0x80000000
63 #endif
64 
65 /* -------------------------------------------------------------------- */
66 /* helper function for parsing well known text format vector objects.*/
67 /* -------------------------------------------------------------------- */
68 
69 #ifdef _OGR_GEOMETRY_H_INCLUDED
70 #define OGR_WKT_TOKEN_MAX 64
71 
72 const char CPL_DLL * OGRWktReadToken( const char * pszInput, char * pszToken );
73 
74 const char CPL_DLL * OGRWktReadPoints( const char * pszInput,
75  OGRRawPoint **ppaoPoints,
76  double **ppadfZ,
77  int * pnMaxPoints,
78  int * pnReadPoints );
79 
80 void CPL_DLL OGRMakeWktCoordinate( char *, double, double, double, int );
81 
82 #endif
83 
84 void OGRFormatDouble( char *pszBuffer, int nBufferLen, double dfVal, char chDecimalSep, int nPrecision = 15 );
85 
86 /* -------------------------------------------------------------------- */
87 /* Date-time parsing and processing functions */
88 /* -------------------------------------------------------------------- */
89 
90 /* Internal use by OGR drivers only, CPL_DLL is just there in case */
91 /* they are compiled as plugins */
92 int CPL_DLL OGRGetDayOfWeek(int day, int month, int year);
93 int CPL_DLL OGRParseXMLDateTime( const char* pszXMLDateTime,
94  OGRField* psField );
95 int CPL_DLL OGRParseRFC822DateTime( const char* pszRFC822DateTime,
96  OGRField* psField );
97 char CPL_DLL * OGRGetRFC822DateTime(const OGRField* psField);
98 char CPL_DLL * OGRGetXMLDateTime(const OGRField* psField);
99 char CPL_DLL * OGRGetXML_UTF8_EscapedString(const char* pszString);
100 
101 int OGRCompareDate( OGRField *psFirstTuple,
102  OGRField *psSecondTuple ); /* used by ogr_gensql.cpp and ogrfeaturequery.cpp */
103 
104 /* General utility option processing. */
105 int CPL_DLL OGRGeneralCmdLineProcessor( int nArgc, char ***ppapszArgv, int nOptions );
106 
107 /************************************************************************/
108 /* Support for special attributes (feature query and selection) */
109 /************************************************************************/
110 #define SPF_FID 0
111 #define SPF_OGR_GEOMETRY 1
112 #define SPF_OGR_STYLE 2
113 #define SPF_OGR_GEOM_WKT 3
114 #define SPF_OGR_GEOM_AREA 4
115 #define SPECIAL_FIELD_COUNT 5
116 
117 extern const char* SpecialFieldNames[SPECIAL_FIELD_COUNT];
118 
119 #ifdef _SWQ_H_INCLUDED_
120 extern const swq_field_type SpecialFieldTypes[SPECIAL_FIELD_COUNT];
121 #endif
122 
123 /************************************************************************/
124 /* Some SRS related stuff, search in SRS data files. */
125 /************************************************************************/
126 
127 OGRErr CPL_DLL OSRGetEllipsoidInfo( int, char **, double *, double *);
128 
129 /* Fast atof function */
130 double OGRFastAtof(const char* pszStr);
131 
132 OGRErr CPL_DLL OGRCheckPermutation(int* panPermutation, int nSize);
133 
134 /* GML related */
135 
136 OGRGeometry *GML2OGRGeometry_XMLNode( const CPLXMLNode *psNode,
137  int bGetSecondaryGeometryOption,
138  int nRecLevel = 0,
139  int nSRSDimension = 0,
140  int bIgnoreGSG = FALSE,
141  int bOrientation = TRUE,
142  int bFaceHoleNegative = FALSE);
143 
144 /************************************************************************/
145 /* PostGIS EWKB encoding */
146 /************************************************************************/
147 
148 OGRGeometry CPL_DLL *OGRGeometryFromEWKB( GByte *pabyWKB, int nLength, int* pnSRID,
149  int bIsPostGIS1_EWKB );
150 OGRGeometry CPL_DLL *OGRGeometryFromHexEWKB( const char *pszBytea, int* pnSRID,
151  int bIsPostGIS1_EWKB );
152 char CPL_DLL * OGRGeometryToHexEWKB( OGRGeometry * poGeometry, int nSRSId,
153  int bIsPostGIS1_EWKB );
154 
155 /************************************************************************/
156 /* WKB Type Handling encoding */
157 /************************************************************************/
158 
159 OGRErr OGRReadWKBGeometryType( unsigned char * pabyData,
160  OGRwkbVariant wkbVariant,
161  OGRwkbGeometryType *eGeometryType, OGRBoolean *b3D );
162 
163 #endif /* ndef OGR_P_H_INCLUDED */
Definition: cpl_minixml.h:65
Definition: ogr_geometry.h:47
OGRwkbGeometryType
Definition: ogr_core.h:309
Definition: ogr_geometry.h:104
OGRwkbVariant
Definition: ogr_core.h:371
Definition: ogr_core.h:574

Generated for GDAL by doxygen 1.8.9.1.