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);
61 font.setFamily(fontName);
62 font.setPixelSize(size);
65 QPainterPath charPath;
66 charPath.addText(0.0, 0.0, font, ch);
68 QRectF bounds = charPath.boundingRect();
69 double invMax = 1 / std::max(bounds.width(), bounds.height());
71 t.scale(invMax, invMax);
72 t.translate(-bounds.center().x(), -bounds.center().y());
73 charPath = t.map(charPath);
76 QImage* img =
new QImage(size, size, QImage::Format_ARGB32_Premultiplied);
77 img->fill(Qt::transparent);
100 QString result = QString::fromStdString(sm_rendererKey);
101 result +=
"://" + font +
"#0x" + QString::number(charCode, 16);
108 QString pattern(name);
109 pattern.remove(0, sm_rendererKey.size() + 3);
110 if(!pattern.contains(
"#"))
114 QStringList myParams = pattern.split(
"#", QString::SkipEmptyParts);
115 if(myParams.size() < 2)
119 bool wasConverted =
false;
121 charCode = myParams[1].toInt(&wasConverted, 0);
131 m_painter.begin(img);
132 m_painter.setRenderHints(QPainter::Antialiasing);
133 m_painter.setPen(m_pen);
134 m_painter.setBrush(m_brush);
149 double s = img->width() - m_pen.width() - 1;
150 double t = img->width() * 0.5;
152 QTransform transform;
153 QPainterPath transformedPath = transform.translate(t, t).scale(s, s).map(path);
155 m_painter.drawPath(transformedPath);
164 ch = charCode.toInt(&isOk, 0);
A concrete renderer based on Qt4 for conversion of Symbology Enconding Mark elements to an image patt...
A Mark specifies a geometric shape and applies coloring to it.
#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