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);
 
te::color::RGBAColor ** render(const te::se::Mark *mark, std::size_t size)
It generates the image pattern from the given Symbology Enconding Mark element. 
 
std::string Convert2LCase(const std::string &value)
It converts a string to lower case. 
 
void Config(QPen &pen, const te::se::Stroke *stroke)
It configs the given pen based on Symbology Enconding Stroke element. 
 
Utility functions for MapTools module. 
 
const Fill * getFill() const 
 
~WellKnownMarkRenderer()
Destructor. 
 
const std::string * getWellKnownName() const 
 
static std::map< std::string, MarkType > sm_markMap
A map that associates a well-known mark name to the correct mark type. 
 
void buildMaps()
Builds the internal auxiliary maps to map Symbology Enconding concepts to Qt. 
 
void setup(QImage *img)
Setups the internal QPainter and associates it with the given paint device (QImage). 
 
MarkType
This enum specifies mark types handle by this renderer. 
 
void end()
Finalizes the internal QPainter resources. 
 
QBrush m_brush
The pen used to draw the mark patterns. 
 
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color. 
 
#define TE_SE_DEFAULT_STROKE_BASIC_COLOR
It specifies the default color used by stroke basic (solid colors). 
 
#define TE_SE_DEFAULT_FILL_BASIC_COLOR
It specifies the default color used by basic fill (solid colors). 
 
void draw(QImage *img, QPainterPath &path)
Draw the given path on the the given image using the internal pen and brush. 
 
WellKnownMarkRenderer()
Constructor. 
 
const Stroke * getStroke() const 
 
void buildPaths()
Builds the pre-defined marks paths. 
 
void getSupportedMarks(std::vector< std::string > &marks) const 
Method that informs the set of supported marks by a specific concrete mark renderer. 
 
A concrete renderer based on Qt4 for conversion of Symbology Enconding Mark elements to an image patt...
 
TEQTWIDGETSEXPORT QImage * GetImage(te::color::RGBAColor **img, int width, int height)
It creates a QImage from an RGBA color array. 
 
A Mark specifies a geometric shape and applies coloring to it.