![]() |
A LandRGraph composed of PolygonEntities. More...
#include <landr/PolygonGraph.hpp>
Public Types | |
typedef std::map < geos::geom::Polygon *, double > | RastValByRastPoly_t |
A a map of polygonized Raster geos::geom::Polygon and its area intersecting PolygonEntity. More... | |
![]() | |
enum | GraphType { POLYGON, LINESTRING } |
typedef std::list< LandREntity * > | Entities_t |
Public Member Functions | |
virtual | ~PolygonGraph () |
LandRGraph::GraphType | getType () |
Returns the type of graph. More... | |
PolygonEntity * | entity (int OfldId) |
Returns a PolygonEntity with OfldId, or 0 if it doesn't exist. More... | |
bool | isComplete () |
Returns true if each PolygonEntity is complete. More... | |
bool | hasIsland () |
Returns true if this PolygonGraph has one or more islands. More... | |
RastValByRastPoly_t | computeRasterPolyOverlapping (PolygonEntity &Entity) |
Gets a map of polygonized Raster polygons and its area intersecting Entity. More... | |
virtual void | setAttributeFromMeanRasterValues (const std::string &AttributeName) |
Creates a new attribute for this PolygonGraph entities, and set for each PolygonEntity this attribute value as the mean of the overlapping raster values, relative to overlapping areas. More... | |
void | createVectorRepresentation (std::string FilePath, std::string FileName) |
Creates on disk a shapefile representing the PolygonEdges of this PolygonGraph. More... | |
void | computeLineStringNeighbours (LineStringGraph &Graph, openfluid::landr::LandRTools::Relationship Relation, double BufferDistance, double ContactLength=0) |
Computes the neighbours between the PolygonEntity elements of this PolygonGraph and the LineStringEntity of a LineStringGraph. More... | |
void | computeNeighboursWithBarriers (LineStringGraph &Graph, openfluid::landr::LandRTools::Relationship Relation, double BufferDistance, double ContactLength=0) |
Computes the neighbours between the PolygonEntity elements of this PolygonGraph by using the LineStringEntity of an input LineStringGraph which are considered as barriers. More... | |
void | createEdgeAttribute (std::string AttributeName, openfluid::core::Value &Value) |
Creates attribute for the PolygonEdge of this PolygonGraph. More... | |
void | removeEdgeAttribute (std::string AttributeName) |
Removes the attribute of the PolygonEdge of this PolygonGraph. More... | |
std::vector< std::string > | getEdgeAttributeNames () |
Returns a vector of the name of the PolygonEdge attributes. More... | |
virtual void | removeEntity (int OfldId) |
Removes from this PolygonGraph the PolygonEntity with OfldId and its associated nodes. More... | |
void | cleanEdges (PolygonEntity &Entity) |
Clean the PolygonEdge of a PolygonEntity. More... | |
std::multimap< double, PolygonEntity * > | getPolygonEntitiesByMinArea (double MinArea, bool Neighbour=true) |
Gets a map of small PolygonEntity which area are under a threshold. More... | |
std::multimap< double, PolygonEntity * > | getPolygonEntitiesByCompactness (double Compactness, bool Neighbour=true) |
Gets a map of sliver PolygonEntity which compactness value are superior to a compactness threshold (Gravelius Index) More... | |
void | mergePolygonEntities (PolygonEntity &Entity, PolygonEntity &EntityToMerge) |
Merge a PolygonEntity into an other one. More... | |
void | mergePolygonEntitiesByMinArea (double MinArea) |
Merge the entities of this PolygonGraph which area is under threshold. More... | |
void | mergePolygonEntitiesByCompactness (double Compactness) |
Merge the entities of this PolygonGraph which compactness value are superior to a compactness threshold (Gravelius Index). More... | |
![]() | |
virtual | ~LandRGraph () |
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... | |
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... | |
void | snapVertices (double snapTolerance) |
Snap the vertices of this LandRGraph under a threshold. More... | |
Static Public Member Functions | |
static PolygonGraph * | create (openfluid::core::GeoVectorValue &Val) |
Creates a new PolygonGraph initialized from a core::GeoVectorValue. More... | |
static PolygonGraph * | create (openfluid::landr::VectorDataset &Vect) |
Create a new PolygonGraph initialized from a VectorDataset. More... | |
static PolygonGraph * | create (const LandRGraph::Entities_t &Entities) |
Create a new PolygonGraph initialized with a list of LandREntity. More... | |
Protected Member Functions | |
PolygonGraph () | |
PolygonGraph (openfluid::core::GeoVectorValue &Val) | |
Creates a new PolygonGraph initialized from a core::GeoVectorValue. More... | |
PolygonGraph (openfluid::landr::VectorDataset &Vect) | |
Creates a new PolygonGraph initialized from a VectorDataset. More... | |
virtual void | addEntity (LandREntity *Entity) |
Adds a LandREntity into this PolygonGraph. More... | |
virtual LandREntity * | createNewEntity (const geos::geom::Geometry *Geom, unsigned int OfldId) |
Creates a new PolygonEntity. More... | |
PolygonEdge * | createEdge (geos::geom::LineString &LineString) |
Creates a new PolygonEdge, with its two DirectedEdges and add them to this graph. More... | |
void | removeSegment (PolygonEntity *Entity, geos::geom::LineString *Segment) |
Removes a segment of the exterior boundary of the input PolygonEntity. More... | |
void | addEdgeAttribute (std::string AttributeName, LandREntity &Entity) |
Adds an attribute to the PolygonEdge of a PolygonEntity. More... | |
void | removeEdgeAttribute (std::string AttributeName, LandREntity &Entity) |
Removes an attribute to the PolygonEdge of a PolygonEntity. More... | |
![]() | |
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... | |
geos::planargraph::Node * | node (const geos::geom::Coordinate &Coordinate) |
Returns a geos::planagraph::Node of this LandRGraph from a geos::geom::Coordinate. More... | |
Additional Inherited Members | |
![]() | |
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 int | FileNum |
A LandRGraph composed of PolygonEntities.
typedef std::map<geos::geom::Polygon*, double> openfluid::landr::PolygonGraph::RastValByRastPoly_t |
A a map of polygonized Raster geos::geom::Polygon and its area intersecting PolygonEntity.
|
protected |
|
protected |
Creates a new PolygonGraph initialized from a core::GeoVectorValue.
|
protected |
Creates a new PolygonGraph initialized from a VectorDataset.
|
virtual |
|
protected |
Adds an attribute to the PolygonEdge of a PolygonEntity.
AttributeName | The name of the attribute to add. |
Entity | The LandREntity to add the PolygonEdge attribute. |
|
protectedvirtual |
Adds a LandREntity into this PolygonGraph.
Implements openfluid::landr::LandRGraph.
void openfluid::landr::PolygonGraph::cleanEdges | ( | PolygonEntity & | Entity | ) |
Clean the PolygonEdge of a PolygonEntity.
Entity | The PolygonEntity to clean. |
void openfluid::landr::PolygonGraph::computeLineStringNeighbours | ( | LineStringGraph & | Graph, |
openfluid::landr::LandRTools::Relationship | Relation, | ||
double | BufferDistance, | ||
double | ContactLength = 0 |
||
) |
Computes the neighbours between the PolygonEntity elements of this PolygonGraph and the LineStringEntity of a LineStringGraph.
Graph | The LineStringGraph to compare to. |
Relation | The Relationship to use for comparison. |
BufferDistance | The distance below which we consider that two elements are related. |
ContactLength | Min Length of the LineString in intersection with polygon Buffered Boundaries to be taking acccount (only for LandRTools::TOUCHES RelationShip) |
void openfluid::landr::PolygonGraph::computeNeighboursWithBarriers | ( | LineStringGraph & | Graph, |
openfluid::landr::LandRTools::Relationship | Relation, | ||
double | BufferDistance, | ||
double | ContactLength = 0 |
||
) |
Computes the neighbours between the PolygonEntity elements of this PolygonGraph by using the LineStringEntity of an input LineStringGraph which are considered as barriers.
A barrier between two PolygonEntity will avoid to considered them as neighbours.
A LineStringEntity is considered as a barrier if it lies within the buffer of this PolygonEntity polygon boundary.
Graph | The LineStringGraph to compare to. |
Relation | The Relationship to use for comparison, the LandRTools::Relationship INTERSECTS is not allowed. |
BufferDistance | The distance below which we consider that two elements are related. |
ContactLength | Min Length of the LineString in intersection with polygon Buffered Boundaries to be taking acccount (only for LandRTools::TOUCHES RelationShip) |
RastValByRastPoly_t openfluid::landr::PolygonGraph::computeRasterPolyOverlapping | ( | PolygonEntity & | Entity | ) |
Gets a map of polygonized Raster polygons and its area intersecting Entity.
Entity | The PolygonEntity to compare with the associated Raster. |
|
static |
Creates a new PolygonGraph initialized from a core::GeoVectorValue.
Val must be composed of one or many Polygons, and each of them must contain a "OFLD_ID" attribute.
|
static |
Create a new PolygonGraph initialized from a VectorDataset.
Vect must be composed of one or many Polygons, and each of them must contain a "OFLD_ID" attribute.
|
static |
Create a new PolygonGraph initialized with a list of LandREntity.
Entities must be PolygonEntity.
|
protected |
Creates a new PolygonEdge, with its two DirectedEdges and add them to this graph.
LineString | The geos::geom::LineString representing the PolygonEdge to create. |
void openfluid::landr::PolygonGraph::createEdgeAttribute | ( | std::string | AttributeName, |
openfluid::core::Value & | Value | ||
) |
Creates attribute for the PolygonEdge of this PolygonGraph.
Doesn't reset if the AttributeName already exists.
AttributeName | The name of the PolygonEdge attribute. |
Value | The core::Value to associate to this attribute. |
|
protectedvirtual |
Creates a new PolygonEntity.
Geom | The geos::geom::Geometry of the new PolygonEntity to create. |
OfldId | The identifier of the new PolygonEntity. |
Implements openfluid::landr::LandRGraph.
void openfluid::landr::PolygonGraph::createVectorRepresentation | ( | std::string | FilePath, |
std::string | FileName | ||
) |
Creates on disk a shapefile representing the PolygonEdges of this PolygonGraph.
FilePath | The path where to create the out file. |
FileName | A name for the out file to create, with a .shp extension. |
|
virtual |
Returns a PolygonEntity with OfldId, or 0 if it doesn't exist.
Reimplemented from openfluid::landr::LandRGraph.
std::vector<std::string> openfluid::landr::PolygonGraph::getEdgeAttributeNames | ( | ) |
Returns a vector of the name of the PolygonEdge attributes.
std::multimap<double, PolygonEntity*> openfluid::landr::PolygonGraph::getPolygonEntitiesByCompactness | ( | double | Compactness, |
bool | Neighbour = true |
||
) |
Gets a map of sliver PolygonEntity which compactness value are superior to a compactness threshold (Gravelius Index)
Compactness | The compactness threshold (perimeter/2 x sqrt (Pi x area)) |
Neighbour | : if true, get only PolygonEntity with at least one PolygonEntity neighbour; default is false. |
std::multimap<double, PolygonEntity*> openfluid::landr::PolygonGraph::getPolygonEntitiesByMinArea | ( | double | MinArea, |
bool | Neighbour = true |
||
) |
Gets a map of small PolygonEntity which area are under a threshold.
MinArea | The area threshold (in map units). |
Neighbour | : if true, get only PolygonEntity with at least one PolygonEntity neighbour; default is true. |
|
virtual |
Returns the type of graph.
Implements openfluid::landr::LandRGraph.
bool openfluid::landr::PolygonGraph::hasIsland | ( | ) |
Returns true if this PolygonGraph has one or more islands.
bool openfluid::landr::PolygonGraph::isComplete | ( | ) |
Returns true if each PolygonEntity is complete.
void openfluid::landr::PolygonGraph::mergePolygonEntities | ( | PolygonEntity & | Entity, |
PolygonEntity & | EntityToMerge | ||
) |
Merge a PolygonEntity into an other one.
The PolygonEntity to merge is deleted.
Entity | An existent PolygonEntity. |
EntityToMerge | The PolygonEntity which will be merged into Entity and will be deleted. |
void openfluid::landr::PolygonGraph::mergePolygonEntitiesByCompactness | ( | double | Compactness | ) |
Merge the entities of this PolygonGraph which compactness value are superior to a compactness threshold (Gravelius Index).
The small PolygonEntity is merged into the one which share the longest boundary.
Compactness | The compactness threshold (perimeter/2 x sqrt (Pi x area)). |
void openfluid::landr::PolygonGraph::mergePolygonEntitiesByMinArea | ( | double | MinArea | ) |
Merge the entities of this PolygonGraph which area is under threshold.
The small PolygonEntity is merged into the one which share the longest boundary.
MinArea | The minimum area threshold. |
|
protected |
Removes an attribute to the PolygonEdge of a PolygonEntity.
AttributeName | The name of the attribute to remove. |
Entity | The LandREntity to remove the PolygonEdge attribute. |
void openfluid::landr::PolygonGraph::removeEdgeAttribute | ( | std::string | AttributeName | ) |
Removes the attribute of the PolygonEdge of this PolygonGraph.
AttributeName | The name of the PolygonEdge attribute to delete. |
Does nothing if AttributeName doesn't exist.
|
virtual |
Removes from this PolygonGraph the PolygonEntity with OfldId and its associated nodes.
OfldId |
Implements openfluid::landr::LandRGraph.
|
protected |
Removes a segment of the exterior boundary of the input PolygonEntity.
Entity | The PolygonEntity to removes the segment to. |
Segment | The geos::geom::LineString to remove. |
|
virtual |
Creates a new attribute for this PolygonGraph entities, and set for each PolygonEntity this attribute value as the mean of the overlapping raster values, relative to overlapping areas.
AttributeName | The name of the attribute to create |
Implements openfluid::landr::LandRGraph.