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
128 Update_LayerOverwrite,
139 Update_LayerCreateOnly,
162 static Pointer New(std::string
const& datasourcename, Modes::type mode =
Modes::Read);
175 static Pointer New(GDALDataset* sourcemode, Modes::type mode =
Modes::Read,
const std::vector<std::string>& layerOptions = std::vector<std::string>());
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;
267 const_iterator cbegin()
const;
268 const_iterator cend()
const;
281 int Size(
bool doForceComputation)
const;
294 std::string GetGlobalExtent(
double& ulx,
double& uly,
double& lrx,
double& lry,
bool force =
false)
const;
304 OGREnvelope GetGlobalExtent(
bool force =
false, std::string* outwkt =
nullptr)
const;
315 void Graft(
const itk::DataObject* data)
override;
323 void Reset(GDALDataset* source);
351 Layer CreateLayer(std::string
const& name, OGRSpatialReference* poSpatialRef =
nullptr, OGRwkbGeometryType eGType = wkbUnknown,
352 std::vector<std::string>
const& papszOptions = std::vector<std::string>());
366 void DeleteLayer(
size_t i);
387 Layer CopyLayer(
Layer& srcLayer, std::string
const& newName, std::vector<std::string>
const& papszOptions = std::vector<std::string>());
398 int GetLayersCount()
const;
410 Layer GetLayer(
size_t i);
414 Layer const GetLayer(
size_t i)
const;
424 Layer GetLayer(std::string
const& name);
428 Layer const GetLayer(std::string
const& name)
const;
440 Layer GetLayerChecked(
size_t i);
444 Layer const GetLayerChecked(
size_t i)
const;
454 Layer GetLayerChecked(std::string
const& name);
458 Layer const GetLayerChecked(std::string
const& name)
const;
479 Layer ExecuteSQL(std::string
const& statement, OGRGeometry* poSpatialFilter,
char const* pszDialect);
497 return m_DataSource ? &boolean::i :
nullptr;
509 bool HasCapability(std::string
const& capabilityName)
const;
521 void SetLayerCreationOptions(
const std::vector<std::string>& options);
522 void AddLayerCreationOptions(std::vector<std::string> options);
523 const std::vector<std::string>& GetLayerCreationOptions()
const;
540 DataSource(GDALDataset* source, Modes::type mode,
const std::vector<std::string>& layerOption = std::vector<std::string>());
547 static Pointer OpenDataSource(std::string
const& datasourceName, Modes::type mode);
550 void PrintSelf(std::ostream& os, itk::Indent indent)
const override;
563 OGRLayer* GetLayerUnchecked(
size_t i);
567 OGRLayer* GetLayerUnchecked(
size_t i)
const;
569 bool IsLayerModifiable(
size_t i)
const;
570 bool IsLayerModifiable(std::string
const& name)
const;
572 size_t GetLayerID(std::string
const& name)
const;
573 int GetLayerIDUnchecked(std::string
const& name)
const;
576 std::string GetDatasetDescription()
const;
587 #ifndef OTB_MANUAL_INSTANTIATION
591 #endif // otbOGRDataSourceWrapper_h