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

A LandRGraph composed of LineStringEntities. More...

#include <landr/LineStringGraph.hpp>

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

Public Member Functions

virtual ~LineStringGraph ()
 
LandRGraph::GraphType getType ()
 Returns the type of graph. More...
 
LineStringEntityentity (int OfldId)
 Returns a LineStringEntity with OFLD_ID, or 0 if it doesn't exist. More...
 
virtual void removeEntity (int OfldId)
 Removes from this LineStringGraph the LineStringEntity with OFLD_ID and its associated nodes. More...
 
LineStringEntitylastLineStringEntity ()
 Returns the last LineStringEntity of this LineStringGraph, according to the LineStringEntity orientations, ie the one that has no down neighbour. More...
 
std::vector< LineStringEntity * > getEndLineStringEntities ()
 Returns a vector of LineStringEntity that have no down neighbour, according to the LineStringEntity orientations. More...
 
std::vector< LineStringEntity * > getStartLineStringEntities ()
 Returns a vector of LineStringEntity that have no up neighbour, according to the LineStringEntity orientations. More...
 
double getRasterValueForEntityStartNode (LineStringEntity &Entity)
 Fetch the associated raster value corresponding to the LineStringEntity StartNode coordinate. More...
 
double getRasterValueForEntityEndNode (LineStringEntity &Entity)
 Fetch the associated raster value corresponding to the LineStringEntity EndNode coordinate. More...
 
void setAttributeFromRasterValueAtStartNode (const std::string &AttributeName)
 Creates a new attribute for these LineStringGraph entities, and set for each LineStringEntity this attribute value as the associated raster values corresponding to the StartNode LineStringEntity coordinates. More...
 
void setAttributeFromRasterValueAtEndNode (const std::string &AttributeName)
 Creates a new attribute for these LineStringGraph entities, and set for each LineStringEntity this attribute value as the associated raster values corresponding to the EndNode LineStringEntity coordinates. More...
 
void reverseLineStringEntity (LineStringEntity &Entity)
 Reverse a LineStringEntity orientation. More...
 
bool isLineStringGraphArborescence ()
 Returns true if this LineStringGraph is an arborescence, false otherwise. More...
 
virtual void setAttributeFromMeanRasterValues (const std::string &AttributeName)
 Creates a new attribute for this LineStringGraph entities, and set for each LineStringEntity this attribute value as the mean of the StartNode altitude and the EndNode altitude. More...
 
void mergeLineStringEntities (LineStringEntity &Entity, LineStringEntity &EntityToMerge)
 Merges a LineStringEntity into an other one. More...
 
std::multimap< double, LineStringEntity * > getLineStringEntitiesByMinLength (double MinLength, bool rmDangle=true, bool HighDegree=true)
 Gets a map of small LineStringEntity under length threshold. More...
 
void setOrientationByOfldId (int OfldId)
 Set the orientation of the LineStringGraph with outlet identification by OFLD_ID identifier. Only for LineStringGraph of arborescence type. More...
 
void mergeLineStringEntitiesByMinLength (double MinLength, bool rmDangle=true)
 Merges the entities of this LineStringGraph under length threshold. 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 LineStringGraphcreate (openfluid::core::GeoVectorValue &Val)
 Creates a new LineStringGraph initialized from a core::GeoVectorValue. More...
 
static LineStringGraphcreate (openfluid::landr::VectorDataset &Vect)
 Creates a new LineStringGraph initialized from a VectorDataset. More...
 
static LineStringGraphcreate (const LandRGraph::Entities_t &Entities)
 Creates a new LineStringGraph initialized with a list of LandREntity. More...
 

Protected Member Functions

 LineStringGraph ()
 
 LineStringGraph (openfluid::core::GeoVectorValue &Val)
 Creates a new LineStringGraph initialized from a core::GeoVectorValue. More...
 
 LineStringGraph (openfluid::landr::VectorDataset &Vect)
 Creates a new LineStringGraph initialized from a VectorDataset. More...
 
virtual void addEntity (LandREntity *Entity)
 Adds a LandREntity into this LineStringGraph. More...
 
virtual LandREntitycreateNewEntity (const geos::geom::Geometry *Geom, unsigned int OfldId)
 Creates a new LineStringEntity. 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

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

Constructor & Destructor Documentation

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

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

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

Creates a new LineStringGraph initialized from a VectorDataset.

virtual openfluid::landr::LineStringGraph::~LineStringGraph ( )
virtual

Member Function Documentation

virtual void openfluid::landr::LineStringGraph::addEntity ( LandREntity Entity)
protectedvirtual
static LineStringGraph* openfluid::landr::LineStringGraph::create ( openfluid::core::GeoVectorValue Val)
static

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

Parameters
ValA core::GeoVectorValue which must be composed of one or many LineStrings, and each of them must contain a "OFLD_ID" attribute.
static LineStringGraph* openfluid::landr::LineStringGraph::create ( openfluid::landr::VectorDataset Vect)
static

Creates a new LineStringGraph initialized from a VectorDataset.

Parameters
VectA VectorDataset which must be composed of one or many LineStrings, and each of them must contain a "OFLD_ID" attribute.
static LineStringGraph* openfluid::landr::LineStringGraph::create ( const LandRGraph::Entities_t Entities)
static

Creates a new LineStringGraph initialized with a list of LandREntity.

Parameters
EntitiesA list of LandREntity which must be LineStringEntity.
virtual LandREntity* openfluid::landr::LineStringGraph::createNewEntity ( const geos::geom::Geometry *  Geom,
unsigned int  OfldId 
)
protectedvirtual

Creates a new LineStringEntity.

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

Implements openfluid::landr::LandRGraph.

LineStringEntity* openfluid::landr::LineStringGraph::entity ( int  OfldId)
virtual

Returns a LineStringEntity with OFLD_ID, or 0 if it doesn't exist.

Reimplemented from openfluid::landr::LandRGraph.

std::vector<LineStringEntity*> openfluid::landr::LineStringGraph::getEndLineStringEntities ( )

Returns a vector of LineStringEntity that have no down neighbour, according to the LineStringEntity orientations.

std::multimap<double,LineStringEntity*> openfluid::landr::LineStringGraph::getLineStringEntitiesByMinLength ( double  MinLength,
bool  rmDangle = true,
bool  HighDegree = true 
)

Gets a map of small LineStringEntity under length threshold.

Parameters
MinLengthThe length threshold (in map units).
rmDangle: if true, get also dangles under the threshold.
HighDegree: if true, do not get the if StartNode and EndNode of this LineStringEntitiy are Degree>=3.
Returns
a multimap of LineStringEntity with key is the length of each LineStringEntity.
double openfluid::landr::LineStringGraph::getRasterValueForEntityEndNode ( LineStringEntity Entity)

Fetch the associated raster value corresponding to the LineStringEntity EndNode coordinate.

Parameters
EntityThe LineStringEntity to get the EndNode coordinate from.
Returns
The raster value corresponding to the LineStringEntity EndNode coordinate.
double openfluid::landr::LineStringGraph::getRasterValueForEntityStartNode ( LineStringEntity Entity)

Fetch the associated raster value corresponding to the LineStringEntity StartNode coordinate.

Parameters
EntityThe LineStringEntity to get the StartNode coordinate from.
Returns
The raster value corresponding to the LineStringEntity StartNode coordinate.
std::vector<LineStringEntity*> openfluid::landr::LineStringGraph::getStartLineStringEntities ( )

Returns a vector of LineStringEntity that have no up neighbour, according to the LineStringEntity orientations.

LandRGraph::GraphType openfluid::landr::LineStringGraph::getType ( )
virtual

Returns the type of graph.

Implements openfluid::landr::LandRGraph.

bool openfluid::landr::LineStringGraph::isLineStringGraphArborescence ( )

Returns true if this LineStringGraph is an arborescence, false otherwise.

An arborescence is a graph with no loop; edges can be well directed or not.

LineStringEntity* openfluid::landr::LineStringGraph::lastLineStringEntity ( )

Returns the last LineStringEntity of this LineStringGraph, according to the LineStringEntity orientations, ie the one that has no down neighbour.

Returns
The last LineStringEntity or 0 if there is zero or more than one LineStringEntity whith no down neighbour.
void openfluid::landr::LineStringGraph::mergeLineStringEntities ( LineStringEntity Entity,
LineStringEntity EntityToMerge 
)

Merges a LineStringEntity into an other one.

The LineStringEntity to merge is deleted.

Parameters
EntityAn existent LineStringEntity.
EntityToMergeThe LineStringEntity which will be merged into Entity and will be deleted.
void openfluid::landr::LineStringGraph::mergeLineStringEntitiesByMinLength ( double  MinLength,
bool  rmDangle = true 
)

Merges the entities of this LineStringGraph under length threshold.

Parameters
MinLengthThe length threshold (in map units).
rmDangleif true, remove also dangles under the threshold, default is true.
virtual void openfluid::landr::LineStringGraph::removeEntity ( int  OfldId)
virtual

Removes from this LineStringGraph the LineStringEntity with OFLD_ID and its associated nodes.

Parameters
OfldIdThe identifier.

Implements openfluid::landr::LandRGraph.

void openfluid::landr::LineStringGraph::reverseLineStringEntity ( LineStringEntity Entity)

Reverse a LineStringEntity orientation.

Parameters
EntityThe LineStringEntity to reverse.
virtual void openfluid::landr::LineStringGraph::setAttributeFromMeanRasterValues ( const std::string &  AttributeName)
virtual

Creates a new attribute for this LineStringGraph entities, and set for each LineStringEntity this attribute value as the mean of the StartNode altitude and the EndNode altitude.

Parameters
AttributeNameThe name of the attribute to create.

Implements openfluid::landr::LandRGraph.

void openfluid::landr::LineStringGraph::setAttributeFromRasterValueAtEndNode ( const std::string &  AttributeName)

Creates a new attribute for these LineStringGraph entities, and set for each LineStringEntity this attribute value as the associated raster values corresponding to the EndNode LineStringEntity coordinates.

Parameters
AttributeNameThe name of the attribute to create for the EndNode
void openfluid::landr::LineStringGraph::setAttributeFromRasterValueAtStartNode ( const std::string &  AttributeName)

Creates a new attribute for these LineStringGraph entities, and set for each LineStringEntity this attribute value as the associated raster values corresponding to the StartNode LineStringEntity coordinates.

Parameters
AttributeNameThe name of the attribute to create for the StartNode
void openfluid::landr::LineStringGraph::setOrientationByOfldId ( int  OfldId)

Set the orientation of the LineStringGraph with outlet identification by OFLD_ID identifier. Only for LineStringGraph of arborescence type.

Parameters
OfldIdThe identifier of the outlet.

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