Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
openfluid::landr::LandRGraph Class Referenceabstract

Interface for a graph composed of LandREntity. More...

#include <landr/LandRGraph.hpp>

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

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 LandREntityentity (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::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...
 
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 LandREntitycreateNewEntity (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::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

static int m_FileNum
 

Detailed Description

Interface for a graph composed of LandREntity.

Member Typedef Documentation

◆ Entities_t

Member Enumeration Documentation

◆ GraphType

Enumerator
POLYGON 
LINESTRING 

Constructor & Destructor Documentation

◆ LandRGraph() [1/3]

openfluid::landr::LandRGraph::LandRGraph ( )
protected

◆ LandRGraph() [2/3]

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

Creates a new LandRGraph from a core::GeoVectorValue.

◆ LandRGraph() [3/3]

openfluid::landr::LandRGraph::LandRGraph ( const openfluid::landr::VectorDataset Vect)
protected

Creates a new LandRGraph from a VectorDataset.

◆ ~LandRGraph()

virtual openfluid::landr::LandRGraph::~LandRGraph ( )
virtual
Attention
Delete also associated RasterPolygonized if present.

Member Function Documentation

◆ addAGeoRasterValue() [1/2]

void openfluid::landr::LandRGraph::addAGeoRasterValue ( openfluid::core::GeoRasterValue Raster)

Associates a core::GeoRasterValue to this LandRGraph.

Parameters
RasterA core::GeoRasterValue.

Replace associated raster if exists.

◆ addAGeoRasterValue() [2/2]

void openfluid::landr::LandRGraph::addAGeoRasterValue ( const openfluid::landr::RasterDataset Raster)

Associates a RasterDataset to this LandRGraph.

Parameters
RasterA RasterDataset.

Replace associated raster if exists.

◆ addAttribute()

void openfluid::landr::LandRGraph::addAttribute ( const std::string &  AttributeName)

Adds an attribute to this LandRGraph.

Doesn't reset if the AttributeName already exists.

Parameters
AttributeNameThe name of the attribute.

◆ addEntitiesFromEntityList()

void openfluid::landr::LandRGraph::addEntitiesFromEntityList ( const LandRGraph::Entities_t Entities)
protected

Adds LandREntity from a LandREntity list to this LandRGraph.

◆ addEntitiesFromGeoVector()

void openfluid::landr::LandRGraph::addEntitiesFromGeoVector ( )
protected

Adds LandREntity from the associated VectorDataset of this LandRGraph.

◆ addEntity()

virtual void openfluid::landr::LandRGraph::addEntity ( LandREntity Entity)
protectedpure virtual

Adds a LandREntity to this LandRGraph.

Parameters
EntityThe LandREntity to add.

Implemented in openfluid::landr::LineStringGraph, and openfluid::landr::PolygonGraph.

◆ computeNeighbours()

void openfluid::landr::LandRGraph::computeNeighbours ( )

Computes the LandREntity neighbours of each LandREntity of this LandRGraph, according to its type.

◆ createNewEntity()

virtual LandREntity* openfluid::landr::LandRGraph::createNewEntity ( const geos::geom::Geometry *  Geom,
unsigned int  OfldId 
)
protectedpure virtual

Creates a new LandREntity.

Parameters
GeomA geos::geom::Geometry.
OfldIdThe identifier of the new LandREntity.

Implemented in openfluid::landr::LineStringGraph, and openfluid::landr::PolygonGraph.

◆ entity()

virtual LandREntity* openfluid::landr::LandRGraph::entity ( int  OfldId)
virtual

Returns the LandREntity with OfldId, or 0 if it doesn't exist.

Reimplemented in openfluid::landr::LineStringGraph, and openfluid::landr::PolygonGraph.

◆ exportToShp()

void openfluid::landr::LandRGraph::exportToShp ( const std::string &  FilePath,
const std::string &  FileName 
)

Creates on disk a shapefile representing this LandRGraph.

Parameters
FilePathThe path where to create the out file.
FileNameA name for the out file to create, with a .shp extension.

◆ getAttributeNames()

std::vector<std::string> openfluid::landr::LandRGraph::getAttributeNames ( )

Returns a vector of the names of the attributes of this LandRGraph.

◆ getEntities()

Entities_t openfluid::landr::LandRGraph::getEntities ( )

Returns a list of the LandREntity of this LandRGraph.

◆ getEntitiesByOfldId()

std::map<int, LandREntity*> openfluid::landr::LandRGraph::getEntitiesByOfldId ( )

Returns a map of the LandREntity of this LandRGraph and their identifiers.

◆ getOfldIdOrderedEntities()

Entities_t openfluid::landr::LandRGraph::getOfldIdOrderedEntities ( )

Returns a list of the LandREntity of this LandRGraph and sorted by identifier.

◆ getRasterValueForEntityCentroid()

virtual double openfluid::landr::LandRGraph::getRasterValueForEntityCentroid ( const LandREntity Entity)
virtual

Fetchs the associated raster value corresponding to the LandREntity centroid coordinate.

Parameters
EntityThe LandREntity to get the centroid coordinate from.
Returns
The raster value corresponding to the LandREntity centroid coordinate.

◆ getSize()

unsigned int openfluid::landr::LandRGraph::getSize ( ) const

Gets the number of LandREntity in the LandRGraph.

◆ getType()

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

Returns the type of graph.

Implemented in openfluid::landr::LineStringGraph, and openfluid::landr::PolygonGraph.

◆ hasAnAssociatedRaster()

bool openfluid::landr::LandRGraph::hasAnAssociatedRaster ( )

Returns true if this LandRGraph has an associated raster, false otherwise.

◆ node()

geos::planargraph::Node* openfluid::landr::LandRGraph::node ( const geos::geom::Coordinate &  Coordinate)
protected

Returns a geos::planagraph::Node of this LandRGraph from a geos::geom::Coordinate.

Parameters
CoordinateA geos::geom::Coordinate.
Returns
A geos::planargraph::Node.

◆ rasterPolygonized()

openfluid::landr::VectorDataset* openfluid::landr::LandRGraph::rasterPolygonized ( )

Transforms the associated raster value into an openfluid::landr::VectorDataset of polygons.

Returns
An openfluid::landr::VectorDataset of the created polygons.

◆ rasterPolygonizedPolys()

std::vector<geos::geom::Polygon*>* openfluid::landr::LandRGraph::rasterPolygonizedPolys ( )

Transforms the associated raster value into a vector of geos::geom::Polygon.

Returns
A vector of the created geos::geom::Polygon.

◆ removeAttribute()

void openfluid::landr::LandRGraph::removeAttribute ( const std::string &  AttributeName)

Removes an attribute to this LandRGraph.

Does nothing if AttributeName doesn't exist.

Parameters
AttributeNameThe name of the attribute.

◆ removeEntity()

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.

Parameters
OfldIdThe identifier.

Implemented in openfluid::landr::PolygonGraph, and openfluid::landr::LineStringGraph.

◆ removeUnusedNodes()

void openfluid::landr::LandRGraph::removeUnusedNodes ( )

Removes from this LandRGraph the nodes of degree 0.

◆ setAttributeFromMeanRasterValues()

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.

Parameters
AttributeNameThe name of the attribute to create.

Implemented in openfluid::landr::LineStringGraph, and openfluid::landr::PolygonGraph.

◆ setAttributeFromRasterValueAtCentroid()

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.

Parameters
AttributeNameThe name of the attribute to create.

◆ setAttributeFromVectorId() [1/2]

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.

Parameters
AttributeNameThe name of the attribute to create.
VectorThe Name of the core::GeoVectorValue.
IdColumnThe ID number column of the core::GeoVectorValue.
ValueColumnThe column of the core::GeoVectorValue to upload.

◆ setAttributeFromVectorId() [2/2]

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.

Parameters
AttributeNameThe name of the attribute to create.
VectorThe Name of the VectorDataset.
IdColumnThe ID number column of the landr::VectorDataset.
ValueColumnThe column of the landr::VectorDataset to upload.

◆ setAttributeFromVectorLocation() [1/2]

virtual void openfluid::landr::LandRGraph::setAttributeFromVectorLocation ( const std::string &  AttributeName,
openfluid::core::GeoVectorValue Vector,
const std::string &  Column,
double  Thresh = 0.0001 
)
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.

Parameters
AttributeNameThe name of the attribute to create.
VectorThe Name of the core::GeoVectorValue.
ColumnThe column of the core::GeoVectorValue to upload.
ThreshThe threshold of minimum distance between the core::GeoVectorValue geometry and the LandRGraph geometry.

◆ setAttributeFromVectorLocation() [2/2]

virtual void openfluid::landr::LandRGraph::setAttributeFromVectorLocation ( const std::string &  AttributeName,
openfluid::landr::VectorDataset Vector,
const std::string &  Column,
double  Thresh = 0.0001 
)
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.

Parameters
AttributeNameThe name of the attribute to create.
VectorThe Name of the VectorDataset.
ColumnThe column of the VectorDataset to upload.
ThreshThe threshold of minimum distance between the VectorDataset geometry and the LandRGraph geometry.

◆ snapVertices()

void openfluid::landr::LandRGraph::snapVertices ( double  snapTolerance)

Snap the vertices of this LandRGraph under a threshold.

Parameters
snapToleranceThe threshold.

Member Data Documentation

◆ m_Entities

Entities_t openfluid::landr::LandRGraph::m_Entities
protected

A list of the LandREntity of this LandRGraph.

◆ m_EntitiesByOfldId

std::map<int, LandREntity*> openfluid::landr::LandRGraph::m_EntitiesByOfldId
protected

A map of the LandREntity of this LandRGraph and sorted by identifier.

◆ m_FileNum

int openfluid::landr::LandRGraph::m_FileNum
staticprotected

◆ mp_Factory

const geos::geom::GeometryFactory* openfluid::landr::LandRGraph::mp_Factory
protected

The geos::geom::GeometryFactory used to build this LandRGraph.

◆ mp_Raster

openfluid::landr::RasterDataset* openfluid::landr::LandRGraph::mp_Raster
protected

The RasterDataset associated to this LandRGraph.

◆ mp_RasterPolygonized

openfluid::landr::VectorDataset* openfluid::landr::LandRGraph::mp_RasterPolygonized
protected

The VectorDataset representation of the RasterDataset associated to this LandRGraph.

◆ mp_RasterPolygonizedPolys

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.

◆ mp_Vector

openfluid::landr::VectorDataset* openfluid::landr::LandRGraph::mp_Vector
protected

The VectorDataset associated to this LandRGraph.


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