Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
openfluid::landr::PolygonGraph Class Reference

A LandRGraph composed of PolygonEntities. More...

#include <landr/PolygonGraph.hpp>

Inheritance diagram for openfluid::landr::PolygonGraph:
Inheritance graph
[legend]
Collaboration diagram for openfluid::landr::PolygonGraph:
Collaboration graph
[legend]

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...
 
- Public Types inherited from openfluid::landr::LandRGraph
enum  GraphType { POLYGON, LINESTRING }
 
typedef std::list< LandREntity * > Entities_t
 

Public Member Functions

virtual ~PolygonGraph ()
 
LandRGraph::GraphType getType ()
 Returns the type of graph. More...
 
PolygonEntityentity (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...
 
- Public Member Functions inherited from openfluid::landr::LandRGraph
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::VectorDatasetrasterPolygonized ()
 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 PolygonGraphcreate (openfluid::core::GeoVectorValue &Val)
 Creates a new PolygonGraph initialized from a core::GeoVectorValue. More...
 
static PolygonGraphcreate (openfluid::landr::VectorDataset &Vect)
 Create a new PolygonGraph initialized from a VectorDataset. More...
 
static PolygonGraphcreate (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 LandREntitycreateNewEntity (const geos::geom::Geometry *Geom, unsigned int OfldId)
 Creates a new PolygonEntity. More...
 
PolygonEdgecreateEdge (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...
 
- Protected Member Functions inherited from openfluid::landr::LandRGraph
 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

- Protected Attributes inherited from openfluid::landr::LandRGraph
openfluid::landr::VectorDatasetmp_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::RasterDatasetmp_Raster
 The RasterDataset associated to this LandRGraph. More...
 
openfluid::landr::VectorDatasetmp_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 inherited from openfluid::landr::LandRGraph
static int m_FileNum
 

Detailed Description

A LandRGraph composed of PolygonEntities.

Member Typedef Documentation

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.

Constructor & Destructor Documentation

openfluid::landr::PolygonGraph::PolygonGraph ( )
protected
openfluid::landr::PolygonGraph::PolygonGraph ( openfluid::core::GeoVectorValue Val)
protected

Creates a new PolygonGraph initialized from a core::GeoVectorValue.

openfluid::landr::PolygonGraph::PolygonGraph ( openfluid::landr::VectorDataset Vect)
protected

Creates a new PolygonGraph initialized from a VectorDataset.

virtual openfluid::landr::PolygonGraph::~PolygonGraph ( )
virtual

Member Function Documentation

void openfluid::landr::PolygonGraph::addEdgeAttribute ( std::string  AttributeName,
LandREntity Entity 
)
protected

Adds an attribute to the PolygonEdge of a PolygonEntity.

Parameters
AttributeNameThe name of the attribute to add.
EntityThe LandREntity to add the PolygonEdge attribute.
virtual void openfluid::landr::PolygonGraph::addEntity ( LandREntity Entity)
protectedvirtual

Adds a LandREntity into this PolygonGraph.

Implements openfluid::landr::LandRGraph.

void openfluid::landr::PolygonGraph::cleanEdges ( PolygonEntity Entity)

Clean the PolygonEdge of a PolygonEntity.

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

Parameters
GraphThe LineStringGraph to compare to.
RelationThe Relationship to use for comparison.
BufferDistanceThe distance below which we consider that two elements are related.
ContactLengthMin 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.

Parameters
GraphThe LineStringGraph to compare to.
RelationThe Relationship to use for comparison, the LandRTools::Relationship INTERSECTS is not allowed.
BufferDistanceThe distance below which we consider that two elements are related.
ContactLengthMin 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.

Parameters
EntityThe PolygonEntity to compare with the associated Raster.
Returns
A map of polygonized Raster Polygons, from associated polygonized raster, with for each one the intersection area.
static PolygonGraph* openfluid::landr::PolygonGraph::create ( openfluid::core::GeoVectorValue Val)
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 PolygonGraph* openfluid::landr::PolygonGraph::create ( openfluid::landr::VectorDataset Vect)
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 PolygonGraph* openfluid::landr::PolygonGraph::create ( const LandRGraph::Entities_t Entities)
static

Create a new PolygonGraph initialized with a list of LandREntity.

Entities must be PolygonEntity.

PolygonEdge* openfluid::landr::PolygonGraph::createEdge ( geos::geom::LineString &  LineString)
protected

Creates a new PolygonEdge, with its two DirectedEdges and add them to this graph.

Parameters
LineStringThe geos::geom::LineString representing the PolygonEdge to create.
Returns
The newly created PolygonEdge, or 0 if fails.
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.

Parameters
AttributeNameThe name of the PolygonEdge attribute.
ValueThe core::Value to associate to this attribute.
virtual LandREntity* openfluid::landr::PolygonGraph::createNewEntity ( const geos::geom::Geometry *  Geom,
unsigned int  OfldId 
)
protectedvirtual

Creates a new PolygonEntity.

Parameters
GeomThe geos::geom::Geometry of the new PolygonEntity to create.
OfldIdThe identifier of the new PolygonEntity.
Returns
A new LandREntity.

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.

Parameters
FilePathThe path where to create the out file.
FileNameA name for the out file to create, with a .shp extension.
PolygonEntity* openfluid::landr::PolygonGraph::entity ( int  OfldId)
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.

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)

Parameters
CompactnessThe compactness threshold (perimeter/2 x sqrt (Pi x area))
Neighbour: if true, get only PolygonEntity with at least one PolygonEntity neighbour; default is false.
Returns
a multimap of PolygonEntity with key is the compactness of each PolygonEntity.
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.

Parameters
MinAreaThe area threshold (in map units).
Neighbour: if true, get only PolygonEntity with at least one PolygonEntity neighbour; default is true.
Returns
a multimap of PolygonEntity with key is the area of each PolygonEntity.
LandRGraph::GraphType openfluid::landr::PolygonGraph::getType ( )
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.

Returns
True if one or more islands are present, false otherwise.
bool openfluid::landr::PolygonGraph::isComplete ( )

Returns true if each PolygonEntity is complete.

Returns
True if all PolygonEntity of this PolygonGraph are complete, false otherwise.
void openfluid::landr::PolygonGraph::mergePolygonEntities ( PolygonEntity Entity,
PolygonEntity EntityToMerge 
)

Merge a PolygonEntity into an other one.

The PolygonEntity to merge is deleted.

Parameters
EntityAn existent PolygonEntity.
EntityToMergeThe 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.

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

Parameters
MinAreaThe minimum area threshold.
void openfluid::landr::PolygonGraph::removeEdgeAttribute ( std::string  AttributeName,
LandREntity Entity 
)
protected

Removes an attribute to the PolygonEdge of a PolygonEntity.

Parameters
AttributeNameThe name of the attribute to remove.
EntityThe LandREntity to remove the PolygonEdge attribute.
void openfluid::landr::PolygonGraph::removeEdgeAttribute ( std::string  AttributeName)

Removes the attribute of the PolygonEdge of this PolygonGraph.

Parameters
AttributeNameThe name of the PolygonEdge attribute to delete.

Does nothing if AttributeName doesn't exist.

virtual void openfluid::landr::PolygonGraph::removeEntity ( int  OfldId)
virtual

Removes from this PolygonGraph the PolygonEntity with OfldId and its associated nodes.

Parameters
OfldId

Implements openfluid::landr::LandRGraph.

void openfluid::landr::PolygonGraph::removeSegment ( PolygonEntity Entity,
geos::geom::LineString *  Segment 
)
protected

Removes a segment of the exterior boundary of the input PolygonEntity.

Parameters
EntityThe PolygonEntity to removes the segment to.
SegmentThe geos::geom::LineString to remove.
virtual void openfluid::landr::PolygonGraph::setAttributeFromMeanRasterValues ( const std::string &  AttributeName)
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.

Parameters
AttributeNameThe name of the attribute to create

Implements openfluid::landr::LandRGraph.


The documentation for this class was generated from the following file: