39 #include "../../common/Translator.h"
40 #include "../../common/progress/TaskProgress.h"
41 #include "../../geometry/Coord2D.h"
42 #include "../../geometry/GeometryProperty.h"
43 #include "../../geometry/Point.h"
44 #include "../../raster/Grid.h"
45 #include "../../raster/Raster.h"
46 #include "../core/AbstractGraphFactory.h"
47 #include "../core/Edge.h"
48 #include "../core/GraphMetadata.h"
49 #include "../core/Vertex.h"
50 #include "../core/VertexProperty.h"
51 #include "../graphs/Graph.h"
52 #include "../Config.h"
53 #include "../Exception.h"
74 m_graph->getMetadata()->m_maxVecCacheSize = 5;
75 m_graph->getMetadata()->m_maxCacheSize = 100000;
83 m_graph->addVertexProperty(gProp);
92 for(std::size_t r = 1; r < m_raster->getNumberOfRows(); r++)
94 for(std::size_t c = 1; c < m_raster->getNumberOfColumns(); c++)
98 m_raster->getValue(c, r, val);
100 int value = (int) val;
105 if(getVertexId(r, c, vId) ==
false)
121 if(value == 255 || value == 0)
133 if(getVertexId(r, c + 1, vTo))
135 int edgeId = getEdgeId();
137 Edge* e =
new Edge(edgeId, vFrom, vTo);
148 if(getVertexId(r + 1, c + 1, vTo))
150 int edgeId = getEdgeId();
152 Edge* e =
new Edge(edgeId, vFrom, vTo);
163 if(getVertexId(r + 1, c, vTo))
165 int edgeId = getEdgeId();
167 Edge* e =
new Edge(edgeId, vFrom, vTo);
178 if(getVertexId(r + 1, c - 1, vTo))
180 int edgeId = getEdgeId();
182 Edge* e =
new Edge(edgeId, vFrom, vTo);
193 if(getVertexId(r, c - 1, vTo))
195 int edgeId = getEdgeId();
197 Edge* e =
new Edge(edgeId, vFrom, vTo);
208 if(getVertexId(r - 1, c - 1, vTo))
210 int edgeId = getEdgeId();
212 Edge* e =
new Edge(edgeId, vFrom, vTo);
223 if(getVertexId(r - 1, c, vTo))
225 int edgeId = getEdgeId();
227 Edge* e =
new Edge(edgeId, vFrom, vTo);
238 if(getVertexId(r - 1, c + 1, vTo))
240 int edgeId = getEdgeId();
242 Edge* e =
new Edge(edgeId, vFrom, vTo);
257 if( row < 1 || row > (
int)m_raster->getNumberOfRows() - 1)
262 if( col < 1 || row > (
int)m_raster->getNumberOfColumns() - 1)
269 id = (row * m_raster->getNumberOfColumns()) + col;
void setGeometryType(GeomType t)
It sets the geometry subtype.
static AbstractGraph * make()
It creates and returns an empty graph with default graph type.
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
bool getVertexId(int row, int col, int &id)
Function used to generated the vertex id based on raster coordenate.
virtual ~LDDGraphBuilder()
Virtual destructor.
void setAttributeVecSize(int size)
This function is used to set the number of attributes associated with the vertex elements.
int getSRID() const
It returns the spatial reference system identifier associated to this property.
void setTotalSteps(int value)
Set the task total stepes.
From the point of view of graph theory, vertices are treated as featureless and indivisible objects...
This abstract class provides the common functions for graph builder classes. Each builder strategy ha...
This class defines the LDD strategy to build a graph.
void setId(unsigned int id)
It sets the property identifier.
#define TR_GRAPH(message)
It marks a string in order to get translated. This is a special mark used in the Graph module of Terr...
An utility struct for representing 2D coordinates.
void addAttribute(int idx, te::dt::AbstractData *ad)
Add a new attribute to this element.
int getEdgeId()
Function used to generated the edge id.
int getSRID() const
Returns the raster spatial reference system identifier.
LDDGraphBuilder()
Default constructor.
void pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
A point with x and y coordinate values.
int m_edgeId
Attribute used as a index counter for edge objects.
void useTimer(bool flag)
Used to define if task use progress timer information.
void setMessage(const std::string &message)
Set the task message.
An abstract class for raster data strucutures.
This class can be used to inform the progress of a task.
bool build(te::rst::Raster *raster, 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.
void setSRID(int srid)
It sets the spatial reference system identifier associated to this property.