22 #ifndef otbOGRDataSourceWrapper_h
23 #define otbOGRDataSourceWrapper_h
28 #if defined(__GNUC__) || defined(__clang__)
29 #pragma GCC diagnostic push
30 #pragma GCC diagnostic ignored "-Wshadow"
31 #include <boost/mpl/if.hpp>
32 #include <boost/type_traits/add_const.hpp>
33 #include <boost/type_traits/is_const.hpp>
34 #include <boost/noncopyable.hpp>
35 #pragma GCC diagnostic pop
37 #include <boost/mpl/if.hpp>
38 #include <boost/type_traits/add_const.hpp>
39 #include <boost/type_traits/is_const.hpp>
40 #include <boost/noncopyable.hpp>
43 #include "itkDataObject.h"
45 #include "itkObjectFactory.h"
51 class OGRSpatialReference;
81 #include "OTBGdalAdaptersExport.h"
83 class OTBGdalAdapters_EXPORT
DataSource :
public itk::DataObject,
public boost::noncopyable
133 Update_LayerOverwrite,
142 Update_LayerCreateOnly,
181 void SetProjectionRef(
const std::string& projectionRef);
182 std::string GetProjectionRef()
const;
211 template <
class Value>
212 class layer_iter :
public boost::iterator_facade<layer_iter<Value>, Value, boost::random_access_traversal_tag, Value>
237 template <
class OtherValue>
241 friend class boost::iterator_core_access;
245 template <
class OtherValue>
248 Value dereference()
const;
281 int Size(
bool doForceComputation)
const;
294 std::string
GetGlobalExtent(
double& ulx,
double& uly,
double& lrx,
double& lry,
bool force =
false)
const;
315 void Graft(
const itk::DataObject* data)
override;
351 Layer CreateLayer(std::string
const& name, OGRSpatialReference* poSpatialRef =
nullptr, OGRwkbGeometryType eGType = wkbUnknown,
352 std::vector<std::string>
const& papszOptions = std::vector<std::string>());
387 Layer CopyLayer(
Layer& srcLayer, std::string
const& newName, std::vector<std::string>
const& papszOptions = std::vector<std::string>());
410 Layer GetLayer(
size_t i);
414 Layer const GetLayer(
size_t i)
const;
428 Layer const GetLayer(std::string
const& name)
const;
444 Layer const GetLayerChecked(
size_t i)
const;
479 Layer ExecuteSQL(std::string
const& statement, OGRGeometry* poSpatialFilter,
char const* pszDialect);
497 return m_DataSource ? &boolean::i :
nullptr;
540 DataSource(GDALDataset* source,
Modes::type mode,
const std::vector<std::string>& layerOption = std::vector<std::string>());
550 void PrintSelf(std::ostream& os, itk::Indent indent)
const override;
567 OGRLayer* GetLayerUnchecked(
size_t i)
const;
587 #ifndef OTB_MANUAL_INSTANTIATION
This class aim at processing GDAL option that can be pass through extended filename.
Implementation class for Layer iterator.
boost::mpl::if_< boost::is_const< Value >, otb::ogr::DataSource const, otb::ogr::DataSource >::type container_type
container_type * m_DataSource
Collection of geometric objects.
bool IsLayerModifiable(vcl_size_t i) const
itk::SmartPointer< const Self > ConstPointer
Layer GetLayerChecked(vcl_size_t i)
Layer const GetLayerChecked(std::string const &name) const
int Size(bool doForceComputation) const
int GetLayersCount() const
const_iterator end() const
Layer CreateLayer(std::string const &name, OGRSpatialReference *poSpatialRef=nullptr, OGRwkbGeometryType eGType=wkbUnknown, std::vector< std::string > const &papszOptions=std::vector< std::string >())
Layer ExecuteSQL(std::string const &statement, OGRGeometry *poSpatialFilter, char const *pszDialect)
static Pointer New(GDALDataset *sourcemode, Modes::type mode=Modes::Read, const std::vector< std::string > &layerOptions=std::vector< std::string >())
OGREnvelope GetGlobalExtent(bool force=false, std::string *outwkt=nullptr) const
std::vector< std::string > m_LayerOptions
static Pointer OpenDataSource(std::string const &datasourceName, Modes::type mode)
int m_FirstModifiableLayerID
const_iterator cend() const
static Pointer New(std::string const &datasourcename, Modes::type mode=Modes::Read)
layer_iter< Layer > iterator
OGRExtendedFilenameToOptions FileNameHelperType
std::string GetGlobalExtent(double &ulx, double &uly, double &lrx, double &lry, bool force=false) const
Layer CopyLayer(Layer &srcLayer, std::string const &newName, std::vector< std::string > const &papszOptions=std::vector< std::string >())
const_iterator begin() const
void AddLayerCreationOptions(std::vector< std::string > options)
void Reset(GDALDataset *source)
GDALDataset * m_DataSource
vcl_size_t GetLayerID(std::string const &name) const
const_iterator cbegin() const
layer_iter< Layer const > const_iterator
void Graft(const itk::DataObject *data) override
DataSource(GDALDataset *source, Modes::type mode, const std::vector< std::string > &layerOption=std::vector< std::string >())
void DeleteLayer(vcl_size_t i)
void PrintSelf(std::ostream &os, itk::Indent indent) const override
itk::SmartPointer< Self > Pointer
bool HasCapability(std::string const &capabilityName) const
itk::DataObject Superclass
int GetLayerIDUnchecked(std::string const &name) const
std::string GetDatasetDescription() const
const std::vector< std::string > & GetLayerCreationOptions() const
OGRLayer * GetLayerUnchecked(vcl_size_t i)
Layer GetLayer(std::string const &name)
Layer GetLayerChecked(std::string const &name)
void SetLayerCreationOptions(const std::vector< std::string > &options)
bool IsLayerModifiable(std::string const &name) const
Layer of geometric objects.
OTBApplicationEngine_EXPORT int Read(const std::string &filename, Application::Pointer application)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
@ Read
Open data source in read-only mode.