Commit 23095fd7 authored by Julien Michel's avatar Julien Michel

ENH: Updating OGR wrappers to use the new OGRVersionProxy class

parent b6860404
......@@ -32,8 +32,8 @@
#include "itkObjectFactory.h" // that should have been included by itkMacro.h
#include "otbOGRLayerWrapper.h"
#include "otbOGRVersionProxy.h"
class GDALDataset;
class OGRLayer;
class OGRSpatialReference;
class OGRGeometry;
......@@ -147,7 +147,7 @@ public:
* \note No condition is assumed on the non-nullity of \c source.
* \see \c DataSource(GDALDataset *)
*/
static Pointer New(GDALDataset * sourcemode, Modes::type mode = Modes::Read);
static Pointer New(OGRVersionProxy::GDALDatasetType * sourcemode, Modes::type mode = Modes::Read);
//@}
/**\name Projection Reference property */
......@@ -284,7 +284,7 @@ public:
* \throw None
* \post Assumes ownership of the \c source.
*/
void Reset(GDALDataset * source);
void Reset(OGRVersionProxy::GDALDatasetType * source);
/**\name Layers modification */
//@{
......@@ -480,7 +480,7 @@ public:
* \warning You must under no circonstance try to delete the \c GDALDataset
* obtained this way.
*/
GDALDataset & ogr();
OGRVersionProxy::GDALDatasetType & ogr();
protected:
/** Default constructor.
......@@ -496,7 +496,7 @@ protected:
/** Init constructor.
* \post The newly constructed object owns the \c source parameter.
*/
DataSource(GDALDataset * source, Modes::type mode);
DataSource(OGRVersionProxy::GDALDatasetType * source, Modes::type mode);
/** Destructor.
* \post The \c GDALDataset owned is released (if not null).
*/
......@@ -529,12 +529,8 @@ private:
size_t GetLayerID(std::string const& name) const;
int GetLayerIDUnchecked(std::string const& name) const;
/** Return a string containing space separated items retrieved by
the GetFileList() method in GDALDataset (for error reporting) */
std::string GetFileListAsString() const;
private:
GDALDataset *m_DataSource;
OGRVersionProxy::GDALDatasetType *m_DataSource;
Modes::type m_OpenMode;
int m_FirstModifiableLayerID;
}; // end class DataSource
......
......@@ -38,7 +38,7 @@
// to the compilation mode of the client code.
inline
GDALDataset & otb::ogr::DataSource::ogr()
otb::OGRVersionProxy::GDALDatasetType & otb::ogr::DataSource::ogr()
{
assert(m_DataSource && "GDALDataset not initialized");
return *m_DataSource;
......
......@@ -24,11 +24,11 @@ PURPOSE. See the above copyright notices for more information.
#include <boost/utility/enable_if.hpp>
// #include "itkIndent.h", included from field
#include "otbOGRFeatureWrapper.h"
#include "otbOGRVersionProxy.h"
// #include "ogr_core.h" // OGRwkbGeometryType, included from feature -> field
// Forward declarations
class OGRLayer;
class GDALDataset;
class OGRGeometry;
class OGRFeatureDefn;
......@@ -105,7 +105,7 @@ public:
* OGRDataSource::ExecuteSQL(). It's actually the constructor called by \c
* DataSource::ExecuteSQL().
*/
Layer(OGRLayer* layer, GDALDataset& sourceInChargeOfLifeTime, bool modifiable);
Layer(OGRLayer* layer, otb::OGRVersionProxy::GDALDatasetType& sourceInChargeOfLifeTime, bool modifiable);
//@}
/**\name Features collection */
......
......@@ -60,8 +60,8 @@ otb::ogr::Layer::Layer(OGRLayer* layer, bool modifiable)
{
}
otb::ogr::Layer::Layer(OGRLayer* layer, GDALDataset& sourceInChargeOfLifeTime, bool modifiable)
: m_Layer(layer, boost::bind(&OGRDataSource::ReleaseResultSet, boost::ref(sourceInChargeOfLifeTime), _1))
otb::ogr::Layer::Layer(OGRLayer* layer, otb::OGRVersionProxy::GDALDatasetType& sourceInChargeOfLifeTime, bool modifiable)
: m_Layer(layer, boost::bind(&otb::OGRVersionProxy::GDALDatasetType::ReleaseResultSet, boost::ref(sourceInChargeOfLifeTime), _1))
, m_Modifiable(modifiable)
{
assert(layer && "A null OGRlayer cannot belong to an OGRDataSource" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment