30 #include "../../common/progress/TaskProgress.h" 
   31 #include "../../common/StringUtils.h" 
   32 #include "../../common/STLUtils.h" 
   33 #include "../../common/Translator.h" 
   34 #include "../../dataaccess/datasource/DataSource.h" 
   35 #include "../../dataaccess/datasource/DataSourceFactory.h" 
   36 #include "../../datatype/AbstractData.h" 
   37 #include "../../geometry/GeometryProperty.h" 
   38 #include "../../geometry/MultiPolygon.h" 
   39 #include "../../geometry/Point.h" 
   40 #include "../../geometry/Polygon.h" 
   41 #include "../../sam/rtree.h" 
   42 #include "../core/AbstractGraphFactory.h" 
   43 #include "../core/Edge.h" 
   44 #include "../core/Vertex.h" 
   45 #include "../core/VertexProperty.h" 
   46 #include "../graphs/Graph.h" 
   47 #include "../Config.h" 
   48 #include "../Exception.h" 
   62   const std::map<std::string, std::string>& dsInfo, 
const std::string& graphType, 
const std::map<std::string, std::string>& gInfo)
 
   69   if(createVertexObjects(shapeFileName, linkColumn, srid) == 
false)
 
   74   if(createEdgeObjects(shapeFileName, linkColumn) == 
false)
 
   96   std::map<std::string, std::string> connInfo;
 
   97   connInfo[
"path"] = fileName;
 
   99   ds->setConnectionInfo(connInfo);
 
  109   std::string dsName = names[0];
 
  111   std::auto_ptr<te::da::DataSet> dataset = ds->
getDataSet(dsName);
 
  120   std::string dsName = names[0];
 
  128   std::auto_ptr<te::da::DataSource> ds = getDataSource(shapeFileName);
 
  136   std::auto_ptr<te::da::DataSet> dataSet = getDataSet(ds.get());
 
  138   if(dataSet.get() == 0)
 
  149   m_graph->addVertexProperty(gProp);
 
  152   std::string geomColumn = 
"";
 
  153   if(getGeometryColumn(shapeFileName, geomColumn) == 
false)
 
  159   while(dataSet->moveNext())
 
  161     int id = dataSet->getInt32(linkColumn);
 
  204   std::auto_ptr<te::da::DataSource> ds = getDataSource(shapeFileName);
 
  212   std::auto_ptr<te::da::DataSet> dataSet = getDataSet(ds.get());
 
  214   if(dataSet.get() == 0)
 
  220   std::string geomColumn = 
"";
 
  221   if(getGeometryColumn(shapeFileName, geomColumn) == 
false)
 
  227   std::map<int, te::gm::Geometry*> geomMap;
 
  229   while(dataSet->moveNext())
 
  231     int id = dataSet->getInt32(linkColumn);
 
  237     geomMap.insert(std::map<int, te::gm::Geometry*>::value_type(
id, g));
 
  240   dataSet->moveBeforeFirst();
 
  245   task.
setMessage(
"RAG Builder - Extracting Edges");
 
  248   while(dataSet->moveNext())
 
  250     int vFromId = dataSet->getInt32(linkColumn);
 
  252     std::auto_ptr<te::gm::Geometry> g = dataSet->getGeometry(geomColumn);
 
  254     std::vector<int> results;
 
  256     rtree.
search(*g->getMBR(), results);
 
  258     for(
size_t t = 0; t < results.size(); ++t)
 
  260       std::map<int, te::gm::Geometry*>::iterator it = geomMap.find(results[t]);
 
  262       if(it != geomMap.end())
 
  264         if(g->touches(it->second))
 
  266           int edgeId = getEdgeId();
 
  268           int vToId = results[t];
 
  270           Edge* e = 
new Edge(edgeId, vFromId, vToId);
 
  289   std::auto_ptr<te::da::DataSource> ds = getDataSource(shapeFileName);
 
  297   boost::ptr_vector<te::dt::Property> properties = getProperties(ds.get());
 
  299   if(properties.empty())
 
  304   boost::ptr_vector<te::dt::Property>::iterator it = properties.begin();
 
  305   while(it != properties.end())
 
  309       columnName = it->getName();
 
  315   if(columnName.empty())
 
MultiPolygon is a MultiSurface whose elements are Polygons. 
 
void setAttributeVecSize(int size)
This function is used to set the number of attributes associated with the vertex elements. 
 
std::auto_ptr< te::da::DataSet > getDataSet(te::da::DataSource *ds)
Function used to get the data set with the vectorial data. 
 
void setMessage(const std::string &message)
Set the task message. 
 
void setSRID(int srid)
It sets the spatial reference system identifier associated to this property. 
 
void setGeometryType(GeomType t)
It sets the geometry subtype. 
 
virtual boost::ptr_vector< te::dt::Property > getProperties(const std::string &datasetName)
It retrieves the properties of the dataset. 
 
A class that represents an R-tree. 
 
This class can be used to inform the progress of a task. 
 
bool getGeometryColumn(const std::string &shapeFileName, std::string &columnName)
Function used to get the geometry column name. 
 
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
 
This class defines the RAG strategy to build a graph,. 
 
int m_edgeId
Attribute used as a index counter for edge objects. 
 
int getEdgeId()
Function used to generated the edge id. 
 
From the point of view of graph theory, vertices are treated as featureless and indivisible objects...
 
void setTotalSteps(int value)
Set the task total stepes. 
 
void setId(unsigned int id)
It sets the property identifier. 
 
bool build(const std::string &shapeFileName, const std::string &linkColumn, const int &srid, const std::map< std::string, 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. 
 
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
 
A point with x and y coordinate values. 
 
An Envelope defines a 2D rectangular region. 
 
void setSRID(int srid)
It sets the Spatial Reference System ID of the Point. 
 
boost::ptr_vector< te::dt::Property > getProperties(te::da::DataSource *ds)
Function used to get the data source properties. 
 
static std::auto_ptr< DataSource > make(const std::string &dsType)
 
bool createVertexObjects(const std::string &shapeFileName, const std::string &linkColumn, const int &srid)
Function used to create all vertex object based on vectorial data. 
 
virtual std::auto_ptr< DataSet > getDataSet(const std::string &name, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It gets the dataset identified by the given name. This method always returns a disconnected dataset...
 
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1. 
 
A base class for values that can be retrieved from the data access module. 
 
std::auto_ptr< te::da::DataSource > getDataSource(const std::string fileName)
Function used to get the data source with the vectorial data. 
 
virtual std::vector< std::string > getDataSetNames()
It gets the dataset names available in the data source. 
 
int search(const te::gm::Envelope &mbr, std::vector< DATATYPE > &report) const 
Range search query. 
 
virtual ~RAGGraphBuilder()
Virtual destructor. 
 
GeomType getGeomTypeId() const 
It returns the geometry subclass type identifier. 
 
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards. 
 
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings. 
 
void insert(const te::gm::Envelope &mbr, const DATATYPE &data)
It inserts an item into the tree. 
 
Point * getCentroid() const 
It returns the mathematical centroid for this surface as a point. 
 
RAGGraphBuilder()
Default constructor. 
 
void addAttribute(int idx, te::dt::AbstractData *ad)
Add a new attribute to this element. 
 
static AbstractGraph * make()
It creates and returns an empty graph with default graph type. 
 
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
 
const Envelope * getMBR() const 
It returns the minimum bounding rectangle for the geometry in an internal representation. 
 
This abstract class provides the common functions for graph builder classes. Each builder strategy ha...
 
virtual void setSRID(int srid)=0
It sets the Spatial Reference System ID of the geometry and all its parts if it is a GeometryCollecti...
 
bool createEdgeObjects(const std::string &shapeFileName, const std::string &linkColumn)
Function used to create all edges object based on vectorial data.