00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
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
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
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
00176 typedef enum
00177 {
00178 wkbXDR = 0,
00179 wkbNDR = 1
00180 } OGRwkbByteOrder;
00181
00182 #ifndef NO_HACK_FOR_IBM_DB2_V72
00183 # define HACK_FOR_IBM_DB2_V72
00184 #endif
00185
00186 #ifdef HACK_FOR_IBM_DB2_V72
00187 # define DB2_V72_FIX_BYTE_ORDER(x) ((((x) & 0x31) == (x)) ? (OGRwkbByteOrder) ((x) & 0x1) : (x))
00188 # define DB2_V72_UNFIX_BYTE_ORDER(x) ((unsigned char) (OGRGeometry::bGenerate_DB2_V72_BYTE_ORDER ? ((x) | 0x30) : (x)))
00189 #else
00190 # define DB2_V72_FIX_BYTE_ORDER(x) (x)
00191 # define DB2_V72_UNFIX_BYTE_ORDER(x) (x)
00192 #endif
00193
00194
00195
00196
00197
00204 typedef enum
00205 { OFTInteger = 0, OFTIntegerList = 1, OFTReal = 2, OFTRealList = 3, OFTString = 4, OFTStringList = 5, OFTWideString = 6, OFTWideStringList = 7, OFTBinary = 8, OFTDate = 9, OFTTime = 10, OFTDateTime = 11
00218 } OGRFieldType;
00219
00224 typedef enum
00225 {
00226 OJUndefined = 0,
00227 OJLeft = 1,
00228 OJRight = 2
00229 } OGRJustification;
00230
00231 #define OGRNullFID -1
00232 #define OGRUnsetMarker -21121
00233
00234
00235
00236
00237
00242 typedef union {
00243 int Integer;
00244 double Real;
00245 char *String;
00246
00247 struct {
00248 int nCount;
00249 int *paList;
00250 } IntegerList;
00251
00252 struct {
00253 int nCount;
00254 double *paList;
00255 } RealList;
00256
00257 struct {
00258 int nCount;
00259 char **paList;
00260 } StringList;
00261
00262 struct {
00263 int nCount;
00264 GByte *paData;
00265 } Binary;
00266
00267 struct {
00268 int nMarker1;
00269 int nMarker2;
00270 } Set;
00271
00272 struct {
00273 GInt16 Year;
00274 GByte Month;
00275 GByte Day;
00276 GByte Hour;
00277 GByte Minute;
00278 GByte Second;
00279 GByte TZFlag;
00280
00281 } Date;
00282 } OGRField;
00283
00284 int CPL_DLL OGRParseDate( const char *pszInput, OGRField *psOutput,
00285 int nOptions );
00286
00287
00288
00289
00290 #define OLCRandomRead "RandomRead"
00291 #define OLCSequentialWrite "SequentialWrite"
00292 #define OLCRandomWrite "RandomWrite"
00293 #define OLCFastSpatialFilter "FastSpatialFilter"
00294 #define OLCFastFeatureCount "FastFeatureCount"
00295 #define OLCFastGetExtent "FastGetExtent"
00296 #define OLCCreateField "CreateField"
00297 #define OLCTransactions "Transactions"
00298 #define OLCDeleteFeature "DeleteFeature"
00299 #define OLCFastSetNextByIndex "FastSetNextByIndex"
00300 #define OLCStringsAsUTF8 "StringsAsUTF8"
00301
00302 #define ODsCCreateLayer "CreateLayer"
00303 #define ODsCDeleteLayer "DeleteLayer"
00304
00305 #define ODrCCreateDataSource "CreateDataSource"
00306 #define ODrCDeleteDataSource "DeleteDataSource"
00307
00308
00309
00310
00311
00312
00317 typedef enum ogr_style_tool_class_id
00318 {
00319 OGRSTCNone = 0,
00320 OGRSTCPen = 1,
00321 OGRSTCBrush = 2,
00322 OGRSTCSymbol = 3,
00323 OGRSTCLabel = 4,
00324 OGRSTCVector = 5
00325 } OGRSTClassId;
00326
00330 typedef enum ogr_style_tool_units_id
00331 {
00332 OGRSTUGround = 0,
00333 OGRSTUPixel = 1,
00334 OGRSTUPoints = 2,
00335 OGRSTUMM = 3,
00336 OGRSTUCM = 4,
00337 OGRSTUInches = 5
00338 } OGRSTUnitId;
00339
00343 typedef enum ogr_style_tool_param_pen_id
00344 {
00345 OGRSTPenColor = 0,
00346 OGRSTPenWidth = 1,
00347 OGRSTPenPattern = 2,
00348 OGRSTPenId = 3,
00349 OGRSTPenPerOffset = 4,
00350 OGRSTPenCap = 5,
00351 OGRSTPenJoin = 6,
00352 OGRSTPenPriority = 7,
00353 OGRSTPenLast = 8
00354
00355 } OGRSTPenParam;
00356
00360 typedef enum ogr_style_tool_param_brush_id
00361 {
00362 OGRSTBrushFColor = 0,
00363 OGRSTBrushBColor = 1,
00364 OGRSTBrushId = 2,
00365 OGRSTBrushAngle = 3,
00366 OGRSTBrushSize = 4,
00367 OGRSTBrushDx = 5,
00368 OGRSTBrushDy = 6,
00369 OGRSTBrushPriority = 7,
00370 OGRSTBrushLast = 8
00371
00372 } OGRSTBrushParam;
00373
00374
00378 typedef enum ogr_style_tool_param_symbol_id
00379 {
00380 OGRSTSymbolId = 0,
00381 OGRSTSymbolAngle = 1,
00382 OGRSTSymbolColor = 2,
00383 OGRSTSymbolSize = 3,
00384 OGRSTSymbolDx = 4,
00385 OGRSTSymbolDy = 5,
00386 OGRSTSymbolStep = 6,
00387 OGRSTSymbolPerp = 7,
00388 OGRSTSymbolOffset = 8,
00389 OGRSTSymbolPriority = 9,
00390 OGRSTSymbolFontName = 10,
00391 OGRSTSymbolLast = 11
00392
00393 } OGRSTSymbolParam;
00394
00398 typedef enum ogr_style_tool_param_label_id
00399 {
00400 OGRSTLabelFontName = 0,
00401 OGRSTLabelSize = 1,
00402 OGRSTLabelTextString = 2,
00403 OGRSTLabelAngle = 3,
00404 OGRSTLabelFColor = 4,
00405 OGRSTLabelBColor = 5,
00406 OGRSTLabelPlacement = 6,
00407 OGRSTLabelAnchor = 7,
00408 OGRSTLabelDx = 8,
00409 OGRSTLabelDy = 9,
00410 OGRSTLabelPerp = 10,
00411 OGRSTLabelBold = 11,
00412 OGRSTLabelItalic = 12,
00413 OGRSTLabelUnderline = 13,
00414 OGRSTLabelPriority = 14,
00415 OGRSTLabelStrikeout = 15,
00416 OGRSTLabelStretch = 16,
00417 OGRSTLabelAdjHor = 17,
00418 OGRSTLabelAdjVert = 18,
00419 OGRSTLabelHColor = 19,
00420 OGRSTLabelLast = 20
00421
00422 } OGRSTLabelParam;
00423
00424
00425
00426
00427
00428 #ifndef GDAL_CHECK_VERSION
00429
00441 int CPL_DLL CPL_STDCALL GDALCheckVersion( int nVersionMajor, int nVersionMinor,
00442 const char* pszCallingComponentName);
00443
00445 #define GDAL_CHECK_VERSION(pszCallingComponentName) \
00446 GDALCheckVersion(GDAL_VERSION_MAJOR, GDAL_VERSION_MINOR, pszCallingComponentName)
00447
00448 #endif
00449
00450 CPL_C_END
00451
00452 #endif