On mercredi 15 février 2017 08:27:06 CET Kurt Schwehr wrote: > Even, > > Thanks for the pointers. I will do touchups on the driver tutorial as I go. > > Maybe more specifically, with the initial setup of the driver and the > datasource: > > I only see two drivers that use GDALDriver. > > grep class */*.{cpp,h} | grep GDALDriver > db2/ogr_db2.h:class OGRDB2Driver : public GDALDriver > s57/ogr_s57.h:class OGRS57Driver : public GDALDriver > > Most OGR drivers do: > > GDALDriver *poDriver = new GDALDriver(); > > But others do: > > gmt/ogrgmtdriver.cpp: OGRSFDriver* poDriver = new OGRGmtDriver; > idb/ogridbdriver.cpp: > OGRSFDriverRegistrar::GetRegistrar()->RegisterDriver(new OGRIDBDriver); > > What's the cleanest way to setup the driver registration?
The OGRSFDriver way is clearly deprecated. For the others, this is a matter of taste. > > Should I be deriving from GDALDataset? Yes > > And a few do: > > egrep class */*.{cpp,h} | grep public | egrep -i GDALDataset | head -7 > geojson/ogrgeojsondriver.cpp:class OGRESRIFeatureServiceDataset: public > GDALDataset > gmlas/ogrgmlaswriter.cpp:class GMLASFakeDataset : public GDALDataset > mongodb/ogrmongodbdriver.cpp:class OGRMongoDBDataSource: public GDALDataset > cad/ogr_cad.h:class GDALCADDataset : public GDALDataset > elastic/ogr_elastic.h:class OGRElasticDataSource : public GDALDataset > gmlas/ogr_gmlas.h:class OGRGMLASDataSource: public GDALDataset > jml/ogr_jml.h:class OGRJMLDataset : public GDALDataset > > But most do: > > egrep class */*.{cpp,h} | grep public | egrep -i OGRDataSource | head -5 > csw/ogrcswdataset.cpp:class OGRCSWDataSource : public OGRDataSource > generic/ogremulatedtransaction.cpp:class OGRDataSourceWithTransaction : > public OGRDataSource > null/ogrnulldriver.cpp:class OGRNULLDataSource : public OGRDataSource > aeronavfaa/ogr_aeronavfaa.h:class OGRAeronavFAADataSource : public > OGRDataSource > amigocloud/ogr_amigocloud.h:class OGRAmigoCloudDataSource : public > OGRDataSource > > egrep class */*.{cpp,h} | grep public | egrep -i OGRDataSource | wc -l > 80 > > OGRDataSource is deprecated and new drivers should derive from GDALDataset, > yes? Yes, not everything has been converted from OGRDataSource to GDALDataset given that we have a compatibility layer. -- Spatialys - Geospatial professional services http://www.spatialys.com
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev