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. More... | |
virtual LandREntity * | entity (int OfldId) |
Returns the LandREntity with OfldId, or 0 if it doesn't exist. More... | |
Entities_t | getEntities () |
Returns a list of the LandREntity of this LandRGraph. More... | |
Entities_t | getOfldIdOrderedEntities () |
Returns a list of the LandREntity of this LandRGraph and sorted by identifier. More... | |
std::map< int, LandREntity * > | getEntitiesByOfldId () |
Returns a map of the LandREntity of this LandRGraph and their identifiers. More... | |
unsigned int | getSize () const |
Gets the number of LandREntity in the LandRGraph. More... | |
void | removeUnusedNodes () |
Removes from this LandRGraph the nodes of degree 0. More... | |
void | addAttribute (const std::string &AttributeName) |
Adds an attribute to this LandRGraph. More... | |
void | removeAttribute (const std::string &AttributeName) |
Removes an attribute to this LandRGraph. More... | |
std::vector< std::string > | getAttributeNames () |
Returns a vector of the names of the attributes of this LandRGraph. More... | |
void | addAGeoRasterValue (openfluid::core::GeoRasterValue &Raster) |
Associates a core::GeoRasterValue to this LandRGraph. More... | |
void | addAGeoRasterValue (const openfluid::landr::RasterDataset &Raster) |
Associates a RasterDataset to this LandRGraph. More... | |
bool | hasAnAssociatedRaster () |
Returns true if this LandRGraph has an associated raster, false otherwise. More... | |
openfluid::landr::VectorDataset * | rasterPolygonized () |
Transforms the associated raster value into an openfluid::landr::VectorDataset of polygons. More... | |
std::vector< geos::geom::Polygon * > * | rasterPolygonizedPolys () |
Transforms the associated raster value into a vector of geos::geom::Polygon. More... | |
virtual double | getRasterValueForEntityCentroid (const LandREntity &Entity) |
Fetchs the associated raster value corresponding to the LandREntity centroid coordinate. More... | |
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. More... | |
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. More... | |
void | computeNeighbours () |
Computes the LandREntity neighbours of each LandREntity of this LandRGraph, according to its type. More... | |
void | exportToShp (const std::string &FilePath, const std::string &FileName) |
Creates on disk a shapefile representing this LandRGraph. More... | |
void | setAttributeFromVectorId (const std::string &AttributeName, openfluid::core::GeoVectorValue &Vector, const std::string &IdColumn, const std::string &ValueColumn) |
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 ID number. More... | |
void | setAttributeFromVectorId (const std::string &AttributeName, openfluid::landr::VectorDataset &Vector, const std::string &IdColumn, const std::string &ValueColumn) |
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. More... | |
virtual void | setAttributeFromVectorLocation (const std::string &AttributeName, openfluid::core::GeoVectorValue &Vector, const std::string &Column, double Thresh=0.0001) |
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. More... | |
virtual void | setAttributeFromVectorLocation (const std::string &AttributeName, openfluid::landr::VectorDataset &Vector, const std::string &Column, double Thresh=0.0001) |
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. More... | |
virtual void | removeEntity (int OfldId)=0 |
Removes a LandREntity with identifier from this LandRGraph. More... | |
void | snapVertices (double snapTolerance) |
Snap the vertices of this LandRGraph under a threshold. More... | |
Protected Member Functions | |
LandRGraph () | |
LandRGraph (openfluid::core::GeoVectorValue &Val) | |
Creates a new LandRGraph from a core::GeoVectorValue. More... | |
LandRGraph (const openfluid::landr::VectorDataset &Vect) | |
Creates a new LandRGraph from a VectorDataset. More... | |
void | addEntitiesFromGeoVector () |
Adds LandREntity from the associated VectorDataset of this LandRGraph. More... | |
void | addEntitiesFromEntityList (const LandRGraph::Entities_t &Entities) |
Adds LandREntity from a LandREntity list to this LandRGraph. More... | |
virtual void | addEntity (LandREntity *Entity)=0 |
Adds a LandREntity to this LandRGraph. More... | |
virtual LandREntity * | createNewEntity (const geos::geom::Geometry *Geom, unsigned int OfldId)=0 |
Creates a new LandREntity. More... | |
geos::planargraph::Node * | node (const geos::geom::Coordinate &Coordinate) |
Returns a geos::planagraph::Node of this LandRGraph from a geos::geom::Coordinate. More... | |
Protected Attributes | |
openfluid::landr::VectorDataset * | mp_Vector |
The VectorDataset associated to this LandRGraph. More... | |
const geos::geom::GeometryFactory * | mp_Factory |
The geos::geom::GeometryFactory used to build this LandRGraph. More... | |
std::map< int, LandREntity * > | m_EntitiesByOfldId |
A map of the LandREntity of this LandRGraph and sorted by identifier. More... | |
Entities_t | m_Entities |
A list of the LandREntity of this LandRGraph. More... | |
openfluid::landr::RasterDataset * | mp_Raster |
The RasterDataset associated to this LandRGraph. More... | |
openfluid::landr::VectorDataset * | mp_RasterPolygonized |
The VectorDataset representation of the RasterDataset associated to this LandRGraph. More... | |
std::vector< geos::geom::Polygon * > * | mp_RasterPolygonizedPolys |
A vector of geos::geom::Polygon representation of the RasterDataset associated to this LandRGraph. More... | |
Static Protected Attributes | |
static int | m_FileNum |
Interface for a graph composed of LandREntity.
typedef std::list<LandREntity*> openfluid::landr::LandRGraph::Entities_t |
|
protected |
|
protected |
Creates a new LandRGraph from a core::GeoVectorValue.
|
protected |
Creates a new LandRGraph from a VectorDataset.
|
virtual |
void openfluid::landr::LandRGraph::addAGeoRasterValue | ( | openfluid::core::GeoRasterValue & | Raster | ) |
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. |
|
protected |
Adds LandREntity from a LandREntity list to this LandRGraph.
|
protected |
Adds LandREntity from the associated VectorDataset of this LandRGraph.
|
protectedpure virtual |
Adds a LandREntity to this LandRGraph.
Entity | The LandREntity to add. |
Implemented in openfluid::landr::LineStringGraph, and openfluid::landr::PolygonGraph.
void openfluid::landr::LandRGraph::computeNeighbours | ( | ) |
Computes the LandREntity neighbours of each LandREntity of this LandRGraph, according to its type.
|
protectedpure 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.
|
virtual |
Returns the LandREntity with OfldId, or 0 if it doesn't exist.
Reimplemented in openfluid::landr::LineStringGraph, and openfluid::landr::PolygonGraph.
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.
Entities_t openfluid::landr::LandRGraph::getEntities | ( | ) |
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.
Entities_t openfluid::landr::LandRGraph::getOfldIdOrderedEntities | ( | ) |
Returns a list of the LandREntity of this LandRGraph and sorted by identifier.
|
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.
|
pure virtual |
Returns the type of graph.
Implemented in openfluid::landr::LineStringGraph, and openfluid::landr::PolygonGraph.
bool openfluid::landr::LandRGraph::hasAnAssociatedRaster | ( | ) |
Returns true if this LandRGraph has an associated raster, false otherwise.
|
protected |
Returns a geos::planagraph::Node of this LandRGraph from a geos::geom::Coordinate.
Coordinate | A geos::geom::Coordinate. |
openfluid::landr::VectorDataset* openfluid::landr::LandRGraph::rasterPolygonized | ( | ) |
Transforms the associated raster value into an openfluid::landr::VectorDataset of polygons.
std::vector<geos::geom::Polygon*>* openfluid::landr::LandRGraph::rasterPolygonizedPolys | ( | ) |
Transforms the associated raster value into a vector of geos::geom::Polygon.
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. |
|
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.
void openfluid::landr::LandRGraph::removeUnusedNodes | ( | ) |
Removes from this LandRGraph the nodes of degree 0.
|
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 & | IdColumn, | ||
const std::string & | ValueColumn | ||
) |
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 ID number.
AttributeName | The name of the attribute to create. |
Vector | The Name of the core::GeoVectorValue. |
IdColumn | The ID number column of the core::GeoVectorValue. |
ValueColumn | The column of the core::GeoVectorValue to upload. |
void openfluid::landr::LandRGraph::setAttributeFromVectorId | ( | const std::string & | AttributeName, |
openfluid::landr::VectorDataset & | Vector, | ||
const std::string & | IdColumn, | ||
const std::string & | ValueColumn | ||
) |
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. |
IdColumn | The ID number column of the landr::VectorDataset. |
ValueColumn | The column of the landr::VectorDataset to upload. |
|
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. |
|
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. |
void openfluid::landr::LandRGraph::snapVertices | ( | double | snapTolerance | ) |
Snap the vertices of this LandRGraph under a threshold.
snapTolerance | The threshold. |
|
protected |
A list of the LandREntity of this LandRGraph.
|
protected |
A map of the LandREntity of this LandRGraph and sorted by identifier.
|
staticprotected |
|
protected |
The geos::geom::GeometryFactory used to build this LandRGraph.
|
protected |
The RasterDataset associated to this LandRGraph.
|
protected |
The VectorDataset representation of the RasterDataset associated to this LandRGraph.
|
protected |
A vector of geos::geom::Polygon representation of the RasterDataset associated to this LandRGraph.
|
protected |
The VectorDataset associated to this LandRGraph.