![]() |
Orfeo Toolbox
3.16
|
Layer of geometric objets. More...
#include <otbOGRLayerWrapper.h>
Classes | |
| struct | boolean |
| int boolean ::* () const More... | |
| class | feature_iter |
Implementation class for Feature iterator. This iterator is a single pass iterator. We may fetch the Feature referenced by an iterator previously stored, but never resume the iteration after a call to Layer::begin(), Layer::start_at(), Layer::CreateFeature(), Layer::DeleteFeature(), Layer::GetFeature(), Layer::SetFeature(), nor fork the iteration. More... | |
Public Member Functions | |
| OGREnvelope | GetExtent (bool force=false) const |
| void | GetExtent (double &ulx, double &uly, double &lrx, double &lry, bool force=false) const |
| OGRwkbGeometryType | GetGeomType () const |
| std::string | GetName () const |
| std::string | GetProjectionRef () const |
| OGRSpatialReference const * | GetSpatialRef () const |
| OGRLayer & | ogr () |
| operator int boolean::* () const | |
| void | PrintSelf (std::ostream &os, itk::Indent indent) const |
Construction | |
| Layer (OGRLayer *layer, bool modifiable) | |
| Layer (OGRLayer *layer, OGRDataSource &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) |
Spatial filter property | |
| |
| OGRGeometry const * | GetSpatialFilter () const |
| void | SetSpatialFilter (OGRGeometry const *spatialFilter) |
| void | SetSpatialFilterRect (double dfMinX, double dfMinY, double dfMaxX, double dfMaxY) |
Features definition | |
| |
| OGRFeatureDefn & | GetLayerDefn () const |
| void | CreateField (FieldDefn const &field, bool bApproxOK=true) |
| void | DeleteField (vcl_size_t 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) |
Private Member Functions | |
| Feature | GetNextFeature () |
Private Attributes | |
| boost::shared_ptr< OGRLayer > | m_Layer |
| bool | m_Modifiable |
Friends | |
| bool | otb::ogr::operator== (Layer const &lhs, Layer const &rhs) |
ITK standard definitions | |
| typedef Layer | Self |
| const char * | GetNameOfClass () const |
Iteration | |
| typedef feature_iter< Feature > | iterator |
| Features iterator. | |
| typedef feature_iter< Feature const > | const_iterator |
| Features const iterator. | |
| class | feature_iter |
| Features iterator. | |
| const_iterator | cbegin () const |
| const_iterator | cend () const |
| const_iterator | begin () const |
| | |
| const_iterator | end () const |
| | |
| iterator | begin () |
| | |
| iterator | end () |
| | |
| const_iterator | cstart_at (vcl_size_t index) const |
| const_iterator | start_at (vcl_size_t index) const |
| | |
| iterator | start_at (vcl_size_t index) |
| | |
Layer of geometric objets.
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 64 of file otbOGRLayerWrapper.h.
| typedef feature_iter<Feature const> otb::ogr::Layer::const_iterator |
Features const iterator.
Definition at line 355 of file otbOGRLayerWrapper.h.
| typedef feature_iter<Feature > otb::ogr::Layer::iterator |
Features iterator.
Definition at line 353 of file otbOGRLayerWrapper.h.
| typedef Layer otb::ogr::Layer::Self |
Definition at line 69 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. |
Definition at line 47 of file otbOGRLayerWrapper.cxx.
| otb::ogr::Layer::Layer | ( | OGRLayer * | layer, |
| OGRDataSource & | sourceInChargeOfLifeTime, | ||
| bool | modifiable | ||
| ) |
Init constructor for layers that need to be released.
| layer | OGRLayer owned by the client code. |
| sourceInChargeOfLifeTime | reference to the actual OGRDataSource 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 |
Definition at line 56 of file otbOGRLayerWrapper.cxx.
| 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 existance that were obtained or created with the previous layer definition. | itk::ExceptionObject | if the new field cannot be modified |
OGRLayer::AlterFieldDefn() otb::ogr::FieldDefn Definition at line 339 of file otbOGRLayerWrapper.cxx.
References otb::ogr::FieldDefn::ogr().
|
inline |
Returns a single-pass iterator to the start of the sequence.
feature_iter Definition at line 365 of file otbOGRLayerWrapper.h.
References cbegin().
Referenced by otb::PersistentImageToOGRLayerFilter< TImage >::GenerateData(), otb::PersistentImageToOGRDataFilter< TImage >::GenerateData(), main(), otb::TransformationFunctorDispatcher< TransformationFunctor, OGRGeometry, FieldTransformationPolicy >::operator()(), and otb::PersistentImageToOGRLayerSegmentationFilter< TImageType, TSegmentationFilter >::ProcessTile().
| otb::ogr::Layer::iterator otb::ogr::Layer::begin | ( | ) |
Returns a single-pass iterator to the start of the sequence.
feature_iter Definition at line 80 of file otbOGRLayerWrapper.cxx.
| otb::ogr::Layer::const_iterator otb::ogr::Layer::cbegin | ( | ) | const |
Returns a single-pass iterator to the start of the sequence.
feature_iter Definition at line 87 of file otbOGRLayerWrapper.cxx.
Referenced by begin().
|
inline |
Returns the end iterator of the sequence.
Definition at line 363 of file otbOGRLayerWrapper.h.
Referenced by end().
| 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() Definition at line 108 of file otbOGRLayerWrapper.cxx.
References otb::ogr::Feature::ogr().
Referenced by otb::PersistentImageToOGRDataFilter< TImage >::GenerateData(), main(), and otb::TransformationFunctorDispatcher< TransformationFunctor, OGRGeometry, FieldTransformationPolicy >::operator()().
| 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 existance 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 Definition at line 297 of file otbOGRLayerWrapper.cxx.
References otb::ogr::FieldDefn::ogr().
Referenced by otb::FieldCopyTransformation::DefineFields(), otb::LabelImageToVectorDataFilter< TInputImage, TPrecision >::GenerateData(), otb::LabelImageToOGRDataSourceFilter< TInputImage >::GenerateData(), and prepareNewFields().
| otb::ogr::Layer::const_iterator otb::ogr::Layer::cstart_at | ( | vcl_size_t | 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). Definition at line 101 of file otbOGRLayerWrapper.cxx.
Referenced by start_at().
| 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() Definition at line 126 of file otbOGRLayerWrapper.cxx.
Referenced by otb::PersistentImageToOGRLayerSegmentationFilter< TImageType, TSegmentationFilter >::ProcessTile().
| void otb::ogr::Layer::DeleteField | ( | vcl_size_t | fieldIndex | ) |
Deletes a field.
| [in] | fieldIndex | index of the field to remove. |
Feature in existance that were obtained or created with the previous layer definition. | itk::ExceptionObject | if the new field cannot be deleted |
OGRLayer::DeleteField() Definition at line 316 of file otbOGRLayerWrapper.cxx.
|
inline |
Returns the end iterator of the sequence.
Definition at line 367 of file otbOGRLayerWrapper.h.
References cend().
Referenced by otb::PersistentImageToOGRLayerFilter< TImage >::GenerateData(), otb::PersistentImageToOGRDataFilter< TImage >::GenerateData(), main(), otb::TransformationFunctorDispatcher< TransformationFunctor, OGRGeometry, FieldTransformationPolicy >::operator()(), and otb::PersistentImageToOGRLayerSegmentationFilter< TImageType, TSegmentationFilter >::ProcessTile().
|
inline |
Returns the end iterator of the sequence.
Definition at line 371 of file otbOGRLayerWrapper.h.
| 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. |
Definition at line 186 of file otbOGRLayerWrapper.cxx.
| 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. |
Definition at line 199 of file otbOGRLayerWrapper.cxx.
| otb::ogr::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() Definition at line 144 of file otbOGRLayerWrapper.cxx.
| int otb::ogr::Layer::GetFeatureCount | ( | bool | doForceComputation | ) | const |
Returns the number of elements in the layer.
| [in] | doForceCompuation | indicates whether the size shall be computed even so it's expensive to do so. |
| None |
OGRLayer::GetFeatureCount() Definition at line 67 of file otbOGRLayerWrapper.cxx.
Referenced by otb::TransformationFunctorDispatcher< TransformationFunctor, OGRGeometry, FieldTransformationPolicy >::operator()().
| OGRwkbGeometryType otb::ogr::Layer::GetGeomType | ( | ) | const |
Returns the type of the geometry stored.
OGRLayer::GetGeomType() Definition at line 428 of file otbOGRLayerWrapper.cxx.
Referenced by otb::GeometriesToGeometriesFilter::DoDefineNewLayerGeometryType(), and main().
| OGRFeatureDefn & otb::ogr::Layer::GetLayerDefn | ( | ) | const |
Returns a reference to the layer definition.
*Field functions instead. Definition at line 291 of file otbOGRLayerWrapper.cxx.
Referenced by otb::FieldCopyTransformation::DefineFields(), otb::LabelImageToVectorDataFilter< TInputImage, TPrecision >::GenerateData(), otb::PersistentImageToOGRDataFilter< TImage >::GenerateData(), otb::FieldCopyTransformation::getDefinition(), main(), and otb::TransformationFunctorDispatcher< TransformationFunctor, OGRGeometry, FieldTransformationPolicy >::operator()().
| std::string otb::ogr::Layer::GetName | ( | ) | const |
Returns the name given to the layer, if any.
Definition at line 176 of file otbOGRLayerWrapper.cxx.
Referenced by otb::ogr::DataSource::CopyLayer(), otb::ogr::DataSource::GetLayerIDUnchecked(), and otb::internal::ProcessVisitor::operator()().
|
inline |
Definition at line 70 of file otbOGRLayerWrapper.h.
|
private |
Internal encapsulation of OGRLayer::GetNextFeature().
OGRFeature of the layer, encapsulated in a Feature. | None |
Definition at line 73 of file otbOGRLayerWrapper.cxx.
Referenced by otb::ogr::Layer::feature_iter< Value >::increment().
| std::string otb::ogr::Layer::GetProjectionRef | ( | void | ) | const |
Returns the projection ref associated with the layer.
Definition at line 263 of file otbOGRLayerWrapper.cxx.
Referenced by otb::GeometriesProjectionFilter::DoProcessLayer().
| 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() Definition at line 236 of file otbOGRLayerWrapper.cxx.
| OGRSpatialReference const * otb::ogr::Layer::GetSpatialRef | ( | ) | const |
Spatial Reference property.
Definition at line 257 of file otbOGRLayerWrapper.cxx.
Referenced by otb::PersistentImageToOGRLayerFilter< TImage >::GenerateData().
| 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. Definition at line 208 of file otbOGRLayerWrapper.cxx.
Referenced by otb::ogr::DataSource::CopyLayer(), 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 220 of file otbOGRLayerWrapper.h.
References otb::ogr::Layer::boolean::i, and m_Layer.
| void otb::ogr::Layer::PrintSelf | ( | std::ostream & | os, |
| itk::Indent | indent | ||
| ) | const |
Prints self into stream.
Definition at line 214 of file otbOGRLayerWrapper.cxx.
References itk::Indent::GetNextIndent(), and otb::ogr::Feature::PrintSelf().
Referenced by main(), otb::ogr::internal::Printer::operator()(), and otb::ogr::DataSource::PrintSelf().
| 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 existance that were obtained or created with the previous layer definition. | itk::ExceptionObject | if the new field cannot be modified |
OGRLayer::ReorderField() Definition at line 366 of file otbOGRLayerWrapper.cxx.
| 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 existance that were obtained or created with the previous layer definition. | itk::ExceptionObject | if the new field cannot be modified |
OGRLayer::ReorderFields() Definition at line 389 of file otbOGRLayerWrapper.cxx.
| 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. Definition at line 155 of file otbOGRLayerWrapper.cxx.
References otb::ogr::Feature::ogr().
Referenced by 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() Definition at line 412 of file otbOGRLayerWrapper.cxx.
| 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() Definition at line 243 of file otbOGRLayerWrapper.cxx.
| 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() Definition at line 250 of file otbOGRLayerWrapper.cxx.
|
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 380 of file otbOGRLayerWrapper.h.
References cstart_at().
Referenced by otb::TransformationFunctorDispatcher< TransformationFunctor, OGRGeometry, FieldTransformationPolicy >::operator()().
| otb::ogr::Layer::iterator otb::ogr::Layer::start_at | ( | vcl_size_t | 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). Definition at line 94 of file otbOGRLayerWrapper.cxx.
|
friend |
Features iterator.
Definition at line 351 of file otbOGRLayerWrapper.h.
|
private |
Data implementation.
Definition at line 517 of file otbOGRLayerWrapper.h.
Referenced by operator int boolean::*(), and otb::ogr::operator==().
|
private |
Definition at line 519 of file otbOGRLayerWrapper.h.