18 #include <QApplication> 267 std::string connInfo(
"file://" + path);
273 std::vector<std::string> datasets = datasource->getDataSetNames();
274 assert(!datasets.empty());
277 std::string datasetName(datasets[0]);
278 std::unique_ptr<te::da::DataSetType>
dt(datasource->getDataSetType(datasetName));
279 assert(
dt->hasGeom());
282 assert(geomProperty);
285 std::unique_ptr<te::gm::Envelope> extent(datasource->getExtent(datasetName, geomProperty->getName()));
300 double llx = extent.
m_llx;
301 double lly = extent.
m_lly;
302 double urx = extent.
m_urx;
303 double ury = extent.
m_ury;
306 canvas->calcAspectRatio(llx, lly, urx, ury);
307 canvas->setWindow(llx, lly, urx, ury);
312 layer->
draw(canvas.get(), extent, 4326, 0, &cancel);
314 QPixmap* pixmap = canvas->getPixmap();
317 dialog.setFixedSize(pixmap->size());
319 QLabel preview(&dialog);
320 preview.setPixmap(*pixmap);
334 std::vector<std::string> marks;
341 std::vector<te::se::Style*> polygonStyles;
345 for(std::size_t i = 0; i < marks.size(); ++i)
351 for(std::size_t i = 0; i < polygonStyles.size(); ++i)
353 polygons->
setStyle(polygonStyles[i]);
361 std::vector<te::se::Style*> lineStyles;
369 for(std::size_t i = 0; i < lineStyles.size(); ++i)
379 std::vector<te::se::Style*> pointStyles;
380 for(std::size_t i = 0; i < marks.size(); ++i)
384 for(std::size_t i = 0; i < pointStyles.size(); ++i)
394 catch(
const std::exception& e)
396 std::cout << std::endl <<
"An exception has occurred in Styling example: " << e.what() << std::endl;
400 std::cout << std::endl <<
"An unexpected exception has occurred in Styling example!" << std::endl;
virtual void setDataSourceId(const std::string &id)
te::se::Style * SimplePolygonStyle()
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.
virtual const te::gm::Envelope & getExtent() const
It returns the Layer extent (or minimum bounding box).
A PolygonSymbolizer is used to draw a polygon (or other area-type geometries), including filling its ...
boost::shared_ptr< DataSource > DataSourcePtr
te::se::Style * TransparentPolygonStyle()
te::se::Style * GraphicFillContourPolygonStyle(const std::string &markName)
te::se::Style * LineWithBorderStyle()
void setDataSetName(const std::string &name)
te::se::Style * RoadStyleOne()
double m_urx
Upper right corner x-coordinate.
#define TE_OPAQUE
For an RGBA color this is the value of the alpha-channel for totally opaque.
void DrawStyledLayers()
It draws a set of layers using styles encoded using OGC Symbology Enconding specification.
te::se::Style * MarkPointStyle(const std::string &markName)
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)
TESEEXPORT LineSymbolizer * CreateLineSymbolizer(Stroke *stroke)
Creates a line symbolizer.
te::se::Style * SimplePolygonStyleWithStroke()
A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
TESEEXPORT PolygonSymbolizer * CreatePolygonSymbolizer(Stroke *stroke, Fill *fill)
Creates a polygon symbolizer.
te::se::Style * GraphicFillPolygonStyle(const std::string &markName)
void push_back(Symbolizer *s)
te::se::Style * TreePolygonStyle()
void setRendererType(const std::string &t)
double m_llx
Lower left corner x-coordinate.
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
An Envelope defines a 2D rectangular region.
The FeatureTypeStyle defines the styling that is to be applied to a dataset that can be viewed as a f...
te::se::Style * SimpleLineStyle()
static te::dt::TimeDuration dt(20, 30, 50, 11)
TESEEXPORT Graphic * CreateGraphic(Mark *mark, const std::string &size, const std::string &rotation, const std::string &opacity)
Creates a graphic.
virtual void setExtent(const te::gm::Envelope &mbr)
It sets the Layer extent (or minimum bounding box).
A Fill specifies the pattern for filling an area geometry.
TESEEXPORT Mark * CreateMark(const std::string &wellKnownName, Stroke *stroke, Fill *fill)
Creates a mark.
double m_lly
Lower left corner y-coordinate.
TESEEXPORT Stroke * CreateStroke(const std::string &color, const std::string &width)
Creates a stroke.
te::se::Style * DashedLineStyle()
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
double m_ury
Upper right corner y-coordinate.
A Stroke specifies the appearance of a linear geometry.
virtual void setStyle(te::se::Style *style)
It sets the Style associated to the layer.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
void Draw(te::map::DataSetLayer *layer)
A LineSymbolizer is used to style a stroke along a linear geometry type, such as a string of line seg...
te::se::Style * RoadStyleTwo()
This file contains include headers for the TerraLib Common Runtime module.
A layer with reference to a dataset.
void setFill(Fill *f)
A Fill specifies the pattern for filling an area geometry.
std::string Convert2String(boost::int16_t value)
It converts a short integer value to a string.
This file contains include headers for the Vector Geometry model of TerraLib.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
This file contains include headers for the Data Access module of TerraLib.
void draw(Canvas *canvas, const te::gm::Envelope &bbox, int srid, const double &scale, bool *cancel)
It draws the layer geographic objects in the given canvas using the informed SRS. ...
te::map::DataSetLayer * CreateDataSetLayer(const std::string &path)
TESEEXPORT PointSymbolizer * CreatePointSymbolizer(Graphic *graphic)
Creates a point symbolizer.
TESEEXPORT Fill * CreateFill(const std::string &color, const std::string &opacity)
Creates a fill.