All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Protected Attributes
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

List of all members.

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.

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.

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.

Destroy the OGRDataSource.

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.

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::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 ( ) [protected, virtual]

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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines