27 #include "../../common/Exception.h" 28 #include "../../core/translator/Translator.h" 29 #include "../../common/STLUtils.h" 30 #include "../../common/progress/TaskProgress.h" 31 #include "../../dataaccess/datasource/DataSource.h" 32 #include "../../dataaccess/utils/Utils.h" 33 #include "../../datatype/SimpleData.h" 34 #include "../../datatype/SimpleProperty.h" 35 #include "../../geometry/Point.h" 36 #include "../../graph/core/Edge.h" 37 #include "../../graph/core/Vertex.h" 72 std::map<int, te::gm::Geometry*> geomMap;
74 dataSet->moveBeforeFirst();
76 while(dataSet->moveNext())
80 int id = atoi(strId.c_str());
87 geomMap.insert(std::map<int, te::gm::Geometry*>::value_type(
id, g));
97 dataSet->moveBeforeFirst();
99 while(dataSet->moveNext())
103 int vFromId = atoi(strIdFrom.c_str());
105 std::unique_ptr<te::gm::Geometry> g = dataSet->getGeometry(geomPos);
107 std::vector<int> results;
109 rtree.
search(*g->getMBR(), results);
111 for(
size_t t = 0; t < results.size(); ++t)
113 std::map<int, te::gm::Geometry*>::iterator it = geomMap.find(results[t]);
115 if(it != geomMap.end())
117 if(g->touches(it->second) || g->intersects(it->second))
121 int vToId = results[t];
void setMessage(const std::string &message)
Set the task message.
void setAttributeVecSize(int size)
This function is used to set the number of attributes associated with the edge elements.
virtual double distance(const Geometry *const rhs) const _NOEXCEPT_OP(false)
It returns the shortest distance between any two points in the two geometry objects.
This class can be used to inform the progress of a task.
std::vector< te::dt::AbstractData * > & getAttributes()
It returns the vector of attributes associated with this element.
#define TE_TR(message)
It marks a string in order to get translated.
te::da::DataSource * m_ds
Data Source pointer.
virtual void constructStrategy()
Build the edges using specific strategy.
virtual void add(Vertex *v)=0
Add a new vertex element to a graph.
bool isActive() const
Verify if the task is active.
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.
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
TEDATAACCESSEXPORT std::size_t GetFirstSpatialPropertyPos(const te::da::DataSet *dataset)
It returns the first dataset spatial property or NULL if none is found.
A point with x and y coordinate values.
An Envelope defines a 2D rectangular region.
int getEdgeId()
Function used to generated the edge id.
This class defines a an adjacency strategy class for a GPM constructor.
GeneralizedProximityMatrix * m_gpm
GPM Pointer.
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
int search(const te::gm::Envelope &mbr, std::vector< DATATYPE > &report) const
Range search query.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
GPMConstructorStrategyType m_type
Constructor Type.
virtual std::unique_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...
std::string getDataSetName()
GPMConstructorAdjacencyStrategy()
Default constructor.
std::string getAttributeName()
void insert(const te::gm::Envelope &mbr, const DATATYPE &data)
It inserts an item into the tree.
virtual ~GPMConstructorAdjacencyStrategy()
Virtual destructor.
A template for atomic data types (integers, floats, strings and others).
void createDistanceAttribute(GeneralizedProximityMatrix *gpm)
Added to the edge a new attribute for distance information.
virtual te::graph::Vertex * getVertex(int id)=0
It returns the vertex element if it's exist.
void addAttribute(int idx, te::dt::AbstractData *ad)
Add a new attribute to this element.
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...
te::graph::AbstractGraph * getGraph()
This class defines the GPM class.