libosmscout  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
osmscout::MapPainter Class Referenceabstract

Abstract base class of all renders (though you can always write your own renderer without inheriting from this class) It implements the general rendering algorithm. More...

#include <MapPainter.h>

+ Inheritance diagram for osmscout::MapPainter:

Classes

struct  AreaData
 
struct  DataStatistic
 Structure used for internal statistic collection. More...
 
struct  LabelLayoutData
 
struct  PolyData
 
struct  WayData
 
struct  WayPathData
 

Public Member Functions

 MapPainter (const StyleConfigRef &styleConfig, CoordBuffer *buffer)
 
virtual ~MapPainter ()
 

Protected Member Functions

virtual void DrawArea (const Projection &projection, const MapParameter &parameter, const AreaData &area)=0
 Draw the given area using the given FillStyle for the area outline. More...
 
virtual void DrawContourLabel (const Projection &projection, const MapParameter &parameter, const PathTextStyle &style, const std::string &text, size_t transStart, size_t transEnd)=0
 Draw the given text as a contour of the given path in a style defined by the given LabelStyle. More...
 
virtual void DrawContourSymbol (const Projection &projection, const MapParameter &parameter, const Symbol &symbol, double space, size_t transStart, size_t transEnd)=0
 Draw the given text as a contour of the given path in a style defined by the given LabelStyle. More...
 
virtual void DrawGround (const Projection &projection, const MapParameter &parameter, const FillStyle &style)=0
 (Optionally) fills the area with the given default color for ground. More...
 
virtual void DrawIcon (const IconStyle *style, double x, double y)=0
 Draw the Icon as defined by the IconStyle at the given pixel coordinate. More...
 
virtual void DrawLabel (const Projection &projection, const MapParameter &parameter, const LabelData &label)=0
 Draw the given text at the given pixel coordinate in a style defined by the given LabelStyle. More...
 
virtual void DrawPath (const Projection &projection, const MapParameter &parameter, const Color &color, double width, const std::vector< double > &dash, LineStyle::CapStyle startCap, LineStyle::CapStyle endCap, size_t transStart, size_t transEnd)=0
 Draw simple line with the given style,the given color, the given width and the given untransformed nodes. More...
 
virtual void DrawSymbol (const Projection &projection, const MapParameter &parameter, const Symbol &symbol, double x, double y)=0
 Draw the Symbol as defined by the SymbolStyle at the given pixel coordinate. More...
 
const std::list< AreaData > & GetAreaData () const
 
virtual void GetFontHeight (const Projection &projection, const MapParameter &parameter, double fontSize, double &height)=0
 Returns the height of the font. More...
 
virtual void GetTextDimension (const Projection &projection, const MapParameter &parameter, double objectWidth, double fontSize, const std::string &text, double &xOff, double &yOff, double &width, double &height)=0
 Return the bounding box of the given text. More...
 
const std::list< WayData > & GetWayData () const
 
virtual bool HasIcon (const StyleConfig &styleConfig, const MapParameter &parameter, IconStyle &style)=0
 Return true, if the icon in the IconStyle is available and can be drawn. More...
 
virtual double proposedLabelWidth (const MapParameter &parameter, double averageCharWidth, double objectWidth, size_t stringLength)
 Compute suggested label width for given parameters. More...
 
bool IsVisibleArea (const Projection &projection, const GeoBox &boundingBox, double pixelOffset) const
 Useful global helper functions. More...
 
bool IsVisibleWay (const Projection &projection, const std::vector< Point > &nodes, double pixelOffset) const
 
void Transform (const Projection &projection, const MapParameter &parameter, const GeoCoord &coord, double &x, double &y)
 
double GetProjectedWidth (const Projection &projection, double minPixel, double width) const
 
double GetProjectedWidth (const Projection &projection, double width) const
 
virtual void AfterPreprocessing (const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, const MapData &data)
 Low level drawing routines that have to be implemented by the concrete drawing engine. More...
 
virtual void BeforeDrawing (const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, const MapData &data)
 
virtual void AfterDrawing (const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, const MapData &data)
 
virtual void DrawNodes (const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, const MapData &data)
 Med level drawing routines that are already implemented by the base class, but which can be overwritten by the driver if necessary. More...
 
virtual void DrawNode (const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, const NodeRef &node)
 
virtual void DrawWay (const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, const WayData &data)
 
virtual void DrawWays (const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter)
 
virtual void DrawAreas (const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter)
 
bool Draw (const Projection &projection, const MapParameter &parameter, const MapData &data)
 

Protected Attributes

StyleConfigRef styleConfig
 Reference to the style configuration to be used. More...
 
TransBuffer transBuffer
 Scratch variables for path optimization algorithm. More...
 
NameFeatureValueReader nameReader
 Attribute readers. More...
 
NameAltFeatureValueReader nameAltReader
 Value reader for the 'alternative name' feature. More...
 
RefFeatureValueReader refReader
 Value reader for the 'ref' feature. More...
 
LayerFeatureValueReader layerReader
 Value reader for the 'layer' feature. More...
 
WidthFeatureValueReader widthReader
 Value reader for the 'width' feature. More...
 
AddressFeatureValueReader addressReader
 Value reader for the 'address' feature. More...
 
std::vector< double > emptyDash
 Presets, precalculations and similar. More...
 
std::vector< double > tunnelDash
 Dash array for drawing tunnel border. More...
 
FillStyle areaMarkStyle
 Marker fill style for internal debugging. More...
 
double contourLabelOffset
 Same value as in MapParameter but converted to pixel. More...
 
double contourLabelSpace
 Same value as in MapParameter but converted to pixel. More...
 
double shieldGridSizeHoriz
 Width of a cell for shield label placement. More...
 
double shieldGridSizeVert
 Height of a cell for shield label placement. More...
 

Detailed Description

Abstract base class of all renders (though you can always write your own renderer without inheriting from this class) It implements the general rendering algorithm.

Concrete renders are implemented by implementing the abstract methods defined by this class and used as callbacks to the concrete renderer.

Constructor & Destructor Documentation

osmscout::MapPainter::MapPainter ( const StyleConfigRef styleConfig,
CoordBuffer buffer 
)
osmscout::MapPainter::~MapPainter ( )
virtual

Member Function Documentation

void osmscout::MapPainter::AfterDrawing ( const StyleConfig styleConfig,
const Projection projection,
const MapParameter parameter,
const MapData &  data 
)
protectedvirtual

Reimplemented in osmscout::MapPainterSVG.

Referenced by Draw().

void osmscout::MapPainter::AfterPreprocessing ( const StyleConfig styleConfig,
const Projection projection,
const MapParameter parameter,
const MapData &  data 
)
protectedvirtual

Low level drawing routines that have to be implemented by the concrete drawing engine.

Some optional callbacks between individual processing steps.

Reimplemented in osmscout::MapPainterSVG.

Referenced by Draw().

void osmscout::MapPainter::BeforeDrawing ( const StyleConfig styleConfig,
const Projection projection,
const MapParameter parameter,
const MapData &  data 
)
protectedvirtual

Reimplemented in osmscout::MapPainterSVG.

Referenced by Draw().

virtual void osmscout::MapPainter::DrawArea ( const Projection projection,
const MapParameter parameter,
const AreaData area 
)
protectedpure virtual

Draw the given area using the given FillStyle for the area outline.

Implemented in osmscout::MapPainterQt, osmscout::MapPainterSVG, osmscout::MapPainterAgg, osmscout::MapPainterCairo, osmscout::MapPainterIOS, and osmscout::MapPainterNoOp.

Referenced by DrawAreas().

void osmscout::MapPainter::DrawAreas ( const StyleConfig styleConfig,
const Projection projection,
const MapParameter parameter 
)
protectedvirtual

References DrawArea().

Referenced by Draw().

virtual void osmscout::MapPainter::DrawContourLabel ( const Projection projection,
const MapParameter parameter,
const PathTextStyle style,
const std::string &  text,
size_t  transStart,
size_t  transEnd 
)
protectedpure virtual

Draw the given text as a contour of the given path in a style defined by the given LabelStyle.

Implemented in osmscout::MapPainterQt, osmscout::MapPainterSVG, osmscout::MapPainterAgg, osmscout::MapPainterCairo, osmscout::MapPainterIOS, and osmscout::MapPainterNoOp.

virtual void osmscout::MapPainter::DrawContourSymbol ( const Projection projection,
const MapParameter parameter,
const Symbol symbol,
double  space,
size_t  transStart,
size_t  transEnd 
)
protectedpure virtual

Draw the given text as a contour of the given path in a style defined by the given LabelStyle.

Implemented in osmscout::MapPainterQt, osmscout::MapPainterSVG, osmscout::MapPainterAgg, osmscout::MapPainterCairo, osmscout::MapPainterIOS, and osmscout::MapPainterNoOp.

virtual void osmscout::MapPainter::DrawGround ( const Projection projection,
const MapParameter parameter,
const FillStyle style 
)
protectedpure virtual

(Optionally) fills the area with the given default color for ground.

In 2D backends this just fills the given area, 3D backends might draw a sphere or an infinite plane.

Implemented in osmscout::MapPainterIOS, osmscout::MapPainterQt, osmscout::MapPainterAgg, osmscout::MapPainterSVG, osmscout::MapPainterCairo, and osmscout::MapPainterNoOp.

virtual void osmscout::MapPainter::DrawIcon ( const IconStyle style,
double  x,
double  y 
)
protectedpure virtual
virtual void osmscout::MapPainter::DrawLabel ( const Projection projection,
const MapParameter parameter,
const LabelData label 
)
protectedpure virtual

Draw the given text at the given pixel coordinate in a style defined by the given LabelStyle.

Implemented in osmscout::MapPainterQt, osmscout::MapPainterAgg, osmscout::MapPainterSVG, osmscout::MapPainterIOS, osmscout::MapPainterCairo, and osmscout::MapPainterNoOp.

void osmscout::MapPainter::DrawNode ( const StyleConfig styleConfig,
const Projection projection,
const MapParameter parameter,
const NodeRef node 
)
protectedvirtual
void osmscout::MapPainter::DrawNodes ( const StyleConfig styleConfig,
const Projection projection,
const MapParameter parameter,
const MapData &  data 
)
protectedvirtual

Med level drawing routines that are already implemented by the base class, but which can be overwritten by the driver if necessary.

References DrawNode(), and osmscout::StyleConfig::GetTypeConfig().

Referenced by Draw().

virtual void osmscout::MapPainter::DrawPath ( const Projection projection,
const MapParameter parameter,
const Color color,
double  width,
const std::vector< double > &  dash,
LineStyle::CapStyle  startCap,
LineStyle::CapStyle  endCap,
size_t  transStart,
size_t  transEnd 
)
protectedpure virtual

Draw simple line with the given style,the given color, the given width and the given untransformed nodes.

Implemented in osmscout::MapPainterQt, osmscout::MapPainterAgg, osmscout::MapPainterCairo, osmscout::MapPainterIOS, osmscout::MapPainterSVG, and osmscout::MapPainterNoOp.

Referenced by DrawWay().

virtual void osmscout::MapPainter::DrawSymbol ( const Projection projection,
const MapParameter parameter,
const Symbol symbol,
double  x,
double  y 
)
protectedpure virtual

Draw the Symbol as defined by the SymbolStyle at the given pixel coordinate.

Implemented in osmscout::MapPainterQt, osmscout::MapPainterAgg, osmscout::MapPainterIOS, osmscout::MapPainterCairo, osmscout::MapPainterSVG, and osmscout::MapPainterNoOp.

void osmscout::MapPainter::DrawWays ( const StyleConfig styleConfig,
const Projection projection,
const MapParameter parameter 
)
protectedvirtual

References DrawWay().

Referenced by Draw().

const std::list<AreaData>& osmscout::MapPainter::GetAreaData ( ) const
inlineprotected
virtual void osmscout::MapPainter::GetFontHeight ( const Projection projection,
const MapParameter parameter,
double  fontSize,
double &  height 
)
protectedpure virtual
double osmscout::MapPainter::GetProjectedWidth ( const Projection projection,
double  minPixel,
double  width 
) const
protected
double osmscout::MapPainter::GetProjectedWidth ( const Projection projection,
double  width 
) const
inlineprotected
virtual void osmscout::MapPainter::GetTextDimension ( const Projection projection,
const MapParameter parameter,
double  objectWidth,
double  fontSize,
const std::string &  text,
double &  xOff,
double &  yOff,
double &  width,
double &  height 
)
protectedpure virtual

Return the bounding box of the given text.

The method is call every time a label for a node or an area has to be drawn (which means "not for contour labels").

The backend may decide to relayout the given text, however it must assure that later calls to corresponding DrawXXX methods will honour the initial bounding box.

Implemented in osmscout::MapPainterQt, osmscout::MapPainterAgg, osmscout::MapPainterSVG, osmscout::MapPainterIOS, osmscout::MapPainterCairo, and osmscout::MapPainterNoOp.

const std::list<WayData>& osmscout::MapPainter::GetWayData ( ) const
inlineprotected
virtual bool osmscout::MapPainter::HasIcon ( const StyleConfig styleConfig,
const MapParameter parameter,
IconStyle style 
)
protectedpure virtual

Return true, if the icon in the IconStyle is available and can be drawn.

If this method returns false, possibly a fallback (using a Symbol) will be chosen.

Implemented in osmscout::MapPainterQt, osmscout::MapPainterAgg, osmscout::MapPainterSVG, osmscout::MapPainterIOS, osmscout::MapPainterCairo, and osmscout::MapPainterNoOp.

bool osmscout::MapPainter::IsVisibleArea ( const Projection projection,
const GeoBox &  boundingBox,
double  pixelOffset 
) const
protected
bool osmscout::MapPainter::IsVisibleWay ( const Projection projection,
const std::vector< Point > &  nodes,
double  pixelOffset 
) const
protected
double osmscout::MapPainter::proposedLabelWidth ( const MapParameter parameter,
double  averageCharWidth,
double  objectWidth,
size_t  stringLength 
)
protectedvirtual
void osmscout::MapPainter::Transform ( const Projection projection,
const MapParameter parameter,
const GeoCoord &  coord,
double &  x,
double &  y 
)
protected

References osmscout::Projection::GeoToPixel().

Referenced by DrawNode().

Member Data Documentation

AddressFeatureValueReader osmscout::MapPainter::addressReader
protected

Value reader for the 'address' feature.

FillStyle osmscout::MapPainter::areaMarkStyle
protected

Marker fill style for internal debugging.

Referenced by MapPainter().

double osmscout::MapPainter::contourLabelOffset
protected
double osmscout::MapPainter::contourLabelSpace
protected
std::vector<double> osmscout::MapPainter::emptyDash
protected

Presets, precalculations and similar.

Empty dash array

Referenced by osmscout::MapPainterSVG::DrawWay(), and DrawWay().

LayerFeatureValueReader osmscout::MapPainter::layerReader
protected

Value reader for the 'layer' feature.

NameAltFeatureValueReader osmscout::MapPainter::nameAltReader
protected

Value reader for the 'alternative name' feature.

NameFeatureValueReader osmscout::MapPainter::nameReader
protected

Attribute readers.

Value reader for the 'name' feature

RefFeatureValueReader osmscout::MapPainter::refReader
protected

Value reader for the 'ref' feature.

double osmscout::MapPainter::shieldGridSizeHoriz
protected

Width of a cell for shield label placement.

Referenced by Draw().

double osmscout::MapPainter::shieldGridSizeVert
protected

Height of a cell for shield label placement.

Referenced by Draw().

StyleConfigRef osmscout::MapPainter::styleConfig
protected

Reference to the style configuration to be used.

Referenced by osmscout::MapPainterQt::DrawGroundTiles(), and osmscout::MapPainterSVG::DrawMap().

TransBuffer osmscout::MapPainter::transBuffer
protected

Scratch variables for path optimization algorithm.

Static (avoid reallocation) buffer of transformed coordinates

Referenced by Draw(), and osmscout::MapPainterQt::DrawGroundTiles().

std::vector<double> osmscout::MapPainter::tunnelDash
protected

Dash array for drawing tunnel border.

Referenced by MapPainter().

WidthFeatureValueReader osmscout::MapPainter::widthReader
protected

Value reader for the 'width' feature.


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