31 #ifndef OGR_CORE_H_INCLUDED
32 #define OGR_CORE_H_INCLUDED
35 #include "gdal_version.h"
48 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS) && !defined(DOXYGEN_SKIP)
54 class CPL_DLL OGREnvelope
57 OGREnvelope() : MinX(std::numeric_limits<double>::infinity()),
58 MaxX(-std::numeric_limits<double>::infinity()),
59 MinY(std::numeric_limits<double>::infinity()),
60 MaxY(-std::numeric_limits<double>::infinity())
64 OGREnvelope(
const OGREnvelope& oOther) :
65 MinX(oOther.MinX),MaxX(oOther.MaxX), MinY(oOther.MinY), MaxY(oOther.MaxY)
74 #ifdef HAVE_GCC_DIAGNOSTIC_PUSH
75 #pragma GCC diagnostic push
76 #pragma GCC diagnostic ignored "-Wfloat-equal"
78 int IsInit()
const {
return MinX != std::numeric_limits<double>::infinity(); }
80 #ifdef HAVE_GCC_DIAGNOSTIC_PUSH
81 #pragma GCC diagnostic pop
84 void Merge( OGREnvelope
const& sOther ) {
85 MinX =
MIN(MinX,sOther.MinX);
86 MaxX =
MAX(MaxX,sOther.MaxX);
87 MinY =
MIN(MinY,sOther.MinY);
88 MaxY =
MAX(MaxY,sOther.MaxY);
91 void Merge(
double dfX,
double dfY ) {
98 void Intersect( OGREnvelope
const& sOther ) {
99 if(Intersects(sOther))
103 MinX =
MAX(MinX,sOther.MinX);
104 MaxX =
MIN(MaxX,sOther.MaxX);
105 MinY =
MAX(MinY,sOther.MinY);
106 MaxY =
MIN(MaxY,sOther.MaxY);
118 *
this = OGREnvelope();
122 int Intersects(OGREnvelope
const& other)
const
124 return MinX <= other.MaxX && MaxX >= other.MinX &&
125 MinY <= other.MaxY && MaxY >= other.MinY;
128 int Contains(OGREnvelope
const& other)
const
130 return MinX <= other.MinX && MinY <= other.MinY &&
131 MaxX >= other.MaxX && MaxY >= other.MaxY;
151 #if defined(__cplusplus) && !defined(CPL_SUPRESS_CPLUSPLUS) && !defined(DOXYGEN_SKIP)
155 class CPL_DLL OGREnvelope3D :
public OGREnvelope
158 OGREnvelope3D() : OGREnvelope(),
159 MinZ(std::numeric_limits<double>::infinity()),
160 MaxZ(-std::numeric_limits<double>::infinity())
164 OGREnvelope3D(
const OGREnvelope3D& oOther) :
166 MinZ(oOther.MinZ), MaxZ(oOther.MaxZ)
173 #ifdef HAVE_GCC_DIAGNOSTIC_PUSH
174 #pragma GCC diagnostic push
175 #pragma GCC diagnostic ignored "-Wfloat-equal"
177 int IsInit()
const {
return MinX != std::numeric_limits<double>::infinity(); }
178 #ifdef HAVE_GCC_DIAGNOSTIC_PUSH
179 #pragma GCC diagnostic pop
182 void Merge( OGREnvelope3D
const& sOther ) {
183 MinX =
MIN(MinX,sOther.MinX);
184 MaxX =
MAX(MaxX,sOther.MaxX);
185 MinY =
MIN(MinY,sOther.MinY);
186 MaxY =
MAX(MaxY,sOther.MaxY);
187 MinZ =
MIN(MinZ,sOther.MinZ);
188 MaxZ =
MAX(MaxZ,sOther.MaxZ);
191 void Merge(
double dfX,
double dfY,
double dfZ ) {
192 MinX =
MIN(MinX,dfX);
193 MaxX =
MAX(MaxX,dfX);
194 MinY =
MIN(MinY,dfY);
195 MaxY =
MAX(MaxY,dfY);
196 MinZ =
MIN(MinZ,dfZ);
197 MaxZ =
MAX(MaxZ,dfZ);
200 void Intersect( OGREnvelope3D
const& sOther ) {
201 if(Intersects(sOther))
205 MinX =
MAX(MinX,sOther.MinX);
206 MaxX =
MIN(MaxX,sOther.MaxX);
207 MinY =
MAX(MinY,sOther.MinY);
208 MaxY =
MIN(MaxY,sOther.MaxY);
209 MinZ =
MAX(MinZ,sOther.MinZ);
210 MaxZ =
MIN(MaxZ,sOther.MaxZ);
224 *
this = OGREnvelope3D();
228 int Intersects(OGREnvelope3D
const& other)
const
230 return MinX <= other.MaxX && MaxX >= other.MinX &&
231 MinY <= other.MaxY && MaxY >= other.MinY &&
232 MinZ <= other.MaxZ && MaxZ >= other.MinZ;
235 int Contains(OGREnvelope3D
const& other)
const
237 return MinX <= other.MinX && MinY <= other.MinY &&
238 MaxX >= other.MaxX && MaxY >= other.MaxY &&
239 MinZ <= other.MinZ && MaxZ >= other.MaxZ;
261 void CPL_DLL *OGRMalloc(
size_t ) CPL_WARN_DEPRECATED("Use
CPLMalloc instead.");
262 void CPL_DLL *OGRCalloc(
size_t,
size_t ) CPL_WARN_DEPRECATED("Use
CPLCalloc instead.");
263 void CPL_DLL *OGRRealloc(
void *,
size_t ) CPL_WARN_DEPRECATED("Use
CPLRealloc instead.");
264 char CPL_DLL *OGRStrdup( const
char * ) CPL_WARN_DEPRECATED("Use
CPLStrdup instead.");
265 void CPL_DLL OGRFree(
void * ) CPL_WARN_DEPRECATED("Use
CPLFree instead.");
268 #ifdef STRICT_OGRERR_TYPE
287 #define OGRERR_NONE 0
288 #define OGRERR_NOT_ENOUGH_DATA 1
289 #define OGRERR_NOT_ENOUGH_MEMORY 2
290 #define OGRERR_UNSUPPORTED_GEOMETRY_TYPE 3
291 #define OGRERR_UNSUPPORTED_OPERATION 4
292 #define OGRERR_CORRUPT_DATA 5
293 #define OGRERR_FAILURE 6
294 #define OGRERR_UNSUPPORTED_SRS 7
295 #define OGRERR_INVALID_HANDLE 8
296 #define OGRERR_NON_EXISTING_FEATURE 9
425 #ifndef GDAL_COMPILATION
427 #define wkb25DBit 0x80000000
431 #define wkbFlatten(x) OGR_GT_Flatten((OGRwkbGeometryType)(x))
436 #define wkbHasZ(x) (OGR_GT_HasZ(x) != 0)
441 #define wkbSetZ(x) OGR_GT_SetZ(x)
446 #define wkbHasM(x) (OGR_GT_HasM(x) != 0)
451 #define wkbSetM(x) OGR_GT_SetM(x)
454 #define ogrZMarker 0x21125711
462 int bAllowPromotingToCurves );
487 #ifndef NO_HACK_FOR_IBM_DB2_V72
488 # define HACK_FOR_IBM_DB2_V72
491 #ifdef HACK_FOR_IBM_DB2_V72
492 # define DB2_V72_FIX_BYTE_ORDER(x) ((((x) & 0x31) == (x)) ? ((x) & 0x1) : (x))
493 # define DB2_V72_UNFIX_BYTE_ORDER(x) ((unsigned char) (OGRGeometry::bGenerate_DB2_V72_BYTE_ORDER ? ((x) | 0x30) : (x)))
495 # define DB2_V72_FIX_BYTE_ORDER(x) (x)
496 # define DB2_V72_UNFIX_BYTE_ORDER(x) (x)
504 #define ALTER_NAME_FLAG 0x1
509 #define ALTER_TYPE_FLAG 0x2
514 #define ALTER_WIDTH_PRECISION_FLAG 0x4
520 #define ALTER_NULLABLE_FLAG 0x8
526 #define ALTER_DEFAULT_FLAG 0x10
531 #define ALTER_ALL_FLAG (ALTER_NAME_FLAG | ALTER_TYPE_FLAG | ALTER_WIDTH_PRECISION_FLAG | ALTER_NULLABLE_FLAG | ALTER_DEFAULT_FLAG)
537 #define OGR_F_VAL_NULL 0x00000001
543 #define OGR_F_VAL_GEOM_TYPE 0x00000002
549 #define OGR_F_VAL_WIDTH 0x00000004
558 #define OGR_F_VAL_ALLOW_NULL_WHEN_DEFAULT 0x00000008
566 #define OGR_F_VAL_ALLOW_DIFFERENT_GEOM_DIM 0x00000010
572 #define OGR_F_VAL_ALL (0x7FFFFFFF & ~OGR_F_VAL_ALLOW_DIFFERENT_GEOM_DIM)
585 {
OFTInteger = 0,
OFTIntegerList = 1,
OFTReal = 2,
OFTRealList = 3,
OFTString = 4,
OFTStringList = 5,
OFTWideString = 6,
OFTWideStringList = 7,
OFTBinary = 8,
OFTDate = 9,
OFTTime = 10,
OFTDateTime = 11,
OFTInteger64 = 12,
OFTInteger64List = 13,
636 #define OGRNullFID -1
643 #define OGRUnsetMarker -21121
651 #define OGRNullMarker -21122
714 #define OGR_GET_MS(floatingpoint_sec) (int)(((floatingpoint_sec) - (int)(floatingpoint_sec)) * 1000 + 0.5)
716 int CPL_DLL OGRParseDate(
const char *pszInput,
OGRField *psOutput,
722 #define OLCRandomRead "RandomRead"
723 #define OLCSequentialWrite "SequentialWrite"
724 #define OLCRandomWrite "RandomWrite"
725 #define OLCFastSpatialFilter "FastSpatialFilter"
726 #define OLCFastFeatureCount "FastFeatureCount"
727 #define OLCFastGetExtent "FastGetExtent"
728 #define OLCCreateField "CreateField"
729 #define OLCDeleteField "DeleteField"
730 #define OLCReorderFields "ReorderFields"
731 #define OLCAlterFieldDefn "AlterFieldDefn"
732 #define OLCTransactions "Transactions"
733 #define OLCDeleteFeature "DeleteFeature"
734 #define OLCFastSetNextByIndex "FastSetNextByIndex"
735 #define OLCStringsAsUTF8 "StringsAsUTF8"
736 #define OLCIgnoreFields "IgnoreFields"
737 #define OLCCreateGeomField "CreateGeomField"
738 #define OLCCurveGeometries "CurveGeometries"
739 #define OLCMeasuredGeometries "MeasuredGeometries"
741 #define ODsCCreateLayer "CreateLayer"
742 #define ODsCDeleteLayer "DeleteLayer"
743 #define ODsCCreateGeomFieldAfterCreateLayer "CreateGeomFieldAfterCreateLayer"
744 #define ODsCCurveGeometries "CurveGeometries"
745 #define ODsCTransactions "Transactions"
746 #define ODsCEmulatedTransactions "EmulatedTransactions"
747 #define ODsCMeasuredGeometries "MeasuredGeometries"
748 #define ODsCRandomLayerRead "RandomLayerRead"
749 #define ODsCRandomLayerWrite "RandomLayerWrite "
751 #define ODrCCreateDataSource "CreateDataSource"
752 #define ODrCDeleteDataSource "DeleteDataSource"
761 #define OLMD_FID64 "OLMD_FID64"
892 #ifndef GDAL_VERSION_INFO_DEFINED
893 #define GDAL_VERSION_INFO_DEFINED
894 const char CPL_DLL * CPL_STDCALL GDALVersionInfo(
const char * );
897 #ifndef GDAL_CHECK_VERSION
910 int CPL_DLL CPL_STDCALL GDALCheckVersion(
int nVersionMajor,
int nVersionMinor,
911 const char* pszCallingComponentName);
914 #define GDAL_CHECK_VERSION(pszCallingComponentName) \
915 GDALCheckVersion(GDAL_VERSION_MAJOR, GDAL_VERSION_MINOR, pszCallingComponentName)
Definition: ogr_core.h:381
Definition: ogr_core.h:344
Definition: ogr_core.h:421
Definition: ogr_core.h:841
Definition: ogr_core.h:878
Definition: ogr_core.h:836
Definition: ogr_core.h:822
Definition: ogr_core.h:858
enum ogr_style_tool_param_symbol_id OGRSTSymbolParam
Definition: ogr_core.h:877
Definition: ogr_core.h:817
Definition: ogr_core.h:365
Definition: ogr_core.h:368
Definition: ogr_core.h:359
OGRFieldSubType
Definition: ogr_core.h:612
Definition: ogr_core.h:352
#define OGRERR_CORRUPT_DATA
Definition: ogr_core.h:292
Definition: ogr_core.h:799
ogr_style_tool_param_label_id
Definition: ogr_core.h:856
Definition: ogr_core.h:818
Definition: ogr_core.h:355
Definition: ogr_core.h:351
#define CPL_C_START
Definition: cpl_port.h:352
Definition: ogr_core.h:367
Definition: ogr_core.h:364
Definition: ogr_core.h:865
Definition: ogr_core.h:399
Definition: ogr_core.h:614
Definition: ogr_core.h:839
Definition: ogr_core.h:599
Definition: ogr_core.h:824
Definition: ogr_core.h:844
Definition: ogr_core.h:398
Definition: ogr_core.h:861
Definition: ogr_core.h:805
Definition: ogr_core.h:319
Definition: ogr_core.h:838
Definition: ogr_core.h:338
Definition: ogr_core.h:350
Definition: ogr_core.h:361
Definition: ogr_core.h:596
Definition: ogr_core.h:871
Definition: ogr_core.h:345
Definition: ogr_core.h:595
enum ogr_style_tool_param_brush_id OGRSTBrushParam
Definition: ogr_core.h:382
OGRwkbGeometryType OGR_GT_SetM(OGRwkbGeometryType eType)
Returns the measured geometry type corresponding to the passed geometry type.
Definition: ogrgeometry.cpp:6394
Definition: ogr_core.h:876
short GInt16
Definition: cpl_port.h:203
Definition: ogr_core.h:823
int OGRBoolean
Definition: ogr_core.h:301
Definition: ogr_core.h:348
Definition: ogr_core.h:395
#define OGRERR_NONE
Definition: ogr_core.h:287
enum ogr_style_tool_param_label_id OGRSTLabelParam
Definition: ogr_core.h:869
Definition: ogr_core.h:372
ogr_style_tool_param_pen_id
Definition: ogr_core.h:797
unsigned char GByte
Definition: cpl_port.h:207
Definition: ogr_core.h:774
Definition: ogr_core.h:786
Definition: ogr_core.h:819
Definition: ogr_core.h:804
Definition: ogr_core.h:589
ogr_style_tool_param_symbol_id
Definition: ogr_core.h:834
Definition: ogr_core.h:392
Definition: ogr_core.h:325
Definition: ogr_core.h:317
Definition: ogr_core.h:843
OGRwkbByteOrder
Definition: ogr_core.h:479
Definition: ogr_core.h:588
OGRwkbGeometryType OGR_GT_Flatten(OGRwkbGeometryType eType)
Returns the 2D geometry type corresponding to the passed geometry type.
Definition: ogrgeometry.cpp:6300
#define OGRERR_UNSUPPORTED_OPERATION
Definition: ogr_core.h:291
Definition: ogr_core.h:314
Definition: ogr_core.h:803
Definition: ogr_core.h:400
Definition: ogr_core.h:362
Definition: ogr_core.h:866
Definition: ogr_core.h:337
#define OGRERR_UNSUPPORTED_GEOMETRY_TYPE
Definition: ogr_core.h:290
Definition: ogr_core.h:385
int OGR_GT_IsSurface(OGRwkbGeometryType)
Return if a geometry type is an instance of Surface.
Definition: ogrgeometry.cpp:6680
Definition: ogr_core.h:820
Definition: ogr_core.h:388
Definition: ogr_core.h:342
Definition: ogr_core.h:859
OGRwkbGeometryType OGR_GT_SetModifier(OGRwkbGeometryType eType, int bSetZ, int bSetM)
Returns a XY, XYZ, XYM or XYZM geometry type depending on parameter.
Definition: ogrgeometry.cpp:6421
Definition: ogr_core.h:322
OGRwkbGeometryType OGR_GT_SetZ(OGRwkbGeometryType eType)
Returns the 3D geometry type corresponding to the passed geometry type.
Definition: ogrgeometry.cpp:6371
int OGR_GT_HasM(OGRwkbGeometryType eType)
Return if the geometry type is a measured type.
Definition: ogrgeometry.cpp:6349
Definition: ogr_core.h:481
enum ogr_style_tool_class_id OGRSTClassId
Definition: ogr_core.h:594
Definition: ogr_core.h:847
Definition: ogr_core.h:598
#define MAX(a, b)
Definition: cpl_port.h:460
int OGR_GT_IsSubClassOf(OGRwkbGeometryType eType, OGRwkbGeometryType eSuperType)
Returns if a type is a subclass of another one.
Definition: ogrgeometry.cpp:6448
Definition: ogr_core.h:334
Definition: ogr_core.h:353
Definition: ogr_core.h:397
Definition: ogr_core.h:802
enum ogr_style_tool_param_pen_id OGRSTPenParam
enum ogr_style_tool_units_id OGRSTUnitId
OGRwkbGeometryType
Definition: ogr_core.h:312
Definition: ogr_core.h:358
Definition: ogr_core.h:788
Definition: ogr_core.h:842
Definition: ogr_core.h:845
int OGR_GT_IsNonLinear(OGRwkbGeometryType)
Return if a geometry type is a non-linear geometry type.
Definition: ogrgeometry.cpp:6702
#define OGRERR_NOT_ENOUGH_MEMORY
Definition: ogr_core.h:289
OGRwkbGeometryType OGRMergeGeometryTypes(OGRwkbGeometryType eMain, OGRwkbGeometryType eExtra)
Find common geometry type.
Definition: ogrgeometry.cpp:2614
Definition: ogr_core.h:373
#define OGRERR_NON_EXISTING_FEATURE
Definition: ogr_core.h:296
OGRwkbGeometryType OGRMergeGeometryTypesEx(OGRwkbGeometryType eMain, OGRwkbGeometryType eExtra, int bAllowPromotingToCurves)
Find common geometry type.
Definition: ogrgeometry.cpp:2651
Definition: ogr_core.h:376
Definition: ogr_core.h:349
Definition: ogr_core.h:618
Definition: ogr_core.h:340
Definition: ogr_core.h:821
Definition: ogr_core.h:384
Definition: ogr_core.h:790
Definition: ogr_core.h:371
#define OGRERR_INVALID_HANDLE
Definition: ogr_core.h:295
Definition: ogr_core.h:354
Definition: ogr_core.h:616
Definition: ogr_core.h:363
Definition: ogr_core.h:396
#define MIN(a, b)
Definition: cpl_port.h:458
Definition: ogr_core.h:777
Definition: ogr_core.h:801
Definition: ogr_core.h:387
Definition: ogr_core.h:806
Definition: ogr_core.h:323
Definition: ogr_core.h:378
Definition: ogr_core.h:330
Definition: ogr_core.h:875
Definition: ogr_core.h:482
OGRJustification
Definition: ogr_core.h:628
Definition: ogr_core.h:873
#define CPLFree
Definition: cpl_conv.h:81
ogr_style_tool_units_id
Definition: ogr_core.h:784
Definition: ogr_core.h:422
Definition: ogr_core.h:593
Definition: ogr_core.h:328
Definition: ogr_core.h:874
Definition: ogr_core.h:316
Definition: ogr_core.h:620
Definition: ogr_core.h:787
Definition: ogr_core.h:864
OGRFieldType
Definition: ogr_core.h:584
Definition: ogr_core.h:369
Definition: ogr_core.h:380
Definition: ogr_core.h:597
Definition: ogr_core.h:860
Definition: ogr_core.h:420
Definition: ogr_core.h:862
Definition: ogr_core.h:356
OGRwkbGeometryType OGR_GT_GetLinear(OGRwkbGeometryType eType)
Returns the non-curve geometry type that can contain the passed geometry type.
Definition: ogrgeometry.cpp:6617
Definition: ogr_core.h:840
OGRwkbVariant
Definition: ogr_core.h:418
Definition: ogr_core.h:868
Definition: ogr_core.h:347
Definition: ogr_core.h:592
Definition: ogr_core.h:870
ogr_style_tool_param_brush_id
Definition: ogr_core.h:815
Definition: ogr_core.h:389
Definition: ogr_core.h:391
Definition: ogr_core.h:661
#define OGRERR_NOT_ENOUGH_DATA
Definition: ogr_core.h:288
Definition: ogr_core.h:390
Definition: ogr_core.h:379
Definition: ogr_core.h:791
Definition: ogr_core.h:360
Definition: ogr_core.h:800
Definition: ogr_core.h:386
OGRwkbGeometryType OGR_GT_GetCollection(OGRwkbGeometryType eType)
Returns the collection type that can contain the passed geometry type.
Definition: ogrgeometry.cpp:6512
Definition: ogr_core.h:776
Definition: ogr_core.h:837
Definition: ogr_core.h:335
ogr_style_tool_class_id
Definition: ogr_core.h:771
#define CPL_C_END
Definition: cpl_port.h:354
Definition: ogr_core.h:863
void * CPLCalloc(size_t, size_t)
Definition: cpl_conv.cpp:128
long long GIntBig
Definition: cpl_port.h:250
Definition: ogr_core.h:778
Definition: ogr_core.h:374
Definition: ogr_core.h:377
void * CPLMalloc(size_t)
Definition: cpl_conv.cpp:158
Definition: ogr_core.h:383
Definition: ogr_core.h:331
Definition: ogr_core.h:846
Definition: ogr_core.h:775
#define OGRERR_FAILURE
Definition: ogr_core.h:293
#define OGRERR_UNSUPPORTED_SRS
Definition: ogr_core.h:294
OGRwkbGeometryType OGR_GT_GetCurve(OGRwkbGeometryType eType)
Returns the curve geometry type that can contain the passed geometry type.
Definition: ogrgeometry.cpp:6568
Definition: ogr_core.h:773
int OGRErr
Definition: ogr_core.h:285
Definition: ogr_core.h:324
Definition: ogr_core.h:867
Definition: ogr_core.h:590
int OGR_GT_HasZ(OGRwkbGeometryType eType)
Return if the geometry type is a 3D geometry type.
Definition: ogrgeometry.cpp:6325
Definition: ogr_core.h:394
const char * OGRGeometryTypeToName(OGRwkbGeometryType eType)
Fetch a human readable name corresponding to an OGRwkbGeometryType value. The returned value should n...
Definition: ogrgeometry.cpp:2391
Definition: ogr_core.h:591
Definition: ogr_core.h:370
Definition: ogr_core.h:587
Definition: ogr_core.h:366
Definition: ogr_core.h:789
Definition: ogr_core.h:586
Definition: ogr_core.h:872
Definition: ogr_core.h:336
int OGR_GT_IsCurve(OGRwkbGeometryType)
Return if a geometry type is an instance of Curve.
Definition: ogrgeometry.cpp:6659
char * CPLStrdup(const char *)
Definition: cpl_conv.cpp:284
void * CPLRealloc(void *, size_t)
Definition: cpl_conv.cpp:215