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>
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 | |
| Canvas * | m_canvas |
| A pointer to the canvas that will be configured. More... | |
Static Private Attributes | |
| static std::map< std::string, te::se::Font::FontStyleType > | sm_fontStyleMap |
| A map that associates FontStyleType to the correct string value. More... | |
| static std::map< std::string, te::se::Font::FontWeightType > | sm_fontWeightMap |
| A map that associates FontWeightType to the correct string value. More... | |
| static std::map< std::string, te::map::LineCapStyle > | sm_lineCapMap |
| A map that associates stroke-linecap value to the correct LineCapStyle. More... | |
| static std::map< std::string, te::map::LineJoinStyle > | sm_lineJoinMap |
| A map that associates stroke-linejoin value to the correct LineJoinStyle. More... | |
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);
Definition at line 73 of file CanvasConfigurer.h.
|
private |
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 133 of file CanvasConfigurer.h.
| te::map::CanvasConfigurer::CanvasConfigurer | ( | Canvas * | canvas | ) |
Constructor.
| canvas | A pointer to the canvas that will be configured. |
Definition at line 63 of file CanvasConfigurer.cpp.
References te::map::BevelJoin, te::map::ButtCap, te::map::MiterJoin, te::map::RoundCap, te::map::RoundJoin, sm_fontStyleMap, sm_fontWeightMap, sm_lineCapMap, sm_lineJoinMap, te::map::SquareCap, te::se::Font::StyleItalic, te::se::Font::StyleNormal, te::se::Font::StyleOblique, TE_SE_BEVEL_JOIN, TE_SE_BUTT_CAP, TE_SE_MITRE_JOIN, TE_SE_ROUND_CAP, TE_SE_ROUND_JOIN, TE_SE_SQUARE_CAP, te::se::Font::WeightBlack, te::se::Font::WeightBold, te::se::Font::WeightDemiBold, te::se::Font::WeightLight, te::se::Font::WeightNormal, and ~CanvasConfigurer().
|
default |
Destructor.
Referenced by CanvasConfigurer().
| void te::map::CanvasConfigurer::config | ( | const te::se::Symbolizer * | symbolizer | ) |
It configs the canvas based on given symbolizer.
| symbolizer | The symbolizer that will be used to config the canvas. |
Definition at line 91 of file CanvasConfigurer.cpp.
References te::common::BaseVisitable< T, R >::accept().
Referenced by te::qt::widgets::CloudDetectionDialog::applyPreview(), te::qt::widgets::SymbologyPreview::build(), te::qt::widgets::SymbologyPreview::buildText(), config(), te::graph::LayerRenderer::draw(), te::qt::af::MapDisplay::drawDataSet(), te::map::DrawGeometries(), te::map::QueryLayerRenderer::drawLayerGeometries(), te::map::QueryLayerRenderer::drawLayerGroupingMem(), te::map::AbstractLayerRenderer::drawLayerGroupingMem(), te::map::QueryLayerRenderer::drawLayerLinkedGroupingMem(), te::wms::WMSLayerRenderer::drawRaster(), te::map::DrawRaster(), GetIcon(), GetRuleIcon(), and visit().
|
private |
Internal method that configs the canvas based on given Stroke element.
| stroke | The Stroke element that will be used to config the canvas. |
| fromLineSymbolizer | A flag that indicates if the given stroke come from LineSymbolizer element. |
Definition at line 234 of file CanvasConfigurer.cpp.
References config(), 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, m_canvas, te::map::Canvas::setLineCapStyle(), te::map::Canvas::setLineColor(), te::map::Canvas::setLineDashStyle(), te::map::Canvas::setLineJoinStyle(), te::map::Canvas::setLineWidth(), te::map::Canvas::setPolygonContourCapStyle(), te::map::Canvas::setPolygonContourColor(), te::map::Canvas::setPolygonContourDashStyle(), te::map::Canvas::setPolygonContourJoinStyle(), te::map::Canvas::setPolygonContourWidth(), sm_lineCapMap, sm_lineJoinMap, TE_OPAQUE, and TE_SE_DEFAULT_STROKE_BASIC_COLOR.
|
private |
Internal method that configs the canvas based on given Fill element.
| fill | The Fill element that will be used to config the canvas. |
Definition at line 285 of file CanvasConfigurer.cpp.
References config(), Fill, te::se::GetColor(), te::se::Fill::getGraphicFill(), m_canvas, te::map::Canvas::setPolygonFillColor(), TE_OPAQUE, and TE_SE_DEFAULT_FILL_BASIC_COLOR.
|
private |
Internal method that configs the canvas based on given Graphic element.
| graphic | The Graphic element that will be used to config the canvas. |
| configStyle | Enumerated value that indicates which style that should be configured (for Point, Line, Contour, or Fill). |
Definition at line 301 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, m_canvas, Point, te::map::Canvas::setLineColor(), te::map::Canvas::setLinePattern(), te::map::Canvas::setLinePatternOpacity(), te::map::Canvas::setLinePatternRotation(), te::map::Canvas::setPointColor(), te::map::Canvas::setPointPattern(), te::map::Canvas::setPointPatternOpacity(), te::map::Canvas::setPointPatternRotation(), te::map::Canvas::setPolygonContourColor(), te::map::Canvas::setPolygonContourPattern(), te::map::Canvas::setPolygonContourPatternOpacity(), te::map::Canvas::setPolygonContourPatternRotation(), te::map::Canvas::setPolygonFillColor(), te::map::Canvas::setPolygonFillPattern(), te::map::Canvas::setPolygonPatternOpacity(), te::map::Canvas::setPolygonPatternRotation(), TE_OPAQUE, TE_SE_DEFAULT_GRAPHIC_SIZE, and TE_TRANSPARENT.
|
private |
Configs the canvas with default values for line styles.
Definition at line 402 of file CanvasConfigurer.cpp.
References te::map::ButtCap, m_canvas, te::map::MiterJoin, te::map::Canvas::setLineCapStyle(), te::map::Canvas::setLineColor(), te::map::Canvas::setLineDashStyle(), te::map::Canvas::setLineJoinStyle(), te::map::Canvas::setLineWidth(), te::map::SolidLine, TE_OPAQUE, TE_SE_DEFAULT_STROKE_BASIC_COLOR, and TE_SE_DEFAULT_STROKE_BASIC_WIDTH.
Referenced by visit().
|
private |
Configs the canvas with default values for point styles.
Definition at line 413 of file CanvasConfigurer.cpp.
References m_canvas, te::map::Canvas::setPointColor(), and TE_OPAQUE.
Referenced by visit().
|
private |
Configs the canvas with default values for polygon styles.
Definition at line 389 of file CanvasConfigurer.cpp.
References te::map::ButtCap, m_canvas, te::map::MiterJoin, te::map::Canvas::setPolygonContourCapStyle(), te::map::Canvas::setPolygonContourColor(), te::map::Canvas::setPolygonContourDashStyle(), te::map::Canvas::setPolygonContourJoinStyle(), te::map::Canvas::setPolygonContourWidth(), te::map::Canvas::setPolygonFillColor(), te::map::SolidLine, TE_OPAQUE, TE_SE_DEFAULT_FILL_BASIC_COLOR, TE_SE_DEFAULT_STROKE_BASIC_COLOR, and TE_SE_DEFAULT_STROKE_BASIC_WIDTH.
Referenced by visit().
|
private |
Configs the canvas with default values for text styles.
Definition at line 418 of file CanvasConfigurer.cpp.
References m_canvas, te::map::Canvas::setTextColor(), te::map::Canvas::setTextPointSize(), TE_OPAQUE, TE_SE_DEFAULT_FONT_SIZE, and TE_SE_DEFAULT_TEXT_COLOR.
Referenced by visit().
|
virtual |
Implements te::se::Visitor.
Definition at line 96 of file CanvasConfigurer.cpp.
|
virtual |
Implements te::se::Visitor.
Definition at line 101 of file CanvasConfigurer.cpp.
|
virtual |
Implements te::se::Visitor.
Definition at line 107 of file CanvasConfigurer.cpp.
|
virtual |
Implements te::se::Visitor.
Definition at line 112 of file CanvasConfigurer.cpp.
|
virtual |
Implements te::se::Visitor.
Definition at line 117 of file CanvasConfigurer.cpp.
References config(), configDefaultPolygon(), te::se::PolygonSymbolizer::getFill(), te::se::PolygonSymbolizer::getStroke(), m_canvas, te::map::Canvas::setPolygonContourColor(), te::map::Canvas::setPolygonFillColor(), and TE_TRANSPARENT.
|
virtual |
Implements te::se::Visitor.
Definition at line 137 of file CanvasConfigurer.cpp.
References config(), configDefaultLine(), te::se::LineSymbolizer::getStroke(), m_canvas, te::map::Canvas::setLineColor(), and TE_TRANSPARENT.
|
virtual |
Implements te::se::Visitor.
Definition at line 153 of file CanvasConfigurer.cpp.
References config(), configDefaultPoint(), te::se::PointSymbolizer::getGraphic(), and Point.
|
virtual |
Implements te::se::Visitor.
Definition at line 163 of file CanvasConfigurer.cpp.
References configDefaultText(), te::se::GetColor(), te::se::GetDouble(), te::se::Font::getFamily(), te::se::Halo::getFill(), te::se::TextSymbolizer::getFill(), te::se::TextSymbolizer::getFont(), te::se::TextSymbolizer::getHalo(), te::se::GetInt(), te::se::Halo::getRadius(), te::se::Font::getSize(), te::se::GetString(), te::se::Font::getStyle(), te::se::Font::getWeight(), m_canvas, te::map::Canvas::setFontFamily(), te::map::Canvas::setTextColor(), te::map::Canvas::setTextContourColor(), te::map::Canvas::setTextContourEnabled(), te::map::Canvas::setTextContourWidth(), te::map::Canvas::setTextPointSize(), te::map::Canvas::setTextStyle(), te::map::Canvas::setTextWeight(), sm_fontStyleMap, sm_fontWeightMap, TE_OPAQUE, TE_SE_DEFAULT_HALO_COLOR, TE_SE_DEFAULT_HALO_RADIUS, and TE_SE_DEFAULT_TEXT_COLOR.
|
virtual |
Implements te::se::Visitor.
Definition at line 228 of file CanvasConfigurer.cpp.
|
private |
A pointer to the canvas that will be configured.
Definition at line 178 of file CanvasConfigurer.h.
Referenced by config(), configDefaultLine(), configDefaultPoint(), configDefaultPolygon(), configDefaultText(), and visit().
|
staticprivate |
A map that associates FontStyleType to the correct string value.
Definition at line 183 of file CanvasConfigurer.h.
Referenced by CanvasConfigurer(), and visit().
|
staticprivate |
A map that associates FontWeightType to the correct string value.
Definition at line 184 of file CanvasConfigurer.h.
Referenced by CanvasConfigurer(), and visit().
|
staticprivate |
A map that associates stroke-linecap value to the correct LineCapStyle.
Definition at line 180 of file CanvasConfigurer.h.
Referenced by CanvasConfigurer(), and config().
|
staticprivate |
A map that associates stroke-linejoin value to the correct LineJoinStyle.
Definition at line 181 of file CanvasConfigurer.h.
Referenced by CanvasConfigurer(), and config().