![]() |
#include <core/GeoVectorValue.hpp>
Public Member Functions | |
GeoVectorValue (const std::string &FilePath, const std::string &FileName) | |
~GeoVectorValue () | |
openfluid::core::UnstructuredValue::UnstructuredType | getType () const |
OGRDataSource * | data () |
OGRLayer * | layer (unsigned int LayerIndex=0) |
OGRFeatureDefn * | layerDef (unsigned int LayerIndex=0) |
bool | isLineType (unsigned int LayerIndex=0) |
bool | isPolygonType (unsigned int LayerIndex=0) |
bool | containsField (const std::string &FieldName, unsigned int LayerIndex=0) |
int | getFieldIndex (const std::string &FieldName, unsigned int LayerIndex=0) |
bool | isFieldOfType (const std::string &FieldName, OGRFieldType FieldType, unsigned int LayerIndex=0) |
bool | isPointType (unsigned int LayerIndex=0) |
bool | isMultiPolygonType (unsigned int LayerIndex=0) |
bool | isMultiLineType (unsigned int LayerIndex=0) |
bool | isMultiPointType (unsigned int LayerIndex=0) |
![]() | |
GeoValue (const std::string &FilePath, const std::string &FileName) | |
virtual | ~GeoValue ()=0 |
std::string | getFilePath () |
![]() | |
UnstructuredValue () | |
virtual | ~UnstructuredValue () |
Protected Member Functions | |
void | tryToOpenSource () |
void | destroyDataSource () |
Protected Attributes | |
OGRDataSource * | mp_Data |
![]() | |
std::string | m_FilePath |
std::string | m_FileName |
std::string | m_AbsolutePath |
Additional Inherited Members | |
![]() | |
enum | UnstructuredType { GeoVectorValue, GeoRasterValue } |
![]() | |
static std::string | computeAbsolutePath (const std::string &FilePath, const std::string &FileName) |
![]() | |
static bool | getValueTypeFromString (const std::string &ValueTypeString, UnstructuredValue::UnstructuredType &ValueType) |
static std::string | getStringFromValueType (const UnstructuredValue::UnstructuredType ValueType) |
Container class for geospatial vector data, represented by an OGR datasource.
openfluid::core::GeoVectorValue::GeoVectorValue | ( | const std::string & | FilePath, |
const 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.
[in] | FilePath | The path of the file(s). |
[in] | FileName | The name or the relative path of the file to open. |
openfluid::core::GeoVectorValue::~GeoVectorValue | ( | ) |
Destructor. Closes the open OGR datasource.
bool openfluid::core::GeoVectorValue::containsField | ( | const std::string & | FieldName, |
unsigned int | LayerIndex = 0 |
||
) |
Returns true if a field exists in the LayerIndex layer.
[in] | FieldName | The name of the field to query. |
[in] | LayerIndex | The index of the layer to query, default 0. |
openfluid::base::FrameworkException | if OGR doesn't succeed to open the datasource. |
OGRDataSource* openfluid::core::GeoVectorValue::data | ( | ) |
Gets the associated opened OGR datasource in read-only access. If the datasource is not already opened, tries to open it first.
openfluid::base::FrameworkException | if OGR doesn't succeed to open the datasource. |
|
protected |
Destroy the OGRDataSource.
int openfluid::core::GeoVectorValue::getFieldIndex | ( | const std::string & | FieldName, |
unsigned int | LayerIndex = 0 |
||
) |
Gets the index of a field in the LayerIndex layer.
[in] | LayerIndex | The index of the layer to query, default 0. |
[in] | FieldName | The name of the field to query. |
openfluid::base::FrameworkException | if OGR doesn't succeed to open the datasource. |
|
virtual |
Returns the type of this GeoVectorValue.
Implements openfluid::core::UnstructuredValue.
bool openfluid::core::GeoVectorValue::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.
[in] | FieldName | The name of the field to query. |
[in] | FieldType | The type of the field to query. |
[in] | LayerIndex | The index of the layer to query, default 0. |
openfluid::base::FrameworkException | if the field doesn't exist. |
openfluid::base::FrameworkException | 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.
[in] | LayerIndex | The index of the layer to compare the type, default 0. |
openfluid::base::FrameworkException | if OGR doesn't succeed to open the datasource. |
bool openfluid::core::GeoVectorValue::isMultiLineType | ( | unsigned int | LayerIndex = 0 | ) |
Returns true if the GeoVectorValue is MultiLine type, false otherwise.
[in] | LayerIndex | The index of the layer to compare the type, default 0. |
openfluid::base::FrameworkException | if OGR doesn't succeed to open the datasource. |
bool openfluid::core::GeoVectorValue::isMultiPointType | ( | unsigned int | LayerIndex = 0 | ) |
Returns true if the GeoVectorValue is MultiPoint type, false otherwise.
[in] | LayerIndex | The index of the layer to compare the type, default 0. |
openfluid::base::FrameworkException | if OGR doesn't succeed to open the datasource. |
bool openfluid::core::GeoVectorValue::isMultiPolygonType | ( | unsigned int | LayerIndex = 0 | ) |
Returns true if the GeoVectorValue is MultiPolygon type, false otherwise.
[in] | LayerIndex | The index of the layer to compare the type, default 0. |
openfluid::base::FrameworkException | if OGR doesn't succeed to open the datasource. |
bool openfluid::core::GeoVectorValue::isPointType | ( | unsigned int | LayerIndex = 0 | ) |
Returns true if the GeoVectorValue is point type, false otherwise.
[in] | LayerIndex | The index of the layer to compare the type, default 0. |
openfluid::base::FrameworkException | 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.
[in] | LayerIndex | The index of the layer to compare the type, default 0. |
openfluid::base::FrameworkException | if OGR doesn't succeed to open the datasource. |
OGRLayer* openfluid::core::GeoVectorValue::layer | ( | unsigned int | LayerIndex = 0 | ) |
Gets a layer of the shape.
[in] | LayerIndex | The index of the asked layer, default 0. |
openfluid::base::FrameworkException | if OGR doesn't succeed to open the datasource. |
OGRFeatureDefn* openfluid::core::GeoVectorValue::layerDef | ( | unsigned int | LayerIndex = 0 | ) |
Gets the Feature definition of a layer.
[in] | LayerIndex | The index of the asked layer definition, default 0. |
openfluid::base::FrameworkException | if OGR doesn't succeed to open the datasource. |
|
protectedvirtual |
Open the OGRDataSource of this GeoVectorValue.
openfluid::base::FrameworkException | if OGR doesn't succeed to open the datasource. |
Implements openfluid::core::GeoValue.
|
protected |
The OGRDataSource associated to this GeoVectorValue.