All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions
openfluid::landr::VectorDataset Class Reference

Interface for managing Vector Data format. More...

#include <landr/VectorDataset.hpp>

List of all members.

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.

Public Member Functions

 VectorDataset (const std::string &FileName)
 Creates a new empty OGRDatasource in the openfluid temp directory, with filename suffixes with timestamp.
 VectorDataset (openfluid::core::GeoVectorValue &Value)
 Creates in the openfluid temp directory a copy of Value OGRDatasource, using Value filename suffixed with timestamp as filename.
 VectorDataset (const VectorDataset &Other)
 Copy constructor.
 ~VectorDataset ()
 Delete the OGRDatasource and relative files in openfluid temp directory.
OGRDataSource * getDataSource ()
 Returns the OGRDataSource associated to this VectorDataset.
OGRDataSource * getDataSource () const
 Returns the const OGRDataSource associated to this VectorDataset.
void copyToDisk (const std::string &FilePath, const std::string &FileName, bool ReplaceIfExists)
 Write to disk a copy of the OGRDataSource.
void addALayer (std::string LayerName="", OGRwkbGeometryType LayerType=wkbUnknown, OGRSpatialReference *SpatialRef=NULL)
 Add to DataSource an empty new layer.
OGRLayer * getLayer (unsigned int LayerIndex=0)
 Get a layer of the shape.
OGRFeatureDefn * getLayerDef (unsigned int LayerIndex=0)
 Get the Feature definition of a layer.
void addAField (const std::string &FieldName, OGRFieldType FieldType=OFTString, unsigned int LayerIndex=0)
 Add a field to a layer.
bool isLineType (unsigned int LayerIndex=0)
 Returns true if the VectorDataset is line type.
bool isPolygonType (unsigned int LayerIndex=0)
 Returns true if the VectorDataset is polygon type.
bool containsField (const std::string &FieldName, unsigned int LayerIndex=0)
 Returns true if a field exists in the LayerIndex layer.
int getFieldIndex (const std::string &FieldName, unsigned int LayerIndex=0)
 Get the index of a field in the LayerIndex layer.
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.
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.
FeaturesList_t getFeatures (unsigned int LayerIndex=0)
 Gets the list of all features of a layer of this GeoVectorValue.
geos::geom::Geometry * getGeometries (unsigned int LayerIndex=0)
 Gets a geos::geom::Geometry representing a collection of all the geometries of the layer LayerIndex of this GeoVectorValue.

Detailed Description

Interface for managing Vector Data format.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

openfluid::landr::VectorDataset::VectorDataset ( const std::string &  FileName)

Creates a new empty OGRDatasource in the openfluid temp directory, with filename suffixes with timestamp.

Parameters:
FileNameThe name of the file to create.
Exceptions:
openfluid::base::OFExceptionif fails.

Creates in the openfluid temp directory a copy of Value OGRDatasource, using Value filename suffixed with timestamp as filename.

Parameters:
ValueThe GeoVectorValue to copy
Exceptions:
openfluid::base::OFExceptionif fails.

Copy constructor.

Exceptions:
openfluid::base::OFExceptionif fails.

Delete the OGRDatasource and relative files in openfluid temp directory.


Member Function Documentation

void openfluid::landr::VectorDataset::addAField ( const std::string &  FieldName,
OGRFieldType  FieldType = OFTString,
unsigned int  LayerIndex = 0 
)

Add a field to a layer.

Parameters:
FieldNameThe name of the field to add.
FieldTypeThe type of the field to add (default OFTString).
LayerIndexThe index of the layer to add the field, default 0.
Exceptions:
openfluid::base::OFExceptionif creating field failed.
void openfluid::landr::VectorDataset::addALayer ( std::string  LayerName = "",
OGRwkbGeometryType  LayerType = wkbUnknown,
OGRSpatialReference *  SpatialRef = NULL 
)

Add to DataSource an empty new layer.

Parameters:
LayerNameThe name of the layer to create.
LayerTypeThe type of the layer to create, default wkbUnknown.
SpatialRefThe coordinate system to use for the new layer, or NULL (default) if no coordinate system is available.
Exceptions:
openfluid::base::OFExceptionif the creation of layer failed.
bool openfluid::landr::VectorDataset::containsField ( const 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.
void openfluid::landr::VectorDataset::copyToDisk ( const std::string &  FilePath,
const std::string &  FileName,
bool  ReplaceIfExists 
)

Write to disk a copy of the OGRDataSource.

Parameters:
FilePathThe path to the directory where writing, will be created if needed.
FileNameThe name of the file to write.
ReplaceIfExistsIf true and the file FilePath/FileName already exists, overwrite it.

Returns the OGRDataSource associated to this VectorDataset.

Returns the const OGRDataSource associated to this VectorDataset.

Gets the list of all features of a layer of this GeoVectorValue.

Parameters:
LayerIndexThe index of the layer to query, default 0.
Returns:
A list of OGRFeature and geos::geom::Geometry of this VectorDataset.
int openfluid::landr::VectorDataset::getFieldIndex ( const std::string &  FieldName,
unsigned int  LayerIndex = 0 
)

Get 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.
geos::geom::Geometry* openfluid::landr::VectorDataset::getGeometries ( unsigned int  LayerIndex = 0)

Gets a geos::geom::Geometry representing a collection of all the geometries of the layer LayerIndex of this GeoVectorValue.

Parameters:
LayerIndexThe index of the layer to query, default 0.
Returns:
A geos::geom::Geometry.
OGRLayer* openfluid::landr::VectorDataset::getLayer ( unsigned int  LayerIndex = 0)

Get a layer of the shape.

Parameters:
LayerIndexThe index of the asked layer, default 0.
Returns:
The layer indexed LayerIndex.
OGRFeatureDefn* openfluid::landr::VectorDataset::getLayerDef ( unsigned int  LayerIndex = 0)

Get 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.
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.

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.
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.

Parameters:
FieldNameThe name of the field to query.
ValueThe value to query.
LayerIndexThe index of the layer to query, default 0.
Returns:
True if the field has at least a feature containing the value Value, False otherwise.
bool openfluid::landr::VectorDataset::isLineType ( unsigned int  LayerIndex = 0)

Returns true if the VectorDataset is line type.

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.
bool openfluid::landr::VectorDataset::isPolygonType ( unsigned int  LayerIndex = 0)

Returns true if the VectorDataset is polygon type.

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.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines