Interface for a graph composed of LandREntity. More...
#include <landr/LandRGraph.hpp>
Public Types | |
enum | GraphType { POLYGON, LINESTRING } |
typedef std::list< LandREntity * > | Entities_t |
Public Member Functions | |
virtual | ~LandRGraph () |
virtual GraphType | getType ()=0 |
Returns the type of graph. | |
virtual LandREntity * | getEntity (int OfldId) |
Returns the LandREntity with OfldId, or 0 if it doesn't exist. | |
Entities_t | getEntities () |
Returns a list of the LandREntity of this LandRGraph. | |
Entities_t | getOfldIdOrderedEntities () |
Returns a list of the LandREntity of this LandRGraph and sorted by identifier. | |
std::map< int, LandREntity * > | getEntitiesByOfldId () |
Returns a map of the LandREntity of this LandRGraph and their identifiers. | |
unsigned int | getSize () const |
Gets the number of LandREntity in the LandRGraph. | |
void | removeUnusedNodes () |
Removes from this LandRGraph the nodes of degree 0. | |
void | addAttribute (const std::string &AttributeName) |
Adds an attribute to this LandRGraph. | |
void | removeAttribute (const std::string &AttributeName) |
Removes an attribute to this LandRGraph. | |
std::vector< std::string > | getAttributeNames () |
Returns a vector of the names of the attributes of this LandRGraph. | |
void | addAGeoRasterValue (openfluid::core::GeoRasterValue &Raster) |
Associates a core::GeoRasterValue to this LandRGraph. | |
void | addAGeoRasterValue (const openfluid::landr::RasterDataset &Raster) |
Associates a RasterDataset to this LandRGraph. | |
bool | hasAnAssociatedRaster () |
Returns true if this LandRGraph has an associated raster, false otherwise. | |
openfluid::landr::VectorDataset * | getRasterPolygonized () |
Transforms the associated raster value into an openfluid::landr::VectorDataset of polygons. | |
std::vector < geos::geom::Polygon * > * | getRasterPolygonizedPolys () |
Transforms the associated raster value into a vector of geos::geom::Polygon. | |
virtual float * | getRasterValueForEntityCentroid (const LandREntity &Entity) |
Fetchs the associated raster value corresponding to the LandREntity centroid coordinate. | |
void | setAttributeFromRasterValueAtCentroid (const std::string &AttributeName) |
Creates a new attribute for all the LandREntity of this LandRGraph, and set for each LandREntity this attribute value as the raster value corresponding to the LandREntity centroid coordinate. | |
virtual void | setAttributeFromMeanRasterValues (const std::string &AttributeName)=0 |
Creates a new attribute for all the LandREntity of this LandRGraph, and set for each LandREntity this attribute value as a mean of the raster value. | |
void | computeNeighbours () |
Computes the LandREntity neighbours of each LandREntity of this LandRGraph, according to its type. | |
void | exportToShp (const std::string &FilePath, const std::string &FileName) |
Creates on disk a shapefile representing this LandRGraph. | |
void | setAttributeFromVectorId (const std::string &AttributeName, openfluid::core::GeoVectorValue &Vector, const std::string &Column) |
Creates a new attribute for all the LandREntity of this LandRGraph, and set for each LandREntity this attribute value as the vector value corresponding to the entity OFLD_ID. | |
void | setAttributeFromVectorId (const std::string &AttributeName, openfluid::landr::VectorDataset &Vector, const std::string &Column) |
Creates a new attribute for all the LandREntity of this LandRGraph, and set for each LandREntity this attribute value as the vector value corresponding to the entity OFLD_ID. | |
virtual void | setAttributeFromVectorLocation (const std::string &AttributeName, openfluid::core::GeoVectorValue &Vector, const std::string &Column, double Thresh=0.0001)=0 |
Creates a new attribute for all the LandREntity of this LandRGraph, and set for each LandREntity this attribute value as the vector value corresponding to the Vector Entity Geometry. | |
virtual void | setAttributeFromVectorLocation (const std::string &AttributeName, openfluid::landr::VectorDataset &Vector, const std::string &Column, double Thresh=0.0001)=0 |
Creates a new attribute for all the LandREntity of this LandRGraph, and set for each LandREntity this attribute value as the vector value corresponding to the Vector Entity Geometry. | |
virtual void | removeEntity (int OfldId)=0 |
Removes a LandREntity with identifier from this LandRGraph. | |
void | snapVertices (double snapTolerance) |
Protected Member Functions | |
LandRGraph () | |
LandRGraph (openfluid::core::GeoVectorValue &Val) | |
Creates a new LandRGraph from a core::GeoVectorValue. | |
LandRGraph (const openfluid::landr::VectorDataset &Vect) | |
Creates a new LandRGraph from a VectorDataset. | |
void | addEntitiesFromGeoVector () |
Adds LandREntity from the associated VectorDataset of this LandRGraph. | |
void | addEntitiesFromEntityList (const LandRGraph::Entities_t &Entities) |
Adds LandREntity from a LandREntity list to this LandRGraph. | |
virtual void | addEntity (LandREntity *Entity)=0 |
Adds a LandREntity to this LandRGraph. | |
virtual LandREntity * | getNewEntity (const geos::geom::Geometry *Geom, unsigned int OfldId)=0 |
Creates a new LandREntity. | |
geos::planargraph::Node * | getNode (const geos::geom::Coordinate &Coordinate) |
Returns a geos::planagraph::Node of this LandRGraph from a geos::geom::Coordinate. | |
Protected Attributes | |
openfluid::landr::VectorDataset * | mp_Vector |
The VectorDataset associated to this LandRGraph. | |
const geos::geom::GeometryFactory * | mp_Factory |
The geos::geom::GeometryFactory used to build this LandRGraph. | |
std::map< int, LandREntity * > | m_EntitiesByOfldId |
A map of the LandREntity of this LandRGraph and sorted by identifier. | |
Entities_t | m_Entities |
A list of the LandREntity of this LandRGraph. | |
openfluid::landr::RasterDataset * | mp_Raster |
The RasterDataset associated to this LandRGraph. | |
openfluid::landr::VectorDataset * | mp_RasterPolygonized |
The VectorDataset representation of the RasterDataset associated to this LandRGraph. | |
std::vector < geos::geom::Polygon * > * | mp_RasterPolygonizedPolys |
A vector of geos::geom::Polygon representation of the RasterDataset associated to this LandRGraph. | |
Static Protected Attributes | |
static int | FileNum |
Interface for a graph composed of LandREntity.
typedef std::list<LandREntity*> openfluid::landr::LandRGraph::Entities_t |
openfluid::landr::LandRGraph::LandRGraph | ( | ) | [protected] |
openfluid::landr::LandRGraph::LandRGraph | ( | openfluid::core::GeoVectorValue & | Val | ) | [protected] |
Creates a new LandRGraph from a core::GeoVectorValue.
openfluid::landr::LandRGraph::LandRGraph | ( | const openfluid::landr::VectorDataset & | Vect | ) | [protected] |
Creates a new LandRGraph from a VectorDataset.
virtual openfluid::landr::LandRGraph::~LandRGraph | ( | ) | [virtual] |
Associates a core::GeoRasterValue to this LandRGraph.
Raster | A core::GeoRasterValue. |
Replace associated raster if exists.
void openfluid::landr::LandRGraph::addAGeoRasterValue | ( | const openfluid::landr::RasterDataset & | Raster | ) |
Associates a RasterDataset to this LandRGraph.
Raster | A RasterDataset. |
Replace associated raster if exists.
void openfluid::landr::LandRGraph::addAttribute | ( | const std::string & | AttributeName | ) |
Adds an attribute to this LandRGraph.
Doesn't reset if the AttributeName already exists.
AttributeName | The name of the attribute. |
void openfluid::landr::LandRGraph::addEntitiesFromEntityList | ( | const LandRGraph::Entities_t & | Entities | ) | [protected] |
Adds LandREntity from a LandREntity list to this LandRGraph.
void openfluid::landr::LandRGraph::addEntitiesFromGeoVector | ( | ) | [protected] |
Adds LandREntity from the associated VectorDataset of this LandRGraph.
virtual void openfluid::landr::LandRGraph::addEntity | ( | LandREntity * | Entity | ) | [protected, pure virtual] |
Adds a LandREntity to this LandRGraph.
Entity | The LandREntity to add. |
Implemented in openfluid::landr::LineStringGraph, and openfluid::landr::PolygonGraph.
Computes the LandREntity neighbours of each LandREntity of this LandRGraph, according to its type.
void openfluid::landr::LandRGraph::exportToShp | ( | const std::string & | FilePath, |
const std::string & | FileName | ||
) |
Creates on disk a shapefile representing this LandRGraph.
FilePath | The path where to create the out file. |
FileName | A name for the out file to create, with a .shp extension. |
std::vector<std::string> openfluid::landr::LandRGraph::getAttributeNames | ( | ) |
Returns a vector of the names of the attributes of this LandRGraph.
Returns a list of the LandREntity of this LandRGraph.
std::map<int, LandREntity*> openfluid::landr::LandRGraph::getEntitiesByOfldId | ( | ) |
Returns a map of the LandREntity of this LandRGraph and their identifiers.
virtual LandREntity* openfluid::landr::LandRGraph::getEntity | ( | int | OfldId | ) | [virtual] |
Returns the LandREntity with OfldId, or 0 if it doesn't exist.
Reimplemented in openfluid::landr::LineStringGraph, and openfluid::landr::PolygonGraph.
virtual LandREntity* openfluid::landr::LandRGraph::getNewEntity | ( | const geos::geom::Geometry * | Geom, |
unsigned int | OfldId | ||
) | [protected, pure virtual] |
Creates a new LandREntity.
Geom | A geos::geom::Geometry. |
OfldId | The identifier of the new LandREntity. |
Implemented in openfluid::landr::LineStringGraph, and openfluid::landr::PolygonGraph.
geos::planargraph::Node* openfluid::landr::LandRGraph::getNode | ( | const geos::geom::Coordinate & | Coordinate | ) | [protected] |
Returns a geos::planagraph::Node of this LandRGraph from a geos::geom::Coordinate.
Coordinate | A geos::geom::Coordinate. |
Returns a list of the LandREntity of this LandRGraph and sorted by identifier.
Transforms the associated raster value into an openfluid::landr::VectorDataset of polygons.
std::vector<geos::geom::Polygon*>* openfluid::landr::LandRGraph::getRasterPolygonizedPolys | ( | ) |
Transforms the associated raster value into a vector of geos::geom::Polygon.
virtual float* openfluid::landr::LandRGraph::getRasterValueForEntityCentroid | ( | const LandREntity & | Entity | ) | [virtual] |
Fetchs the associated raster value corresponding to the LandREntity centroid coordinate.
Entity | The LandREntity to get the centroid coordinate from. |
unsigned int openfluid::landr::LandRGraph::getSize | ( | ) | const |
Gets the number of LandREntity in the LandRGraph.
virtual GraphType openfluid::landr::LandRGraph::getType | ( | ) | [pure virtual] |
Returns the type of graph.
Implemented in openfluid::landr::LineStringGraph, and openfluid::landr::PolygonGraph.
Returns true if this LandRGraph has an associated raster, false otherwise.
void openfluid::landr::LandRGraph::removeAttribute | ( | const std::string & | AttributeName | ) |
Removes an attribute to this LandRGraph.
Does nothing if AttributeName doesn't exist.
AttributeName | The name of the attribute. |
virtual void openfluid::landr::LandRGraph::removeEntity | ( | int | OfldId | ) | [pure virtual] |
Removes a LandREntity with identifier from this LandRGraph.
The associated nodes of the LandREntity are also removed.
OfldId | The identifier. |
Implemented in openfluid::landr::PolygonGraph, and openfluid::landr::LineStringGraph.
Removes from this LandRGraph the nodes of degree 0.
virtual void openfluid::landr::LandRGraph::setAttributeFromMeanRasterValues | ( | const std::string & | AttributeName | ) | [pure virtual] |
Creates a new attribute for all the LandREntity of this LandRGraph, and set for each LandREntity this attribute value as a mean of the raster value.
AttributeName | The name of the attribute to create. |
Implemented in openfluid::landr::LineStringGraph, and openfluid::landr::PolygonGraph.
void openfluid::landr::LandRGraph::setAttributeFromRasterValueAtCentroid | ( | const std::string & | AttributeName | ) |
Creates a new attribute for all the LandREntity of this LandRGraph, and set for each LandREntity this attribute value as the raster value corresponding to the LandREntity centroid coordinate.
AttributeName | The name of the attribute to create. |
void openfluid::landr::LandRGraph::setAttributeFromVectorId | ( | const std::string & | AttributeName, |
openfluid::core::GeoVectorValue & | Vector, | ||
const std::string & | Column | ||
) |
Creates a new attribute for all the LandREntity of this LandRGraph, and set for each LandREntity this attribute value as the vector value corresponding to the entity OFLD_ID.
AttributeName | The name of the attribute to create. |
Vector | The Name of the core::GeoVectorValue. |
Column | The column of the core::GeoVectorValue to upload. |
void openfluid::landr::LandRGraph::setAttributeFromVectorId | ( | const std::string & | AttributeName, |
openfluid::landr::VectorDataset & | Vector, | ||
const std::string & | Column | ||
) |
Creates a new attribute for all the LandREntity of this LandRGraph, and set for each LandREntity this attribute value as the vector value corresponding to the entity OFLD_ID.
AttributeName | The name of the attribute to create. |
Vector | The Name of the VectorDataset. |
Column | The column of the core::GeoVectorValue to upload. |
virtual void openfluid::landr::LandRGraph::setAttributeFromVectorLocation | ( | const std::string & | AttributeName, |
openfluid::core::GeoVectorValue & | Vector, | ||
const std::string & | Column, | ||
double | Thresh = 0.0001 |
||
) | [pure virtual] |
Creates a new attribute for all the LandREntity of this LandRGraph, and set for each LandREntity this attribute value as the vector value corresponding to the Vector Entity Geometry.
AttributeName | The name of the attribute to create. |
Vector | The Name of the core::GeoVectorValue. |
Column | The column of the core::GeoVectorValue to upload. |
Thresh | The threshold of minimum distance between the core::GeoVectorValue geometry and the LandRGraph geometry (only used for LineStringGraph). |
Implemented in openfluid::landr::LineStringGraph, and openfluid::landr::PolygonGraph.
virtual void openfluid::landr::LandRGraph::setAttributeFromVectorLocation | ( | const std::string & | AttributeName, |
openfluid::landr::VectorDataset & | Vector, | ||
const std::string & | Column, | ||
double | Thresh = 0.0001 |
||
) | [pure virtual] |
Creates a new attribute for all the LandREntity of this LandRGraph, and set for each LandREntity this attribute value as the vector value corresponding to the Vector Entity Geometry.
AttributeName | The name of the attribute to create. |
Vector | The Name of the VectorDataset. |
Column | The column of the VectorDataset to upload. |
Thresh | The threshold of minimum distance between the VectorDataset geometry and the LandRGraph geometry (only used for LineStringGraph). |
Implemented in openfluid::landr::LineStringGraph, and openfluid::landr::PolygonGraph.
void openfluid::landr::LandRGraph::snapVertices | ( | double | snapTolerance | ) |
int openfluid::landr::LandRGraph::FileNum [static, protected] |
Entities_t openfluid::landr::LandRGraph::m_Entities [protected] |
A list of the LandREntity of this LandRGraph.
std::map<int, LandREntity*> openfluid::landr::LandRGraph::m_EntitiesByOfldId [protected] |
A map of the LandREntity of this LandRGraph and sorted by identifier.
const geos::geom::GeometryFactory* openfluid::landr::LandRGraph::mp_Factory [protected] |
The geos::geom::GeometryFactory used to build this LandRGraph.
The RasterDataset associated to this LandRGraph.
The VectorDataset representation of the RasterDataset associated to this LandRGraph.
std::vector<geos::geom::Polygon*>* openfluid::landr::LandRGraph::mp_RasterPolygonizedPolys [protected] |
A vector of geos::geom::Polygon representation of the RasterDataset associated to this LandRGraph.
The VectorDataset associated to this LandRGraph.