Container class for geospatial vector data, represented by an OGR datasource. More...
#include <core/GeoVectorValue.hpp>
Public Member Functions | |
GeoVectorValue (std::string FilePath, std::string FileName) | |
Creates a new value. | |
~GeoVectorValue () | |
Closes the opened OGR datasource. | |
openfluid::core::UnstructuredValue::UnstructuredType | getType () const |
Returns the type of this GeoVectorValue. | |
OGRDataSource * | get () |
Gets the associated opened OGR datasource in read-only access. | |
OGRLayer * | getLayer (unsigned int LayerIndex=0) |
Gets a layer of the shape. | |
OGRFeatureDefn * | getLayerDef (unsigned int LayerIndex=0) |
Gets the Feature definition of a layer. | |
bool | isLineType (unsigned int LayerIndex=0) |
Returns true if the GeoVectorValue is line type, false otherwise. | |
bool | isPolygonType (unsigned int LayerIndex=0) |
Returns true if the GeoVectorValue is polygon type, false otherwise. | |
bool | containsField (std::string FieldName, unsigned int LayerIndex=0) |
Returns true if a field exists in the LayerIndex layer. | |
int | getFieldIndex (std::string FieldName, unsigned int LayerIndex=0) |
Gets the index of a field in the LayerIndex layer. | |
bool | isFieldOfType (std::string FieldName, OGRFieldType FieldType, unsigned int LayerIndex=0) |
Returns true if a field is of the type FieldType in the LayerIndex layer. | |
Protected Member Functions | |
void | tryToOpenSource () |
Open the OGRDataSource of this GeoVectorValue. | |
void | destroyDataSource () |
Destroy the OGRDataSource. | |
Protected Attributes | |
OGRDataSource * | mp_Data |
The OGRDataSource associated to this GeoVectorValue. |
Container class for geospatial vector data, represented by an OGR datasource.
openfluid::core::GeoVectorValue::GeoVectorValue | ( | std::string | FilePath, |
std::string | FileName | ||
) |
Creates a new value.
For ESRI Shapefile, the FileName
may be the name of a .shp, .shx or .dbf file, or a path to a directory containing proper shape files.
It doesn't open the associated OGR datasource.
FilePath | The path of the file(s). |
FileName | The name or the relative path of the file to open. |
Closes the opened OGR datasource.
bool openfluid::core::GeoVectorValue::containsField | ( | 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. |
openfluid::base::OFException | if OGR doesn't succeed to open the datasource. |
void openfluid::core::GeoVectorValue::destroyDataSource | ( | ) | [protected] |
Destroy the OGRDataSource.
OGRDataSource* openfluid::core::GeoVectorValue::get | ( | ) |
Gets the associated opened OGR datasource in read-only access.
If the datasource is not already opened, tries to open it first.
openfluid::base::OFException | if OGR doesn't succeed to open the datasource. |
int openfluid::core::GeoVectorValue::getFieldIndex | ( | std::string | FieldName, |
unsigned int | LayerIndex = 0 |
||
) |
Gets 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. |
openfluid::base::OFException | if OGR doesn't succeed to open the datasource. |
OGRLayer* openfluid::core::GeoVectorValue::getLayer | ( | unsigned int | LayerIndex = 0 | ) |
Gets a layer of the shape.
LayerIndex | The index of the asked layer, default 0. |
openfluid::base::OFException | if OGR doesn't succeed to open the datasource. |
OGRFeatureDefn* openfluid::core::GeoVectorValue::getLayerDef | ( | unsigned int | LayerIndex = 0 | ) |
Gets the Feature definition of a layer.
LayerIndex | The index of the asked layer definition, default 0. |
openfluid::base::OFException | if OGR doesn't succeed to open the datasource. |
openfluid::core::UnstructuredValue::UnstructuredType openfluid::core::GeoVectorValue::getType | ( | ) | const [virtual] |
Returns the type of this GeoVectorValue.
Implements openfluid::core::UnstructuredValue.
bool openfluid::core::GeoVectorValue::isFieldOfType | ( | 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::OFException | if the field doesn't exist. |
openfluid::base::OFException | if OGR doesn't succeed to open the datasource. |
bool openfluid::core::GeoVectorValue::isLineType | ( | unsigned int | LayerIndex = 0 | ) |
Returns true if the GeoVectorValue is line type, false otherwise.
LayerIndex | The index of the layer to compare the type, default 0. |
openfluid::base::OFException | if OGR doesn't succeed to open the datasource. |
bool openfluid::core::GeoVectorValue::isPolygonType | ( | unsigned int | LayerIndex = 0 | ) |
Returns true if the GeoVectorValue is polygon type, false otherwise.
LayerIndex | The index of the layer to compare the type, default 0. |
openfluid::base::OFException | if OGR doesn't succeed to open the datasource. |
void openfluid::core::GeoVectorValue::tryToOpenSource | ( | ) | [protected, virtual] |
Open the OGRDataSource of this GeoVectorValue.
openfluid::base::OFException | if OGR doesn't succeed to open the datasource. |
Implements openfluid::core::GeoValue.
OGRDataSource* openfluid::core::GeoVectorValue::mp_Data [protected] |
The OGRDataSource associated to this GeoVectorValue.