All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
openfluid::core::GeoVectorValue Class Reference

Container class for geospatial vector data, represented by an OGR datasource. More...

#include <core/GeoVectorValue.hpp>

Inheritance diagram for openfluid::core::GeoVectorValue:
openfluid::core::GeoValue openfluid::core::UnstructuredValue

Public Member Functions

 GeoVectorValue (std::string FilePath, std::string FileName)
 Creates a new value. More...
 
 ~GeoVectorValue ()
 Closes the opened OGR datasource. More...
 
openfluid::core::UnstructuredValue::UnstructuredType getType () const
 Returns the type of this GeoVectorValue. More...
 
OGRDataSource * get ()
 Gets the associated opened OGR datasource in read-only access. More...
 
OGRLayer * getLayer (unsigned int LayerIndex=0)
 Gets a layer of the shape. More...
 
OGRFeatureDefn * getLayerDef (unsigned int LayerIndex=0)
 Gets the Feature definition of a layer. More...
 
bool isLineType (unsigned int LayerIndex=0)
 Returns true if the GeoVectorValue is line type, false otherwise. More...
 
bool isPolygonType (unsigned int LayerIndex=0)
 Returns true if the GeoVectorValue is polygon type, false otherwise. More...
 
bool containsField (std::string FieldName, unsigned int LayerIndex=0)
 Returns true if a field exists in the LayerIndex layer. More...
 
int getFieldIndex (std::string FieldName, unsigned int LayerIndex=0)
 Gets the index of a field in the LayerIndex layer. More...
 
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. More...
 
bool isPointType (unsigned int LayerIndex=0)
 Returns true if the GeoVectorValue is point type, false otherwise. More...
 
bool isMultiPolygonType (unsigned int LayerIndex=0)
 Returns true if the GeoVectorValue is MultiPolygon type, false otherwise. More...
 
bool isMultiLineType (unsigned int LayerIndex=0)
 Returns true if the GeoVectorValue is MultiLine type, false otherwise. More...
 
bool isMultiPointType (unsigned int LayerIndex=0)
 Returns true if the GeoVectorValue is MultiPoint type, false otherwise. More...
 
- Public Member Functions inherited from openfluid::core::GeoValue
 GeoValue (std::string FilePath, std::string FileName)
 
virtual ~GeoValue ()=0
 
std::string getFilePath ()
 
- Public Member Functions inherited from openfluid::core::UnstructuredValue
 UnstructuredValue ()
 
virtual ~UnstructuredValue ()
 

Protected Member Functions

void tryToOpenSource ()
 Open the OGRDataSource of this GeoVectorValue. More...
 
void destroyDataSource ()
 Destroy the OGRDataSource. More...
 

Protected Attributes

OGRDataSource * mp_Data
 The OGRDataSource associated to this GeoVectorValue. More...
 
- Protected Attributes inherited from openfluid::core::GeoValue
std::string m_FilePath
 
std::string m_FileName
 
std::string m_AbsolutePath
 

Additional Inherited Members

- Public Types inherited from openfluid::core::UnstructuredValue
enum  UnstructuredType { GeoVectorValue, GeoRasterValue }
 
- Static Public Member Functions inherited from openfluid::core::GeoValue
static std::string computeAbsolutePath (std::string FilePath, std::string FileName)
 
- Static Public Member Functions inherited from openfluid::core::UnstructuredValue
static bool getValueTypeFromString (const std::string ValueTypeString, UnstructuredValue::UnstructuredType &ValueType)
 
static std::string getStringFromValueType (const UnstructuredValue::UnstructuredType ValueType)
 

Detailed Description

Container class for geospatial vector data, represented by an OGR datasource.

Constructor & Destructor Documentation

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.

Parameters
FilePathThe path of the file(s).
FileNameThe name or the relative path of the file to open.
openfluid::core::GeoVectorValue::~GeoVectorValue ( )

Closes the opened OGR datasource.

Member Function Documentation

bool openfluid::core::GeoVectorValue::containsField ( std::string  FieldName,
unsigned int  LayerIndex = 0 
)

Returns true if a field exists in the LayerIndex layer.

Parameters
FieldNameThe name of the field to query.
LayerIndexThe index of the layer to query, default 0.
Returns
True if the field FieldName exists, False otherwise.
Exceptions
openfluid::base::OFExceptionif 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.

Returns
The opened OGR datasource.
Exceptions
openfluid::base::OFExceptionif 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.

Parameters
LayerIndexThe index of the layer to query, default 0.
FieldNameThe name of the field to query.
Returns
The index of FieldName or -1 if field FieldName doesn't exist.
Exceptions
openfluid::base::OFExceptionif OGR doesn't succeed to open the datasource.
OGRLayer* openfluid::core::GeoVectorValue::getLayer ( unsigned int  LayerIndex = 0)

Gets a layer of the shape.

Parameters
LayerIndexThe index of the asked layer, default 0.
Returns
The layer indexed LayerIndex.
Exceptions
openfluid::base::OFExceptionif OGR doesn't succeed to open the datasource.
OGRFeatureDefn* openfluid::core::GeoVectorValue::getLayerDef ( unsigned int  LayerIndex = 0)

Gets the Feature definition of a layer.

Parameters
LayerIndexThe index of the asked layer definition, default 0.
Returns
The OGR Feature definition of the LayerIndex layer.
Exceptions
openfluid::base::OFExceptionif 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.

Parameters
FieldNameThe name of the field to query.
FieldTypeThe type of the field to query.
LayerIndexThe index of the layer to query, default 0.
Returns
True if the field FieldName is type FieldType.
Exceptions
openfluid::base::OFExceptionif the field doesn't exist.
openfluid::base::OFExceptionif 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.

Parameters
LayerIndexThe index of the layer to compare the type, default 0.
Returns
True if the type of the layer LayerIndex is wkbLineString, false otherwise.
Exceptions
openfluid::base::OFExceptionif 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.

Parameters
LayerIndexThe index of the layer to compare the type, default 0.
Returns
True if the type of the layer LayerIndex is wkbMultiLineString, false otherwise.
Exceptions
openfluid::base::OFExceptionif 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.

Parameters
LayerIndexThe index of the layer to compare the type, default 0.
Returns
True if the type of the layer LayerIndex is wkbMultiPoint, false otherwise.
Exceptions
openfluid::base::OFExceptionif 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.

Parameters
LayerIndexThe index of the layer to compare the type, default 0.
Returns
True if the type of the layer LayerIndex is wkbMultiPolygon, false otherwise.
Exceptions
openfluid::base::OFExceptionif 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.

Parameters
LayerIndexThe index of the layer to compare the type, default 0.
Returns
True if the type of the layer LayerIndex is wkbPoint, false otherwise.
Exceptions
openfluid::base::OFExceptionif 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.

Parameters
LayerIndexThe index of the layer to compare the type, default 0.
Returns
True if the type of the layer LayerIndex is wkbPolygon, false otherwise.
Exceptions
openfluid::base::OFExceptionif OGR doesn't succeed to open the datasource.
void openfluid::core::GeoVectorValue::tryToOpenSource ( )
protectedvirtual

Open the OGRDataSource of this GeoVectorValue.

Exceptions
openfluid::base::OFExceptionif OGR doesn't succeed to open the datasource.

Implements openfluid::core::GeoValue.

Member Data Documentation

OGRDataSource* openfluid::core::GeoVectorValue::mp_Data
protected

The OGRDataSource associated to this GeoVectorValue.


The documentation for this class was generated from the following file: