39 #include "../../core/translator/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" 77 m_graph->addVertexProperty(gProp);
92 m_raster->
getValue(static_cast<unsigned int>(c), static_cast<unsigned int>(r), val);
94 int value = (
int) val;
99 if (
getVertexId(static_cast<int>(r), static_cast<int>(c), vId) ==
false)
115 if(value == 255 || value == 0)
127 if (
getVertexId(static_cast<int>(r), static_cast<int>(c + 1), vTo))
131 Edge* e =
new Edge(edgeId, vFrom, vTo);
142 if (
getVertexId(static_cast<int>(r + 1), static_cast<int>(c + 1), vTo))
146 Edge* e =
new Edge(edgeId, vFrom, vTo);
157 if (
getVertexId(static_cast<int>(r + 1), static_cast<int>(c), vTo))
161 Edge* e =
new Edge(edgeId, vFrom, vTo);
172 if (
getVertexId(static_cast<int>(r + 1), static_cast<int>(c - 1), vTo))
176 Edge* e =
new Edge(edgeId, vFrom, vTo);
187 if (
getVertexId(static_cast<int>(r), static_cast<int>(c - 1), vTo))
191 Edge* e =
new Edge(edgeId, vFrom, vTo);
202 if (
getVertexId(static_cast<int>(r - 1), static_cast<int>(c - 1), vTo))
206 Edge* e =
new Edge(edgeId, vFrom, vTo);
217 if (
getVertexId(static_cast<int>(r - 1), static_cast<int>(c), vTo))
221 Edge* e =
new Edge(edgeId, vFrom, vTo);
232 if (
getVertexId(static_cast<int>(r - 1), static_cast<int>(c + 1), vTo))
236 Edge* e =
new Edge(edgeId, vFrom, vTo);
void setAttributeVecSize(int size)
This function is used to set the number of attributes associated with the vertex elements.
bool getVertexId(int row, int col, int &id)
Function used to generated the vertex id based on raster coordenate.
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.
unsigned int getNumberOfColumns() const
Returns the raster number of columns.
void useTimer(bool flag)
Used to define if task use progress timer information.
virtual ~LDDGraphBuilder()
Virtual destructor.
This class can be used to inform the progress of a task.
An utility struct for representing 2D coordinates.
#define TE_TR(message)
It marks a string in order to get translated.
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.
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
int getSRID() const
It returns the spatial reference system identifier associated to this property.
A point with x and y coordinate values.
An abstract class for raster data strucutures.
unsigned int getNumberOfRows() const
Returns the raster number of rows.
bool build(te::rst::Raster *raster, const 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 pulse()
Calls setCurrentStep() function using getCurrentStep() + 1.
Grid * getGrid()
It returns the raster grid.
virtual void getValue(unsigned int c, unsigned int r, double &value, std::size_t b=0) const
Returns the attribute value of a band of a cell.
int getSRID() const
Returns the raster spatial reference system identifier.
LDDGraphBuilder()
Default constructor.
void gridToGeo(const double &col, const double &row, double &x, double &y) const
Get the spatial location of a grid point.
te::rst::Raster * m_raster
Input raster with LDD information.
This class defines the LDD strategy to build a graph.
void addAttribute(int idx, te::dt::AbstractData *ad)
Add a new attribute to this element.
boost::shared_ptr< AbstractGraph > m_graph
Graph object.
static AbstractGraph * make()
It creates and returns an empty graph with default graph type.
int m_edgeId
Attribute used as a index counter for edge objects.
int getEdgeId()
Function used to generated the edge id.