27 #include "../../../geometry/Polygon.h"
28 #include "../../../geometry/LinearRing.h"
29 #include "../../../geometry/Point.h"
30 #include "../../../maptools/CanvasConfigurer.h"
31 #include "../../../se/Rule.h"
32 #include "../../../se/Symbolizer.h"
33 #include "../canvas/Canvas.h"
45 if(symb->
getType() ==
"PolygonSymbolizer")
50 ring->
setPoint(1, size.width() - offset, offset);
51 ring->
setPoint(2, size.width() - offset, size.height() - offset);
52 ring->
setPoint(3, offset, size.height() - offset);
57 else if(symb->
getType() ==
"LineSymbolizer")
60 line->
setPoint(0, offset, size.height() * 0.5);
61 line->
setPoint(1, size.width() - offset, size.height() * 0.5);
64 else if(symb->
getType() ==
"PointSymbolizer")
65 geom =
new te::gm::Point(size.width() * 0.5, size.height() * 0.5);
67 QPixmap result =
build(symb, geom, size);
77 result.fill(Qt::transparent);
80 QPainter painter(&result);
81 for(std::size_t i = 0; i < symbs.size(); ++i)
83 QPixmap pix = build(symbs[i], size);
84 painter.drawPixmap(0, 0, pix);
101 if(symb->
getType() ==
"RasterSymbolizer")
105 assert(!size.isEmpty());
109 canvas.
setWindow(0.0, 0.0, size.width(), size.height());
119 return *canvas.getPixmap();
124 QPixmap result(size);
125 result.fill(Qt::transparent);
128 QPainter painter(&result);
129 for(std::size_t i = 0; i < symbs.size(); ++i)
131 QPixmap pix = build(symbs[i], geom, size);
132 painter.drawPixmap(0, 0, pix);
static QPixmap build(const te::se::Symbolizer *symb, const QSize &size)
Generates the preview of given symbolizer element.
virtual const std::string & getType() const =0
It returns the symbolizer type.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
A LinearRing is a LineString that is both closed and simple.
A Symbolizer describes how a feature is to appear on a map.
void config(const te::se::Symbolizer *symbolizer)
It configs the canvas based on given symbolizer.
const std::vector< Symbolizer * > & getSymbolizers() const
This class represents a symbol. TODO: More description!
#define TE_TRANSPARENT
For an RGBA color this is the value of the alpha-channel for totally transparent. ...
LineString is a curve with linear interpolation between points.
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
A Symbology Enconding visitor that configures a given canvas based on symbolizers elements...
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
A canvas built on top of Qt.
A point with x and y coordinate values.
void setPoint(std::size_t i, const double &x, const double &y)
It sets the value of the specified point.
Static class used to generate preview of Symbology elements.
This class represents a symbol.
void setRingN(std::size_t i, Curve *r)
It sets the informed position ring to the new one.
void setWindow(const double &llx, const double &lly, const double &urx, const double &ury)
It sets the world (or window) coordinates area (supposing a cartesian reference system).
const std::vector< te::se::Symbolizer * > & getSymbolizers() const
It returns the list of Symbolizers that compose the symbol.