gooderp18绿色标准版
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

183 lines
8.3KB

  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. #ifndef OGR_P_H_INCLUDED
  31. #define OGR_P_H_INCLUDED
  32. /* -------------------------------------------------------------------- */
  33. /* Include the common portability library ... lets us do lots */
  34. /* of stuff easily. */
  35. /* -------------------------------------------------------------------- */
  36. #include "cpl_string.h"
  37. #include "cpl_conv.h"
  38. #include "cpl_minixml.h"
  39. #include "ogr_core.h"
  40. #include "ogr_geometry.h"
  41. #include "ogr_feature.h"
  42. /* A default name for the default geometry column, instead of '' */
  43. #define OGR_GEOMETRY_DEFAULT_NON_EMPTY_NAME "_ogr_geometry_"
  44. #ifdef CPL_MSB
  45. # define OGR_SWAP(x) (x == wkbNDR)
  46. #else
  47. # define OGR_SWAP(x) (x == wkbXDR)
  48. #endif
  49. /* PostGIS 1.X has non standard codes for the following geometry types */
  50. #define POSTGIS15_CURVEPOLYGON 13 /* instead of 10 */
  51. #define POSTGIS15_MULTICURVE 14 /* instead of 11 */
  52. #define POSTGIS15_MULTISURFACE 15 /* instead of 12 */
  53. /* Has been deprecated. Can only be used in very specific circumstances */
  54. #ifdef GDAL_COMPILATION
  55. #define wkb25DBitInternalUse 0x80000000
  56. #endif
  57. /* -------------------------------------------------------------------- */
  58. /* helper function for parsing well known text format vector objects.*/
  59. /* -------------------------------------------------------------------- */
  60. #ifdef OGR_GEOMETRY_H_INCLUDED
  61. #define OGR_WKT_TOKEN_MAX 64
  62. const char CPL_DLL * OGRWktReadToken( const char * pszInput, char * pszToken );
  63. const char CPL_DLL * OGRWktReadPoints( const char * pszInput,
  64. OGRRawPoint **ppaoPoints,
  65. double **ppadfZ,
  66. int * pnMaxPoints,
  67. int * pnReadPoints );
  68. const char CPL_DLL * OGRWktReadPointsM( const char * pszInput,
  69. OGRRawPoint **ppaoPoints,
  70. double **ppadfZ,
  71. double **ppadfM,
  72. int * flags, /* geometry flags, are we expecting Z, M, or both; may change due to input */
  73. int * pnMaxPoints,
  74. int * pnReadPoints );
  75. void CPL_DLL OGRMakeWktCoordinate( char *, double, double, double, int );
  76. void CPL_DLL OGRMakeWktCoordinateM( char *, double, double, double, double, OGRBoolean, OGRBoolean );
  77. #endif
  78. void OGRFormatDouble( char *pszBuffer, int nBufferLen, double dfVal,
  79. char chDecimalSep, int nPrecision = 15, char chConversionSpecifier = 'f' );
  80. /* -------------------------------------------------------------------- */
  81. /* Date-time parsing and processing functions */
  82. /* -------------------------------------------------------------------- */
  83. /* Internal use by OGR drivers only, CPL_DLL is just there in case */
  84. /* they are compiled as plugins */
  85. int CPL_DLL OGRGetDayOfWeek(int day, int month, int year);
  86. int CPL_DLL OGRParseXMLDateTime( const char* pszXMLDateTime,
  87. OGRField* psField );
  88. int CPL_DLL OGRParseRFC822DateTime( const char* pszRFC822DateTime,
  89. OGRField* psField );
  90. char CPL_DLL * OGRGetRFC822DateTime(const OGRField* psField);
  91. char CPL_DLL * OGRGetXMLDateTime(const OGRField* psField);
  92. char CPL_DLL * OGRGetXML_UTF8_EscapedString(const char* pszString);
  93. int OGRCompareDate(const OGRField *psFirstTuple,
  94. const OGRField *psSecondTuple ); /* used by ogr_gensql.cpp and ogrfeaturequery.cpp */
  95. /* General utility option processing. */
  96. int CPL_DLL OGRGeneralCmdLineProcessor( int nArgc, char ***ppapszArgv, int nOptions );
  97. /************************************************************************/
  98. /* Support for special attributes (feature query and selection) */
  99. /************************************************************************/
  100. #define SPF_FID 0
  101. #define SPF_OGR_GEOMETRY 1
  102. #define SPF_OGR_STYLE 2
  103. #define SPF_OGR_GEOM_WKT 3
  104. #define SPF_OGR_GEOM_AREA 4
  105. #define SPECIAL_FIELD_COUNT 5
  106. extern const char* const SpecialFieldNames[SPECIAL_FIELD_COUNT];
  107. #ifdef SWQ_H_INCLUDED_
  108. extern const swq_field_type SpecialFieldTypes[SPECIAL_FIELD_COUNT];
  109. #endif
  110. /************************************************************************/
  111. /* Some SRS related stuff, search in SRS data files. */
  112. /************************************************************************/
  113. OGRErr CPL_DLL OSRGetEllipsoidInfo( int, char **, double *, double *);
  114. /* Fast atof function */
  115. double OGRFastAtof(const char* pszStr);
  116. OGRErr CPL_DLL OGRCheckPermutation(int* panPermutation, int nSize);
  117. /* GML related */
  118. OGRGeometry *GML2OGRGeometry_XMLNode( const CPLXMLNode *psNode,
  119. int nPseudoBoolGetSecondaryGeometryOption,
  120. int nRecLevel = 0,
  121. int nSRSDimension = 0,
  122. bool bIgnoreGSG = false,
  123. bool bOrientation = true,
  124. bool bFaceHoleNegative = false);
  125. /************************************************************************/
  126. /* PostGIS EWKB encoding */
  127. /************************************************************************/
  128. OGRGeometry CPL_DLL *OGRGeometryFromEWKB( GByte *pabyWKB, int nLength, int* pnSRID,
  129. int bIsPostGIS1_EWKB );
  130. OGRGeometry CPL_DLL *OGRGeometryFromHexEWKB( const char *pszBytea, int* pnSRID,
  131. int bIsPostGIS1_EWKB );
  132. char CPL_DLL * OGRGeometryToHexEWKB( OGRGeometry * poGeometry, int nSRSId,
  133. int nPostGISMajor, int nPostGISMinor );
  134. /************************************************************************/
  135. /* WKB Type Handling encoding */
  136. /************************************************************************/
  137. OGRErr OGRReadWKBGeometryType( const unsigned char * pabyData,
  138. OGRwkbVariant wkbVariant,
  139. OGRwkbGeometryType *eGeometryType );
  140. /************************************************************************/
  141. /* Other */
  142. /************************************************************************/
  143. void CPL_DLL OGRUpdateFieldType( OGRFieldDefn* poFDefn,
  144. OGRFieldType eNewType,
  145. OGRFieldSubType eNewSubType );
  146. #endif /* ndef OGR_P_H_INCLUDED */
上海开阖软件有限公司 沪ICP备12045867号-1