- Main Page
- Classes
- Files
- Directories
- Related Pages

- File List
- File Members

# ogr_core.h

    00001 /******************************************************************************
    00002  * $Id: ogr_core.h 10646 2007-01-18 02:38:10Z warmerdam $
    00003  *
    00004  * Project:  OpenGIS Simple Features Reference Implementation
    00005  * Purpose:  Define some core portability services for cross-platform OGR code.
    00006  * Author:   Frank Warmerdam, warmerdam@pobox.com
    00007  *
    00008  ******************************************************************************
    00009  * Copyright (c) 1999, Frank Warmerdam
    00010  *
    00011  * Permission is hereby granted, free of charge, to any person obtaining a
    00012  * copy of this software and associated documentation files (the "Software"),
    00013  * to deal in the Software without restriction, including without limitation
    00014  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
    00015  * and/or sell copies of the Software, and to permit persons to whom the
    00016  * Software is furnished to do so, subject to the following conditions:
    00017  *
    00018  * The above copyright notice and this permission notice shall be included
    00019  * in all copies or substantial portions of the Software.
    00020  *
    00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    00022  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00023  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    00024  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00025  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    00026  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    00027  * DEALINGS IN THE SOFTWARE.
    00028  ****************************************************************************/
    00029
    00030 #ifndef _OGR_CORE_H_INCLUDED
    00031 #define _OGR_CORE_H_INCLUDED
    00032
    00033 #include "cpl_port.h"
    00034
    00039 #ifdef __cplusplus
    00040 class CPL_DLL OGREnvelope
    00041 {
    00042   public:
    00043         OGREnvelope()
    00044         {
    00045                 MinX = MaxX = MinY = MaxY = 0;
    00046         }
    00047     double      MinX;
    00048     double      MaxX;
    00049     double      MinY;
    00050     double      MaxY;
    00051
    00052     int  IsInit() { return MinX != 0 || MinY != 0 || MaxX != 0 || MaxY != 0; }
    00053     void Merge( OGREnvelope & sOther ) {
    00054         if( IsInit() )
    00055         {
    00056             MinX = MIN(MinX,sOther.MinX);
    00057             MaxX = MAX(MaxX,sOther.MaxX);
    00058             MinY = MIN(MinY,sOther.MinY);
    00059             MaxY = MAX(MaxY,sOther.MaxY);
    00060         }
    00061         else
    00062         {
    00063             MinX = sOther.MinX;
    00064             MaxX = sOther.MaxX;
    00065             MinY = sOther.MinY;
    00066             MaxY = sOther.MaxY;
    00067         }
    00068     }
    00069 };
    00070 #else
    00071 typedef struct
    00072 {
    00073     double      MinX;
    00074     double      MaxX;
    00075     double      MinY;
    00076     double      MaxY;
    00077 } OGREnvelope;
    00078 #endif
    00079
    00080 CPL_C_START
    00081
    00082 void CPL_DLL *OGRMalloc( size_t );
    00083 void CPL_DLL *OGRCalloc( size_t, size_t );
    00084 void CPL_DLL *OGRRealloc( void *, size_t );
    00085 char CPL_DLL *OGRStrdup( const char * );
    00086 void CPL_DLL OGRFree( void * );
    00087
    00088 typedef int OGRErr;
    00089
    00090 #define OGRERR_NONE                0
    00091 #define OGRERR_NOT_ENOUGH_DATA     1    /* not enough data to deserialize */
    00092 #define OGRERR_NOT_ENOUGH_MEMORY   2
    00093 #define OGRERR_UNSUPPORTED_GEOMETRY_TYPE 3
    00094 #define OGRERR_UNSUPPORTED_OPERATION 4
    00095 #define OGRERR_CORRUPT_DATA        5
    00096 #define OGRERR_FAILURE             6
    00097 #define OGRERR_UNSUPPORTED_SRS     7
    00098
    00099 typedef int     OGRBoolean;
    00100
    00101 /* -------------------------------------------------------------------- */
    00102 /*      ogr_geometry.h related definitions.                             */
    00103 /* -------------------------------------------------------------------- */
    00110 typedef enum
    00111 {
    00112     wkbUnknown = 0,             /* non-standard */
    00113     wkbPoint = 1,               /* rest are standard WKB type codes */
    00114     wkbLineString = 2,
    00115     wkbPolygon = 3,
    00116     wkbMultiPoint = 4,
    00117     wkbMultiLineString = 5,
    00118     wkbMultiPolygon = 6,
    00119     wkbGeometryCollection = 7,
    00120     wkbNone = 100,              /* non-standard, for pure attribute records */
    00121     wkbLinearRing = 101,        /* non-standard, just for createGeometry() */
    00122     wkbPoint25D = 0x80000001,   /* 2.5D extensions as per 99-402 */
    00123     wkbLineString25D = 0x80000002,
    00124     wkbPolygon25D = 0x80000003,
    00125     wkbMultiPoint25D = 0x80000004,
    00126     wkbMultiLineString25D = 0x80000005,
    00127     wkbMultiPolygon25D = 0x80000006,
    00128     wkbGeometryCollection25D = 0x80000007
    00129 } OGRwkbGeometryType;
    00130
    00131 #define wkb25DBit 0x80000000
    00132 #define wkbFlatten(x)  ((OGRwkbGeometryType) ((x) & (~wkb25DBit)))
    00133
    00134 #define ogrZMarker 0x21125711
    00135
    00136 const char CPL_DLL * OGRGeometryTypeToName( OGRwkbGeometryType eType );
    00137
    00138 typedef enum
    00139 {
    00140     wkbXDR = 0,         /* MSB/Sun/Motoroloa: Most Significant Byte First   */
    00141     wkbNDR = 1          /* LSB/Intel/Vax: Least Significant Byte First      */
    00142 } OGRwkbByteOrder;
    00143
    00144 #ifndef NO_HACK_FOR_IBM_DB2_V72
    00145 #  define HACK_FOR_IBM_DB2_V72
    00146 #endif
    00147
    00148 #ifdef HACK_FOR_IBM_DB2_V72
    00149 #  define DB2_V72_FIX_BYTE_ORDER(x) ((((x) & 0x31) == (x)) ? (OGRwkbByteOrder) ((x) & 0x1) : (x))
    00150 #  define DB2_V72_UNFIX_BYTE_ORDER(x) ((unsigned char) (OGRGeometry::bGenerate_DB2_V72_BYTE_ORDER ? ((x) | 0x30) : (x)))
    00151 #else
    00152 #  define DB2_V72_FIX_BYTE_ORDER(x) (x)
    00153 #  define DB2_V72_UNFIX_BYTE_ORDER(x) (x)
    00154 #endif
    00155
    00156 /************************************************************************/
    00157 /*                  ogr_feature.h related definitions.                  */
    00158 /************************************************************************/
    00159
    00166 typedef enum
    00167 {                   OFTInteger = 0,                 OFTIntegerList = 1,        OFTReal = 2,                        OFTRealList = 3,                  OFTString = 4,                       OFTStringList = 5,       OFTWideString = 6,     OFTWideStringList = 7,                        OFTBinary = 8,                                   OFTDate = 9,                                   OFTTime = 10,                          OFTDateTime = 11
    00180 } OGRFieldType;
    00181
    00186 typedef enum
    00187 {
    00188     OJUndefined = 0,
    00189     OJLeft = 1,
    00190     OJRight = 2
    00191 } OGRJustification;
    00192
    00193 #define OGRNullFID            -1
    00194 #define OGRUnsetMarker        -21121
    00195
    00196 /************************************************************************/
    00197 /*                               OGRField                               */
    00198 /************************************************************************/
    00199
    00204 typedef union {
    00205     int         Integer;
    00206     double      Real;
    00207     char       *String;
    00208     /* wchar    *WideString; */
    00209
    00210     struct {
    00211         int     nCount;
    00212         int     *paList;
    00213     } IntegerList;
    00214
    00215     struct {
    00216         int     nCount;
    00217         double  *paList;
    00218     } RealList;
    00219
    00220     struct {
    00221         int     nCount;
    00222         char    **paList;
    00223     } StringList;
    00224
    00225     /*
    00226     union {
    00227         int   nCount;
    00228         wchar *paList;
    00229     } WideStringList;
    00230     */
    00231
    00232     struct {
    00233         int     nCount;
    00234         GByte   *paData;
    00235     } Binary;
    00236
    00237     struct {
    00238         int     nMarker1;
    00239         int     nMarker2;
    00240     } Set;
    00241
    00242     struct {
    00243         GInt16  Year;
    00244         GByte   Month;
    00245         GByte   Day;
    00246         GByte   Hour;
    00247         GByte   Minute;
    00248         GByte   Second;
    00249         GByte   TZFlag; /* 0=unknown, 1=localtime(ambiguous),
    00250                            100=GMT, 104=GMT+1, 80=GMT-5, etc */
    00251     } Date;
    00252 } OGRField;
    00253
    00254 int CPL_DLL OGRParseDate( const char *pszInput, OGRField *psOutput,
    00255                           int nOptions );
    00256
    00257 /* -------------------------------------------------------------------- */
    00258 /*      Constants from ogrsf_frmts.h for capabilities.                  */
    00259 /* -------------------------------------------------------------------- */
    00260 #define OLCRandomRead          "RandomRead"
    00261 #define OLCSequentialWrite     "SequentialWrite"
    00262 #define OLCRandomWrite         "RandomWrite"
    00263 #define OLCFastSpatialFilter   "FastSpatialFilter"
    00264 #define OLCFastFeatureCount    "FastFeatureCount"
    00265 #define OLCFastGetExtent       "FastGetExtent"
    00266 #define OLCCreateField         "CreateField"
    00267 #define OLCTransactions        "Transactions"
    00268 #define OLCDeleteFeature       "DeleteFeature"
    00269 #define OLCFastSetNextByIndex  "FastSetNextByIndex"
    00270
    00271 #define ODsCCreateLayer        "CreateLayer"
    00272 #define ODsCDeleteLayer        "DeleteLayer"
    00273
    00274 #define ODrCCreateDataSource   "CreateDataSource"
    00275 #define ODrCDeleteDataSource   "DeleteDataSource"
    00276
    00277 CPL_C_END
    00278
    00279 #endif /* ndef _OGR_CORE_H_INCLUDED */
    00280

Generated for GDAL by 1.5.1.