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

This class defines functions used to load and save graphs using GAL and GWT formats, both formats use a ' ' as separator. More...

#include <SpatialWeightsExchanger.h>

Public Member Functions

void exportToGAL (te::graph::AbstractGraph *g, std::string pathFileName, std::string dataSetName="", std::string propertyName="")
 Function used to export a graph to Spatial Weights File GAL Format. More...
 
void exportToGWT (te::graph::AbstractGraph *g, std::string pathFileName, int distAttrIdx, std::string dataSetName="", std::string propertyName="")
 Function used to export a graph to Spatial Weights File GWT Format. More...
 
te::graph::AbstractGraphimportFromGAL (std::string pathFileName, std::map< std::string, std::string > dsInfo, std::string graphType, std::map< std::string, std::string > gInfo, te::da::DataSource *ds=0)
 Function used to import a graph from a Spatial Weights File GAL Format. More...
 
te::graph::AbstractGraphimportFromGWT (std::string pathFileName, std::map< std::string, std::string > dsInfo, std::string graphType, std::map< std::string, std::string > gInfo, te::da::DataSource *ds=0)
 Function used to import a graph from a Spatial Weights File GWT Format. More...
 
 SpatialWeightsExchanger ()
 Default constructor. More...
 
 ~SpatialWeightsExchanger ()
 Virtual destructor. More...
 

Protected Member Functions

void associateGeometry (te::graph::AbstractGraph *g, te::da::DataSource *ds, std::string dataSetName, std::string propertyName)
 Function used to associate the geometry coord attribute to vertex objects. More...
 
int getEdgeId ()
 Function used to generated the edge id. More...
 

Private Attributes

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

Detailed Description

This class defines functions used to load and save graphs using GAL and GWT formats, both formats use a ' ' as separator.

Definition at line 74 of file SpatialWeightsExchanger.h.

Constructor & Destructor Documentation

te::graph::SpatialWeightsExchanger::SpatialWeightsExchanger ( )

Default constructor.

Definition at line 73 of file SpatialWeightsExchanger.cpp.

te::graph::SpatialWeightsExchanger::~SpatialWeightsExchanger ( )

Virtual destructor.

Definition at line 77 of file SpatialWeightsExchanger.cpp.

Member Function Documentation

void te::graph::SpatialWeightsExchanger::associateGeometry ( te::graph::AbstractGraph g,
te::da::DataSource ds,
std::string  dataSetName,
std::string  propertyName 
)
protected
void te::graph::SpatialWeightsExchanger::exportToGAL ( te::graph::AbstractGraph g,
std::string  pathFileName,
std::string  dataSetName = "",
std::string  propertyName = "" 
)

Function used to export a graph to Spatial Weights File GAL Format.

Parameters
gPointer to a valid graph
pathFileNamePath and file name (with extension) for file creation.
dataSetNameData Set name that contains the geometry information
propertyNameThe attribute name used as vertex id and dataset id column

Definition at line 81 of file SpatialWeightsExchanger.cpp.

References te::graph::GraphMetadata::getDataSource(), te::graph::AbstractGraph::getEdge(), te::graph::Vertex::getId(), te::graph::Edge::getIdFrom(), te::graph::Edge::getIdTo(), te::graph::AbstractGraph::getMetadata(), and te::graph::Vertex::getNeighborhood().

void te::graph::SpatialWeightsExchanger::exportToGWT ( te::graph::AbstractGraph g,
std::string  pathFileName,
int  distAttrIdx,
std::string  dataSetName = "",
std::string  propertyName = "" 
)

Function used to export a graph to Spatial Weights File GWT Format.

Parameters
gPointer to a valid graph
pathFileNamePath and file name (with extension) for file creation.
dataSetNameData Set name that contains the geometry information
propertyNameThe attribute name used as vertex id and dataset id column

Definition at line 269 of file SpatialWeightsExchanger.cpp.

References te::graph::Edge::getAttributes(), te::graph::GraphMetadata::getDataSource(), te::graph::Edge::getIdFrom(), te::graph::Edge::getIdTo(), te::graph::AbstractGraph::getMetadata(), and te::dt::SimpleData< T, typeCode >::getValue().

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

Function used to generated the edge id.

Returns
Integer value as ID

Definition at line 433 of file SpatialWeightsExchanger.cpp.

te::graph::AbstractGraph * te::graph::SpatialWeightsExchanger::importFromGAL ( std::string  pathFileName,
std::map< std::string, std::string >  dsInfo,
std::string  graphType,
std::map< std::string, std::string >  gInfo,
te::da::DataSource ds = 0 
)

Function used to import a graph from a Spatial Weights File GAL Format.

Parameters
pathFileNamePath and file name (with extension) with Spatial Weights information.
dsInfoContainer with data source information
graphTypeAttribute used to define the output graph type
gInfoContainer with graph generation parameters
dsPointer to a datasource in case the gal file has the shapefile information.
Returns
A Valid graph pointer if the file was correctly readed and null pointer in other case.

Definition at line 149 of file SpatialWeightsExchanger.cpp.

References te::graph::AbstractGraph::add(), te::graph::AbstractGraph::getVertex(), and te::graph::AbstractGraphFactory::make().

te::graph::AbstractGraph * te::graph::SpatialWeightsExchanger::importFromGWT ( std::string  pathFileName,
std::map< std::string, std::string >  dsInfo,
std::string  graphType,
std::map< std::string, std::string >  gInfo,
te::da::DataSource ds = 0 
)

Function used to import a graph from a Spatial Weights File GWT Format.

Parameters
pathFileNamePath and file name (with extension) with Spatial Weights information.
dsInfoContainer with data source information
graphTypeAttribute used to define the output graph type
gInfoContainer with graph generation parameters
dsPointer to a datasource in case the gwt file has the shapefile information.
Returns
A Valid graph pointer if the file was correctly readed and null pointer in other case.

Definition at line 320 of file SpatialWeightsExchanger.cpp.

References te::graph::AbstractGraph::add(), te::graph::AbstractGraph::addEdgeProperty(), te::dt::DOUBLE_TYPE, te::graph::AbstractGraph::getVertex(), te::graph::AbstractGraphFactory::make(), te::dt::Property::setId(), and te::dt::Property::setParent().

Member Data Documentation

int te::graph::SpatialWeightsExchanger::m_edgeId
private

Attribute used as a index counter for edge objects.

Definition at line 161 of file SpatialWeightsExchanger.h.


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