All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
te::graph::FlowGraphBuilder Class Reference

This class defines the Flow strategy to build a graph. More...

#include <FlowGraphBuilder.h>

Inheritance diagram for te::graph::FlowGraphBuilder:
te::graph::AbstractGraphBuilder

Public Member Functions

 FlowGraphBuilder ()
 Default constructor. More...
 
virtual ~FlowGraphBuilder ()
 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 &csvFileName, const int &fromIdx, const int &toIdx, const int &weightIdx, const std::map< std::string, std::string > &dsInfo, const std::string &graphType, const std::map< std::string, std::string > &gInfo)
 Function used to build the output graph based on input parameters. 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 &csvFileName, const int &fromIdx, const int &toIdx, const int &weightIdx)
 Function used to create all edges object based on flow table 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::auto_ptr< te::da::DataSetgetDataSet (te::da::DataSource *ds)
 Function used to get the data set with the vectorial data. More...
 
std::auto_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...
 
boost::ptr_vector
< te::dt::Property
getProperties (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 Flow strategy to build a graph.

This function needs a vectorial data and table with flow information, this table must have the origin and destination info about each flow.

Note
For now the the shapefile must have only polygon geometries and the flow table must be a CSV file.
See also
AbstractGraphBuilder

Definition at line 73 of file FlowGraphBuilder.h.

Constructor & Destructor Documentation

te::graph::FlowGraphBuilder::FlowGraphBuilder ( )

Default constructor.

Definition at line 60 of file FlowGraphBuilder.cpp.

References m_edgeId.

te::graph::FlowGraphBuilder::~FlowGraphBuilder ( )
virtual

Virtual destructor.

Definition at line 65 of file FlowGraphBuilder.cpp.

Member Function Documentation

bool te::graph::FlowGraphBuilder::build ( const std::string &  shapeFileName,
const std::string &  linkColumn,
const int &  srid,
const std::string &  csvFileName,
const int &  fromIdx,
const int &  toIdx,
const int &  weightIdx,
const std::map< std::string, std::string > &  dsInfo,
const std::string &  graphType,
const std::map< std::string, std::string > &  gInfo 
)

Function used to build the output graph based on input parameters.

Parameters
shapeFileNameFile name wiht vectorial data
linkColumnColumn name from vectorial data used as link column
sridVectorial projection id
csvFileNameCSV File name with flow data
fromIdxIndex for column table with origin information.
toIdxIndex for column table with destiny information.
weightIdxIndex for column table with weight information.
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 69 of file FlowGraphBuilder.cpp.

References te::graph::AbstractGraphFactory::make().

bool te::graph::FlowGraphBuilder::createEdgeObjects ( const std::string &  csvFileName,
const int &  fromIdx,
const int &  toIdx,
const int &  weightIdx 
)
protected

Function used to create all edges object based on flow table data.

Parameters
csvFileNameCSV File name with flow data
fromIdxIndex for column table with origin information.
toIdxIndex for column table with destiny information.
weightIdxIndex for column table with weight information.
Returns
True if the edges was created correctly and false in othe case

Definition at line 264 of file FlowGraphBuilder.cpp.

References te::dt::INT32_TYPE, te::dt::Property::setId(), and te::dt::Property::setParent().

bool te::graph::FlowGraphBuilder::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 131 of file FlowGraphBuilder.cpp.

References te::graph::Vertex::addAttribute(), te::dt::Property::clone(), te::common::Convert2UCase(), te::dt::GEOMETRY_TYPE, te::gm::CurvePolygon::getCentroid(), te::gm::Geometry::getGeomTypeId(), te::gm::MultiPolygonType, te::gm::PointType, te::gm::PolygonType, te::graph::Vertex::setAttributeVecSize(), te::gm::GeometryProperty::setGeometryType(), te::dt::Property::setId(), te::dt::Property::setParent(), te::gm::GeometryProperty::setSRID(), te::gm::AbstractPoint::setSRID(), and te::gm::Geometry::setSRID().

std::auto_ptr< te::da::DataSet > te::graph::FlowGraphBuilder::getDataSet ( te::da::DataSource ds)
protected

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

Returns
Data set.

Definition at line 111 of file FlowGraphBuilder.cpp.

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

std::auto_ptr< te::da::DataSource > te::graph::FlowGraphBuilder::getDataSource ( const std::string  fileName)
protected

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

Returns
Data source.

Definition at line 99 of file FlowGraphBuilder.cpp.

References te::da::DataSourceFactory::make().

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

Function used to generated the edge id.

Returns
Integer value as ID

Definition at line 90 of file FlowGraphBuilder.cpp.

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

Get error message.

Definition at line 43 of file AbstractGraphBuilder.cpp.

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

Get generated graph.

Definition at line 48 of file AbstractGraphBuilder.cpp.

boost::ptr_vector< te::dt::Property > te::graph::FlowGraphBuilder::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 122 of file FlowGraphBuilder.cpp.

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

Member Data Documentation

int te::graph::FlowGraphBuilder::m_edgeId
private

Attribute used as a index counter for edge objects.

Definition at line 173 of file FlowGraphBuilder.h.

Referenced by FlowGraphBuilder().

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

Error message.

Definition at line 84 of file AbstractGraphBuilder.h.

Referenced by te::graph::AbstractGraphBuilder::AbstractGraphBuilder().

boost::shared_ptr<AbstractGraph> te::graph::AbstractGraphBuilder::m_graph
protectedinherited

Graph object.

Definition at line 82 of file AbstractGraphBuilder.h.

Referenced by te::graph::AbstractGraphBuilder::AbstractGraphBuilder().


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