OGR: ogr_core.h Source File

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

- File List
- File Members

# ogr_core.h

Go to the documentation of this file.

    00001 /******************************************************************************
    00002  * $Id: ogr_core.h 15084 2008-07-30 23:27:04Z 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 #include "gdal_version.h"
    00035
    00046 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS)
    00047 class CPL_DLL OGREnvelope
    00048 {
    00049   public:
    00050         OGREnvelope()
    00051         {
    00052                 MinX = MaxX = MinY = MaxY = 0;
    00053         }
    00054     double      MinX;
    00055     double      MaxX;
    00056     double      MinY;
    00057     double      MaxY;
    00058
    00059     int  IsInit() const { return MinX != 0 || MinY != 0 || MaxX != 0 || MaxY != 0; }
    00060     void Merge( OGREnvelope const& sOther ) {
    00061         if( IsInit() )
    00062         {
    00063             MinX = MIN(MinX,sOther.MinX);
    00064             MaxX = MAX(MaxX,sOther.MaxX);
    00065             MinY = MIN(MinY,sOther.MinY);
    00066             MaxY = MAX(MaxY,sOther.MaxY);
    00067         }
    00068         else
    00069         {
    00070             MinX = sOther.MinX;
    00071             MaxX = sOther.MaxX;
    00072             MinY = sOther.MinY;
    00073             MaxY = sOther.MaxY;
    00074         }
    00075     }
    00076     void Merge( double dfX, double dfY ) {
    00077         if( IsInit() )
    00078         {
    00079             MinX = MIN(MinX,dfX);
    00080             MaxX = MAX(MaxX,dfX);
    00081             MinY = MIN(MinY,dfY);
    00082             MaxY = MAX(MaxY,dfY);
    00083         }
    00084         else
    00085         {
    00086             MinX = MaxX = dfX;
    00087             MinY = MaxY = dfY;
    00088         }
    00089     }
    00090
    00091     int Intersects(OGREnvelope const& other) const
    00092     {
    00093         return MinX <= other.MaxX && MaxX >= other.MinX &&
    00094                MinY <= other.MaxY && MaxY >= other.MinY;
    00095     }
    00096
    00097     int Contains(OGREnvelope const& other) const
    00098     {
    00099         return MinX <= other.MinX && MinY <= other.MinY &&
    00100                MaxX >= other.MaxX && MaxY >= other.MaxY;
    00101     }
    00102 };
    00103 #else
    00104 typedef struct
    00105 {
    00106     double      MinX;
    00107     double      MaxX;
    00108     double      MinY;
    00109     double      MaxY;
    00110 } OGREnvelope;
    00111 #endif
    00112
    00113 CPL_C_START
    00114
    00115 void CPL_DLL *OGRMalloc( size_t );
    00116 void CPL_DLL *OGRCalloc( size_t, size_t );
    00117 void CPL_DLL *OGRRealloc( void *, size_t );
    00118 char CPL_DLL *OGRStrdup( const char * );
    00119 void CPL_DLL OGRFree( void * );
    00120
    00121 typedef int OGRErr;
    00122
    00123 #define OGRERR_NONE                0
    00124 #define OGRERR_NOT_ENOUGH_DATA     1    /* not enough data to deserialize */
    00125 #define OGRERR_NOT_ENOUGH_MEMORY   2
    00126 #define OGRERR_UNSUPPORTED_GEOMETRY_TYPE 3
    00127 #define OGRERR_UNSUPPORTED_OPERATION 4
    00128 #define OGRERR_CORRUPT_DATA        5
    00129 #define OGRERR_FAILURE             6
    00130 #define OGRERR_UNSUPPORTED_SRS     7
    00131 #define OGRERR_INVALID_HANDLE      8
    00132
    00133 typedef int     OGRBoolean;
    00134
    00135 /* -------------------------------------------------------------------- */
    00136 /*      ogr_geometry.h related definitions.                             */
    00137 /* -------------------------------------------------------------------- */
    00144 typedef enum
    00145 {
    00146     wkbUnknown = 0,
    00147     wkbPoint = 1,
    00148     wkbLineString = 2,
    00150     wkbPolygon = 3,
    00153     wkbMultiPoint = 4,
    00154     wkbMultiLineString = 5,
    00155     wkbMultiPolygon = 6,
    00156     wkbGeometryCollection = 7,
    00158     wkbNone = 100,
    00159     wkbLinearRing = 101,
    00160     wkbPoint25D = 0x80000001,
    00161     wkbLineString25D = 0x80000002,
    00162     wkbPolygon25D = 0x80000003,
    00163     wkbMultiPoint25D = 0x80000004,
    00164     wkbMultiLineString25D = 0x80000005,
    00165     wkbMultiPolygon25D = 0x80000006,
    00166     wkbGeometryCollection25D = 0x80000007
    00167 } OGRwkbGeometryType;
    00168
    00169 #define wkb25DBit 0x80000000
    00170 #define wkbFlatten(x)  ((OGRwkbGeometryType) ((x) & (~wkb25DBit)))
    00171
    00172 #define ogrZMarker 0x21125711
    00173
    00174 const char CPL_DLL * OGRGeometryTypeToName( OGRwkbGeometryType eType );
    00175 OGRwkbGeometryType CPL_DLL OGRMergeGeometryTypes( OGRwkbGeometryType eMain,
    00176                                                   OGRwkbGeometryType eExtra );
    00177
    00178 typedef enum
    00179 {
    00180     wkbXDR = 0,         /* MSB/Sun/Motoroloa: Most Significant Byte First   */
    00181     wkbNDR = 1          /* LSB/Intel/Vax: Least Significant Byte First      */
    00182 } OGRwkbByteOrder;
    00183
    00184 #ifndef NO_HACK_FOR_IBM_DB2_V72
    00185 #  define HACK_FOR_IBM_DB2_V72
    00186 #endif
    00187
    00188 #ifdef HACK_FOR_IBM_DB2_V72
    00189 #  define DB2_V72_FIX_BYTE_ORDER(x) ((((x) & 0x31) == (x)) ? (OGRwkbByteOrder) ((x) & 0x1) : (x))
    00190 #  define DB2_V72_UNFIX_BYTE_ORDER(x) ((unsigned char) (OGRGeometry::bGenerate_DB2_V72_BYTE_ORDER ? ((x) | 0x30) : (x)))
    00191 #else
    00192 #  define DB2_V72_FIX_BYTE_ORDER(x) (x)
    00193 #  define DB2_V72_UNFIX_BYTE_ORDER(x) (x)
    00194 #endif
    00195
    00196 /************************************************************************/
    00197 /*                  ogr_feature.h related definitions.                  */
    00198 /************************************************************************/
    00199
    00206 typedef enum
    00207 {                   OFTInteger = 0,                 OFTIntegerList = 1,        OFTReal = 2,                        OFTRealList = 3,                  OFTString = 4,                       OFTStringList = 5,                             OFTWideString = 6,                             OFTWideStringList = 7,                        OFTBinary = 8,                                   OFTDate = 9,                                   OFTTime = 10,                          OFTDateTime = 11
    00220 } OGRFieldType;
    00221
    00226 typedef enum
    00227 {
    00228     OJUndefined = 0,
    00229     OJLeft = 1,
    00230     OJRight = 2
    00231 } OGRJustification;
    00232
    00233 #define OGRNullFID            -1
    00234 #define OGRUnsetMarker        -21121
    00235
    00236 /************************************************************************/
    00237 /*                               OGRField                               */
    00238 /************************************************************************/
    00239
    00244 typedef union {
    00245     int         Integer;
    00246     double      Real;
    00247     char       *String;
    00248
    00249     struct {
    00250         int     nCount;
    00251         int     *paList;
    00252     } IntegerList;
    00253
    00254     struct {
    00255         int     nCount;
    00256         double  *paList;
    00257     } RealList;
    00258
    00259     struct {
    00260         int     nCount;
    00261         char    **paList;
    00262     } StringList;
    00263
    00264     struct {
    00265         int     nCount;
    00266         GByte   *paData;
    00267     } Binary;
    00268
    00269     struct {
    00270         int     nMarker1;
    00271         int     nMarker2;
    00272     } Set;
    00273
    00274     struct {
    00275         GInt16  Year;
    00276         GByte   Month;
    00277         GByte   Day;
    00278         GByte   Hour;
    00279         GByte   Minute;
    00280         GByte   Second;
    00281         GByte   TZFlag; /* 0=unknown, 1=localtime(ambiguous),
    00282                            100=GMT, 104=GMT+1, 80=GMT-5, etc */
    00283     } Date;
    00284 } OGRField;
    00285
    00286 int CPL_DLL OGRParseDate( const char *pszInput, OGRField *psOutput,
    00287                           int nOptions );
    00288
    00289 /* -------------------------------------------------------------------- */
    00290 /*      Constants from ogrsf_frmts.h for capabilities.                  */
    00291 /* -------------------------------------------------------------------- */
    00292 #define OLCRandomRead          "RandomRead"
    00293 #define OLCSequentialWrite     "SequentialWrite"
    00294 #define OLCRandomWrite         "RandomWrite"
    00295 #define OLCFastSpatialFilter   "FastSpatialFilter"
    00296 #define OLCFastFeatureCount    "FastFeatureCount"
    00297 #define OLCFastGetExtent       "FastGetExtent"
    00298 #define OLCCreateField         "CreateField"
    00299 #define OLCTransactions        "Transactions"
    00300 #define OLCDeleteFeature       "DeleteFeature"
    00301 #define OLCFastSetNextByIndex  "FastSetNextByIndex"
    00302 #define OLCStringsAsUTF8       "StringsAsUTF8"
    00303
    00304 #define ODsCCreateLayer        "CreateLayer"
    00305 #define ODsCDeleteLayer        "DeleteLayer"
    00306
    00307 #define ODrCCreateDataSource   "CreateDataSource"
    00308 #define ODrCDeleteDataSource   "DeleteDataSource"
    00309
    00310
    00311 /************************************************************************/
    00312 /*                  ogr_featurestyle.h related definitions.             */
    00313 /************************************************************************/
    00314
    00319 typedef enum ogr_style_tool_class_id
    00320 {
    00321     OGRSTCNone   = 0,
    00322     OGRSTCPen    = 1,
    00323     OGRSTCBrush  = 2,
    00324     OGRSTCSymbol = 3,
    00325     OGRSTCLabel  = 4,
    00326     OGRSTCVector = 5
    00327 } OGRSTClassId;
    00328
    00332 typedef enum ogr_style_tool_units_id
    00333 {
    00334     OGRSTUGround = 0,
    00335     OGRSTUPixel  = 1,
    00336     OGRSTUPoints = 2,
    00337     OGRSTUMM     = 3,
    00338     OGRSTUCM     = 4,
    00339     OGRSTUInches = 5
    00340 } OGRSTUnitId;
    00341
    00345 typedef enum ogr_style_tool_param_pen_id
    00346 {
    00347     OGRSTPenColor       = 0,
    00348     OGRSTPenWidth       = 1,
    00349     OGRSTPenPattern     = 2,
    00350     OGRSTPenId          = 3,
    00351     OGRSTPenPerOffset   = 4,
    00352     OGRSTPenCap         = 5,
    00353     OGRSTPenJoin        = 6,
    00354     OGRSTPenPriority    = 7,
    00355     OGRSTPenLast        = 8
    00356
    00357 } OGRSTPenParam;
    00358
    00362 typedef enum ogr_style_tool_param_brush_id
    00363 {
    00364     OGRSTBrushFColor    = 0,
    00365     OGRSTBrushBColor    = 1,
    00366     OGRSTBrushId        = 2,
    00367     OGRSTBrushAngle     = 3,
    00368     OGRSTBrushSize      = 4,
    00369     OGRSTBrushDx        = 5,
    00370     OGRSTBrushDy        = 6,
    00371     OGRSTBrushPriority  = 7,
    00372     OGRSTBrushLast      = 8
    00373
    00374 } OGRSTBrushParam;
    00375
    00376
    00380 typedef enum ogr_style_tool_param_symbol_id
    00381 {
    00382     OGRSTSymbolId       = 0,
    00383     OGRSTSymbolAngle    = 1,
    00384     OGRSTSymbolColor    = 2,
    00385     OGRSTSymbolSize     = 3,
    00386     OGRSTSymbolDx       = 4,
    00387     OGRSTSymbolDy       = 5,
    00388     OGRSTSymbolStep     = 6,
    00389     OGRSTSymbolPerp     = 7,
    00390     OGRSTSymbolOffset   = 8,
    00391     OGRSTSymbolPriority = 9,
    00392     OGRSTSymbolFontName = 10,
    00393     OGRSTSymbolOColor   = 11,
    00394     OGRSTSymbolLast     = 12
    00395
    00396 } OGRSTSymbolParam;
    00397
    00401 typedef enum ogr_style_tool_param_label_id
    00402 {
    00403     OGRSTLabelFontName  = 0,
    00404     OGRSTLabelSize      = 1,
    00405     OGRSTLabelTextString = 2,
    00406     OGRSTLabelAngle     = 3,
    00407     OGRSTLabelFColor    = 4,
    00408     OGRSTLabelBColor    = 5,
    00409     OGRSTLabelPlacement = 6,
    00410     OGRSTLabelAnchor    = 7,
    00411     OGRSTLabelDx        = 8,
    00412     OGRSTLabelDy        = 9,
    00413     OGRSTLabelPerp      = 10,
    00414     OGRSTLabelBold      = 11,
    00415     OGRSTLabelItalic    = 12,
    00416     OGRSTLabelUnderline = 13,
    00417     OGRSTLabelPriority  = 14,
    00418     OGRSTLabelStrikeout = 15,
    00419     OGRSTLabelStretch   = 16,
    00420     OGRSTLabelAdjHor    = 17,
    00421     OGRSTLabelAdjVert   = 18,
    00422     OGRSTLabelHColor    = 19,
    00423     OGRSTLabelOColor    = 20,
    00424     OGRSTLabelLast      = 21
    00425
    00426 } OGRSTLabelParam;
    00427
    00428 /* ------------------------------------------------------------------- */
    00429 /*                        Version checking                             */
    00430 /* -------------------------------------------------------------------- */
    00431
    00432 /* Note to developers : please keep this section in sync with gdal.h */
    00433
    00434 #ifndef GDAL_VERSION_INFO_DEFINED
    00435 #define GDAL_VERSION_INFO_DEFINED
    00436 const char CPL_DLL * CPL_STDCALL GDALVersionInfo( const char * );
    00437 #endif
    00438
    00439 #ifndef GDAL_CHECK_VERSION
    00440
    00452 int CPL_DLL CPL_STDCALL GDALCheckVersion( int nVersionMajor, int nVersionMinor,
    00453                                           const char* pszCallingComponentName);
    00454
    00456 #define GDAL_CHECK_VERSION(pszCallingComponentName) \
    00457  GDALCheckVersion(GDAL_VERSION_MAJOR, GDAL_VERSION_MINOR, pszCallingComponentName)
    00458
    00459 #endif
    00460
    00461 CPL_C_END
    00462
    00463 #endif /* ndef OGR_CORE_H_INCLUDED */

Generated for GDAL by 1.5.9.