GDAL
ogr_p.h
00001 /******************************************************************************
00002  * $Id: ogr_p.h 37564 2017-03-03 09:09:26Z 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 #include "ogr_feature.h"
00046 
00047 /* A default name for the default geometry column, instead of '' */
00048 #define OGR_GEOMETRY_DEFAULT_NON_EMPTY_NAME     "_ogr_geometry_"
00049 
00050 #ifdef CPL_MSB
00051 #  define OGR_SWAP(x)   (x == wkbNDR)
00052 #else
00053 #  define OGR_SWAP(x)   (x == wkbXDR)
00054 #endif
00055 
00056 /* PostGIS 1.X has non standard codes for the following geometry types */
00057 #define POSTGIS15_CURVEPOLYGON  13  /* instead of 10 */
00058 #define POSTGIS15_MULTICURVE    14  /* instead of 11 */
00059 #define POSTGIS15_MULTISURFACE  15  /* instead of 12 */
00060 
00061 /* Has been deprecated. Can only be used in very specific circumstances */
00062 #ifdef GDAL_COMPILATION
00063 #define wkb25DBitInternalUse 0x80000000
00064 #endif
00065 
00066 /* -------------------------------------------------------------------- */
00067 /*      helper function for parsing well known text format vector objects.*/
00068 /* -------------------------------------------------------------------- */
00069 
00070 #ifdef OGR_GEOMETRY_H_INCLUDED
00071 #define OGR_WKT_TOKEN_MAX       64
00072 
00073 const char CPL_DLL * OGRWktReadToken( const char * pszInput, char * pszToken );
00074 
00075 const char CPL_DLL * OGRWktReadPoints( const char * pszInput,
00076                                        OGRRawPoint **ppaoPoints,
00077                                        double **ppadfZ,
00078                                        int * pnMaxPoints,
00079                                        int * pnReadPoints );
00080 
00081 const char CPL_DLL * OGRWktReadPointsM( const char * pszInput,
00082                                         OGRRawPoint **ppaoPoints,
00083                                         double **ppadfZ,
00084                                         double **ppadfM,
00085                                         int * flags, /* geometry flags, are we expecting Z, M, or both; may change due to input */
00086                                         int * pnMaxPoints,
00087                                         int * pnReadPoints );
00088 
00089 void CPL_DLL OGRMakeWktCoordinate( char *, double, double, double, int );
00090 void CPL_DLL OGRMakeWktCoordinateM( char *, double, double, double, double, OGRBoolean, OGRBoolean );
00091 
00092 #endif
00093 
00094 void OGRFormatDouble( char *pszBuffer, int nBufferLen, double dfVal,
00095                       char chDecimalSep, int nPrecision = 15, char chConversionSpecifier = 'f' );
00096 
00097 /* -------------------------------------------------------------------- */
00098 /*      Date-time parsing and processing functions                      */
00099 /* -------------------------------------------------------------------- */
00100 
00101 /* Internal use by OGR drivers only, CPL_DLL is just there in case */
00102 /* they are compiled as plugins  */
00103 int CPL_DLL OGRGetDayOfWeek(int day, int month, int year);
00104 int CPL_DLL OGRParseXMLDateTime( const char* pszXMLDateTime,
00105                                  OGRField* psField );
00106 int CPL_DLL OGRParseRFC822DateTime( const char* pszRFC822DateTime,
00107                                     OGRField* psField );
00108 char CPL_DLL * OGRGetRFC822DateTime(const OGRField* psField);
00109 char CPL_DLL * OGRGetXMLDateTime(const OGRField* psField);
00110 char CPL_DLL * OGRGetXML_UTF8_EscapedString(const char* pszString);
00111 
00112 int OGRCompareDate(const OGRField *psFirstTuple,
00113                    const OGRField *psSecondTuple ); /* used by ogr_gensql.cpp and ogrfeaturequery.cpp */
00114 
00115 /* General utility option processing. */
00116 int CPL_DLL OGRGeneralCmdLineProcessor( int nArgc, char ***ppapszArgv, int nOptions );
00117 
00118 /************************************************************************/
00119 /*     Support for special attributes (feature query and selection)     */
00120 /************************************************************************/
00121 #define SPF_FID 0
00122 #define SPF_OGR_GEOMETRY 1
00123 #define SPF_OGR_STYLE 2
00124 #define SPF_OGR_GEOM_WKT 3
00125 #define SPF_OGR_GEOM_AREA 4
00126 #define SPECIAL_FIELD_COUNT 5
00127 
00128 extern const char* const SpecialFieldNames[SPECIAL_FIELD_COUNT];
00129 
00130 #ifdef SWQ_H_INCLUDED_
00131 extern const swq_field_type SpecialFieldTypes[SPECIAL_FIELD_COUNT];
00132 #endif
00133 
00134 /************************************************************************/
00135 /*     Some SRS related stuff, search in SRS data files.                */
00136 /************************************************************************/
00137 
00138 OGRErr CPL_DLL OSRGetEllipsoidInfo( int, char **, double *, double *);
00139 
00140 /* Fast atof function */
00141 double OGRFastAtof(const char* pszStr);
00142 
00143 OGRErr CPL_DLL OGRCheckPermutation(int* panPermutation, int nSize);
00144 
00145 /* GML related */
00146 
00147 OGRGeometry *GML2OGRGeometry_XMLNode( const CPLXMLNode *psNode,
00148                                       int nPseudoBoolGetSecondaryGeometryOption,
00149                                       int nRecLevel = 0,
00150                                       int nSRSDimension = 0,
00151                                       bool bIgnoreGSG = false,
00152                                       bool bOrientation = true,
00153                                       bool bFaceHoleNegative = false);
00154 
00155 /************************************************************************/
00156 /*                        PostGIS EWKB encoding                         */
00157 /************************************************************************/
00158 
00159 OGRGeometry CPL_DLL *OGRGeometryFromEWKB( GByte *pabyWKB, int nLength, int* pnSRID,
00160                                           int bIsPostGIS1_EWKB  );
00161 OGRGeometry CPL_DLL *OGRGeometryFromHexEWKB( const char *pszBytea, int* pnSRID,
00162                                              int bIsPostGIS1_EWKB );
00163 char CPL_DLL * OGRGeometryToHexEWKB( OGRGeometry * poGeometry, int nSRSId,
00164                                      int nPostGISMajor, int nPostGISMinor );
00165 
00166 /************************************************************************/
00167 /*                        WKB Type Handling encoding                    */
00168 /************************************************************************/
00169 
00170 OGRErr OGRReadWKBGeometryType( unsigned char * pabyData,
00171                                OGRwkbVariant wkbVariant,
00172                                OGRwkbGeometryType *eGeometryType );
00173 
00174 /************************************************************************/
00175 /*                            Other                                     */
00176 /************************************************************************/
00177 
00178 void CPL_DLL OGRUpdateFieldType( OGRFieldDefn* poFDefn,
00179                                  OGRFieldType eNewType,
00180                                  OGRFieldSubType eNewSubType );
00181 
00182 #endif /* ndef OGR_P_H_INCLUDED */

Generated for GDAL by doxygen 1.7.6.1.