OTB
9.0.0
Orfeo Toolbox
|
#include <otbOGRLayerWrapper.h>
Classes | |
struct | boolean |
class | feature_iter |
Public Member Functions | |
Construction | |
Layer (OGRLayer *layer, bool modifiable) | |
Layer (OGRLayer *layer, GDALDataset &sourceInChargeOfLifeTime, bool modifiable) | |
Features collection | |
int | GetFeatureCount (bool doForceComputation) const |
void | CreateFeature (Feature feature) |
void | DeleteFeature (long nFID) |
Feature | GetFeature (long nFID) |
void | SetFeature (Feature feature) |
std::string | GetName () const |
OGREnvelope | GetExtent (bool force=false) const |
void | GetExtent (double &ulx, double &uly, double &lrx, double &lry, bool force=false) const |
void | PrintSelf (std::ostream &os, itk::Indent indent) const |
operator int boolean::* () const | |
OGRLayer & | ogr () |
Spatial filter property | |
| |
OGRGeometry const * | GetSpatialFilter () const |
void | SetSpatialFilter (OGRGeometry const *spatialFilter) |
void | SetSpatialFilterRect (double dfMinX, double dfMinY, double dfMaxX, double dfMaxY) |
OGRSpatialReference const * | GetSpatialRef () const |
std::string | GetProjectionRef () const |
ITK standard definitions | |
typedef Layer | Self |
const char * | GetNameOfClass () const |
Iteration | |
typedef feature_iter< Feature > | iterator |
typedef feature_iter< Feature const > | const_iterator |
template<class > | |
class | feature_iter |
const_iterator | cbegin () const |
const_iterator | cend () const |
const_iterator | begin () const |
const_iterator | end () const |
iterator | begin () |
iterator | end () |
const_iterator | cstart_at (GIntBig index) const |
const_iterator | start_at (GIntBig index) const |
iterator | start_at (GIntBig index) |
Features definition | |
| |
bool | operator== (Layer const &lhs, Layer const &rhs) |
std::shared_ptr< OGRLayer > | m_Layer |
bool | m_Modifiable |
OGRFeatureDefn & | GetLayerDefn () const |
void | CreateField (FieldDefn const &field, bool bApproxOK=true) |
void | DeleteField (int fieldIndex) |
void | AlterFieldDefn (vcl_size_t fieldIndex, FieldDefn const &newFieldDefn, int nFlags) |
void | ReorderField (vcl_size_t oldPos, vcl_size_t newPos) |
void | ReorderFields (int *map) |
void | SetIgnoredFields (char const **fieldNames) |
OGRwkbGeometryType | GetGeomType () const |
Feature | GetNextFeature () |
Layer of geometric objects.
It provides an encapsulation of OGR classes. In that particular case, it's an encapsulation of OGRLayer
.
OGRLayer
. OGRLayer
. otb::ogr::DataSource::ExecuteSQL()
, it will automatically manage the release of the underlying OGRLayer
. OGRDataSource
is released Definition at line 80 of file otbOGRLayerWrapper.h.
typedef feature_iter<Feature const> otb::ogr::Layer::const_iterator |
Features const iterator.
Definition at line 397 of file otbOGRLayerWrapper.h.
typedef feature_iter<Feature> otb::ogr::Layer::iterator |
Features iterator.
Definition at line 395 of file otbOGRLayerWrapper.h.
typedef Layer otb::ogr::Layer::Self |
Definition at line 86 of file otbOGRLayerWrapper.h.
otb::ogr::Layer::Layer | ( | OGRLayer * | layer, |
bool | modifiable | ||
) |
Init constructor with a layer owned by a DataSource.
layer | OGRLayer instance that is owned by a DataSource. |
datasource | Pointer to the actual data source. |
None | On destruction of the proxy class, the internal OGRLayer is left alone. |
otb::ogr::Layer::Layer | ( | OGRLayer * | layer, |
GDALDataset & | sourceInChargeOfLifeTime, | ||
bool | modifiable | ||
) |
Init constructor for layers that need to be released.
layer | OGRLayer owned by the client code. |
sourceInChargeOfLifeTime | reference to the actual GDALDataset that knows how to release the layer. |
m_datasource
is left null: we suppose (for now, that the layer won't need access to the datasource meta-information).None |
void otb::ogr::Layer::AlterFieldDefn | ( | vcl_size_t | fieldIndex, |
FieldDefn const & | newFieldDefn, | ||
int | nFlags | ||
) |
Changes the definition of the i-th field.
[in] | fieldIndex | index of the field to change |
[in,out] | newFieldDefn | definition of the new field. |
[in] | nFlags | combination of ALTER_NAME_FLAG , ALTER_TYPE_FLAG and ALTER_WIDTH_PRECISION_FLAG to indicate which of the name and/or type and/or width and precision fields from the new field definition must be taken into account. |
Feature
in existence that were obtained or created with the previous layer definition. itk::ExceptionObject | if the new field cannot be modified |
OGRLayer::AlterFieldDefn()
otb::ogr::FieldDefn
iterator otb::ogr::Layer::begin | ( | ) |
Returns a single-pass iterator to the start of the sequence.
feature_iter
|
inline |
Returns a single-pass iterator to the start of the sequence.
feature_iter
Definition at line 412 of file otbOGRLayerWrapper.h.
Referenced by otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::DispatchInputVectors(), otb::PersistentSamplingFilterBase< TInputImage >::DispatchInputVectors(), otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::FillOneOutput(), otb::PersistentSamplingFilterBase< TInputImage >::FillOneOutput(), otb::PersistentImageToOGRLayerFilter< TImageType >::GenerateData(), otb::PersistentImageToOGRDataFilter< TImage >::GenerateData(), otb::PersistentSamplingFilterBase< TInputImage >::GenerateOutputInformation(), otb::TransformationFunctorDispatcher< TransformationFunctor, OGRGeometry, FieldTransformationPolicy >::operator()(), otb::PersistentImageToOGRLayerSegmentationFilter< TImageType, TSegmentationFilter >::ProcessTile(), otb::PersistentOGRDataToClassStatisticsFilter< TInputImage, TMaskImage >::Synthetize(), otb::PersistentImageSampleExtractorFilter< TInputImage >::ThreadedGenerateVectorData(), and otb::PersistentSamplingFilterBase< TInputImage >::ThreadedGenerateVectorData().
const_iterator otb::ogr::Layer::cbegin | ( | ) | const |
Returns a single-pass iterator to the start of the sequence.
feature_iter
Referenced by otb::Wrapper::VectorPrediction< RegressionMode >::ReadInputListSample().
|
inline |
Returns the end iterator of the sequence.
Definition at line 406 of file otbOGRLayerWrapper.h.
void otb::ogr::Layer::CreateFeature | ( | Feature | feature | ) |
Adds a pre-existing Feature
to the layer.
[in,out] | feature | feature to add. Upon successful completion, the feature id will be updated (unless it was previously set) |
itk::ExceptionObject | if the feature can't be added. |
OGRLayer::CreateFeature()
Referenced by otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::FillOneOutput(), otb::PersistentSamplingFilterBase< TInputImage >::FillOneOutput(), otb::Wrapper::VectorPrediction< RegressionMode >::FillOutputLayer(), otb::PersistentImageToOGRDataFilter< TImage >::GenerateData(), otb::TransformationFunctorDispatcher< TransformationFunctor, OGRGeometry, FieldTransformationPolicy >::operator()(), otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::ProcessSample(), and otb::PersistentImageSampleExtractorFilter< TInputImage >::ThreadedGenerateVectorData().
void otb::ogr::Layer::CreateField | ( | FieldDefn const & | field, |
bool | bApproxOK = true |
||
) |
Adds a new field given its definition.
[in] | field | field definition |
[in] | bApproxOK | If true, the field may be created in a slightly different form depending on the limitations of the format driver. |
Feature
in existence that were obtained or created with the previous layer definition. itk::ExceptionObject | if the new field cannot be created |
OGRLayer::CreateField()
OGRDriver
. otb::ogr::FieldDefn
Referenced by otb::Wrapper::VectorPrediction< RegressionMode >::AddPredictionField(), otb::PersistentSamplingFilterBase< TInputImage >::AllocateOutputs(), otb::Wrapper::VectorPrediction< RegressionMode >::CreateOutputDataSource(), otb::LabelImageToVectorDataFilter< TInputImage, TPrecision >::GenerateData(), otb::LabelImageToOGRDataSourceFilter< TInputImage >::GenerateData(), otb::PersistentImageToOGRDataFilter< TImage >::Initialize(), and otb::PersistentSamplingFilterBase< TInputImage >::InitializeOutputDataSource().
const_iterator otb::ogr::Layer::cstart_at | ( | GIntBig | index | ) | const |
Returns a single-pass iterator to the i-th Feature
of the sequence.
feature_iter
Depending of the actual driver (i.e. OGRDriver
), this may be done in O(N). void otb::ogr::Layer::DeleteFeature | ( | long | nFID | ) |
Removes a feature identified by its id from the Layer
.
[in] | nFID | feature id. |
itk::ExceptionObject | if the feature can't be added. |
OGRFeature::DeleteFeature()
Referenced by otb::PersistentImageToOGRLayerSegmentationFilter< TImageType, TSegmentationFilter >::ProcessTile().
void otb::ogr::Layer::DeleteField | ( | int | fieldIndex | ) |
Deletes a field.
[in] | fieldIndex | index of the field to remove. |
Feature
in existence that were obtained or created with the previous layer definition. itk::ExceptionObject | if the new field cannot be deleted |
OGRLayer::DeleteField()
|
inline |
Returns the end iterator of the sequence.
Definition at line 427 of file otbOGRLayerWrapper.h.
|
inline |
Returns the end iterator of the sequence.
Definition at line 418 of file otbOGRLayerWrapper.h.
Referenced by otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::DispatchInputVectors(), otb::PersistentSamplingFilterBase< TInputImage >::DispatchInputVectors(), otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::FillOneOutput(), otb::PersistentSamplingFilterBase< TInputImage >::FillOneOutput(), otb::PersistentImageToOGRLayerFilter< TImageType >::GenerateData(), otb::PersistentImageToOGRDataFilter< TImage >::GenerateData(), otb::TransformationFunctorDispatcher< TransformationFunctor, OGRGeometry, FieldTransformationPolicy >::operator()(), otb::PersistentImageToOGRLayerSegmentationFilter< TImageType, TSegmentationFilter >::ProcessTile(), otb::PersistentImageSampleExtractorFilter< TInputImage >::ThreadedGenerateVectorData(), and otb::PersistentSamplingFilterBase< TInputImage >::ThreadedGenerateVectorData().
OGREnvelope otb::ogr::Layer::GetExtent | ( | bool | force = false | ) | const |
Retrieves the extent of the layer.
[in] | force | Force computation of the extent if not available. May force the driver to walk all geometries to compute the extent. |
itk::ExceptionObject | if the extent can not be retrieved. |
void otb::ogr::Layer::GetExtent | ( | double & | ulx, |
double & | uly, | ||
double & | lrx, | ||
double & | lry, | ||
bool | force = false |
||
) | const |
Retrieves the extent of the layer.
[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 the extent if not available. May force the driver to walk all geometries to compute the extent. |
itk::ExceptionObject | if the extent can not be retrieved. |
Feature otb::ogr::Layer::GetFeature | ( | long | nFID | ) |
Finds a feature from its id.
[in] | nFID | feature id. |
OGRFeature
stored in the layer and that matches the requested id. itk::ExceptionObject | if nFID is null |
nFID
value cannot be OGRNullFID
GetFID()
equals nFID
OGRFeature::GetFeature()
int otb::ogr::Layer::GetFeatureCount | ( | bool | doForceComputation | ) | const |
Returns the number of elements in the layer.
[in] | doForceComputation | indicates whether the size shall be computed even so it's expensive to do so. |
None |
OGRLayer::GetFeatureCount()
Referenced by otb::PersistentSamplingFilterBase< TInputImage >::DispatchInputVectors(), otb::TransformationFunctorDispatcher< TransformationFunctor, OGRGeometry, FieldTransformationPolicy >::operator()(), otb::PersistentImageSampleExtractorFilter< TInputImage >::ThreadedGenerateVectorData(), and otb::PersistentSamplingFilterBase< TInputImage >::ThreadedGenerateVectorData().
OGRwkbGeometryType otb::ogr::Layer::GetGeomType | ( | ) | const |
Returns the type of the geometry stored.
OGRLayer::GetGeomType()
Referenced by otb::PersistentSamplingFilterBase< TInputImage >::AllocateOutputs(), and otb::Wrapper::VectorPrediction< RegressionMode >::CreateOutputDataSource().
OGRFeatureDefn& otb::ogr::Layer::GetLayerDefn | ( | ) | const |
Returns a reference to the layer definition.
*Field
functions instead. Referenced by otb::Wrapper::VectorPrediction< RegressionMode >::AddPredictionField(), otb::PersistentSamplingFilterBase< TInputImage >::AllocateOutputs(), otb::Wrapper::VectorPrediction< RegressionMode >::CreateOutputDataSource(), otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::DispatchInputVectors(), otb::PersistentSamplingFilterBase< TInputImage >::DispatchInputVectors(), otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::FillOneOutput(), otb::PersistentSamplingFilterBase< TInputImage >::FillOneOutput(), otb::Wrapper::VectorPrediction< RegressionMode >::FillOutputLayer(), otb::LabelImageToVectorDataFilter< TInputImage, TPrecision >::GenerateData(), otb::PersistentImageToOGRDataFilter< TImage >::GenerateData(), otb::FieldCopyTransformation::getDefinition(), otb::PersistentSamplingFilterBase< TInputImage >::InitializeOutputDataSource(), otb::TransformationFunctorDispatcher< TransformationFunctor, OGRGeometry, FieldTransformationPolicy >::operator()(), otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::ProcessSample(), and otb::PersistentImageSampleExtractorFilter< TInputImage >::ThreadedGenerateVectorData().
std::string otb::ogr::Layer::GetName | ( | ) | const |
Returns the name given to the layer, if any.
Referenced by otb::PersistentSamplingFilterBase< TInputImage >::InitializeOutputDataSource().
|
inline |
Definition at line 87 of file otbOGRLayerWrapper.h.
|
private |
Internal encapsulation of OGRLayer::GetNextFeature()
.
OGRFeature
of the layer, encapsulated in a Feature
. None |
std::string otb::ogr::Layer::GetProjectionRef | ( | ) | const |
Returns the projection ref associated with the layer.
Referenced by otb::PersistentSamplingFilterBase< TInputImage >::InitializeOutputDataSource().
OGRGeometry const* otb::ogr::Layer::GetSpatialFilter | ( | ) | const |
Returns a reference to the current spatial filter, if any.
SetSpatialFilter
or SetSpatialFilterRect
for this purpose. None |
OGRLayer::GetSpatialFilter()
OGRSpatialReference const* otb::ogr::Layer::GetSpatialRef | ( | ) | const |
Spatial Reference property.
Referenced by otb::PersistentSamplingFilterBase< TInputImage >::AllocateOutputs(), otb::Wrapper::VectorPrediction< RegressionMode >::CreateOutputDataSource(), otb::PersistentImageToOGRLayerFilter< TImageType >::GenerateData(), and otb::PersistentImageSampleExtractorFilter< TInputImage >::GenerateOutputInformation().
OGRLayer& otb::ogr::Layer::ogr | ( | ) |
Access to raw OGRLayer
. This function provides an abstraction leak in case deeper control on the underlying OGRLayer
is required.
OGRLayer
must be valid, i.e. m_Layer != 0
, an assertion is fired otherwise. OGRLayer
obtained this way. Referenced by otb::Wrapper::VectorPrediction< RegressionMode >::DoExecute(), otb::Wrapper::TrainVectorBase< TInputValue, TOutputValue >::DoUpdateParameters(), otb::Wrapper::TrainVectorBase< TInputValue, TOutputValue >::ExtractSamplesWithLabel(), otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::FillOneOutput(), otb::PersistentSamplingFilterBase< TInputImage >::FillOneOutput(), otb::LabelImageToVectorDataFilter< TInputImage, TPrecision >::GenerateData(), otb::LabelImageToOGRDataSourceFilter< TInputImage >::GenerateData(), and otb::PersistentImageToOGRDataFilter< TImage >::GenerateData().
|
inline |
Can the layer 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 246 of file otbOGRLayerWrapper.h.
void otb::ogr::Layer::PrintSelf | ( | std::ostream & | os, |
itk::Indent | indent | ||
) | const |
Prints self into stream.
void otb::ogr::Layer::ReorderField | ( | vcl_size_t | oldPos, |
vcl_size_t | newPos | ||
) |
Moves a field from one position to another.
[in] | oldPos | old field index position |
[in] | newPos | new field index position |
Feature
in existence that were obtained or created with the previous layer definition. itk::ExceptionObject | if the new field cannot be modified |
OGRLayer::ReorderField()
void otb::ogr::Layer::ReorderFields | ( | int * | map | ) |
Reorder all the fields of the layer.
[in] | map | array that tells the new position of each field. |
Feature
in existence that were obtained or created with the previous layer definition. itk::ExceptionObject | if the new field cannot be modified |
OGRLayer::ReorderFields()
void otb::ogr::Layer::SetFeature | ( | Feature | feature | ) |
Changes a Feature
in the Layer.
[in,out] | feature | feature to set. Upon successful completion, the feature id will be updated (in case it was previously set) |
itk::ExceptionObject | if the feature can't be set. |
OGRLayer::SetFeature()
OGRDriver
. Referenced by otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::FillOneOutput(), otb::PersistentSamplingFilterBase< TInputImage >::FillOneOutput(), otb::Wrapper::VectorPrediction< RegressionMode >::FillOutputLayer(), otb::TransformationFunctorDispatcher< TransformationFunctor, OGRGeometry, FieldTransformationPolicy >::operator()(), and otb::PersistentImageToOGRLayerSegmentationFilter< TImageType, TSegmentationFilter >::ProcessTile().
void otb::ogr::Layer::SetIgnoredFields | ( | char const ** | fieldNames | ) |
Sets which fields can be omitted when retrieving features from the layer.
[in] | fieldNames | 0-terminated array of the field names to ignore when fetching features from the layer. 0 to clear the list. end |
Besides field names of the layers, the following special fields can be passed: "OGR_GEOMETRY" to ignore geometry and "OGR_STYLE" to ignore layer style.
By default, no fields are ignored.
itk::ExceptionObject | if the new field cannot be modified |
OGRLayer::SetIgnoredFields()
void otb::ogr::Layer::SetSpatialFilter | ( | OGRGeometry const * | spatialFilter | ) |
Sets the current spatial filter. Replaces the current spatial filter with a clone of the one passed as parameter. Thus the parameter remains of the responsibility of the caller.
The spatial filter is used to filter the Feature's
obtained when iterating on the layer.
[in] | spatialFilter | new spatial filter definition, NULL clears the filter. |
None |
OGRLayer::SetSpatialFilter()
Referenced by otb::PersistentOGRDataToSamplePositionFilter< TInputImage, TMaskImage, TSampler >::DispatchInputVectors(), and otb::PersistentSamplingFilterBase< TInputImage >::DispatchInputVectors().
void otb::ogr::Layer::SetSpatialFilterRect | ( | double | dfMinX, |
double | dfMinY, | ||
double | dfMaxX, | ||
double | dfMaxY | ||
) |
Sets a new rectangular spatial filter. Defines the new filter as a rectangular shape.
The coordinates used shall be in the same referential as the layer as the whole (as returned by GetSpatialRef()
).
OGRLayer::SetSpatialFilterRect()
iterator otb::ogr::Layer::start_at | ( | GIntBig | index | ) |
Returns a single-pass iterator to the i-th Feature
of the sequence.
feature_iter
Depending of the actual driver (i.e. OGRDriver
), this may be done in O(N).
|
inline |
Returns a single-pass iterator to the i-th Feature
of the sequence.
feature_iter
Depending of the actual driver (i.e. OGRDriver
), this may be done in O(N). Definition at line 440 of file otbOGRLayerWrapper.h.
Referenced by otb::TransformationFunctorDispatcher< TransformationFunctor, OGRGeometry, FieldTransformationPolicy >::operator()().
|
friend |
Features iterator.
Definition at line 393 of file otbOGRLayerWrapper.h.
Compares layers identities.
Definition at line 562 of file otbOGRLayerWrapper.h.
|
private |
Data implementation.
Definition at line 586 of file otbOGRLayerWrapper.h.
Referenced by otb::ogr::operator==().
|
private |
Compares layers identities.
Definition at line 588 of file otbOGRLayerWrapper.h.