te::graph::RAGGraphBuilder Class Reference

This class defines the RAG strategy to build a graph,. More...

#include <RAGGraphBuilder.h>

Inheritance diagram for te::graph::RAGGraphBuilder:
te::graph::AbstractGraphBuilder

Public Member Functions

 RAGGraphBuilder ()
 Default constructor. More...
 
virtual ~RAGGraphBuilder ()
 Virtual destructor. More...
 
Methods

Methods used by this builder

bool build (const std::string &shapeFileName, const std::string &linkColumn, const int &srid, const std::string &dsInfo, const std::string &graphType, const std::map< std::string, std::string > &gInfo)
 Function used to generated a graph using the RAG strategy. More...
 
Abstract Methods

Method common to each graph builder

std::string getErrorMessage ()
 Get error message. More...
 
boost::shared_ptr< AbstractGraphgetGraph ()
 Get generated graph. More...
 

Protected Member Functions

bool createEdgeObjects (const std::string &shapeFileName, const std::string &linkColumn)
 Function used to create all edges object based on vectorial data. More...
 
bool createVertexObjects (const std::string &shapeFileName, const std::string &linkColumn, const int &srid)
 Function used to create all vertex object based on vectorial data. More...
 
std::unique_ptr< te::da::DataSetgetDataSet (te::da::DataSource *ds)
 Function used to get the data set with the vectorial data. More...
 
std::unique_ptr< te::da::DataSourcegetDataSource (const std::string &fileName)
 Function used to get the data source with the vectorial data. More...
 
int getEdgeId ()
 Function used to generated the edge id. More...
 
bool getGeometryColumn (const std::string &shapeFileName, std::string &columnName)
 Function used to get the geometry column name. More...
 
boost::ptr_vector< te::dt::PropertygetProperties (te::da::DataSource *ds)
 Function used to get the data source properties. More...
 

Protected Attributes

std::string m_errorMessage
 Error message. More...
 
boost::shared_ptr< AbstractGraphm_graph
 Graph object. More...
 

Private Attributes

int m_edgeId
 Attribute used as a index counter for edge objects. More...
 

Detailed Description

This class defines the RAG strategy to build a graph,.

This is strategy is based on adjacency of a region.

See also
AbstractGraphBuilder

Definition at line 66 of file RAGGraphBuilder.h.

Constructor & Destructor Documentation

te::graph::RAGGraphBuilder::RAGGraphBuilder ( )

Default constructor.

Definition at line 52 of file RAGGraphBuilder.cpp.

References m_edgeId, and ~RAGGraphBuilder().

te::graph::RAGGraphBuilder::~RAGGraphBuilder ( )
virtualdefault

Virtual destructor.

Referenced by RAGGraphBuilder().

Member Function Documentation

bool te::graph::RAGGraphBuilder::build ( const std::string &  shapeFileName,
const std::string &  linkColumn,
const int srid,
const std::string &  dsInfo,
const std::string &  graphType,
const std::map< std::string, std::string > &  gInfo 
)

Function used to generated a graph using the RAG strategy.

Parameters
shapeFileNameFile name wiht vectorial data
linkColumnColumn name from vectorial data used as link column
sridVectorial projection id
dsInfoContainer with data source information
graphTypeAttribute used to define the output graph type
gInfoContainer with graph generation parameters
Returns
True if the graph was correctly generated and false in other case.

Definition at line 59 of file RAGGraphBuilder.cpp.

References createEdgeObjects(), createVertexObjects(), te::graph::AbstractGraphBuilder::m_graph, and te::graph::AbstractGraphFactory::make().

bool te::graph::RAGGraphBuilder::createEdgeObjects ( const std::string &  shapeFileName,
const std::string &  linkColumn 
)
protected

Function used to create all edges object based on vectorial data.

Parameters
shapeFileNameFile name wiht vectorial data
linkColumnColumn name from vectorial data used as link column
Returns
True if the edges was created correctly and false in othe case

Definition at line 196 of file RAGGraphBuilder.cpp.

References ds, te::common::FreeContents(), getDataSet(), getDataSource(), getEdgeId(), getGeometryColumn(), te::gm::Geometry::getMBR(), te::sam::rtree::Index< DATATYPE, MAXNODES, MINNODES >::insert(), te::graph::AbstractGraphBuilder::m_graph, te::common::TaskProgress::pulse(), te::sam::rtree::Index< DATATYPE, MAXNODES, MINNODES >::search(), te::common::TaskProgress::setMessage(), and te::common::TaskProgress::setTotalSteps().

Referenced by build().

bool te::graph::RAGGraphBuilder::createVertexObjects ( const std::string &  shapeFileName,
const std::string &  linkColumn,
const int srid 
)
protected

Function used to create all vertex object based on vectorial data.

Parameters
shapeFileNameFile name wiht vectorial data
linkColumnColumn name from vectorial data used as link column
sridVectorial projection id
Returns
True if the vertexs was created correctly and false in othe case

Definition at line 120 of file RAGGraphBuilder.cpp.

References te::graph::Vertex::addAttribute(), ds, te::gm::CurvePolygon::getCentroid(), getDataSet(), getDataSource(), getGeometryColumn(), te::gm::Geometry::getGeomTypeId(), te::graph::AbstractGraphBuilder::m_graph, te::gm::MultiPolygonType, p, te::gm::PointType, te::gm::PolygonType, te::graph::Vertex::setAttributeVecSize(), te::gm::GeometryProperty::setGeometryType(), te::dt::Property::setId(), te::gm::GeometryProperty::setSRID(), te::gm::Point::setSRID(), and te::gm::Geometry::setSRID().

Referenced by build().

std::unique_ptr< te::da::DataSet > te::graph::RAGGraphBuilder::getDataSet ( te::da::DataSource ds)
protected

Function used to get the data set with the vectorial data.

Returns
Data set.

Definition at line 100 of file RAGGraphBuilder.cpp.

References te::da::DataSource::getDataSet(), and te::da::DataSource::getDataSetNames().

Referenced by createEdgeObjects(), and createVertexObjects().

std::unique_ptr< te::da::DataSource > te::graph::RAGGraphBuilder::getDataSource ( const std::string &  fileName)
protected

Function used to get the data source with the vectorial data.

Returns
Data source.

Definition at line 91 of file RAGGraphBuilder.cpp.

References ds, and te::da::DataSourceFactory::make().

Referenced by createEdgeObjects(), createVertexObjects(), and getGeometryColumn().

int te::graph::RAGGraphBuilder::getEdgeId ( )
protected

Function used to generated the edge id.

Returns
Integer value as ID

Definition at line 81 of file RAGGraphBuilder.cpp.

References m_edgeId.

Referenced by createEdgeObjects().

std::string te::graph::AbstractGraphBuilder::getErrorMessage ( )
inherited

Get error message.

Definition at line 41 of file AbstractGraphBuilder.cpp.

References te::graph::AbstractGraphBuilder::m_errorMessage.

Referenced by CreateLDDGraph().

bool te::graph::RAGGraphBuilder::getGeometryColumn ( const std::string &  shapeFileName,
std::string &  columnName 
)
protected

Function used to get the geometry column name.

Parameters
shapeFileNameFile name wiht vectorial data
columnNameUsed to set the geometry column name
Returns
True if the the vectorial data was a geometry column and false in othe case

Definition at line 281 of file RAGGraphBuilder.cpp.

References ds, te::dt::GEOMETRY_TYPE, getDataSource(), and getProperties().

Referenced by createEdgeObjects(), and createVertexObjects().

boost::shared_ptr< te::graph::AbstractGraph > te::graph::AbstractGraphBuilder::getGraph ( )
inherited

Get generated graph.

Definition at line 46 of file AbstractGraphBuilder.cpp.

References te::graph::AbstractGraphBuilder::m_graph.

Referenced by CreateLDDGraph().

boost::ptr_vector< te::dt::Property > te::graph::RAGGraphBuilder::getProperties ( te::da::DataSource ds)
protected

Function used to get the data source properties.

Returns
A vector with all properties from a data source

Definition at line 111 of file RAGGraphBuilder.cpp.

References te::da::DataSource::getDataSetNames(), and te::da::DataSource::getProperties().

Referenced by getGeometryColumn().

Member Data Documentation

int te::graph::RAGGraphBuilder::m_edgeId
private

Attribute used as a index counter for edge objects.

Definition at line 171 of file RAGGraphBuilder.h.

Referenced by getEdgeId(), and RAGGraphBuilder().

std::string te::graph::AbstractGraphBuilder::m_errorMessage
protectedinherited

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