te::qt::widgets::GlyphMarkRenderer Class Reference

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>

Inheritance diagram for te::qt::widgets::GlyphMarkRenderer:
te::map::AbstractMarkRenderer

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...
 

Detailed Description

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".

See also
AbstractMarkRenderer

Definition at line 56 of file GlyphMarkRenderer.h.

Constructor & Destructor Documentation

te::qt::widgets::GlyphMarkRenderer::GlyphMarkRenderer ( )

Constructor.

te::qt::widgets::GlyphMarkRenderer::~GlyphMarkRenderer ( )

Destructor.

Member Function Documentation

static void te::qt::widgets::GlyphMarkRenderer::decode ( QString &  name,
QString &  font,
QChar &  charCode 
)
static

Decodes the given name extracting the parameters known by this renderer.

Parameters
nameThe name dealt by this renderer. e.g. "ttf://Times#0x12".
fontThe font name that will be extracted from name.
charCoderThe char code that will be extracted from name.
void te::qt::widgets::GlyphMarkRenderer::draw ( QImage *  img,
QPainterPath &  path 
)
protected

Draw the given path on the the given image using the internal pen and brush.

Parameters
imgThe image where the path will be drawn.
pathThe path that will be drawn.
static QString te::qt::widgets::GlyphMarkRenderer::encode ( const QString &  font,
const int &  charCode 
)
static

Encodes the given parameters to a format known by this renderer.

Parameters
fontThe font name. e.g. "Times".
charCoderThe decimal char code.
Returns
A string that represents the format known by this renderer. e.g. "ttf://Times#0x12".
Note
The given char code will be enconded in hexadecimal.
void te::qt::widgets::GlyphMarkRenderer::end ( )
protected

Finalizes the internal QPainter resources.

bool te::qt::widgets::GlyphMarkRenderer::getChar ( QString &  charCode,
QChar &  ch 
)
protected

Converts the character code to a char.

Parameters
charCodeThe character code. It can be enconded in hexadecimal, octonal or decimal.
chThe result char from character code conversion.
Returns
It returns true if the character code was converted. Otherwise, it returns false.
void te::qt::widgets::GlyphMarkRenderer::getSupportedMarks ( std::vector< std::string > &  marks) const
virtual

Method that informs the set of supported marks by a specific concrete mark renderer.

Parameters
marksA pre-created vector of string that will be filled with the supported marks names.

Implements te::map::AbstractMarkRenderer.

te::color::RGBAColor** te::qt::widgets::GlyphMarkRenderer::render ( const te::se::Mark mark,
std::size_t  size 
)
virtual

It generates the image pattern from the given Symbology Enconding Mark element.

Parameters
markThe Symbology Enconding Mark element that will be used to build the image pattern.
sizeThe size of image pattern that will be generated.
Returns
The RGBA image that represents the mark.
Note
The caller will take the ownership of the returned pointer.

Implements te::map::AbstractMarkRenderer.

void te::qt::widgets::GlyphMarkRenderer::setup ( QImage *  img)
protected

Setups the internal QPainter and associates it with the given paint device (QImage).

Member Data Documentation

QBrush te::qt::widgets::GlyphMarkRenderer::m_brush
private

The pen used to draw the mark patterns.

Definition at line 128 of file GlyphMarkRenderer.h.

QPainter te::qt::widgets::GlyphMarkRenderer::m_painter
private

The painter used to draw the mark patterns.

Definition at line 126 of file GlyphMarkRenderer.h.

QPen te::qt::widgets::GlyphMarkRenderer::m_pen
private

The pen used to draw the mark patterns.

Definition at line 127 of file GlyphMarkRenderer.h.

std::string te::qt::widgets::GlyphMarkRenderer::sm_rendererKey
staticprivate

The renderer key.

Definition at line 130 of file GlyphMarkRenderer.h.


The documentation for this class was generated from the following file: