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
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
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
00103
00110 typedef enum
00111 {
00112 wkbUnknown = 0,
00113 wkbPoint = 1,
00114 wkbLineString = 2,
00115 wkbPolygon = 3,
00116 wkbMultiPoint = 4,
00117 wkbMultiLineString = 5,
00118 wkbMultiPolygon = 6,
00119 wkbGeometryCollection = 7,
00120 wkbNone = 100,
00121 wkbLinearRing = 101,
00122 wkbPoint25D = 0x80000001,
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,
00141 wkbNDR = 1
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
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
00198
00199
00204 typedef union {
00205 int Integer;
00206 double Real;
00207 char *String;
00208
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
00227
00228
00229
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;
00250
00251 } Date;
00252 } OGRField;
00253
00254 int CPL_DLL OGRParseDate( const char *pszInput, OGRField *psOutput,
00255 int nOptions );
00256
00257
00258
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
00280