libosmscout 0.1
Loading...
Searching...
No Matches
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
 Data structure for holding temporary data about areas. More...
 
struct  ContourSymbolData
 
class  DatabaseCacheEntry
 
struct  RouteLabelData
 Data structure for holding temporary data route labels. More...
 
class  WayData
 Data structure for holding temporary data about ways. More...
 
struct  WayPathData
 Data structure for holding temporary data about way paths (a way may consist of multiple paths/lines rendered) More...
 

Public Types

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

Public Member Functions

bool Draw (const Projection &projection, const MapParameter &parameter, const std::vector< MapData > &data)
 
bool Draw (const Projection &projection, const MapParameter &parameter, const std::vector< MapData > &data, RenderSteps startStep, RenderSteps endStep)
 
 MapPainter ()
 
virtual ~MapPainter ()
 

Protected Member Functions

virtual void AfterDrawingCallback (const Projection &projection, const MapParameter &parameter, const std::vector< MapData > &data)
 
virtual void AfterPreprocessingCallback (const Projection &projection, const MapParameter &parameter, const std::vector< MapData > &data)
 
virtual void BeforeDrawingCallback (const Projection &projection, const MapParameter &parameter, const std::vector< MapData > &data)
 
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.
 
virtual void DrawContourLines (const Projection &projection, const MapParameter &parameter, const std::vector< MapData > &data)
 
virtual void DrawContourLines (size_t dbIndex, const Projection &projection, const MapParameter &parameter, const MapData &data)
 
virtual void DrawContourSymbol (const Projection &projection, const MapParameter &parameter, const Symbol &symbol, const ContourSymbolData &data)=0
 Draw the given Symbol on top of the contour of the given path.
 
virtual void DrawGround (const Projection &projection, const MapParameter &parameter, const FillStyle &style)=0
 (Optionally) fills the area with the given default color for ground.
 
virtual void DrawHillShading (const Projection &projection, const MapParameter &parameter, const std::vector< MapData > &data)
 
virtual void DrawHillShading (const StyleConfigRef &styleConfig, const Projection &projection, const MapParameter &parameter, const MapData &data)
 
virtual void DrawIcon (const IconStyle *style, const Vertex2D &centerPos, double width, double height)=0
 Draw the Icon as defined by the IconStyle at the given pixel coordinate (icon center).
 
virtual void DrawLabels (const Projection &projection, const MapParameter &parameter, const std::vector< MapData > &data)=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, const CoordBufferRange &coordRange)=0
 Draw simple line with the given style,the given color, the given width and the given untransformed nodes.
 
virtual void DrawSymbol (const Projection &projection, const MapParameter &parameter, const Symbol &symbol, const Vertex2D &screenPos, double scaleFactor=1.0)=0
 Draw the Symbol as defined by the SymbolStyle at the given pixel coordinate (symbol center).
 
virtual void DrawWay (const Projection &projection, const MapParameter &parameter, const WayData &data)
 
const std::list< AreaData > & GetAreaData () const
 
virtual double GetFontHeight (const Projection &projection, const MapParameter &parameter, double fontSize)=0
 Returns the height of the font.
 
double GetProjectedWidth (const Projection &projection, double minPixel, double width) const
 
double GetProjectedWidth (const Projection &projection, double width) const
 
virtual double GetProposedLabelWidth (const MapParameter &parameter, double averageCharWidth, double objectWidth, size_t stringLength)
 Compute suggested label width for given parameters.
 
const std::list< WayData > & GetWayData () const
 
virtual bool HasIcon (const StyleConfig &styleConfig, const Projection &projection, const MapParameter &parameter, IconStyle &style)=0
 Return true, if the icon in the IconStyle is available and can be drawn.
 
bool IsVisibleArea (const Projection &projection, const GeoBox &boundingBox, double pixelOffset) const
 Useful global helper functions.
 
bool IsVisibleWay (const Projection &projection, const GeoBox &boundingBox, double pixelOffset) const
 
std::vector< OffsetRelParseLaneTurns (const LanesFeatureValue &feature) const
 
virtual void RegisterContourLabel (const Projection &projection, const MapParameter &parameter, const ObjectFileRef &ref, const PathLabelData &label, const LabelPath &labelPath)=0
 Register contour label.
 
virtual void RegisterRegularLabel (const Projection &projection, const MapParameter &parameter, const ObjectFileRef &ref, const std::vector< LabelData > &labels, const Vertex2D &position, double objectWidth)=0
 Register regular label with given text at the given pixel coordinate in a style defined by the given LabelStyle.
 
virtual void StyleSheetChanged (const Projection &projection, const MapParameter &parameter, const std::vector< MapData > &data)
 Low level drawing routines that have to be implemented by the concrete drawing engine.
 

Protected Attributes

FillStyle areaMarkStyle
 Marker fill style for internal debugging.
 
FeatureValueBuffer coastlineSegmentAttributes
 
double contourLabelOffset
 Same value as in MapParameter but converted to pixel.
 
double contourLabelSpace
 Same value as in MapParameter but converted to pixel.
 
CoordBuffer coordBuffer
 Coordinate buffer.
 
std::vector< DatabaseCacheEntrydatabaseCache
 Cache of database specific data for rendering, such as attribute readers and style config reference.
 
TextStyleRef debugLabel
 
std::vector< double > emptyDash
 Presets, precalculations and similar.
 
FillStyleRef landFill
 Fallback styles in case they are missing for the style sheet.
 
FillStyleRef seaFill
 
double shieldGridSizeHoriz
 Width of a cell for shield label placement.
 
double shieldGridSizeVert
 Height of a cell for shield label placement.
 
TransBuffer transBuffer
 Internal coordinate transformation data structures.
 
std::vector< double > tunnelDash
 Dash array for drawing tunnel border.
 

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()

◆ ~MapPainter()

osmscout::MapPainter::~MapPainter ( )
virtual

Member Function Documentation

◆ AfterDrawingCallback()

void osmscout::MapPainter::AfterDrawingCallback ( const Projection projection,
const MapParameter parameter,
const std::vector< MapData > &  data 
)
protectedvirtual

Reimplemented in osmscout::MapPainterSVG.

◆ AfterPreprocessingCallback()

void osmscout::MapPainter::AfterPreprocessingCallback ( const Projection projection,
const MapParameter parameter,
const std::vector< MapData > &  data 
)
protectedvirtual

Reimplemented in osmscout::MapPainterSVG.

◆ BeforeDrawingCallback()

void osmscout::MapPainter::BeforeDrawingCallback ( const Projection projection,
const MapParameter parameter,
const std::vector< MapData > &  data 
)
protectedvirtual

◆ Draw() [1/2]

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

◆ Draw() [2/2]

◆ DrawArea()

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

Referenced by DrawContourLines(), and DrawHillShading().

◆ DrawContourLines() [1/2]

void osmscout::MapPainter::DrawContourLines ( const Projection projection,
const MapParameter parameter,
const std::vector< MapData > &  data 
)
protectedvirtual

◆ DrawContourLines() [2/2]

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

References osmscout::MapPainter::AreaData::borderStyle, osmscout::MapPainter::AreaData::boundingBox, osmscout::MapPainter::WayData::buffer, osmscout::MapPainter::WayData::color, osmscout::Projection::ConvertWidthToPixel(), coordBuffer, osmscout::MapPainter::WayData::coordRange, osmscout::MapPainter::AreaData::coordRange, osmscout::CrossesElevationLine(), databaseCache, osmscout::MapPainter::WayData::dbIndex, osmscout::MapPainter::AreaData::dbIndex, DrawArea(), DrawWay(), osmscout::MapPainter::WayData::endIsClosed, osmscout::GeoBox::GetBottomLeft(), osmscout::GeoBox::GetBottomRight(), osmscout::Projection::GetDimensions(), osmscout::GeoBox::GetDisplayText(), osmscout::GeoBox::GetMaxLat(), osmscout::GeoBox::GetMaxLon(), osmscout::GeoBox::GetMinLat(), osmscout::GeoBox::GetMinLon(), GetProjectedWidth(), osmscout::MapParameter::GetRenderContourLines(), osmscout::GeoBox::GetTopLeft(), osmscout::GeoBox::GetTopRight(), osmscout::Log::Info(), osmscout::GeoBox::Intersects(), osmscout::MapPainter::WayData::layer, osmscout::MapPainter::WayData::lineStyle, osmscout::MapPainter::WayData::lineWidth, osmscout::log, osmscout::SRTM::nodata, osmscout::TransPolygon::none, osmscout::MapPainter::AreaData::ref, osmscout::RoundDown(), osmscout::RoundUp(), osmscout::FeatureValueBuffer::SetType(), osmscout::MapData::srtmTile, osmscout::MapPainter::WayData::startIsClosed, transBuffer, osmscout::TransformBoundingBox(), osmscout::TransformWay(), osmscout::Log::Warn(), and osmscout::MapPainter::WayData::wayPriority.

Referenced by MapPainter().

◆ DrawContourSymbol()

virtual void osmscout::MapPainter::DrawContourSymbol ( const Projection projection,
const MapParameter parameter,
const Symbol symbol,
const ContourSymbolData data 
)
protectedpure virtual

Draw the given Symbol on top of the contour of the given path.

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

◆ DrawHillShading() [1/2]

void osmscout::MapPainter::DrawHillShading ( const Projection projection,
const MapParameter parameter,
const std::vector< MapData > &  data 
)
protectedvirtual

◆ DrawHillShading() [2/2]

◆ DrawIcon()

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

Draw the Icon as defined by the IconStyle at the given pixel coordinate (icon center).

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

◆ DrawLabels()

virtual void osmscout::MapPainter::DrawLabels ( const Projection projection,
const MapParameter parameter,
const std::vector< 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,
const CoordBufferRange coordRange 
)
protectedpure virtual

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

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

Referenced by DrawWay().

◆ DrawSymbol()

virtual void osmscout::MapPainter::DrawSymbol ( const Projection projection,
const MapParameter parameter,
const Symbol symbol,
const Vertex2D screenPos,
double  scaleFactor = 1.0 
)
protectedpure virtual

Draw the Symbol as defined by the SymbolStyle at the given pixel coordinate (symbol center).

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

◆ DrawWay()

◆ 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()

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.

References osmscout::MapParameter::GetLabelLineFitToArea(), osmscout::MapParameter::GetLabelLineFitToWidth(), osmscout::MapParameter::GetLabelLineMaxCharCount(), and osmscout::MapParameter::GetLabelLineMinCharCount().

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

◆ IsVisibleArea()

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

◆ IsVisibleWay()

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

◆ ParseLaneTurns()

◆ RegisterContourLabel()

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

◆ RegisterRegularLabel()

virtual void osmscout::MapPainter::RegisterRegularLabel ( const Projection projection,
const MapParameter parameter,
const ObjectFileRef ref,
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::MapPainterAgg, osmscout::MapPainterCairo, osmscout::MapPainterQt, osmscout::MapPainterSVG, and osmscout::MapPainterNoOp.

Referenced by DrawHillShading().

◆ StyleSheetChanged()

void osmscout::MapPainter::StyleSheetChanged ( const Projection projection,
const MapParameter parameter,
const std::vector< MapData > &  data 
)
protectedvirtual

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

Some optional callbacks between individual processing steps. Stylesheet at least of one of the databases has changed, so the renderer can clear caches and similar.

Reimplemented in osmscout::MapPainterCairo, and osmscout::MapPainterQt.

Member Data Documentation

◆ areaMarkStyle

FillStyle osmscout::MapPainter::areaMarkStyle
protected

Marker fill style for internal debugging.

Referenced by MapPainter().

◆ coastlineSegmentAttributes

FeatureValueBuffer osmscout::MapPainter::coastlineSegmentAttributes
protected

◆ 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

◆ databaseCache

std::vector<DatabaseCacheEntry> osmscout::MapPainter::databaseCache
protected

Cache of database specific data for rendering, such as attribute readers and style config reference.

The index of the entry corresponds to MapData provided for rendering.

Referenced by DrawContourLines().

◆ debugLabel

TextStyleRef osmscout::MapPainter::debugLabel
protected

Referenced by MapPainter().

◆ emptyDash

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

Presets, precalculations and similar.

Empty dash array

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

◆ landFill

FillStyleRef osmscout::MapPainter::landFill
protected

Fallback styles in case they are missing for the style sheet.

Referenced by osmscout::MapPainterSVG::AfterPreprocessingCallback(), and MapPainter().

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

◆ transBuffer

TransBuffer osmscout::MapPainter::transBuffer
protected

Internal coordinate transformation data structures.

Internal buffer for coordinate transformation from geo coordinates to display coordinates

Referenced by DrawContourLines(), and DrawHillShading().

◆ tunnelDash

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

Dash array for drawing tunnel border.

Referenced by MapPainter().


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