OTB
9.0.0
Orfeo Toolbox
|
#include <otbOGRDataSourceWrapper.h>
Classes | |
struct | boolean |
class | layer_iter |
struct | Modes |
Public Types | |
Standard ITK typedefs | |
typedef DataSource | Self |
typedef itk::DataObject | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer< const Self > | ConstPointer |
typedef OGRExtendedFilenameToOptions | FileNameHelperType |
Public Member Functions | |
Projection Reference property | |
bool | Clear () |
Layers modification | |
Layer | CreateLayer (std::string const &name, OGRSpatialReference *poSpatialRef=nullptr, OGRwkbGeometryType eGType=wkbUnknown, std::vector< std::string > const &papszOptions=std::vector< std::string >()) |
void | DeleteLayer (vcl_size_t i) |
Layer | CopyLayer (Layer &srcLayer, std::string const &newName, std::vector< std::string > const &papszOptions=std::vector< std::string >()) |
Static Public Member Functions | |
Creation functions | |
static Pointer | New (std::string const &datasourcename, Modes::type mode=Modes::Read) |
static Pointer | New (GDALDataset *sourcemode, Modes::type mode=Modes::Read, const std::vector< std::string > &layerOptions=std::vector< std::string >()) |
Standard macros | |
static Pointer | New () |
virtual ::itk::LightObject::Pointer | CreateAnother (void) const |
virtual const char * | GetNameOfClass () const |
Iteration | |
typedef layer_iter< Layer > | iterator |
typedef layer_iter< Layer const > | const_iterator |
template<class > | |
class | layer_iter |
const_iterator | begin () const |
const_iterator | end () const |
const_iterator | cbegin () const |
const_iterator | cend () const |
iterator | begin () |
iterator | end () |
int | Size (bool doForceComputation) const |
std::string | GetGlobalExtent (double &ulx, double &uly, double &lrx, double &lry, bool force=false) const |
OGREnvelope | GetGlobalExtent (bool force=false, std::string *outwkt=nullptr) const |
void | Graft (const itk::DataObject *data) override |
void | Reset (GDALDataset *source) |
Layers access | |
| |
GDALDataset * | m_DataSource |
std::vector< std::string > | m_LayerOptions |
Modes::type | m_OpenMode |
int | m_FirstModifiableLayerID |
int | GetLayersCount () const |
Layer | GetLayer (vcl_size_t i) |
const Layer | GetLayer (vcl_size_t i) const |
Layer | GetLayer (std::string const &name) |
const Layer | GetLayer (std::string const &name) const |
Layer | GetLayerChecked (vcl_size_t i) |
const Layer | GetLayerChecked (vcl_size_t i) const |
Layer | GetLayerChecked (std::string const &name) |
const Layer | GetLayerChecked (std::string const &name) const |
Layer | ExecuteSQL (std::string const &statement, OGRGeometry *poSpatialFilter, char const *pszDialect) |
operator int boolean::* () const | |
void | SyncToDisk () |
bool | HasCapability (std::string const &capabilityName) const |
GDALDataset & | ogr () |
void | SetLayerCreationOptions (const std::vector< std::string > &options) |
void | AddLayerCreationOptions (std::vector< std::string > options) |
const std::vector< std::string > & | GetLayerCreationOptions () const |
DataSource () | |
DataSource (GDALDataset *source, Modes::type mode, const std::vector< std::string > &layerOption=std::vector< std::string >()) | |
~DataSource () override | |
void | PrintSelf (std::ostream &os, itk::Indent indent) const override |
static Pointer | OpenDataSource (std::string const &datasourceName, Modes::type mode) |
OGRLayer * | GetLayerUnchecked (vcl_size_t i) |
OGRLayer * | GetLayerUnchecked (vcl_size_t i) const |
bool | IsLayerModifiable (vcl_size_t i) const |
bool | IsLayerModifiable (std::string const &name) const |
vcl_size_t | GetLayerID (std::string const &name) const |
int | GetLayerIDUnchecked (std::string const &name) const |
std::string | GetDatasetDescription () const |
Collection of geometric objects.
This class is meant to supersede otb::VectorData
class. It provides an encapsulation of OGR classes. In that particular case, it's an encapsulation of GDALDataset
.
OGRRegisterAll()
is implicitly called on construction.SetStyleTable()
& GetStyleTable()
SetDriver()
& GetDriver()
Definition at line 83 of file otbOGRDataSourceWrapper.h.
typedef layer_iter<Layer const> otb::ogr::DataSource::const_iterator |
Returns the number of elements in the Data Source.
[in] | doForceComputation | indicates whether the size shall be computed on each layer even so it's expensive to do so. |
None |
OGRLayer::GetFeatureCount()
Definition at line 257 of file otbOGRDataSourceWrapper.h.
typedef itk::SmartPointer<const Self> otb::ogr::DataSource::ConstPointer |
Definition at line 91 of file otbOGRDataSourceWrapper.h.
Definition at line 94 of file otbOGRDataSourceWrapper.h.
Returns the number of elements in the Data Source.
[in] | doForceComputation | indicates whether the size shall be computed on each layer even so it's expensive to do so. |
None |
OGRLayer::GetFeatureCount()
Definition at line 256 of file otbOGRDataSourceWrapper.h.
typedef itk::SmartPointer<Self> otb::ogr::DataSource::Pointer |
Definition at line 90 of file otbOGRDataSourceWrapper.h.
typedef DataSource otb::ogr::DataSource::Self |
Definition at line 88 of file otbOGRDataSourceWrapper.h.
typedef itk::DataObject otb::ogr::DataSource::Superclass |
Definition at line 89 of file otbOGRDataSourceWrapper.h.
|
protected |
Default constructor. The actual GDALDataset
is using the in-memory OGRSFDriver:
OGRMemDriver
.
itk::ExceptionObject | if the inner GDALDataset cannot be opened. |
OGRRegisterAll()
is implicitly called on construction DataSource::New()
|
protected |
Init constructor.
source
parameter.
|
overrideprotected |
Destructor.
GDALDataset
owned is released (if not null). void otb::ogr::DataSource::AddLayerCreationOptions | ( | std::vector< std::string > | options | ) |
Returns the number of layers.
GDALDataset::GetLayersCount()
iterator otb::ogr::DataSource::begin | ( | ) |
Returns the number of elements in the Data Source.
[in] | doForceComputation | indicates whether the size shall be computed on each layer even so it's expensive to do so. |
None |
OGRLayer::GetFeatureCount()
|
inline |
Returns the number of elements in the Data Source.
[in] | doForceComputation | indicates whether the size shall be computed on each layer even so it's expensive to do so. |
None |
OGRLayer::GetFeatureCount()
Definition at line 259 of file otbOGRDataSourceWrapper.h.
const_iterator otb::ogr::DataSource::cbegin | ( | ) | const |
Returns the number of elements in the Data Source.
[in] | doForceComputation | indicates whether the size shall be computed on each layer even so it's expensive to do so. |
None |
OGRLayer::GetFeatureCount()
const_iterator otb::ogr::DataSource::cend | ( | ) | const |
Returns the number of elements in the Data Source.
[in] | doForceComputation | indicates whether the size shall be computed on each layer even so it's expensive to do so. |
None |
OGRLayer::GetFeatureCount()
bool otb::ogr::DataSource::Clear | ( | ) |
Clears the data source.
GDALDataset
owned is destroyed with the dedicated function from OGR API. m_DataSource = 0
Layer otb::ogr::DataSource::CopyLayer | ( | Layer & | srcLayer, |
std::string const & | newName, | ||
std::vector< std::string > const & | papszOptions = std::vector< std::string >() |
||
) |
Copies a layer.
[in] | srcLayer | Source layer to copy. It may come from another DataSource . |
[in] | newName | Name of the new layer |
[in] | papszOptions | Creation options |
OGRLayer
created. itk::ExceptionObject | in case the layer cannot be created on the data source. |
OGRLayer
in order to encapsulate all lifetime management of the OGRLayer
obtained (i.e. never to be destroyed). If you want to delete a layer obtained with CreateLayer()
, you must use DeleteLayer()
. papszOptions
parameter may later become a std::vector<std::string>
. GDALDataset::CopyLayer()
virtual::itk::LightObject::Pointer otb::ogr::DataSource::CreateAnother | ( | void | ) | const |
Default builder. This builder function creates a new DataSource
with its default constructor. The actual GDALDataset
is using the in-memory OGRSFDriver:
OGRMemDriver
.
itk::ExceptionObject | if the inner GDALDataset cannot be opened. |
OGRRegisterAll()
is implicitly called on construction. DataSource()
Layer otb::ogr::DataSource::CreateLayer | ( | std::string const & | name, |
OGRSpatialReference * | poSpatialRef = nullptr , |
||
OGRwkbGeometryType | eGType = wkbUnknown , |
||
std::vector< std::string > const & | papszOptions = std::vector< std::string >() |
||
) |
Creates a new layer.
[in] | name | name for the layer |
poSpatialRef | the coordinate system to use for the new layer, or NULL if no coordinate system is available. | |
[in] | eGType | the geometry type for the layer. Use wkbUnknown if there are no constraints on the types geometry to be written. |
[in] | papszOptions | a StringList of name=value options. Options are driver specific. |
OGRLayer
created. itk::ExceptionObject | in case the layer cannot be created on the data source. |
OGRLayer
is order to encapsulate all lifetime management of the OGRLayer
obtained (i.e. never to be destroyed). If you want to delete a layer obtained with CreateLayer()
, you must use DeleteLayer()
. papszOptions
parameter may later become a std::vector<std::string>
. GDALDataset::CreateLayer()
Referenced by otb::PersistentSamplingFilterBase< TInputImage >::InitializeOutputDataSource().
void otb::ogr::DataSource::DeleteLayer | ( | vcl_size_t | i | ) |
Deletes the i-th layer from the data source.
[in] | i | layer index |
itk::ExceptionObject | in case the index is out of range |
itk::ExceptionObject | if the layer cannot be deleted from the data source. |
i
must be in range [0, GetLayersCount()). GDALDataset::DeleteLayer()
iterator otb::ogr::DataSource::end | ( | ) |
Returns the number of elements in the Data Source.
[in] | doForceComputation | indicates whether the size shall be computed on each layer even so it's expensive to do so. |
None |
OGRLayer::GetFeatureCount()
|
inline |
Returns the number of elements in the Data Source.
[in] | doForceComputation | indicates whether the size shall be computed on each layer even so it's expensive to do so. |
None |
OGRLayer::GetFeatureCount()
Definition at line 263 of file otbOGRDataSourceWrapper.h.
Layer otb::ogr::DataSource::ExecuteSQL | ( | std::string const & | statement, |
OGRGeometry * | poSpatialFilter, | ||
char const * | pszDialect | ||
) |
Executes the statement..
[in] | statement | textual description of the SQL statement. |
[in] | poSpatialFilter | Geometry representing a spatial filter – may be null. |
[in] | pszDialect | allows control of the statement dialect. If set to NULL, the OGR SQL engine will be used, except for RDBMS drivers that will use their dedicated SQL engine, unless OGRSQL is explicitly passed as the dialect. |
Layer
that contains the matching Features
. In case of error, or no matching result sets, a null Layer will be returned. Check for Layer's
validity before doing anything else. None | even when there is an error – OGR can not report errors, neither this wrapping. |
Layer
will be automatically collected on its destruction; i.e. unlike OGR API, no need to explicitly call GDALDataset::ReleaseResultSet()
. GDALDataset::ExecuteSQL()
|
private |
Get a string describing the dataset
OGREnvelope otb::ogr::DataSource::GetGlobalExtent | ( | bool | force = false , |
std::string * | outwkt = nullptr |
||
) | const |
Retrieves the union of the extents of all layers.
[in] | force | Force computation of layers extents if not available. May force the driver to walk all geometries to compute the extent. |
[out] | outwkt | The Wkt of the extent projection (which is the wkt of the first layer SRS); if null, nothing is returned this way |
itk::ExceptionObject | if the layers extents can not be retrieved. |
std::string otb::ogr::DataSource::GetGlobalExtent | ( | double & | ulx, |
double & | uly, | ||
double & | lrx, | ||
double & | lry, | ||
bool | force = false |
||
) | const |
Retrieves the union of the extents of all layers.
[out] | ulx | reference to upper-left x coordinate of the extent |
[out] | uly | reference to upper-left y coordinate of the extent |
[out] | lrx | reference to lower-right x coordinate of the extent |
[out] | uly | reference to lower-right y coordinate of the extent |
[in] | force | Force computation of layers extents if not available. May force the driver to walk all geometries to compute the extent. |
itk::ExceptionObject | if the layers extents can not be retrieved. |
Layer otb::ogr::DataSource::GetLayer | ( | std::string const & | name | ) |
Unchecked Accessor to a given layer.
[in] | name | name of the layer to search |
None |
GetLayerChecked(std::string const&)
if you'd rather have an exception instead of testing whether the layer obtained is valid.
|
inline |
Unchecked Accessor to a given layer.
[in] | name | name of the layer to search |
None |
GetLayerChecked(std::string const&)
if you'd rather have an exception instead of testing whether the layer obtained is valid. Definition at line 64 of file otbOGRDataSourceWrapper.hxx.
|
inline |
Unchecked Accessor to a given layer.
[in] | i | index of the layer to access |
i < GetLayersCount()
, an assertion will be fired otherwise. None |
GetLayerUnchecked()
if invalid indices are programming errors, or if null layers are to be expected. Definition at line 51 of file otbOGRDataSourceWrapper.hxx.
Referenced by otb::PersistentSamplingFilterBase< TInputImage >::AllocateOutputs(), otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::DispatchInputVectors(), otb::PersistentSamplingFilterBase< TInputImage >::DispatchInputVectors(), otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::FillOneOutput(), otb::PersistentSamplingFilterBase< TInputImage >::FillOneOutput(), otb::PersistentSamplingFilterBase< TInputImage >::GenerateOutputInformation(), otb::PersistentSamplingFilterBase< TInputImage >::InitializeOutputDataSource(), and otb::PersistentOGRDataToClassStatisticsFilter< TInputImage, TMaskImage >::Synthetize().
|
inline |
Definition at line 59 of file otbOGRDataSourceWrapper.hxx.
Layer otb::ogr::DataSource::GetLayerChecked | ( | std::string const & | name | ) |
Checked Accessor to a given layer.
[in] | name | name of the layer to search |
itk::ExceptionObject | if there exist no layer by that name |
GetLayer(std::string const&)
if you'd rather test the obtained layer instead of catching an exception. const Layer otb::ogr::DataSource::GetLayerChecked | ( | std::string const & | name | ) | const |
Checked Accessor to a given layer.
[in] | name | name of the layer to search |
itk::ExceptionObject | if there exist no layer by that name |
GetLayer(std::string const&)
if you'd rather test the obtained layer instead of catching an exception. Layer otb::ogr::DataSource::GetLayerChecked | ( | vcl_size_t | i | ) |
Checked Accessor to a given layer.
[in] | i | index of the layer to access |
i < GetLayersCount()
, an exception is raised otherwise. GetLayer()
if invalid indices, and null layers, are expected to be programming errors. None |
|
inline |
Checked Accessor to a given layer.
[in] | i | index of the layer to access |
i < GetLayersCount()
, an exception is raised otherwise. GetLayer()
if invalid indices, and null layers, are expected to be programming errors. None |
Definition at line 70 of file otbOGRDataSourceWrapper.hxx.
const std::vector<std::string>& otb::ogr::DataSource::GetLayerCreationOptions | ( | ) | const |
Returns the number of layers.
GDALDataset::GetLayersCount()
|
private |
Returns the number of layers.
GDALDataset::GetLayersCount()
|
private |
Returns the number of layers.
GDALDataset::GetLayersCount()
int otb::ogr::DataSource::GetLayersCount | ( | ) | const |
Returns the number of layers.
GDALDataset::GetLayersCount()
Referenced by otb::PersistentSamplingFilterBase< TInputImage >::AllocateOutputs(), otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::FillOneOutput(), otb::PersistentSamplingFilterBase< TInputImage >::FillOneOutput(), and otb::OGRDataSourceToLabelImageFilter< TOutputImage >::GenerateOutputInformation().
|
private |
Internal unchecked accessor to a given layer.
[in] | i | index of the layer to access |
i < GetLayersCount()
, return 0 otherwise None |
|
inlineprivate |
otb::ogr::DataSource::GetLayerUnchecked(size_t i)
otb::ogr::DataSource::GetLayerUnchecked(size_t i)
Definition at line 75 of file otbOGRDataSourceWrapper.hxx.
|
virtual |
Default builder. This builder function creates a new DataSource
with its default constructor. The actual GDALDataset
is using the in-memory OGRSFDriver:
OGRMemDriver
.
itk::ExceptionObject | if the inner GDALDataset cannot be opened. |
OGRRegisterAll()
is implicitly called on construction. DataSource()
|
override |
Grafts data and information from one data source to another.
OGRLayer
has an embedded input iterator. As a consequence, the layer cannot support multiple access to its elements.This is a convenience function to setup a second data source with all the meta information of another data source and use the same underlying GDALDataset
.
bool otb::ogr::DataSource::HasCapability | ( | std::string const & | capabilityName | ) | const |
Returns whether a capability is available.
[in] | capabilityName | name of the capability to check. |
None |
GDALDataset::TestCapability()
|
private |
Returns the number of layers.
GDALDataset::GetLayersCount()
|
private |
Returns the number of layers.
GDALDataset::GetLayersCount()
|
static |
Default builder. This builder function creates a new DataSource
with its default constructor. The actual GDALDataset
is using the in-memory OGRSFDriver:
OGRMemDriver
.
itk::ExceptionObject | if the inner GDALDataset cannot be opened. |
OGRRegisterAll()
is implicitly called on construction. DataSource()
Referenced by otb::Wrapper::VectorPrediction< RegressionMode >::CreateOutputDataSource(), otb::Wrapper::VectorPrediction< RegressionMode >::DoExecute(), otb::Wrapper::VectorPrediction< RegressionMode >::DoUpdateParameters(), otb::Wrapper::TrainVectorBase< TInputValue, TOutputValue >::DoUpdateParameters(), otb::Wrapper::TrainVectorBase< TInputValue, TOutputValue >::ExtractSamplesWithLabel(), otb::LabelImageToVectorDataFilter< TInputImage, TPrecision >::GenerateData(), otb::LabelImageToOGRDataSourceFilter< TInputImage >::GenerateData(), otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::MakeOutput(), otb::Wrapper::VectorPrediction< RegressionMode >::ReopenDataSourceInUpdateMode(), and otb::Wrapper::TrainImagesBase::SplitTrainingAndValidationSamples().
|
static |
Builder from a built GDALDataset
.
[in,out] | source | GDALDataset already constructed. |
DataSource
that assumes ownership of source
. Nothing |
OGRRegisterAll()
is supposed to have been called before building source
. source
. DataSource(GDALDataset *)
|
static |
Builder from an existing named data source.
[in] | datasourcename | OGR identifier of the data source |
[in] | mode | opening mode (read or read-write) |
DataSource
. itk::ExceptionObject | if the inner GDALDataset cannot be opened. |
OGRRegisterAll()
is implicitly called on construction DataSource(GDALDataset *)
|
inline |
Access to raw GDALDataset
. This function provides an abstraction leak in case deeper control on the underlying GDALDataset
is required.
GDALDataset
must be valid, i.e. m_DataSource != 0
, an assertion is fired otherwise. GDALDataset
obtained this way. Definition at line 45 of file otbOGRDataSourceWrapper.hxx.
References m_DataSource.
|
staticprotected |
Returns the number of layers.
GDALDataset::GetLayersCount()
|
inline |
Can the data source be used (ie not null).
Hack to provide a boolean operator that is convertible only to a boolean expression to be used in if
tests.
Definition at line 495 of file otbOGRDataSourceWrapper.h.
|
overrideprotected |
Prints self into stream.
void otb::ogr::DataSource::Reset | ( | GDALDataset * | source | ) |
Resets current data source with the one in parameter.
[in,out] | source | source GDALDataset that this instance will own. |
None |
source
. void otb::ogr::DataSource::SetLayerCreationOptions | ( | const std::vector< std::string > & | options | ) |
Returns the number of layers.
GDALDataset::GetLayersCount()
int otb::ogr::DataSource::Size | ( | bool | doForceComputation | ) | const |
Returns the number of elements in the Data Source.
[in] | doForceComputation | indicates whether the size shall be computed on each layer even so it's expensive to do so. |
None |
OGRLayer::GetFeatureCount()
void otb::ogr::DataSource::SyncToDisk | ( | ) |
Flushes all changes to disk.
|
friend |
Returns the number of elements in the Data Source.
[in] | doForceComputation | indicates whether the size shall be computed on each layer even so it's expensive to do so. |
None |
OGRLayer::GetFeatureCount()
Definition at line 255 of file otbOGRDataSourceWrapper.h.
|
private |
Returns the number of layers.
GDALDataset::GetLayersCount()
Definition at line 579 of file otbOGRDataSourceWrapper.h.
Referenced by otb::ogr::DataSource::layer_iter< Value >::dereference(), otb::ogr::DataSource::layer_iter< Value >::equal(), otb::ogr::DataSource::layer_iter< Value >::increment(), and ogr().
|
private |
Returns the number of layers.
GDALDataset::GetLayersCount()
Definition at line 582 of file otbOGRDataSourceWrapper.h.
|
private |
Returns the number of layers.
GDALDataset::GetLayersCount()
Definition at line 580 of file otbOGRDataSourceWrapper.h.
|
private |
Returns the number of layers.
GDALDataset::GetLayersCount()
Definition at line 581 of file otbOGRDataSourceWrapper.h.