25 #include <boost/shared_ptr.hpp> 28 #include <QApplication> 36 std::cout << std::endl <<
"Create MST Graph..." << std::endl;
39 std::string data_dir = TERRALIB_DATA_DIR;
40 std::unique_ptr<te::da::DataSource>
ds =
OpenOGRDataSource(data_dir +
"/graph/up_pol_rec_pol.shp");
42 std::string dataSetName =
"up_pol_rec_pol";
43 std::unique_ptr<te::da::DataSet> dataSet = ds->getDataSet(dataSetName);
44 std::unique_ptr<te::da::DataSetType> dataSetType = ds->getDataSetType(dataSetName);
49 std::unique_ptr<te::sa::GeneralizedProximityMatrix> gpm;
53 gpm.reset(swe.
importFromGAL(data_dir +
"/graph/up_pol_rec_gal.gal", ds.get()));
55 gpm->getGraph()->getMetadata()->setSRID(29193);
56 gpm->getGraph()->getMetadata()->setEnvelope(*dataSet->getExtent(geomPos));
60 std::vector<int> attrsIdx;
62 std::string attrName =
"Attr1";
64 std::size_t idx = dataSetType->getPropertyPosition(attrName);
65 int type = dataSet->getPropertyDataType(idx);
68 attrsIdx.push_back(gpmIdx);
79 graph->getMetadata()->setEnvelope(*dataSet->getExtent(geomPos));
92 w->
addGraph(graph, *dataSet->getExtent(geomPos), style);
151 for(std::size_t t = 0; t < attrsIdx.size(); ++t)
156 weight += (valueTo - valueFrom) * (valueTo - valueFrom);
void CreateMSTGraph(bool draw)
Creates a MST GRAPH.
virtual te::graph::Edge * getNextEdge()
It returns a pointer to the next edge element of a graph.
void setAttributeVecSize(int size)
This function is used to set the number of attributes associated with the edge elements.
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
A Mark specifies a geometric shape and applies coloring to it.
Utilitary function for spatial analysis module.
An static class with global definitions for the TerraLib Graph Module.
#define TE_SA_SKATER_ATTR_WEIGHT_NAME
double CalculateWeight(std::vector< int > attrsIdx, te::graph::Vertex *vFrom, te::graph::Vertex *vTo)
A PointSymbolizer specifies the rendering of a graphic Symbolizer at a point.
This file contains include headers for TerraLib Symbology Encoding module.
void push_back(const std::string &semanticTypeIdentifier)
static te::dt::Date ds(2010, 01, 01)
te::sa::GeneralizedProximityMatrix * importFromGAL(std::string pathFileName, te::da::DataSource *ds=0)
Function used to import a gpm from a Spatial Weights File GAL Format.
te::se::Style * getMSTGraphStyle()
std::vector< te::dt::AbstractData * > & getAttributes()
It returns the vector of attributes associated with this element.
TESEEXPORT LineSymbolizer * CreateLineSymbolizer(Stroke *stroke)
Creates a line symbolizer.
A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
void push_back(Symbolizer *s)
This class defines functions used to load and save gpm's using GAL and GWT formats, both formats use a ' ' as separator.
This file contains a class that represents the Minimum Spanning Tree operation.
From the point of view of graph theory, vertices are treated as featureless and indivisible objects...
Abstract class used to define the main functions of graph struct. All graph implementations must used...
virtual te::graph::GraphMetadata * getMetadata()=0
Function used to access the graph metadata.
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.
The FeatureTypeStyle defines the styling that is to be applied to a dataset that can be viewed as a f...
A simple main window to show example of TerraLib Qt Tools.
Abstract class used to define the main functions of graph struct. All graph implementations must used...
void addGraph(te::graph::AbstractGraph *graph, te::gm::Envelope extent, te::se::Style *s=0)
TESEEXPORT Graphic * CreateGraphic(Mark *mark, const std::string &size, const std::string &rotation, const std::string &opacity)
Creates a graphic.
A Fill specifies the pattern for filling an area geometry.
int getIdFrom()
It returns the vertex origin identification.
From the point of view of graph theory, vertices are treated as featureless and indivisible objects...
Utility functions for the data access module.
TESAEXPORT int AssociateGPMVertexAttribute(te::sa::GeneralizedProximityMatrix *gpm, te::da::DataSource *ds, std::string dataSetName, std::string attrLink, std::string attr, int dataType, int srid=TE_UNKNOWN_SRS, int subType=static_cast< int >(te::gm::UnknownGeometryType))
Function used to set a an attribute valeu from a dataset to the vertex objects from a gpm...
TESEEXPORT Mark * CreateMark(const std::string &wellKnownName, Stroke *stroke, Fill *fill)
Creates a mark.
void addVectorialLayer(std::string path, int srid)
virtual te::graph::Edge * getFirstEdge()
It returns a pointer to the first edge element of a graph.
TESEEXPORT Stroke * CreateStroke(const std::string &color, const std::string &width)
Creates a stroke.
void CreateWeightAttribute(te::graph::AbstractGraph *graph, int weightAttrIdx, std::vector< int > attrsIdx)
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
A Stroke specifies the appearance of a linear geometry.
A LineSymbolizer is used to style a stroke along a linear geometry type, such as a string of line seg...
This class defines functions used to load and save gpm's using GAL and GWT formats, both formats use a ' ' as separator.
A simple main window to show example of TerraLib Graph.
A template for atomic data types (integers, floats, strings and others).
TESAEXPORT int AddGraphEdgeAttribute(te::graph::AbstractGraph *graph, std::string attrName, int dataType)
Function used to create the edge attribute metadata in the graph of the gpm.
TESAEXPORT double GetDataValue(te::dt::AbstractData *ad)
Function used to get the numeric value from a gpm property.
This file contains several implementations for atomic data types (integers, floats, strings and others).
These routines show how to use the Graph module.
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.
std::unique_ptr< te::da::DataSource > OpenOGRDataSource(const std::string &pathName)
Auxiliar functions for load a org data source.
TESEEXPORT PointSymbolizer * CreatePointSymbolizer(Graphic *graphic)
Creates a point symbolizer.
TESEEXPORT Fill * CreateFill(const std::string &color, const std::string &opacity)
Creates a fill.
int getIdTo()
It returns the vertex destiny identification.
This class defines the GPM class.