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

Member Enumeration Documentation

Enumerator
POLYGON 
LINESTRING 

Constructor & Destructor Documentation

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

Creates a new LandRGraph from a core::GeoVectorValue.

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

Creates a new LandRGraph from a VectorDataset.

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

Member Function Documentation

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.

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

Associates a RasterDataset to this LandRGraph.

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

Parameters
AttributeNameThe name of the attribute.
void openfluid::landr::LandRGraph::addEntitiesFromEntityList ( const LandRGraph::Entities_t Entities)
protected

Adds LandREntity from a LandREntity list to this LandRGraph.

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

Adds LandREntity from the associated VectorDataset of this LandRGraph.

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.

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

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

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.

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.

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.
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 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.
unsigned int openfluid::landr::LandRGraph::getSize ( ) const

Gets the number of LandREntity in the LandRGraph.

virtual GraphType openfluid::landr::LandRGraph::getType ( )
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.

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

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

Removes from this LandRGraph the nodes of degree 0.

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.

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.
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.
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.
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.
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.
void openfluid::landr::LandRGraph::snapVertices ( double  snapTolerance)

Snap the vertices of this LandRGraph under a threshold.

Parameters
snapToleranceThe threshold.

Member Data Documentation

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

A list of the LandREntity of this LandRGraph.

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

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

int openfluid::landr::LandRGraph::m_FileNum
staticprotected
const geos::geom::GeometryFactory* openfluid::landr::LandRGraph::mp_Factory
protected

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

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

The RasterDataset associated to this LandRGraph.

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

The VectorDataset representation of the RasterDataset associated to this LandRGraph.

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.

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: