27 #include "../../../common/StringUtils.h"
28 #include "../../../maptools/Utils.h"
29 #include "../../../se/Mark.h"
41 : te::map::AbstractMarkRenderer()
43 m_brush.setStyle(Qt::SolidPattern);
58 std::map<std::string, MarkType>::iterator it = sm_markMap.find(lname);
59 if(it == sm_markMap.end())
66 QImage* img =
new QImage(size, size, QImage::Format_ARGB32_Premultiplied);
67 img->fill(Qt::transparent);
77 draw(img, m_squarePath);
81 draw(img, m_circlePath);
85 draw(img, m_trianglePath);
89 draw(img, m_starPath);
93 draw(img, m_crossPath);
101 draw(img, m_diamondPath);
105 draw(img, m_ellipsePath);
109 draw(img, m_semiCirclePath);
113 draw(img, m_pentagonPath);
117 draw(img, m_hexagonPath);
121 draw(img, m_octagonPath);
135 std::map<std::string, MarkType>::const_iterator it;
136 for(it = sm_markMap.begin(); it != sm_markMap.end(); ++it)
137 marks.push_back(it->first);
160 QTransform transform;
163 m_squarePath.addRect(-0.5, -0.5, 1.0, 1.0);
166 m_circlePath.addEllipse(-0.5, -0.5, 1.0, 1.0);
169 m_trianglePath.moveTo(0.0, 1.25);
170 m_trianglePath.lineTo(1.0, -0.75);
171 m_trianglePath.lineTo(-1.0, -0.75);
172 m_trianglePath.closeSubpath();
173 m_trianglePath.translate(0, -0.25);
174 m_trianglePath = transform.scale(0.5, 0.5).rotate(180).map(m_trianglePath);
177 m_starPath.moveTo(0.191, 0.0);
178 m_starPath.lineTo(0.25, 0.344);
179 m_starPath.lineTo(0.0, 0.588);
180 m_starPath.lineTo(0.346, 0.638);
181 m_starPath.lineTo(0.5, 1.0);
182 m_starPath.lineTo(0.654, 0.638);
183 m_starPath.lineTo(1.0, 0.588);
184 m_starPath.lineTo(0.75, 0.344);
185 m_starPath.lineTo(0.8, 0.0);
186 m_starPath.lineTo(0.5, 0.162);
187 m_starPath.closeSubpath();
188 m_starPath.translate(-0.5, -0.5);
190 m_starPath = transform.rotate(180).map(m_starPath);
193 m_crossPath.moveTo(0.5, 0.125);
194 m_crossPath.lineTo(0.125, 0.125);
195 m_crossPath.lineTo(0.125, 0.5);
196 m_crossPath.lineTo(-0.125, 0.5);
197 m_crossPath.lineTo(-0.125, 0.125);
198 m_crossPath.lineTo(-0.5, 0.125);
199 m_crossPath.lineTo(-0.5, -0.125);
200 m_crossPath.lineTo(-0.125, -0.125);
201 m_crossPath.lineTo(-0.125, -0.5);
202 m_crossPath.lineTo(0.125, -0.5);
203 m_crossPath.lineTo(0.125, -0.125);
204 m_crossPath.lineTo(0.5, -0.125);
205 m_crossPath.closeSubpath();
209 m_xPath = transform.rotate(-45).map(m_crossPath);
213 m_diamondPath = transform.rotate(-45).scale(0.7, 0.7).map(m_squarePath);
216 m_ellipsePath.addEllipse(-0.5, -0.3, 1.0, 0.7);
219 m_semiCirclePath.arcTo(QRectF(-0.5, -0.5, 1.0, 1.0), 0.0, 180.0);
220 m_semiCirclePath.closeSubpath();
224 m_pentagonPath.moveTo(-0.6, -0.75);
225 m_pentagonPath.lineTo(-1.0, 0.50);
226 m_pentagonPath.lineTo(0.0, 1.25);
227 m_pentagonPath.lineTo(1.0, 0.50);
228 m_pentagonPath.lineTo(0.6, -0.75);
229 m_pentagonPath.closeSubpath();
230 m_pentagonPath.translate(0, -0.25);
231 m_pentagonPath = transform.scale(0.5, 0.5).rotate(180).map(m_pentagonPath);
235 m_hexagonPath.moveTo(-0.5, -0.5);
236 m_hexagonPath.lineTo(-1.0, 0.4);
237 m_hexagonPath.lineTo(-0.5, 1.1);
238 m_hexagonPath.lineTo(0.5, 1.1);
239 m_hexagonPath.lineTo(1.0, 0.4);
240 m_hexagonPath.lineTo(0.5, -0.5);
241 m_hexagonPath.closeSubpath();
242 m_hexagonPath.translate(0, -0.25);
243 m_hexagonPath = transform.scale(0.5, 0.5).rotate(180).map(m_hexagonPath);
247 m_octagonPath.moveTo(-0.5, -0.75);
248 m_octagonPath.lineTo(-1.0, -0.15);
249 m_octagonPath.lineTo(-1.0, 0.75);
250 m_octagonPath.lineTo(-0.5, 1.25);
251 m_octagonPath.lineTo(0.5, 1.25);
252 m_octagonPath.lineTo(1.0, 0.75);
253 m_octagonPath.lineTo(1.0, -0.15);
254 m_octagonPath.lineTo(0.5, -0.75);
255 m_octagonPath.closeSubpath();
256 m_octagonPath.translate(0, -0.25);
257 m_octagonPath = transform.scale(0.5, 0.5).rotate(180).map(m_octagonPath);
262 m_painter.begin(img);
263 m_painter.setRenderHints(QPainter::Antialiasing);
264 m_painter.setPen(m_pen);
265 m_painter.setBrush(m_brush);
280 double s = img->width() - m_pen.width() - 1;
281 double t = img->width() * 0.5;
283 QTransform transform;
284 QPainterPath transformedPath = transform.translate(t, t).scale(s, s).map(path);
286 m_painter.drawPath(transformedPath);
A Mark specifies a geometric shape and applies coloring to it.
std::string Convert2LCase(const std::string &value)
It converts a string to lower case.
A concrete renderer based on Qt4 for conversion of Symbology Enconding Mark elements to an image patt...
#define TE_SE_DEFAULT_STROKE_BASIC_COLOR
It specifies the default color used by stroke basic (solid colors).
const std::string * getWellKnownName() const
const Stroke * getStroke() const
#define TE_SE_DEFAULT_FILL_BASIC_COLOR
It specifies the default color used by basic fill (solid colors).
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
const Fill * getFill() const