27 #include "../../../geometry/Envelope.h" 28 #include "../../../geometry/Polygon.h" 29 #include "../../../geometry/LinearRing.h" 30 #include "../../../geometry/Point.h" 31 #include "../../../maptools/CanvasConfigurer.h" 32 #include "../../../se/AnchorPoint.h" 33 #include "../../../se/Displacement.h" 34 #include "../../../se/LabelPlacement.h" 35 #include "../../../se/PointPlacement.h" 36 #include "../../../se/Rule.h" 37 #include "../../../se/Symbolizer.h" 38 #include "../../../se/TextSymbolizer.h" 39 #include "../../../se/Utils.h" 40 #include "../canvas/Canvas.h" 55 if(symb->
getType() ==
"PolygonSymbolizer")
60 ring->
setPoint(1, size.width() - offset, offset);
61 ring->
setPoint(2, size.width() - offset, size.height() - offset);
62 ring->
setPoint(3, offset, size.height() - offset);
67 else if(symb->
getType() ==
"LineSymbolizer")
70 line->
setPoint(0, offset, size.height() * 0.5);
71 line->
setPoint(1, size.width() - offset, size.height() * 0.5);
74 else if(symb->
getType() ==
"PointSymbolizer")
76 geom =
new te::gm::Point(size.width() * 0.5, size.height() * 0.5);
78 else if(symb->
getType() ==
"RasterSymbolizer")
80 QIcon raster = QIcon::fromTheme(
"raster-symbolizer");
81 return raster.pixmap(size);
83 else if (symb->
getType() ==
"TextSymbolizer")
90 QPixmap result =
build(symb, geom, size);
100 result.fill(Qt::transparent);
103 QPainter painter(&result);
104 for(std::size_t i = 0; i < symbs.size(); ++i)
106 QPixmap pix =
build(symbs[i], size);
107 painter.drawPixmap(0, 0, pix);
124 if(symb->
getType() ==
"RasterSymbolizer")
128 assert(!size.isEmpty());
132 canvas.
setWindow(0.0, 0.0, size.width(), size.height());
142 return *canvas.getPixmap();
149 if (symb->
getType() !=
"TextSymbolizer")
152 assert(!size.isEmpty());
156 canvas.
setWindow(0.0, size.height(), size.width(), 0);
164 double posX = size.width() / 2.;
165 double posY = size.height() / 2.;
168 double anchorX = 0.5;
169 double anchorY = 0.5;
170 int displacementX = 0;
171 int displacementY = 0;
195 canvas.drawText(posX, posY,
"ABC", angle, anchorX, anchorY, displacementX, displacementY);
197 return *canvas.getPixmap();
202 QPixmap result(size);
203 result.fill(Qt::transparent);
206 QPainter painter(&result);
207 for(std::size_t i = 0; i < symbs.size(); ++i)
209 QPixmap pix =
build(symbs[i], geom, size);
210 painter.drawPixmap(0, 0, pix);
A TextSymbolizer is used to render text labels according to various graphical parameters.
const ParameterValue * getDisplacementX() const
const AnchorPoint * getAnchorPoint() const
const LabelPlacement * getLabelPlacement() const
This class represents a symbol.
const Displacement * getDisplacement() const
A Symbolizer describes how a feature is to appear on a map.
Static class used to generate preview of Symbology elements.
TESEEXPORT double GetDouble(const te::se::ParameterValue *param)
It gets the parameter value as a double.
const ParameterValue * getRotation() const
const ParameterValue * getDisplacementY() const
A PointPlacement specifies how a text label should be rendered relative to a geometric point...
A LinearRing is a LineString that is both closed and simple.
LineString is a curve with linear interpolation between points.
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.
const ParameterValue * getAnchorPointX() const
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
const std::vector< Symbolizer * > & getSymbolizers() const
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
virtual const std::string & getType() const =0
It returns the symbolizer type.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
TESEEXPORT int GetInt(const te::se::ParameterValue *param)
It gets the parameter value as an integer.
const ParameterValue * getAnchorPointY() const
#define TE_TRANSPARENT
For an RGBA color this is the value of the alpha-channel for totally transparent. ...
const PointPlacement * getPointPlacement() const
void setRingN(std::size_t i, Curve *r)
It sets the informed position ring to the new one.