![]() |
Interface for managing Vector Data format. More...
#include <landr/VectorDataset.hpp>
Public Types | |
typedef std::list< std::pair < OGRFeature *, geos::geom::Geometry * > > | FeaturesList_t |
A list of pair of OGRFeature and geos::geom::Geometry related to this VectorDataset entities. More... | |
Public Member Functions | |
VectorDataset (const std::string &FileName) | |
Creates a new empty OGRDatasource in the openfluid temp directory, with filename suffixes with timestamp. More... | |
VectorDataset (openfluid::core::GeoVectorValue &Value) | |
Creates in the openfluid temp directory a copy of Value OGRDatasource, using Value filename suffixed with timestamp as filename. More... | |
VectorDataset (const VectorDataset &Other) | |
Copy constructor. More... | |
~VectorDataset () | |
Delete the OGRDatasource and relative files in openfluid temp directory. More... | |
OGRDataSource * | source () |
Returns the OGRDataSource associated to this VectorDataset. More... | |
OGRDataSource * | source () const |
Returns the const OGRDataSource associated to this VectorDataset. More... | |
void | copyToDisk (const std::string &FilePath, const std::string &FileName, bool ReplaceIfExists) |
Write to disk a copy of the OGRDataSource. More... | |
void | addALayer (std::string LayerName="", OGRwkbGeometryType LayerType=wkbUnknown, OGRSpatialReference *SpatialRef=nullptr) |
Add to DataSource an empty new layer. More... | |
OGRLayer * | layer (unsigned int LayerIndex=0) |
Get a layer of the shape. More... | |
OGRFeatureDefn * | layerDef (unsigned int LayerIndex=0) |
Get the Feature definition of a layer. More... | |
void | addAField (const std::string &FieldName, OGRFieldType FieldType=OFTString, unsigned int LayerIndex=0) |
Add a field to a layer. More... | |
bool | isLineType (unsigned int LayerIndex=0) |
Returns true if the VectorDataset is line type. More... | |
bool | isPolygonType (unsigned int LayerIndex=0) |
Returns true if the VectorDataset is polygon type. More... | |
bool | containsField (const std::string &FieldName, unsigned int LayerIndex=0) |
Returns true if a field exists in the LayerIndex layer. More... | |
int | getFieldIndex (const std::string &FieldName, unsigned int LayerIndex=0) |
Get the index of a field in the LayerIndex layer. More... | |
bool | isFieldOfType (const std::string &FieldName, OGRFieldType FieldType, unsigned int LayerIndex=0) |
Returns true if a field is of the type FieldType in the LayerIndex layer. More... | |
bool | isIntValueSet (const std::string &FieldName, int Value, unsigned int LayerIndex=0) |
Returns true if a field has the value Value in the LayerIndex layer. More... | |
FeaturesList_t | features (unsigned int LayerIndex=0) |
Gets the list of all features of a layer of this GeoVectorValue. More... | |
geos::geom::Geometry * | geometries (unsigned int LayerIndex=0) |
Gets a geos::geom::Geometry representing a collection of all the geometries of the layer LayerIndex of this GeoVectorValue. More... | |
bool | isPointType (unsigned int LayerIndex=0) |
Returns true if the VectorDataset is point type. More... | |
void | setIndexIntField (const std::string &FieldName, int BeginValue=1, unsigned int LayerIndex=0) |
Sets an integer Field with an index list (increment value one by one) More... | |
OGREnvelope | envelope () |
Returns the OGREnvelope associated to this VectorDataset. More... | |
void | snapVertices (double Threshold, unsigned int LayerIndex=0) |
Snap the vertices of this VectorDataset. Only for Polygon or Line Type;. More... | |
std::string | checkTopology (double Threshold, unsigned int LayerIndex=0) |
Check the topology of this VectorDataset. Only for Polygon Type. More... | |
std::list< std::pair < OGRFeature *, OGRFeature * > > | findOverlap (unsigned int LayerIndex=0) |
Find the overlapping polygons. Only for Polygon Type;. More... | |
std::list< std::pair < OGRFeature *, OGRFeature * > > | findGap (double Threshold, unsigned int LayerIndex=0) |
Find gap between polygons. Only for Polygon Type;. More... | |
void | cleanOverlap (double Threshold, unsigned int LayerIndex=0) |
Clean the overlapping polygons. Only for Polygon Type;. More... | |
std::list< OGRFeature * > | hasDuplicateGeometry (unsigned int LayerIndex=0) |
Identify the duplicate geometry of this VectorDataset. More... | |
Interface for managing Vector Data format.
typedef std::list<std::pair<OGRFeature*, geos::geom::Geometry*> > openfluid::landr::VectorDataset::FeaturesList_t |
A list of pair of OGRFeature and geos::geom::Geometry related to this VectorDataset entities.
openfluid::landr::VectorDataset::VectorDataset | ( | const std::string & | FileName | ) |
Creates a new empty OGRDatasource in the openfluid temp directory, with filename suffixes with timestamp.
FileName | The name of the file to create. |
openfluid::base::FrameworkException | if fails. |
openfluid::landr::VectorDataset::VectorDataset | ( | openfluid::core::GeoVectorValue & | Value | ) |
Creates in the openfluid temp directory a copy of Value OGRDatasource, using Value filename suffixed with timestamp as filename.
Value | The GeoVectorValue to copy |
openfluid::base::FrameworkException | if fails. |
openfluid::landr::VectorDataset::VectorDataset | ( | const VectorDataset & | Other | ) |
Copy constructor.
openfluid::base::FrameworkException | if fails. |
openfluid::landr::VectorDataset::~VectorDataset | ( | ) |
Delete the OGRDatasource and relative files in openfluid temp directory.
void openfluid::landr::VectorDataset::addAField | ( | const std::string & | FieldName, |
OGRFieldType | FieldType = OFTString , |
||
unsigned int | LayerIndex = 0 |
||
) |
Add a field to a layer.
FieldName | The name of the field to add. |
FieldType | The type of the field to add (default OFTString). |
LayerIndex | The index of the layer to add the field, default 0. |
openfluid::base::FrameworkException | if creating field failed. |
void openfluid::landr::VectorDataset::addALayer | ( | std::string | LayerName = "" , |
OGRwkbGeometryType | LayerType = wkbUnknown , |
||
OGRSpatialReference * | SpatialRef = nullptr |
||
) |
Add to DataSource an empty new layer.
LayerName | The name of the layer to create. |
LayerType | The type of the layer to create, default wkbUnknown. |
SpatialRef | The coordinate system to use for the new layer, or nullptr (default) if no coordinate system is available. |
openfluid::base::FrameworkException | if the creation of layer failed. |
std::string openfluid::landr::VectorDataset::checkTopology | ( | double | Threshold, |
unsigned int | LayerIndex = 0 |
||
) |
Check the topology of this VectorDataset. Only for Polygon Type.
Threshold | The maximum distance between polygon to be considered as gap. |
LayerIndex | The index of the layer to query, default 0. |
void openfluid::landr::VectorDataset::cleanOverlap | ( | double | Threshold, |
unsigned int | LayerIndex = 0 |
||
) |
Clean the overlapping polygons. Only for Polygon Type;.
Threshold | The snapping threshold value. |
LayerIndex | The index of the layer to query, default 0. |
bool openfluid::landr::VectorDataset::containsField | ( | const std::string & | FieldName, |
unsigned int | LayerIndex = 0 |
||
) |
Returns true if a field exists in the LayerIndex layer.
FieldName | The name of the field to query. |
LayerIndex | The index of the layer to query, default 0. |
void openfluid::landr::VectorDataset::copyToDisk | ( | const std::string & | FilePath, |
const std::string & | FileName, | ||
bool | ReplaceIfExists | ||
) |
Write to disk a copy of the OGRDataSource.
FilePath | The path to the directory where writing, will be created if needed. |
FileName | The name of the file to write. |
ReplaceIfExists | If true and the file FilePath/FileName already exists, overwrite it. |
OGREnvelope openfluid::landr::VectorDataset::envelope | ( | ) |
Returns the OGREnvelope associated to this VectorDataset.
FeaturesList_t openfluid::landr::VectorDataset::features | ( | unsigned int | LayerIndex = 0 | ) |
Gets the list of all features of a layer of this GeoVectorValue.
LayerIndex | The index of the layer to query, default 0. |
std::list<std::pair<OGRFeature*, OGRFeature*> > openfluid::landr::VectorDataset::findGap | ( | double | Threshold, |
unsigned int | LayerIndex = 0 |
||
) |
Find gap between polygons. Only for Polygon Type;.
Threshold | The maximum distance between polygon to be considered as gap. |
LayerIndex | The index of the layer to query, default 0. |
std::list<std::pair<OGRFeature*, OGRFeature*> > openfluid::landr::VectorDataset::findOverlap | ( | unsigned int | LayerIndex = 0 | ) |
Find the overlapping polygons. Only for Polygon Type;.
LayerIndex | The index of the layer to query, default 0. |
geos::geom::Geometry* openfluid::landr::VectorDataset::geometries | ( | unsigned int | LayerIndex = 0 | ) |
Gets a geos::geom::Geometry representing a collection of all the geometries of the layer LayerIndex of this GeoVectorValue.
LayerIndex | The index of the layer to query, default 0. |
int openfluid::landr::VectorDataset::getFieldIndex | ( | const std::string & | FieldName, |
unsigned int | LayerIndex = 0 |
||
) |
Get the index of a field in the LayerIndex layer.
LayerIndex | The index of the layer to query, default 0. |
FieldName | The name of the field to query. |
std::list<OGRFeature*> openfluid::landr::VectorDataset::hasDuplicateGeometry | ( | unsigned int | LayerIndex = 0 | ) |
Identify the duplicate geometry of this VectorDataset.
LayerIndex | The index of the layer to query, default 0. |
bool openfluid::landr::VectorDataset::isFieldOfType | ( | const std::string & | FieldName, |
OGRFieldType | FieldType, | ||
unsigned int | LayerIndex = 0 |
||
) |
Returns true if a field is of the type FieldType in the LayerIndex layer.
FieldName | The name of the field to query. |
FieldType | The type of the field to query. |
LayerIndex | The index of the layer to query, default 0. |
openfluid::base::FrameworkException | if the field doesn't exist. |
bool openfluid::landr::VectorDataset::isIntValueSet | ( | const std::string & | FieldName, |
int | Value, | ||
unsigned int | LayerIndex = 0 |
||
) |
Returns true if a field has the value Value in the LayerIndex layer.
FieldName | The name of the field to query. |
Value | The value to query. |
LayerIndex | The index of the layer to query, default 0. |
bool openfluid::landr::VectorDataset::isLineType | ( | unsigned int | LayerIndex = 0 | ) |
Returns true if the VectorDataset is line type.
LayerIndex | The index of the layer to compare the type, default 0. |
bool openfluid::landr::VectorDataset::isPointType | ( | unsigned int | LayerIndex = 0 | ) |
Returns true if the VectorDataset is point type.
LayerIndex | The index of the layer to compare the type, default 0. |
bool openfluid::landr::VectorDataset::isPolygonType | ( | unsigned int | LayerIndex = 0 | ) |
Returns true if the VectorDataset is polygon type.
LayerIndex | The index of the layer to compare the type, default 0. |
OGRLayer* openfluid::landr::VectorDataset::layer | ( | unsigned int | LayerIndex = 0 | ) |
Get a layer of the shape.
LayerIndex | The index of the asked layer, default 0. |
OGRFeatureDefn* openfluid::landr::VectorDataset::layerDef | ( | unsigned int | LayerIndex = 0 | ) |
Get the Feature definition of a layer.
LayerIndex | The index of the asked layer definition, default 0. |
void openfluid::landr::VectorDataset::setIndexIntField | ( | const std::string & | FieldName, |
int | BeginValue = 1 , |
||
unsigned int | LayerIndex = 0 |
||
) |
Sets an integer Field with an index list (increment value one by one)
FieldName | The name of the field to query (must exist). |
BeginValue | The begin value, default 1. |
LayerIndex | The index of the layer to query, default 0. |
void openfluid::landr::VectorDataset::snapVertices | ( | double | Threshold, |
unsigned int | LayerIndex = 0 |
||
) |
Snap the vertices of this VectorDataset. Only for Polygon or Line Type;.
Threshold | The snapping threshold value. |
LayerIndex | The index of the layer to query, default 0. |
OGRDataSource* openfluid::landr::VectorDataset::source | ( | ) |
Returns the OGRDataSource associated to this VectorDataset.
OGRDataSource* openfluid::landr::VectorDataset::source | ( | ) | const |
Returns the const OGRDataSource associated to this VectorDataset.