A concrete renderer based on Qt4 for conversion of Symbology Enconding Mark elements to an image pattern. It is a extension that considers marks with well-known name in the format: "ttf://font#code". Here, "font" is the name of a TrueType font and "code" is the character code. The character code can be enconded in hexadecimal, octonal or decimal. e.g.: "ttf://Arial#0x12", "ttf://Times#042", "ttf://Verdana#10". More...
#include <GlyphMarkRenderer.h>
Public Member Functions | |
void | getSupportedMarks (std::vector< std::string > &marks) const |
Method that informs the set of supported marks by a specific concrete mark renderer. More... | |
GlyphMarkRenderer () | |
Constructor. More... | |
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. More... | |
~GlyphMarkRenderer () | |
Destructor. More... | |
Static Public Member Functions | |
static void | decode (QString &name, QString &font, QChar &charCode) |
Decodes the given name extracting the parameters known by this renderer. More... | |
static QString | encode (const QString &font, const int &charCode) |
Encodes the given parameters to a format known by this renderer. More... | |
Protected Member Functions | |
Internal methods of Qt4 Mark Renderer. | |
Methods that manipulate Qt4 concepts like QPainter, QImage, QBrush, QPen, QPainterPath, etc. | |
void | setup (QImage *img) |
Setups the internal QPainter and associates it with the given paint device (QImage). More... | |
void | end () |
Finalizes the internal QPainter resources. More... | |
void | draw (QImage *img, QPainterPath &path) |
Draw the given path on the the given image using the internal pen and brush. More... | |
bool | getChar (QString &charCode, QChar &ch) |
Converts the character code to a char. More... | |
Private Attributes | |
QBrush | m_brush |
The pen used to draw the mark patterns. More... | |
QPainter | m_painter |
The painter used to draw the mark patterns. More... | |
QPen | m_pen |
The pen used to draw the mark patterns. More... | |
Static Private Attributes | |
static std::string | sm_rendererKey |
The renderer key. More... | |
A concrete renderer based on Qt4 for conversion of Symbology Enconding Mark elements to an image pattern. It is a extension that considers marks with well-known name in the format: "ttf://font#code". Here, "font" is the name of a TrueType font and "code" is the character code. The character code can be enconded in hexadecimal, octonal or decimal. e.g.: "ttf://Arial#0x12", "ttf://Times#042", "ttf://Verdana#10".
Definition at line 56 of file GlyphMarkRenderer.h.
te::qt::widgets::GlyphMarkRenderer::GlyphMarkRenderer | ( | ) |
Constructor.
Definition at line 40 of file GlyphMarkRenderer.cpp.
References m_brush, and TE_SE_DEFAULT_FILL_BASIC_COLOR.
te::qt::widgets::GlyphMarkRenderer::~GlyphMarkRenderer | ( | ) |
Destructor.
Definition at line 47 of file GlyphMarkRenderer.cpp.
|
static |
Decodes the given name extracting the parameters known by this renderer.
name | The name dealt by this renderer. e.g. "ttf://Times#0x12". |
font | The font name that will be extracted from name. |
charCoder | The char code that will be extracted from name. |
Definition at line 105 of file GlyphMarkRenderer.cpp.
Referenced by render(), te::qt::widgets::GlyphMarkPropertyItem::updateUi(), and te::qt::widgets::GlyphMarkWidget::updateUi().
|
protected |
Draw the given path on the the given image using the internal pen and brush.
img | The image where the path will be drawn. |
path | The path that will be drawn. |
Definition at line 144 of file GlyphMarkRenderer.cpp.
|
static |
Encodes the given parameters to a format known by this renderer.
font | The font name. e.g. "Times". |
charCoder | The decimal char code. |
Definition at line 98 of file GlyphMarkRenderer.cpp.
Referenced by te::qt::widgets::GlyphMarkPropertyItem::updateMarkName(), and te::qt::widgets::GlyphMarkWidget::updateMarkName().
|
protected |
Finalizes the internal QPainter resources.
Definition at line 137 of file GlyphMarkRenderer.cpp.
References TE_SE_DEFAULT_FILL_BASIC_COLOR, and TE_SE_DEFAULT_STROKE_BASIC_COLOR.
|
protected |
Converts the character code to a char.
charCode | The character code. It can be enconded in hexadecimal, octonal or decimal. |
ch | The result char from character code conversion. |
Definition at line 160 of file GlyphMarkRenderer.cpp.
|
virtual |
Method that informs the set of supported marks by a specific concrete mark renderer.
marks | A pre-created vector of string that will be filled with the supported marks names. |
Implements te::map::AbstractMarkRenderer.
Definition at line 94 of file GlyphMarkRenderer.cpp.
|
virtual |
It generates the image pattern from the given Symbology Enconding Mark element.
mark | The Symbology Enconding Mark element that will be used to build the image pattern. |
size | The size of image pattern that will be generated. |
Implements te::map::AbstractMarkRenderer.
Definition at line 51 of file GlyphMarkRenderer.cpp.
References te::qt::widgets::Config(), decode(), te::se::Mark::getFill(), te::qt::widgets::GetImage(), te::se::Mark::getStroke(), and te::se::Mark::getWellKnownName().
|
protected |
Setups the internal QPainter and associates it with the given paint device (QImage).
Definition at line 129 of file GlyphMarkRenderer.cpp.
|
private |
The pen used to draw the mark patterns.
Definition at line 128 of file GlyphMarkRenderer.h.
Referenced by GlyphMarkRenderer().
|
private |
The painter used to draw the mark patterns.
Definition at line 126 of file GlyphMarkRenderer.h.
|
private |
The pen used to draw the mark patterns.
Definition at line 127 of file GlyphMarkRenderer.h.
|
staticprivate |
The renderer key.
Definition at line 130 of file GlyphMarkRenderer.h.