All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
openfluid::landr::VectorDataset Class Reference

Interface for managing Vector Data format. More...

#include <landr/VectorDataset.hpp>

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

Public Member Functions

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

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.
openfluid::landr::VectorDataset::VectorDataset ( openfluid::core::GeoVectorValue Value)

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.
openfluid::landr::VectorDataset::VectorDataset ( const VectorDataset Other)

Copy constructor.

Exceptions
openfluid::base::OFExceptionif fails.
openfluid::landr::VectorDataset::~VectorDataset ( )

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.
OGRDataSource* openfluid::landr::VectorDataset::getDataSource ( )

Returns the OGRDataSource associated to this VectorDataset.

OGRDataSource* openfluid::landr::VectorDataset::getDataSource ( ) const

Returns the const OGRDataSource associated to this VectorDataset.

FeaturesList_t openfluid::landr::VectorDataset::getFeatures ( unsigned int  LayerIndex = 0)

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::isPointType ( unsigned int  LayerIndex = 0)

Returns true if the VectorDataset is point type.

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