GDAL
|
00001 /****************************************************************************** 00002 * $Id: ogr_p.h 28900 2015-04-14 09:40:34Z rouault $ 00003 * 00004 * Project: OpenGIS Simple Features Reference Implementation 00005 * Purpose: Some private helper functions and stuff for OGR implementation. 00006 * Author: Frank Warmerdam, warmerdam@pobox.com 00007 * 00008 ****************************************************************************** 00009 * Copyright (c) 1999, Frank Warmerdam 00010 * Copyright (c) 2008-2014, Even Rouault <even dot rouault at mines-paris dot org> 00011 * 00012 * Permission is hereby granted, free of charge, to any person obtaining a 00013 * copy of this software and associated documentation files (the "Software"), 00014 * to deal in the Software without restriction, including without limitation 00015 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00016 * and/or sell copies of the Software, and to permit persons to whom the 00017 * Software is furnished to do so, subject to the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be included 00020 * in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00023 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00024 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00025 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00026 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00027 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00028 * DEALINGS IN THE SOFTWARE. 00029 ****************************************************************************/ 00030 00031 #ifndef OGR_P_H_INCLUDED 00032 #define OGR_P_H_INCLUDED 00033 00034 /* -------------------------------------------------------------------- */ 00035 /* Include the common portability library ... lets us do lots */ 00036 /* of stuff easily. */ 00037 /* -------------------------------------------------------------------- */ 00038 00039 #include "cpl_string.h" 00040 #include "cpl_conv.h" 00041 #include "cpl_minixml.h" 00042 00043 #include "ogr_core.h" 00044 #include "ogr_geometry.h" 00045 00046 /* A default name for the default geometry column, instead of '' */ 00047 #define OGR_GEOMETRY_DEFAULT_NON_EMPTY_NAME "_ogr_geometry_" 00048 00049 #ifdef CPL_MSB 00050 # define OGR_SWAP(x) (x == wkbNDR) 00051 #else 00052 # define OGR_SWAP(x) (x == wkbXDR) 00053 #endif 00054 00055 /* PostGIS 1.X has non standard codes for the following geometry types */ 00056 #define POSTGIS15_CURVEPOLYGON 13 /* instead of 10 */ 00057 #define POSTGIS15_MULTICURVE 14 /* instead of 11 */ 00058 #define POSTGIS15_MULTISURFACE 15 /* instead of 12 */ 00059 00060 /* Has been deprecated. Can only be used in very specific circumstances */ 00061 #ifdef GDAL_COMPILATION 00062 #define wkb25DBitInternalUse 0x80000000 00063 #endif 00064 00065 /* -------------------------------------------------------------------- */ 00066 /* helper function for parsing well known text format vector objects.*/ 00067 /* -------------------------------------------------------------------- */ 00068 00069 #ifdef _OGR_GEOMETRY_H_INCLUDED 00070 #define OGR_WKT_TOKEN_MAX 64 00071 00072 const char CPL_DLL * OGRWktReadToken( const char * pszInput, char * pszToken ); 00073 00074 const char CPL_DLL * OGRWktReadPoints( const char * pszInput, 00075 OGRRawPoint **ppaoPoints, 00076 double **ppadfZ, 00077 int * pnMaxPoints, 00078 int * pnReadPoints ); 00079 00080 void CPL_DLL OGRMakeWktCoordinate( char *, double, double, double, int ); 00081 00082 #endif 00083 00084 void OGRFormatDouble( char *pszBuffer, int nBufferLen, double dfVal, char chDecimalSep, int nPrecision = 15 ); 00085 00086 /* -------------------------------------------------------------------- */ 00087 /* Date-time parsing and processing functions */ 00088 /* -------------------------------------------------------------------- */ 00089 00090 /* Internal use by OGR drivers only, CPL_DLL is just there in case */ 00091 /* they are compiled as plugins */ 00092 int CPL_DLL OGRGetDayOfWeek(int day, int month, int year); 00093 int CPL_DLL OGRParseXMLDateTime( const char* pszXMLDateTime, 00094 OGRField* psField ); 00095 int CPL_DLL OGRParseRFC822DateTime( const char* pszRFC822DateTime, 00096 OGRField* psField ); 00097 char CPL_DLL * OGRGetRFC822DateTime(const OGRField* psField); 00098 char CPL_DLL * OGRGetXMLDateTime(const OGRField* psField); 00099 char CPL_DLL * OGRGetXML_UTF8_EscapedString(const char* pszString); 00100 00101 int OGRCompareDate( OGRField *psFirstTuple, 00102 OGRField *psSecondTuple ); /* used by ogr_gensql.cpp and ogrfeaturequery.cpp */ 00103 00104 /* General utility option processing. */ 00105 int CPL_DLL OGRGeneralCmdLineProcessor( int nArgc, char ***ppapszArgv, int nOptions ); 00106 00107 /************************************************************************/ 00108 /* Support for special attributes (feature query and selection) */ 00109 /************************************************************************/ 00110 #define SPF_FID 0 00111 #define SPF_OGR_GEOMETRY 1 00112 #define SPF_OGR_STYLE 2 00113 #define SPF_OGR_GEOM_WKT 3 00114 #define SPF_OGR_GEOM_AREA 4 00115 #define SPECIAL_FIELD_COUNT 5 00116 00117 extern const char* SpecialFieldNames[SPECIAL_FIELD_COUNT]; 00118 00119 #ifdef _SWQ_H_INCLUDED_ 00120 extern const swq_field_type SpecialFieldTypes[SPECIAL_FIELD_COUNT]; 00121 #endif 00122 00123 /************************************************************************/ 00124 /* Some SRS related stuff, search in SRS data files. */ 00125 /************************************************************************/ 00126 00127 OGRErr CPL_DLL OSRGetEllipsoidInfo( int, char **, double *, double *); 00128 00129 /* Fast atof function */ 00130 double OGRFastAtof(const char* pszStr); 00131 00132 OGRErr CPL_DLL OGRCheckPermutation(int* panPermutation, int nSize); 00133 00134 /* GML related */ 00135 00136 OGRGeometry *GML2OGRGeometry_XMLNode( const CPLXMLNode *psNode, 00137 int bGetSecondaryGeometryOption, 00138 int nRecLevel = 0, 00139 int nSRSDimension = 0, 00140 int bIgnoreGSG = FALSE, 00141 int bOrientation = TRUE, 00142 int bFaceHoleNegative = FALSE); 00143 00144 /************************************************************************/ 00145 /* PostGIS EWKB encoding */ 00146 /************************************************************************/ 00147 00148 OGRGeometry CPL_DLL *OGRGeometryFromEWKB( GByte *pabyWKB, int nLength, int* pnSRID, 00149 int bIsPostGIS1_EWKB ); 00150 OGRGeometry CPL_DLL *OGRGeometryFromHexEWKB( const char *pszBytea, int* pnSRID, 00151 int bIsPostGIS1_EWKB ); 00152 char CPL_DLL * OGRGeometryToHexEWKB( OGRGeometry * poGeometry, int nSRSId, 00153 int bIsPostGIS1_EWKB ); 00154 00155 /************************************************************************/ 00156 /* WKB Type Handling encoding */ 00157 /************************************************************************/ 00158 00159 OGRErr OGRReadWKBGeometryType( unsigned char * pabyData, 00160 OGRwkbVariant wkbVariant, 00161 OGRwkbGeometryType *eGeometryType, OGRBoolean *b3D ); 00162 00163 #endif /* ndef OGR_P_H_INCLUDED */