libosmscout  1.1.1
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
osmscout::MapPainter Class Referenceabstract

#include <libosmscout-map/include/osmscout/MapPainter.h>

Inheritance diagram for osmscout::MapPainter:
Inheritance graph
[legend]
Collaboration diagram for osmscout::MapPainter:
Collaboration graph
[legend]

Classes

struct  AreaData
 
struct  DataStatistic
 
struct  PolyData
 
struct  RouteLabelData
 
struct  WayData
 
struct  WayPathData
 

Public Types

using WayPathDataIt = std::list< WayPathData >::iterator
 

Public Member Functions

 MapPainter (const StyleConfigRef &styleConfig)
 
virtual ~MapPainter ()
 
bool Draw (const Projection &projection, const MapParameter &parameter, const MapData &data, RenderSteps startStep, RenderSteps endStep)
 
bool Draw (const Projection &projection, const MapParameter &parameter, const MapData &data)
 

Protected Member Functions

const std::list< WayData > & GetWayData () const
 
const std::list< AreaData > & GetAreaData () const
 
virtual bool HasIcon (const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, IconStyle &style)=0
 
virtual double GetFontHeight (const Projection &projection, const MapParameter &parameter, double fontSize)=0
 
virtual void DrawGround (const Projection &projection, const MapParameter &parameter, const FillStyle &style)=0
 
virtual void RegisterRegularLabel (const Projection &projection, const MapParameter &parameter, const std::vector< LabelData > &labels, const Vertex2D &position, double objectWidth)=0
 
virtual void RegisterContourLabel (const Projection &projection, const MapParameter &parameter, const PathLabelData &label, const LabelPath &labelPath)=0
 
virtual void DrawLabels (const Projection &projection, const MapParameter &parameter, const MapData &data)=0
 
virtual void DrawContourLines (const Projection &projection, const MapParameter &parameter, const MapData &data)
 
virtual void DrawHillShading (const Projection &projection, const MapParameter &parameter, const MapData &data)
 
virtual void DrawIcon (const IconStyle *style, double centerX, double centerY, double width, double height)=0
 
virtual void DrawSymbol (const Projection &projection, const MapParameter &parameter, const Symbol &symbol, double x, double y)=0
 
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
 
virtual void DrawContourSymbol (const Projection &projection, const MapParameter &parameter, const Symbol &symbol, double space, size_t transStart, size_t transEnd)=0
 
virtual void DrawArea (const Projection &projection, const MapParameter &parameter, const AreaData &area)=0
 
virtual double GetProposedLabelWidth (const MapParameter &parameter, double averageCharWidth, double objectWidth, size_t stringLength)
 
virtual void DrawWay (const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, const WayData &data)
 
std::vector< OffsetRelParseLaneTurns (const LanesFeatureValue &)
 
virtual void AfterPreprocessing (const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, const MapData &data)
 
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)
 

Protected Attributes

TextStyleRef debugLabel
 
StyleConfigRef styleConfig
 Reference to the style configuration to be used. More...
 
TransBuffer transBuffer
 Internal buffer for coordinate transformation from geo coordinates to display coordinates. More...
 
CoordBuffer coordBuffer
 Coordinate buffer. More...
 
FillStyleRef landFill
 
FillStyleRef seaFill
 
FeatureValueBuffer coastlineSegmentAttributes
 
NameFeatureValueReader nameReader
 Value reader for the 'name' feature. 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...
 
LanesFeatureValueReader lanesReader
 Value reader for the 'lanes' feature. More...
 
AccessFeatureValueReader accessReader
 Value reader for the 'lanes' feature. More...
 
ColorFeatureValueReader colorReader
 Value reader for the 'color' feature. More...
 
std::vector< double > emptyDash
 Empty dash array. 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...
 
bool IsVisibleArea (const Projection &projection, const GeoBox &boundingBox, double pixelOffset) const
 
bool IsVisibleWay (const Projection &projection, const GeoBox &boundingBox, 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
 

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.

Member Typedef Documentation

◆ WayPathDataIt

using osmscout::MapPainter::WayPathDataIt = std::list<WayPathData>::iterator

Constructor & Destructor Documentation

◆ MapPainter()

osmscout::MapPainter::MapPainter ( const StyleConfigRef styleConfig)

◆ ~MapPainter()

virtual osmscout::MapPainter::~MapPainter ( )
virtual

Member Function Documentation

◆ AfterDrawing()

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

◆ AfterPreprocessing()

virtual 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, osmscout::MapPainterDirectX, and osmscout::MapPainterGDI.

◆ BeforeDrawing()

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

◆ Draw() [1/2]

bool osmscout::MapPainter::Draw ( const Projection projection,
const MapParameter &  parameter,
const MapData &  data,
RenderSteps  startStep,
RenderSteps  endStep 
)

◆ Draw() [2/2]

bool osmscout::MapPainter::Draw ( const Projection projection,
const MapParameter &  parameter,
const MapData &  data 
)

◆ DrawArea()

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

◆ DrawContourLines()

virtual void osmscout::MapPainter::DrawContourLines ( const Projection projection,
const MapParameter &  parameter,
const MapData &  data 
)
protectedvirtual

◆ DrawContourSymbol()

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::MapPainterSVG, osmscout::MapPainterDirectX, osmscout::MapPainterQt, osmscout::MapPainterCairo, osmscout::MapPainterAgg, osmscout::MapPainterGDI, and osmscout::MapPainterNoOp.

◆ DrawGround()

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::MapPainterSVG, osmscout::MapPainterQt, osmscout::MapPainterDirectX, osmscout::MapPainterAgg, osmscout::MapPainterCairo, osmscout::MapPainterGDI, and osmscout::MapPainterNoOp.

◆ DrawHillShading()

virtual void osmscout::MapPainter::DrawHillShading ( const Projection projection,
const MapParameter &  parameter,
const MapData &  data 
)
protectedvirtual

◆ DrawIcon()

virtual void osmscout::MapPainter::DrawIcon ( const IconStyle style,
double  centerX,
double  centerY,
double  width,
double  height 
)
protectedpure virtual

◆ DrawLabels()

virtual void osmscout::MapPainter::DrawLabels ( const Projection projection,
const MapParameter &  parameter,
const MapData &  data 
)
protectedpure virtual

◆ DrawPath()

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::MapPainterSVG, osmscout::MapPainterCairo, osmscout::MapPainterDirectX, osmscout::MapPainterGDI, osmscout::MapPainterAgg, and osmscout::MapPainterNoOp.

◆ DrawSymbol()

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 (symbol center).

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

◆ DrawWay()

virtual void osmscout::MapPainter::DrawWay ( const StyleConfig styleConfig,
const Projection projection,
const MapParameter &  parameter,
const WayData data 
)
protectedvirtual

◆ GetAreaData()

const std::list<AreaData>& osmscout::MapPainter::GetAreaData ( ) const
inlineprotected

◆ GetFontHeight()

virtual double osmscout::MapPainter::GetFontHeight ( const Projection projection,
const MapParameter &  parameter,
double  fontSize 
)
protectedpure virtual

◆ GetProjectedWidth() [1/2]

double osmscout::MapPainter::GetProjectedWidth ( const Projection projection,
double  minPixel,
double  width 
) const
protected

◆ GetProjectedWidth() [2/2]

double osmscout::MapPainter::GetProjectedWidth ( const Projection projection,
double  width 
) const
inlineprotected

◆ GetProposedLabelWidth()

virtual double osmscout::MapPainter::GetProposedLabelWidth ( const MapParameter &  parameter,
double  averageCharWidth,
double  objectWidth,
size_t  stringLength 
)
protectedvirtual

Compute suggested label width for given parameters. It may be used by backend for layout labels with wrapping words.

◆ GetWayData()

const std::list<WayData>& osmscout::MapPainter::GetWayData ( ) const
inlineprotected

◆ HasIcon()

virtual bool osmscout::MapPainter::HasIcon ( const StyleConfig styleConfig,
const Projection projection,
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.

Icon style dimensions and iconId may be setup for later usage.

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

◆ IsVisibleArea()

bool osmscout::MapPainter::IsVisibleArea ( const Projection projection,
const GeoBox &  boundingBox,
double  pixelOffset 
) const
protected

Useful global helper functions.

◆ IsVisibleWay()

bool osmscout::MapPainter::IsVisibleWay ( const Projection projection,
const GeoBox &  boundingBox,
double  pixelOffset 
) const
protected

◆ ParseLaneTurns()

std::vector<OffsetRel> osmscout::MapPainter::ParseLaneTurns ( const LanesFeatureValue )
protected

◆ RegisterContourLabel()

virtual void osmscout::MapPainter::RegisterContourLabel ( const Projection projection,
const MapParameter &  parameter,
const PathLabelData label,
const LabelPath labelPath 
)
protectedpure virtual

◆ RegisterRegularLabel()

virtual void osmscout::MapPainter::RegisterRegularLabel ( const Projection projection,
const MapParameter &  parameter,
const std::vector< LabelData > &  labels,
const Vertex2D &  position,
double  objectWidth 
)
protectedpure virtual

Register regular label with given text at the given pixel coordinate in a style defined by the given LabelStyle.

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

◆ Transform()

void osmscout::MapPainter::Transform ( const Projection projection,
const MapParameter &  parameter,
const GeoCoord &  coord,
double &  x,
double &  y 
)
protected

Member Data Documentation

◆ accessReader

AccessFeatureValueReader osmscout::MapPainter::accessReader
protected

Value reader for the 'lanes' feature.

◆ addressReader

AddressFeatureValueReader osmscout::MapPainter::addressReader
protected

Value reader for the 'address' feature.

◆ areaMarkStyle

FillStyle osmscout::MapPainter::areaMarkStyle
protected

Marker fill style for internal debugging.

◆ coastlineSegmentAttributes

FeatureValueBuffer osmscout::MapPainter::coastlineSegmentAttributes
protected

◆ colorReader

ColorFeatureValueReader osmscout::MapPainter::colorReader
protected

Value reader for the 'color' feature.

◆ contourLabelOffset

double osmscout::MapPainter::contourLabelOffset
protected

Same value as in MapParameter but converted to pixel.

◆ contourLabelSpace

double osmscout::MapPainter::contourLabelSpace
protected

Same value as in MapParameter but converted to pixel.

◆ coordBuffer

CoordBuffer osmscout::MapPainter::coordBuffer
protected

Coordinate buffer.

◆ debugLabel

TextStyleRef osmscout::MapPainter::debugLabel
protected

◆ emptyDash

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

Empty dash array.

Presets, precalculations and similar

◆ landFill

FillStyleRef osmscout::MapPainter::landFill
protected

Fallback styles in case they are missing for the style sheet

◆ lanesReader

LanesFeatureValueReader osmscout::MapPainter::lanesReader
protected

Value reader for the 'lanes' feature.

◆ layerReader

LayerFeatureValueReader osmscout::MapPainter::layerReader
protected

Value reader for the 'layer' feature.

◆ nameAltReader

NameAltFeatureValueReader osmscout::MapPainter::nameAltReader
protected

Value reader for the 'alternative name' feature.

◆ nameReader

NameFeatureValueReader osmscout::MapPainter::nameReader
protected

Value reader for the 'name' feature.

Attribute readers

◆ refReader

RefFeatureValueReader osmscout::MapPainter::refReader
protected

Value reader for the 'ref' feature.

◆ seaFill

FillStyleRef osmscout::MapPainter::seaFill
protected

◆ shieldGridSizeHoriz

double osmscout::MapPainter::shieldGridSizeHoriz
protected

Width of a cell for shield label placement.

◆ shieldGridSizeVert

double osmscout::MapPainter::shieldGridSizeVert
protected

Height of a cell for shield label placement.

◆ styleConfig

StyleConfigRef osmscout::MapPainter::styleConfig
protected

Reference to the style configuration to be used.

◆ transBuffer

TransBuffer osmscout::MapPainter::transBuffer
protected

Internal buffer for coordinate transformation from geo coordinates to display coordinates.

Internal coordinate transformation data structures

◆ tunnelDash

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

Dash array for drawing tunnel border.

◆ widthReader

WidthFeatureValueReader osmscout::MapPainter::widthReader
protected

Value reader for the 'width' feature.


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