GDAL
ogr_p.h
1/******************************************************************************
2 * $Id: ogr_p.h 205ab0157961d02098fa1955ed353d617b0a73bc 2017-05-15 10:29:33Z Even 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#include "ogr_feature.h"
46
47/* A default name for the default geometry column, instead of '' */
48#define OGR_GEOMETRY_DEFAULT_NON_EMPTY_NAME "_ogr_geometry_"
49
50#ifdef CPL_MSB
51# define OGR_SWAP(x) (x == wkbNDR)
52#else
53# define OGR_SWAP(x) (x == wkbXDR)
54#endif
55
56/* PostGIS 1.X has non standard codes for the following geometry types */
57#define POSTGIS15_CURVEPOLYGON 13 /* instead of 10 */
58#define POSTGIS15_MULTICURVE 14 /* instead of 11 */
59#define POSTGIS15_MULTISURFACE 15 /* instead of 12 */
60
61/* Has been deprecated. Can only be used in very specific circumstances */
62#ifdef GDAL_COMPILATION
63#define wkb25DBitInternalUse 0x80000000
64#endif
65
66/* -------------------------------------------------------------------- */
67/* helper function for parsing well known text format vector objects.*/
68/* -------------------------------------------------------------------- */
69
70#ifdef OGR_GEOMETRY_H_INCLUDED
71#define OGR_WKT_TOKEN_MAX 64
72
73const char CPL_DLL * OGRWktReadToken( const char * pszInput, char * pszToken );
74
75const char CPL_DLL * OGRWktReadPoints( const char * pszInput,
76 OGRRawPoint **ppaoPoints,
77 double **ppadfZ,
78 int * pnMaxPoints,
79 int * pnReadPoints );
80
81const char CPL_DLL * OGRWktReadPointsM( const char * pszInput,
82 OGRRawPoint **ppaoPoints,
83 double **ppadfZ,
84 double **ppadfM,
85 int * flags, /* geometry flags, are we expecting Z, M, or both; may change due to input */
86 int * pnMaxPoints,
87 int * pnReadPoints );
88
89void CPL_DLL OGRMakeWktCoordinate( char *, double, double, double, int );
90void CPL_DLL OGRMakeWktCoordinateM( char *, double, double, double, double, OGRBoolean, OGRBoolean );
91
92#endif
93
94void OGRFormatDouble( char *pszBuffer, int nBufferLen, double dfVal,
95 char chDecimalSep, int nPrecision = 15, char chConversionSpecifier = 'f' );
96
97/* -------------------------------------------------------------------- */
98/* Date-time parsing and processing functions */
99/* -------------------------------------------------------------------- */
100
101/* Internal use by OGR drivers only, CPL_DLL is just there in case */
102/* they are compiled as plugins */
103int CPL_DLL OGRGetDayOfWeek(int day, int month, int year);
104int CPL_DLL OGRParseXMLDateTime( const char* pszXMLDateTime,
105 OGRField* psField );
106int CPL_DLL OGRParseRFC822DateTime( const char* pszRFC822DateTime,
107 OGRField* psField );
108char CPL_DLL * OGRGetRFC822DateTime(const OGRField* psField);
109char CPL_DLL * OGRGetXMLDateTime(const OGRField* psField);
110char CPL_DLL * OGRGetXML_UTF8_EscapedString(const char* pszString);
111
112int OGRCompareDate(const OGRField *psFirstTuple,
113 const OGRField *psSecondTuple ); /* used by ogr_gensql.cpp and ogrfeaturequery.cpp */
114
115/* General utility option processing. */
116int CPL_DLL OGRGeneralCmdLineProcessor( int nArgc, char ***ppapszArgv, int nOptions );
117
118/************************************************************************/
119/* Support for special attributes (feature query and selection) */
120/************************************************************************/
121#define SPF_FID 0
122#define SPF_OGR_GEOMETRY 1
123#define SPF_OGR_STYLE 2
124#define SPF_OGR_GEOM_WKT 3
125#define SPF_OGR_GEOM_AREA 4
126#define SPECIAL_FIELD_COUNT 5
127
128extern const char* const SpecialFieldNames[SPECIAL_FIELD_COUNT];
129
130#ifdef SWQ_H_INCLUDED_
131extern const swq_field_type SpecialFieldTypes[SPECIAL_FIELD_COUNT];
132#endif
133
134/************************************************************************/
135/* Some SRS related stuff, search in SRS data files. */
136/************************************************************************/
137
138OGRErr CPL_DLL OSRGetEllipsoidInfo( int, char **, double *, double *);
139
140/* Fast atof function */
141double OGRFastAtof(const char* pszStr);
142
143OGRErr CPL_DLL OGRCheckPermutation(int* panPermutation, int nSize);
144
145/* GML related */
146
147OGRGeometry *GML2OGRGeometry_XMLNode( const CPLXMLNode *psNode,
148 int nPseudoBoolGetSecondaryGeometryOption,
149 int nRecLevel = 0,
150 int nSRSDimension = 0,
151 bool bIgnoreGSG = false,
152 bool bOrientation = true,
153 bool bFaceHoleNegative = false);
154
155/************************************************************************/
156/* PostGIS EWKB encoding */
157/************************************************************************/
158
159OGRGeometry CPL_DLL *OGRGeometryFromEWKB( GByte *pabyWKB, int nLength, int* pnSRID,
160 int bIsPostGIS1_EWKB );
161OGRGeometry CPL_DLL *OGRGeometryFromHexEWKB( const char *pszBytea, int* pnSRID,
162 int bIsPostGIS1_EWKB );
163char CPL_DLL * OGRGeometryToHexEWKB( OGRGeometry * poGeometry, int nSRSId,
164 int nPostGISMajor, int nPostGISMinor );
165
166/************************************************************************/
167/* WKB Type Handling encoding */
168/************************************************************************/
169
170OGRErr OGRReadWKBGeometryType( const unsigned char * pabyData,
171 OGRwkbVariant wkbVariant,
172 OGRwkbGeometryType *eGeometryType );
173
174/************************************************************************/
175/* Other */
176/************************************************************************/
177
178void CPL_DLL OGRUpdateFieldType( OGRFieldDefn* poFDefn,
179 OGRFieldType eNewType,
180 OGRFieldSubType eNewSubType );
181
182#endif /* ndef OGR_P_H_INCLUDED */
Definition of an attribute of an OGRFeatureDefn.
Definition: ogr_feature.h:93
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:287
Simple container for a position.
Definition: ogr_geometry.h:64
Various convenience functions for CPL.
Definitions for CPL mini XML Parser/Serializer.
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:215
Various convenience functions for working with strings and string lists.
Core portability services for cross-platform OGR code.
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:306
OGRFieldSubType
List of field subtypes.
Definition: ogr_core.h:623
OGRwkbVariant
Output variants of WKB we support.
Definition: ogr_core.h:424
OGRFieldType
List of feature field types.
Definition: ogr_core.h:595
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:318
int OGRErr
Simple container for a bounding region.
Definition: ogr_core.h:290
Simple feature classes.
Simple feature geometry classes.
Document node structure.
Definition: cpl_minixml.h:67
OGRFeature field attribute value union.
Definition: ogr_core.h:683

Generated for GDAL by doxygen 1.9.4.