te::map::CanvasConfigurer Class Reference

A Symbology Enconding visitor that configures a given canvas based on symbolizers elements. If you want to use this visitor, use a command like: te::map::CanvasConfigurer cc(canvas); cc.config(symbolizer); More...

#include <CanvasConfigurer.h>

Inheritance diagram for te::map::CanvasConfigurer:
te::se::Visitor

Public Member Functions

Initializer Methods
 CanvasConfigurer (Canvas *canvas)
 Constructor. More...
 
 ~CanvasConfigurer ()
 Destructor. More...
 
Config Method

Method that can be used to configure a canvas based on Symbology Enconding symbolizer elements.

void config (const te::se::Symbolizer *symbolizer)
 It configs the canvas based on given symbolizer. More...
 
Visitor Methods

All concrete visitors must implement these methods.

void visit (const te::se::Style &visited)
 
void visit (const te::se::FeatureTypeStyle &visited)
 
void visit (const te::se::CoverageStyle &visited)
 
void visit (const te::se::Symbolizer &visited)
 
void visit (const te::se::PolygonSymbolizer &visited)
 
void visit (const te::se::LineSymbolizer &visited)
 
void visit (const te::se::PointSymbolizer &visited)
 
void visit (const te::se::TextSymbolizer &visited)
 
void visit (const te::se::RasterSymbolizer &visited)
 

Private Types

enum  ConfigStyle { Point, Line, Contour, Fill }
 Internal enum that indicates which style that should be configured. More...
 

Private Member Functions

void config (const te::se::Stroke *stroke, const bool &fromLineSymbolizer=true)
 Internal method that configs the canvas based on given Stroke element. More...
 
void config (const te::se::Fill *fill)
 Internal method that configs the canvas based on given Fill element. More...
 
void config (const te::se::Graphic *graphic, ConfigStyle configStyle)
 Internal method that configs the canvas based on given Graphic element. More...
 
void configDefaultLine ()
 Configs the canvas with default values for line styles. More...
 
void configDefaultPoint ()
 Configs the canvas with default values for point styles. More...
 
void configDefaultPolygon ()
 Configs the canvas with default values for polygon styles. More...
 
void configDefaultText ()
 Configs the canvas with default values for text styles. More...
 

Private Attributes

Canvasm_canvas
 A pointer to the canvas that will be configured. More...
 

Static Private Attributes

static std::map< std::string, te::map::LineCapStylesm_lineCapMap
 A map that associates stroke-linecap value to the correct LineCapStyle. More...
 
static std::map< std::string, te::map::LineJoinStylesm_lineJoinMap
 A map that associates stroke-linejoin value to the correct LineJoinStyle. More...
 

Detailed Description

A Symbology Enconding visitor that configures a given canvas based on symbolizers elements. If you want to use this visitor, use a command like: te::map::CanvasConfigurer cc(canvas); cc.config(symbolizer);

See also
te::se::Visitor

Definition at line 72 of file CanvasConfigurer.h.

Member Enumeration Documentation

Internal enum that indicates which style that should be configured.

Enumerator
Point 

Adjust parameters associated with point.

Line 

Adjust parameters associated with line.

Contour 

Adjust parameters associated with contour.

Fill 

Adjust parameters associated with fill.

Definition at line 132 of file CanvasConfigurer.h.

Constructor & Destructor Documentation

te::map::CanvasConfigurer::CanvasConfigurer ( Canvas canvas)

Constructor.

Parameters
canvasA pointer to the canvas that will be configured.
Note
This class will not take the ownership of the given canvas.

Definition at line 60 of file CanvasConfigurer.cpp.

References te::map::BevelJoin, te::map::ButtCap, te::map::MiterJoin, te::map::RoundCap, te::map::RoundJoin, sm_lineCapMap, sm_lineJoinMap, te::map::SquareCap, TE_SE_BEVEL_JOIN, TE_SE_BUTT_CAP, TE_SE_MITRE_JOIN, TE_SE_ROUND_CAP, TE_SE_ROUND_JOIN, and TE_SE_SQUARE_CAP.

te::map::CanvasConfigurer::~CanvasConfigurer ( )

Destructor.

Definition at line 74 of file CanvasConfigurer.cpp.

Member Function Documentation

void te::map::CanvasConfigurer::config ( const te::se::Stroke stroke,
const bool &  fromLineSymbolizer = true 
)
private

Internal method that configs the canvas based on given Stroke element.

Parameters
strokeThe Stroke element that will be used to config the canvas.
fromLineSymbolizerA flag that indicates if the given stroke come from LineSymbolizer element.

Definition at line 218 of file CanvasConfigurer.cpp.

References Contour, te::se::GetColor(), te::se::Stroke::getDashArray(), te::map::GetDashStyle(), te::se::Stroke::getGraphicFill(), te::se::GetInt(), te::se::Stroke::getLineCap(), te::se::Stroke::getLineJoin(), te::se::GetString(), te::se::Stroke::getWidth(), Line, TE_OPAQUE, and TE_SE_DEFAULT_STROKE_BASIC_COLOR.

void te::map::CanvasConfigurer::config ( const te::se::Fill fill)
private

Internal method that configs the canvas based on given Fill element.

Parameters
fillThe Fill element that will be used to config the canvas.

Definition at line 269 of file CanvasConfigurer.cpp.

References Fill, te::se::GetColor(), te::se::Fill::getGraphicFill(), TE_OPAQUE, and TE_SE_DEFAULT_FILL_BASIC_COLOR.

void te::map::CanvasConfigurer::config ( const te::se::Graphic graphic,
ConfigStyle  configStyle 
)
private

Internal method that configs the canvas based on given Graphic element.

Parameters
graphicThe Graphic element that will be used to config the canvas.
configStyleEnumerated value that indicates which style that should be configured (for Point, Line, Contour, or Fill).

Definition at line 285 of file CanvasConfigurer.cpp.

References Contour, Fill, te::common::Free(), te::se::GetDouble(), te::se::Graphic::getExternalGraphics(), te::common::Singleton< ExternalGraphicRendererManager >::getInstance(), te::common::Singleton< MarkRendererManager >::getInstance(), te::se::GetInt(), te::se::Graphic::getMarks(), te::se::Graphic::getOpacity(), te::se::Graphic::getRotation(), te::se::Graphic::getSize(), Line, Point, te::map::ExternalGraphicRendererManager::render(), te::map::MarkRendererManager::render(), TE_OPAQUE, TE_SE_DEFAULT_GRAPHIC_SIZE, and TE_TRANSPARENT.

void te::map::CanvasConfigurer::configDefaultLine ( )
private

Configs the canvas with default values for line styles.

Definition at line 386 of file CanvasConfigurer.cpp.

References te::map::ButtCap, te::map::MiterJoin, te::map::SolidLine, TE_OPAQUE, TE_SE_DEFAULT_STROKE_BASIC_COLOR, and TE_SE_DEFAULT_STROKE_BASIC_WIDTH.

void te::map::CanvasConfigurer::configDefaultPoint ( )
private

Configs the canvas with default values for point styles.

Definition at line 397 of file CanvasConfigurer.cpp.

References TE_OPAQUE.

void te::map::CanvasConfigurer::configDefaultPolygon ( )
private

Configs the canvas with default values for polygon styles.

Definition at line 373 of file CanvasConfigurer.cpp.

References te::map::ButtCap, te::map::MiterJoin, te::map::SolidLine, TE_OPAQUE, TE_SE_DEFAULT_FILL_BASIC_COLOR, TE_SE_DEFAULT_STROKE_BASIC_COLOR, and TE_SE_DEFAULT_STROKE_BASIC_WIDTH.

void te::map::CanvasConfigurer::configDefaultText ( )
private

Configs the canvas with default values for text styles.

Definition at line 402 of file CanvasConfigurer.cpp.

References TE_OPAQUE, TE_SE_DEFAULT_FONT_SIZE, and TE_SE_DEFAULT_TEXT_COLOR.

void te::map::CanvasConfigurer::visit ( const te::se::Style visited)
virtual

Implements te::se::Visitor.

Definition at line 82 of file CanvasConfigurer.cpp.

void te::map::CanvasConfigurer::visit ( const te::se::FeatureTypeStyle visited)
virtual

Implements te::se::Visitor.

Definition at line 87 of file CanvasConfigurer.cpp.

void te::map::CanvasConfigurer::visit ( const te::se::CoverageStyle visited)
virtual

Implements te::se::Visitor.

Definition at line 92 of file CanvasConfigurer.cpp.

void te::map::CanvasConfigurer::visit ( const te::se::Symbolizer visited)
virtual

Implements te::se::Visitor.

Definition at line 97 of file CanvasConfigurer.cpp.

void te::map::CanvasConfigurer::visit ( const te::se::PolygonSymbolizer visited)
virtual
void te::map::CanvasConfigurer::visit ( const te::se::LineSymbolizer visited)
virtual

Implements te::se::Visitor.

Definition at line 122 of file CanvasConfigurer.cpp.

References te::se::LineSymbolizer::getStroke(), and TE_TRANSPARENT.

void te::map::CanvasConfigurer::visit ( const te::se::PointSymbolizer visited)
virtual

Implements te::se::Visitor.

Definition at line 138 of file CanvasConfigurer.cpp.

References te::se::PointSymbolizer::getGraphic(), and Point.

void te::map::CanvasConfigurer::visit ( const te::se::RasterSymbolizer visited)
virtual

Implements te::se::Visitor.

Definition at line 213 of file CanvasConfigurer.cpp.

Member Data Documentation

Canvas* te::map::CanvasConfigurer::m_canvas
private

A pointer to the canvas that will be configured.

Definition at line 177 of file CanvasConfigurer.h.

std::map< std::string, te::map::LineCapStyle > te::map::CanvasConfigurer::sm_lineCapMap
staticprivate

A map that associates stroke-linecap value to the correct LineCapStyle.

Definition at line 179 of file CanvasConfigurer.h.

Referenced by CanvasConfigurer().

std::map< std::string, te::map::LineJoinStyle > te::map::CanvasConfigurer::sm_lineJoinMap
staticprivate

A map that associates stroke-linejoin value to the correct LineJoinStyle.

Definition at line 180 of file CanvasConfigurer.h.

Referenced by CanvasConfigurer().


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