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

ogr_api.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * $Id: ogr_api.h,v 1.17 2003/10/09 15:27:41 warmerda Exp $
00003  *
00004  * Project:  OpenGIS Simple Features Reference Implementation
00005  * Purpose:  C API for OGR Geometry, Feature, Layers, DataSource and drivers.
00006  * Author:   Frank Warmerdam, warmerdam@pobox.com
00007  *
00008  ******************************************************************************
00009  * Copyright (c) 2002, 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_api.h,v $
00031  * Revision 1.17  2003/10/09 15:27:41  warmerda
00032  * added OGRLayer::DeleteFeature() support
00033  *
00034  * Revision 1.16  2003/09/04 14:01:44  warmerda
00035  * added OGRGetGenerate_DB2_V72_BYTE_ORDER
00036  *
00037  * Revision 1.15  2003/08/27 15:40:37  warmerda
00038  * added support for generating DB2 V7.2 compatible WKB
00039  *
00040  * Revision 1.14  2003/04/22 19:33:26  warmerda
00041  * Added synctodisk
00042  *
00043  * Revision 1.13  2003/04/08 21:21:13  warmerda
00044  * added OGRGetDriverByName
00045  *
00046  * Revision 1.12  2003/04/08 19:30:56  warmerda
00047  * added CopyLayer and CopyDataSource entry points
00048  *
00049  * Revision 1.11  2003/03/19 20:28:20  warmerda
00050  * added shared access, and reference counting apis
00051  *
00052  * Revision 1.10  2003/03/12 20:52:07  warmerda
00053  * implemented support for gml:Box
00054  *
00055  * Revision 1.9  2003/03/06 20:29:27  warmerda
00056  * added GML import/export entry points
00057  *
00058  * Revision 1.8  2003/03/05 05:08:49  warmerda
00059  * added GetLayerByName
00060  *
00061  * Revision 1.7  2003/03/03 05:05:54  warmerda
00062  * added support for DeleteDataSource and DeleteLayer
00063  *
00064  * Revision 1.6  2003/01/07 16:44:27  warmerda
00065  * added removeGeometry
00066  *
00067  * Revision 1.5  2003/01/06 21:37:00  warmerda
00068  * added CPL_DLL attribute on OGRBuildPolygon...
00069  *
00070  * Revision 1.4  2003/01/02 21:45:23  warmerda
00071  * move OGRBuildPolygonsFromEdges into C API
00072  *
00073  * Revision 1.3  2002/10/24 16:46:08  warmerda
00074  * removed bogus OGR_G_GetWkbSize()
00075  *
00076  * Revision 1.2  2002/09/26 19:00:07  warmerda
00077  * ensure all entry points CPL_DLL'ed
00078  *
00079  * Revision 1.1  2002/09/26 18:11:51  warmerda
00080  * New
00081  *
00082  */
00083 
00084 #ifndef _OGR_API_H_INCLUDED
00085 #define _OGR_API_H_INCLUDED
00086 
00096 #include "ogr_core.h"
00097 
00098 CPL_C_START
00099 
00100 /* -------------------------------------------------------------------- */
00101 /*      Geometry related functions (ogr_geometry.h)                     */
00102 /* -------------------------------------------------------------------- */
00103 typedef void *OGRGeometryH;
00104 
00105 #ifndef _DEFINED_OGRSpatialReferenceH
00106 #define _DEFINED_OGRSpatialReferenceH
00107 
00108 typedef void *OGRSpatialReferenceH;                               
00109 typedef void *OGRCoordinateTransformationH;
00110 
00111 #endif
00112 
00113 struct _CPLXMLNode;
00114 
00115 /* From base OGRGeometry class */
00116 
00117 OGRErr CPL_DLL OGR_G_CreateFromWkb( unsigned char *, OGRSpatialReferenceH, 
00118                                     OGRGeometryH * );
00119 OGRErr CPL_DLL OGR_G_CreateFromWkt( char **, OGRSpatialReferenceH, 
00120                                     OGRGeometryH * );
00121 void   CPL_DLL OGR_G_DestroyGeometry( OGRGeometryH );
00122 OGRGeometryH CPL_DLL OGR_G_CreateGeometry( OGRwkbGeometryType );
00123 
00124 int    CPL_DLL OGR_G_GetDimension( OGRGeometryH );
00125 int    CPL_DLL OGR_G_GetCoordinateDimension( OGRGeometryH );
00126 OGRGeometryH CPL_DLL OGR_G_Clone( OGRGeometryH );
00127 void   CPL_DLL OGR_G_GetEnvelope( OGRGeometryH, OGREnvelope * );
00128 OGRErr CPL_DLL OGR_G_ImportFromWkb( OGRGeometryH, unsigned char *, int );
00129 OGRErr CPL_DLL OGR_G_ExportToWkb( OGRGeometryH, OGRwkbByteOrder, unsigned char*);
00130 int    CPL_DLL OGR_G_WkbSize( OGRGeometryH hGeom );
00131 OGRErr CPL_DLL OGR_G_ImportFromWkt( OGRGeometryH, char ** );
00132 OGRErr CPL_DLL OGR_G_ExportToWkt( OGRGeometryH, char ** );
00133 OGRwkbGeometryType CPL_DLL OGR_G_GetGeometryType( OGRGeometryH );
00134 const char CPL_DLL *OGR_G_GetGeometryName( OGRGeometryH );
00135 void   CPL_DLL OGR_G_DumpReadable( OGRGeometryH, FILE *, const char * );
00136 void   CPL_DLL OGR_G_FlattenTo2D( OGRGeometryH );
00137 
00138 OGRGeometryH CPL_DLL OGR_G_CreateFromGML( const char * );
00139 char   CPL_DLL *OGR_G_ExportToGML( OGRGeometryH );
00140 
00141 #if defined(_CPL_MINIXML_H_INCLUDED)
00142 OGRGeometryH CPL_DLL OGR_G_CreateFromGMLTree( const CPLXMLNode * );
00143 CPLXMLNode CPL_DLL *OGR_G_ExportToGMLTree( OGRGeometryH );
00144 CPLXMLNode CPL_DLL *OGR_G_ExportEnvelopeToGMLTree( OGRGeometryH );
00145 #endif
00146 
00147 void   CPL_DLL OGR_G_AssignSpatialReference( OGRGeometryH, 
00148                                              OGRSpatialReferenceH );
00149 OGRSpatialReferenceH CPL_DLL OGR_G_GetSpatialReference( OGRGeometryH );
00150 OGRErr CPL_DLL OGR_G_Transform( OGRGeometryH, OGRCoordinateTransformationH );
00151 OGRErr CPL_DLL OGR_G_TransformTo( OGRGeometryH, OGRSpatialReferenceH );
00152 
00153 int    CPL_DLL OGR_G_Intersect( OGRGeometryH, OGRGeometryH );
00154 int    CPL_DLL OGR_G_Equal( OGRGeometryH, OGRGeometryH );
00155 void   CPL_DLL OGR_G_Empty( OGRGeometryH );
00156 
00157 /* Methods for getting/setting vertices in points, line strings and rings */
00158 int    CPL_DLL OGR_G_GetPointCount( OGRGeometryH );
00159 double CPL_DLL OGR_G_GetX( OGRGeometryH, int );
00160 double CPL_DLL OGR_G_GetY( OGRGeometryH, int );
00161 double CPL_DLL OGR_G_GetZ( OGRGeometryH, int );
00162 void   CPL_DLL OGR_G_GetPoint( OGRGeometryH, int iPoint, 
00163                                double *, double *, double * );
00164 void   CPL_DLL OGR_G_SetPoint( OGRGeometryH, int iPoint, 
00165                                double, double, double );
00166 void   CPL_DLL OGR_G_AddPoint( OGRGeometryH, double, double, double );
00167 
00168 /* Methods for getting/setting rings and members collections */
00169 
00170 int    CPL_DLL OGR_G_GetGeometryCount( OGRGeometryH );
00171 OGRGeometryH CPL_DLL OGR_G_GetGeometryRef( OGRGeometryH, int );
00172 OGRErr CPL_DLL OGR_G_AddGeometry( OGRGeometryH, OGRGeometryH );
00173 OGRErr CPL_DLL OGR_G_AddGeometryDirectly( OGRGeometryH, OGRGeometryH );
00174 OGRErr CPL_DLL OGR_G_RemoveGeometry( OGRGeometryH, int, int );
00175 
00176 OGRGeometryH CPL_DLL OGRBuildPolygonFromEdges( OGRGeometryH hLinesAsCollection,
00177                                        int bBestEffort, 
00178                                        int bAutoClose, 
00179                                        double dfTolerance,
00180                                        OGRErr * peErr );
00181 
00182 OGRErr CPL_DLL OGRSetGenerate_DB2_V72_BYTE_ORDER( 
00183     int bGenerate_DB2_V72_BYTE_ORDER );
00184 
00185 int CPL_DLL OGRGetGenerate_DB2_V72_BYTE_ORDER();
00186 
00187 /* -------------------------------------------------------------------- */
00188 /*      Feature related (ogr_feature.h)                                 */
00189 /* -------------------------------------------------------------------- */
00190 
00191 typedef void *OGRFieldDefnH;
00192 typedef void *OGRFeatureDefnH;
00193 typedef void *OGRFeatureH;
00194 
00195 /* OGRFieldDefn */
00196 
00197 OGRFieldDefnH CPL_DLL OGR_Fld_Create( const char *, OGRFieldType );
00198 void   CPL_DLL OGR_Fld_Destroy( OGRFieldDefnH );
00199 
00200 void   CPL_DLL OGR_Fld_SetName( OGRFieldDefnH, const char * );
00201 const char CPL_DLL *OGR_Fld_GetNameRef( OGRFieldDefnH );
00202 OGRFieldType CPL_DLL OGR_Fld_GetType( OGRFieldDefnH );
00203 void   CPL_DLL OGR_Fld_SetType( OGRFieldDefnH, OGRFieldType );
00204 OGRJustification CPL_DLL OGR_Fld_GetJustify( OGRFieldDefnH );
00205 void   CPL_DLL OGR_Fld_SetJustify( OGRFieldDefnH, OGRJustification );
00206 int    CPL_DLL OGR_Fld_GetWidth( OGRFieldDefnH );
00207 void   CPL_DLL OGR_Fld_SetWidth( OGRFieldDefnH, int );
00208 int    CPL_DLL OGR_Fld_GetPrecision( OGRFieldDefnH );
00209 void   CPL_DLL OGR_Fld_SetPrecision( OGRFieldDefnH, int );
00210 void   CPL_DLL OGR_Fld_Set( OGRFieldDefnH, const char *, OGRFieldType, 
00211                             int, int, OGRJustification );
00212 
00213 const char CPL_DLL *OGR_GetFieldTypeName( OGRFieldType );
00214 
00215 /* OGRFeatureDefn */
00216 
00217 OGRFeatureDefnH CPL_DLL OGR_FD_Create( const char * );
00218 void   CPL_DLL OGR_FD_Destroy( OGRFeatureDefnH );
00219 const char CPL_DLL *OGR_FD_GetName( OGRFeatureDefnH );
00220 int    CPL_DLL OGR_FD_GetFieldCount( OGRFeatureDefnH );
00221 OGRFieldDefnH CPL_DLL OGR_FD_GetFieldDefn( OGRFeatureDefnH, int );
00222 int    CPL_DLL OGR_FD_GetFieldIndex( OGRFeatureDefnH, const char * );
00223 void   CPL_DLL OGR_FD_AddFieldDefn( OGRFeatureDefnH, OGRFieldDefnH );
00224 OGRwkbGeometryType CPL_DLL OGR_FD_GetGeomType( OGRFeatureDefnH );
00225 void   CPL_DLL OGR_FD_SetGeomType( OGRFeatureDefnH, OGRwkbGeometryType );
00226 int    CPL_DLL OGR_FD_Reference( OGRFeatureDefnH );
00227 int    CPL_DLL OGR_FD_Dereference( OGRFeatureDefnH );
00228 int    CPL_DLL OGR_FD_GetReferenceCount( OGRFeatureDefnH );
00229 
00230 /* OGRFeature */
00231 
00232 OGRFeatureH CPL_DLL OGR_F_Create( OGRFeatureDefnH );
00233 void   CPL_DLL OGR_F_Destroy( OGRFeatureH );
00234 OGRFeatureDefnH CPL_DLL OGR_F_GetDefnRef( OGRFeatureH );
00235 
00236 OGRErr CPL_DLL OGR_F_SetGeometryDirectly( OGRFeatureH, OGRGeometryH );
00237 OGRErr CPL_DLL OGR_F_SetGeometry( OGRFeatureH, OGRGeometryH );
00238 OGRGeometryH CPL_DLL OGR_F_GetGeometryRef( OGRFeatureH );
00239 OGRFeatureH CPL_DLL OGR_F_Clone( OGRFeatureH );
00240 int    CPL_DLL OGR_F_Equal( OGRFeatureH, OGRFeatureH );
00241 
00242 int    CPL_DLL OGR_F_GetFieldCount( OGRFeatureH );
00243 OGRFieldDefnH CPL_DLL OGR_F_GetFieldDefnRef( OGRFeatureH, int );
00244 int    CPL_DLL OGR_F_GetFieldIndex( OGRFeatureH, const char * );
00245 
00246 int    CPL_DLL OGR_F_IsFieldSet( OGRFeatureH, int );
00247 void   CPL_DLL OGR_F_UnsetField( OGRFeatureH, int );
00248 OGRField CPL_DLL *OGR_F_GetRawFieldRef( OGRFeatureH, int );
00249 
00250 int    CPL_DLL OGR_F_GetFieldAsInteger( OGRFeatureH, int );
00251 double CPL_DLL OGR_F_GetFieldAsDouble( OGRFeatureH, int );
00252 const char CPL_DLL *OGR_F_GetFieldAsString( OGRFeatureH, int );
00253 const int CPL_DLL *OGR_F_GetFieldAsIntegerList( OGRFeatureH, int, int * );
00254 const double CPL_DLL *OGR_F_GetFieldAsDoubleList( OGRFeatureH, int, int * );
00255 char  CPL_DLL **OGR_F_GetFieldAsStringList( OGRFeatureH, int );
00256 
00257 void   CPL_DLL OGR_F_SetFieldInteger( OGRFeatureH, int, int );
00258 void   CPL_DLL OGR_F_SetFieldDouble( OGRFeatureH, int, double );
00259 void   CPL_DLL OGR_F_SetFieldString( OGRFeatureH, int, const char * );
00260 void   CPL_DLL OGR_F_SetFieldIntegerList( OGRFeatureH, int, int, int * );
00261 void   CPL_DLL OGR_F_SetFieldDoubleList( OGRFeatureH, int, int, double * );
00262 void   CPL_DLL OGR_F_SetFieldStringList( OGRFeatureH, int, char ** );
00263 void   CPL_DLL OGR_F_SetFieldRaw( OGRFeatureH, int, OGRField * );
00264 
00265 long   CPL_DLL OGR_F_GetFID( OGRFeatureH );
00266 OGRErr CPL_DLL OGR_F_SetFID( OGRFeatureH, long );
00267 void   CPL_DLL OGR_F_DumpReadable( OGRFeatureH, FILE * );
00268 OGRErr CPL_DLL OGR_F_SetFrom( OGRFeatureH, OGRFeatureH, int );
00269 
00270 const char CPL_DLL *OGR_F_GetStyleString( OGRFeatureH );
00271 void   CPL_DLL OGR_F_SetStyleString( OGRFeatureH, const char * );
00272 
00273 /* -------------------------------------------------------------------- */
00274 /*      ogrsf_frmts.h                                                   */
00275 /* -------------------------------------------------------------------- */
00276 
00277 typedef void *OGRLayerH;
00278 typedef void *OGRDataSourceH;
00279 typedef void *OGRSFDriverH;
00280 
00281 /* OGRLayer */
00282 
00283 OGRGeometryH CPL_DLL OGR_L_GetSpatialFilter( OGRLayerH );
00284 void   CPL_DLL OGR_L_SetSpatialFilter( OGRLayerH, OGRGeometryH );
00285 OGRErr CPL_DLL OGR_L_SetAttributeFilter( OGRLayerH, const char * );
00286 void   CPL_DLL OGR_L_ResetReading( OGRLayerH );
00287 OGRFeatureH CPL_DLL OGR_L_GetNextFeature( OGRLayerH );
00288 OGRFeatureH CPL_DLL OGR_L_GetFeature( OGRLayerH, long );
00289 OGRErr CPL_DLL OGR_L_SetFeature( OGRLayerH, OGRFeatureH );
00290 OGRErr CPL_DLL OGR_L_CreateFeature( OGRLayerH, OGRFeatureH );
00291 OGRErr CPL_DLL OGR_L_DeleteFeature( OGRLayerH, long );
00292 OGRFeatureDefnH CPL_DLL OGR_L_GetLayerDefn( OGRLayerH );
00293 OGRSpatialReferenceH CPL_DLL OGR_L_GetSpatialRef( OGRLayerH );
00294 int    CPL_DLL OGR_L_GetFeatureCount( OGRLayerH, int );
00295 OGRErr CPL_DLL OGR_L_GetExtent( OGRLayerH, OGREnvelope *, int );
00296 int    CPL_DLL OGR_L_TestCapability( OGRLayerH, const char * );
00297 OGRErr CPL_DLL OGR_L_CreateField( OGRLayerH, OGRFieldDefnH, int );
00298 OGRErr CPL_DLL OGR_L_StartTransaction( OGRLayerH );
00299 OGRErr CPL_DLL OGR_L_CommitTransaction( OGRLayerH );
00300 OGRErr CPL_DLL OGR_L_RollbackTransaction( OGRLayerH );
00301 int    CPL_DLL OGR_L_Reference( OGRLayerH );
00302 int    CPL_DLL OGR_L_Dereference( OGRLayerH );
00303 int    CPL_DLL OGR_L_GetRefCount( OGRLayerH );
00304 OGRErr CPL_DLL OGR_L_SyncToDisk( OGRLayerH );
00305 
00306 /* OGRDataSource */
00307 
00308 void   CPL_DLL OGR_DS_Destroy( OGRDataSourceH );
00309 const char CPL_DLL *OGR_DS_GetName( OGRDataSourceH );
00310 int    CPL_DLL OGR_DS_GetLayerCount( OGRDataSourceH );
00311 OGRLayerH CPL_DLL OGR_DS_GetLayer( OGRDataSourceH, int );
00312 OGRLayerH CPL_DLL OGR_DS_GetLayerByName( OGRDataSourceH, const char * );
00313 OGRErr    CPL_DLL OGR_DS_DeleteLayer( OGRDataSourceH, int );
00314 OGRLayerH CPL_DLL OGR_DS_CreateLayer( OGRDataSourceH, const char *, 
00315                                       OGRSpatialReferenceH, OGRwkbGeometryType,
00316                                       char ** );
00317 OGRLayerH CPL_DLL OGR_DS_CopyLayer( OGRDataSourceH, OGRLayerH, const char *,
00318                                     char ** );
00319 int    CPL_DLL OGR_DS_TestCapability( OGRDataSourceH, const char * );
00320 OGRLayerH CPL_DLL OGR_DS_ExecuteSQL( OGRDataSourceH, const char *,
00321                                      OGRGeometryH, const char * );
00322 void   CPL_DLL OGR_DS_ReleaseResultSet( OGRDataSourceH, OGRLayerH );
00323 int    CPL_DLL OGR_DS_Reference( OGRDataSourceH );
00324 int    CPL_DLL OGR_DS_Dereference( OGRDataSourceH );
00325 int    CPL_DLL OGR_DS_GetRefCount( OGRDataSourceH );
00326 int    CPL_DLL OGR_DS_GetSummaryRefCount( OGRDataSourceH );
00327 OGRErr CPL_DLL OGR_DS_SyncToDisk( OGRDataSourceH );
00328 
00329 /* OGRSFDriver */
00330 
00331 const char CPL_DLL *OGR_Dr_GetName( OGRSFDriverH );
00332 OGRDataSourceH CPL_DLL OGR_Dr_Open( OGRSFDriverH, const char *, int );
00333 int CPL_DLL OGR_Dr_TestCapability( OGRSFDriverH, const char * );
00334 OGRDataSourceH CPL_DLL OGR_Dr_CreateDataSource( OGRSFDriverH, const char *,
00335                                                 char ** );
00336 OGRDataSourceH CPL_DLL OGR_Dr_CopyDataSource( OGRSFDriverH,  OGRDataSourceH, 
00337                                               const char *, char ** );
00338 OGRErr CPL_DLL OGR_Dr_DeleteDataSource( OGRSFDriverH, const char * );
00339 
00340 /* OGRSFDriverRegistrar */
00341 
00342 OGRDataSourceH CPL_DLL OGROpen( const char *, int, OGRSFDriverH * );
00343 OGRDataSourceH CPL_DLL OGROpenShared( const char *, int, OGRSFDriverH * );
00344 OGRErr  CPL_DLL OGRReleaseDataSource( OGRDataSourceH );
00345 void    CPL_DLL OGRRegisterDriver( OGRSFDriverH );
00346 int     CPL_DLL OGRGetDriverCount();
00347 OGRSFDriverH CPL_DLL OGRGetDriver( int );
00348 OGRSFDriverH CPL_DLL OGRGetDriverByName( const char * );
00349 int     CPL_DLL OGRGetOpenDSCount();
00350 OGRDataSourceH CPL_DLL OGRGetOpenDS( int iDS );
00351 
00352 
00353 /* note: this is also declared in ogrsf_frmts.h */
00354 void CPL_DLL OGRRegisterAll();
00355 
00356 CPL_C_END
00357 
00358 #endif /* ndef _OGR_API_H_INCLUDED */
00359 
00360 

Generated on Thu Nov 13 00:06:15 2003 for OGR by doxygen 1.3.4