Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

ogr_core.h

00001 /****************************************************************************** 00002 * $Id: ogr_core.h,v 1.24 2003/10/09 15:27:41 warmerda Exp $ 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 * $Log: ogr_core.h,v $ 00031 * Revision 1.24 2003/10/09 15:27:41 warmerda 00032 * added OGRLayer::DeleteFeature() support 00033 * 00034 * Revision 1.23 2003/09/11 19:59:41 warmerda 00035 * avoid casting issue with UNFIX macro 00036 * 00037 * Revision 1.22 2003/08/27 15:40:37 warmerda 00038 * added support for generating DB2 V7.2 compatible WKB 00039 * 00040 * Revision 1.21 2003/08/11 03:28:04 warmerda 00041 * Export OGREnvelope C++ class with CPL_DLL as per bug 378. 00042 * 00043 * Revision 1.20 2003/06/09 13:48:54 warmerda 00044 * added DB2 V7.2 byte order hack 00045 * 00046 * Revision 1.19 2003/05/08 13:27:22 warmerda 00047 * dont use C++ comments in this c includable file 00048 * 00049 * Revision 1.18 2003/04/29 19:03:58 warmerda 00050 * removed extra comma 00051 * 00052 * Revision 1.17 2003/03/03 05:05:54 warmerda 00053 * added support for DeleteDataSource and DeleteLayer 00054 * 00055 * Revision 1.16 2003/02/19 02:57:49 warmerda 00056 * added wkbLinearRing support 00057 * 00058 * Revision 1.15 2003/01/14 20:08:49 warmerda 00059 * fixed another bug in OGREnvelope.Merge 00060 * 00061 * Revision 1.14 2003/01/07 17:51:55 warmerda 00062 * fixed OGREnvelope.Merge() 00063 * 00064 * Revision 1.13 2003/01/06 17:56:03 warmerda 00065 * Added Merge and IsInit() method on OGREnvelope 00066 * 00067 * Revision 1.12 2002/11/08 18:25:45 warmerda 00068 * remove extranious comma in enum, confuses HPUX compiler 00069 * 00070 * Revision 1.11 2002/11/08 15:42:41 warmerda 00071 * ensure type correctness of wkbFlatten 00072 * 00073 * Revision 1.10 2002/10/24 20:53:02 warmerda 00074 * expand tabs 00075 * 00076 * Revision 1.9 2002/09/26 18:13:17 warmerda 00077 * moved some defs to ogr_core.h for sharing with ogr_api.h 00078 * 00079 * Revision 1.8 2000/07/11 20:15:12 warmerda 00080 * apply CPL_DLL to OGR functions 00081 * 00082 * Revision 1.7 2000/07/09 20:47:35 warmerda 00083 * added CPL_START/END 00084 * 00085 * Revision 1.6 1999/11/18 19:02:19 warmerda 00086 * expanded tabs 00087 * 00088 * Revision 1.5 1999/07/07 04:23:07 danmo 00089 * Fixed typo in #define _OGR_..._H_INCLUDED line 00090 * 00091 * Revision 1.4 1999/07/05 18:56:52 warmerda 00092 * now includes cpl_port.h 00093 * 00094 * Revision 1.3 1999/07/05 17:19:03 warmerda 00095 * added OGRERR_UNSUPPORTED_SRS 00096 * 00097 * Revision 1.2 1999/05/31 15:00:37 warmerda 00098 * added generic OGRERR_FAILURE error code. 00099 * 00100 * Revision 1.1 1999/05/20 14:35:00 warmerda 00101 * New 00102 * 00103 */ 00104 00105 #ifndef _OGR_CORE_H_INCLUDED 00106 #define _OGR_CORE_H_INCLUDED 00107 00108 #include "cpl_port.h" 00109 00114 #ifdef __cplusplus 00115 class CPL_DLL OGREnvelope 00116 { 00117 public: 00118 OGREnvelope() 00119 { 00120 MinX = MaxX = MinY = MaxY = 0; 00121 } 00122 double MinX; 00123 double MaxX; 00124 double MinY; 00125 double MaxY; 00126 00127 int IsInit() { return MinX != 0 || MinY != 0 || MaxX != 0 || MaxY != 0; } 00128 void Merge( OGREnvelope & sOther ) { 00129 if( IsInit() ) 00130 { 00131 MinX = MIN(MinX,sOther.MinX); 00132 MaxX = MAX(MaxX,sOther.MaxX); 00133 MinY = MIN(MinY,sOther.MinY); 00134 MaxY = MAX(MaxY,sOther.MaxY); 00135 } 00136 else 00137 { 00138 MinX = sOther.MinX; 00139 MaxX = sOther.MaxX; 00140 MinY = sOther.MinY; 00141 MaxY = sOther.MaxY; 00142 } 00143 } 00144 }; 00145 #else 00146 typedef struct 00147 { 00148 double MinX; 00149 double MaxX; 00150 double MinY; 00151 double MaxY; 00152 } OGREnvelope; 00153 #endif 00154 00155 CPL_C_START 00156 00157 void CPL_DLL *OGRMalloc( size_t ); 00158 void CPL_DLL *OGRCalloc( size_t, size_t ); 00159 void CPL_DLL *OGRRealloc( void *, size_t ); 00160 char CPL_DLL *OGRStrdup( const char * ); 00161 void CPL_DLL OGRFree( void * ); 00162 00163 typedef int OGRErr; 00164 00165 #define OGRERR_NONE 0 00166 #define OGRERR_NOT_ENOUGH_DATA 1 /* not enough data to deserialize */ 00167 #define OGRERR_NOT_ENOUGH_MEMORY 2 00168 #define OGRERR_UNSUPPORTED_GEOMETRY_TYPE 3 00169 #define OGRERR_UNSUPPORTED_OPERATION 4 00170 #define OGRERR_CORRUPT_DATA 5 00171 #define OGRERR_FAILURE 6 00172 #define OGRERR_UNSUPPORTED_SRS 7 00173 00174 typedef int OGRBoolean; 00175 00176 /* -------------------------------------------------------------------- */ 00177 /* ogr_geometry.h related definitions. */ 00178 /* -------------------------------------------------------------------- */ 00185 typedef enum 00186 { 00187 wkbUnknown = 0, /* non-standard */ 00188 wkbPoint = 1, /* rest are standard WKB type codes */ 00189 wkbLineString = 2, 00190 wkbPolygon = 3, 00191 wkbMultiPoint = 4, 00192 wkbMultiLineString = 5, 00193 wkbMultiPolygon = 6, 00194 wkbGeometryCollection = 7, 00195 wkbNone = 100, /* non-standard, for pure attribute records */ 00196 wkbLinearRing = 101, /* non-standard, just for createGeometry() */ 00197 wkbPoint25D = 0x80000001, /* 2.5D extensions as per 99-402 */ 00198 wkbLineString25D = 0x80000002, 00199 wkbPolygon25D = 0x80000003, 00200 wkbMultiPoint25D = 0x80000004, 00201 wkbMultiLineString25D = 0x80000005, 00202 wkbMultiPolygon25D = 0x80000006, 00203 wkbGeometryCollection25D = 0x80000007 00204 } OGRwkbGeometryType; 00205 00206 #define wkb25DBit 0x80000000 00207 #define wkbFlatten(x) ((OGRwkbGeometryType) ((x) & (~wkb25DBit))) 00208 00209 #define ogrZMarker 0x21125711 00210 00211 const char CPL_DLL * OGRGeometryTypeToName( OGRwkbGeometryType eType ); 00212 00213 typedef enum 00214 { 00215 wkbXDR = 0, /* MSB/Sun/Motoroloa: Most Significant Byte First */ 00216 wkbNDR = 1 /* LSB/Intel/Vax: Least Significant Byte First */ 00217 } OGRwkbByteOrder; 00218 00219 #ifndef NO_HACK_FOR_IBM_DB2_V72 00220 # define HACK_FOR_IBM_DB2_V72 00221 #endif 00222 00223 #ifdef HACK_FOR_IBM_DB2_V72 00224 # define DB2_V72_FIX_BYTE_ORDER(x) ((((x) & 0x31) == (x)) ? (OGRwkbByteOrder) ((x) & 0x1) : (x)) 00225 # define DB2_V72_UNFIX_BYTE_ORDER(x) ((unsigned char) (OGRGeometry::bGenerate_DB2_V72_BYTE_ORDER ? ((x) | 0x30) : (x))) 00226 #else 00227 # define DB2_V72_FIX_BYTE_ORDER(x) (x) 00228 # define DB2_V72_UNFIX_BYTE_ORDER(x) (x) 00229 #endif 00230 00231 /************************************************************************/ 00232 /* ogr_feature.h related definitions. */ 00233 /************************************************************************/ 00234 00241 typedef enum 00242 { OFTInteger = 0, OFTIntegerList = 1, OFTReal = 2, OFTRealList = 3, OFTString = 4, OFTStringList = 5, OFTWideString = 6, OFTWideStringList = 7, OFTBinary = 8 00252 } OGRFieldType; 00253 00258 typedef enum 00259 { 00260 OJUndefined = 0, 00261 OJLeft = 1, 00262 OJRight = 2 00263 } OGRJustification; 00264 00265 #define OGRNullFID -1 00266 #define OGRUnsetMarker -21121 00267 00268 /************************************************************************/ 00269 /* OGRField */ 00270 /************************************************************************/ 00271 00276 typedef union { 00277 int Integer; 00278 double Real; 00279 char *String; 00280 /* wchar *WideString; */ 00281 00282 struct { 00283 int nCount; 00284 int *paList; 00285 } IntegerList; 00286 00287 struct { 00288 int nCount; 00289 double *paList; 00290 } RealList; 00291 00292 struct { 00293 int nCount; 00294 char **paList; 00295 } StringList; 00296 00297 /* 00298 union { 00299 int nCount; 00300 wchar *paList; 00301 } WideStringList; 00302 */ 00303 00304 struct { 00305 int nMarker1; 00306 int nMarker2; 00307 } Set; 00308 } OGRField; 00309 00310 /* -------------------------------------------------------------------- */ 00311 /* Constants from ogrsf_frmts.h for capabilities. */ 00312 /* -------------------------------------------------------------------- */ 00313 #define OLCRandomRead "RandomRead" 00314 #define OLCSequentialWrite "SequentialWrite" 00315 #define OLCRandomWrite "RandomWrite" 00316 #define OLCFastSpatialFilter "FastSpatialFilter" 00317 #define OLCFastFeatureCount "FastFeatureCount" 00318 #define OLCFastGetExtent "FastGetExtent" 00319 #define OLCCreateField "CreateField" 00320 #define OLCTransactions "Transactions" 00321 #define OLCDeleteFeature "DeleteFeature" 00322 00323 #define ODsCCreateLayer "CreateLayer" 00324 #define ODsCDeleteLayer "DeleteLayer" 00325 00326 #define ODrCCreateDataSource "CreateDataSource" 00327 #define ODrCDeleteDataSource "DeleteDataSource" 00328 00329 CPL_C_END 00330 00331 #endif /* ndef _OGR_CORE_H_INCLUDED */ 00332

Generated on Thu Jul 29 19:47:50 2004 for OGR by doxygen 1.3.7