alaCarte Maps
Renderer for OpenStreetMap tiles
Renderer Class Reference

#include <renderer.hpp>

Public Member Functions

 Renderer (const shared_ptr< Geodata > &data)
 
TESTABLE void renderEmptyTile (RenderAttributes &map, const shared_ptr< RenderCanvas > &canvas, const shared_ptr< Tile > &tile)
 
TESTABLE void renderMetaTile (RenderAttributes &map, const shared_ptr< RenderCanvas > &canvas, const shared_ptr< MetaIdentifier > &id)
 
TESTABLE void sliceTile (const shared_ptr< RenderCanvas > &canvas, const shared_ptr< MetaIdentifier > &id, const shared_ptr< Tile > &tile) const
 

Protected Member Functions

void placeLabels (const std::list< shared_ptr< Label > > &labels, std::vector< shared_ptr< Label > > &placed)
 Place labels with greedy algorithm. More...
 
void placeShields (const std::list< shared_ptr< Shield > > &shields, std::vector< shared_ptr< Shield > > &placed)
 Place labels with greedy algorithm. More...
 

Private Member Functions

void printTileId (cairo_t *cr, const shared_ptr< TileIdentifier > &id) const
 Debug function that prints identifier on the tile. More...
 
void sortObjects (RenderAttributes &map, std::vector< NodeId > &nodes, std::vector< WayId > &ways, std::vector< RelId > &relations) const
 Sort objetcs into painting order. More...
 
bool isCutOff (const FloatRect &box, const FloatRect &owner)
 Checks if all neighbour tile know about the owner of the label. More...
 
void compositeLayers (CairoLayer *layers) const
 Composited all layers into the first layer. More...
 
void paintBackground (CairoLayer &layer, const Style *canvasStyle) const
 
void renderObjects (CairoLayer *layers, RenderAttributes &map, const cairo_matrix_t *transform, std::vector< NodeId > &nodes, std::vector< WayId > &ways, std::vector< RelId > &relations, std::list< shared_ptr< Label >> &labels, std::list< shared_ptr< Shield >> &shields, AssetCache &cache) const
 Renders a OSM layer onto the given cairo surface. More...
 
template<typename LabelType >
void renderLabels (cairo_t *cr, std::vector< shared_ptr< LabelType > > &labels, AssetCache &cache) const
 
void renderShields (cairo_t *cr, std::vector< shared_ptr< Shield > > &shields) const
 Only renders the shield background, the text is rendered in renderLabels. More...
 
void renderArea (const FixedRect &area, const shared_ptr< RenderCanvas > &canvas, double width, double height, RenderAttributes &map, AssetCache &cache)
 

Private Attributes

const shared_ptr< Geodatadata
 stores the actual data More...
 
FloatRect bounds
 
FloatRect neighbours [8]
 
FloatRect neighbourRequests [8]
 

Static Private Attributes

static boost::mutex renderLock
 lock calls to cairo for old versions that are not thread-safe. More...
 

Detailed Description

Definition at line 49 of file renderer.hpp.

Constructor & Destructor Documentation

Renderer::Renderer ( const shared_ptr< Geodata > &  data)

Definition at line 90 of file renderer.cpp.

Member Function Documentation

void Renderer::compositeLayers ( CairoLayer layers) const
private

Composited all layers into the first layer.

Definition at line 449 of file renderer.cpp.

bool Renderer::isCutOff ( const FloatRect box,
const FloatRect owner 
)
private

Checks if all neighbour tile know about the owner of the label.

Definition at line 353 of file renderer.cpp.

void Renderer::paintBackground ( CairoLayer layer,
const Style canvasStyle 
) const
private

Definition at line 465 of file renderer.cpp.

void Renderer::placeLabels ( const std::list< shared_ptr< Label > > &  labels,
std::vector< shared_ptr< Label > > &  placed 
)
protected

Place labels with greedy algorithm.

Definition at line 362 of file renderer.cpp.

void Renderer::placeShields ( const std::list< shared_ptr< Shield > > &  shields,
std::vector< shared_ptr< Shield > > &  placed 
)
protected

Place labels with greedy algorithm.

Definition at line 424 of file renderer.cpp.

void Renderer::printTileId ( cairo_t *  cr,
const shared_ptr< TileIdentifier > &  id 
) const
private

Debug function that prints identifier on the tile.

Definition at line 115 of file renderer.cpp.

void Renderer::renderArea ( const FixedRect area,
const shared_ptr< RenderCanvas > &  canvas,
double  width,
double  height,
RenderAttributes map,
AssetCache cache 
)
private

Definition at line 510 of file renderer.cpp.

void Renderer::renderEmptyTile ( RenderAttributes map,
const shared_ptr< RenderCanvas > &  canvas,
const shared_ptr< Tile > &  tile 
)

Definition at line 485 of file renderer.cpp.

template<typename LabelType >
void Renderer::renderLabels ( cairo_t *  cr,
std::vector< shared_ptr< LabelType > > &  labels,
AssetCache cache 
) const
private

Definition at line 313 of file renderer.cpp.

void Renderer::renderMetaTile ( RenderAttributes map,
const shared_ptr< RenderCanvas > &  canvas,
const shared_ptr< MetaIdentifier > &  id 
)

Definition at line 583 of file renderer.cpp.

void Renderer::renderObjects ( CairoLayer layers,
RenderAttributes map,
const cairo_matrix_t *  transform,
std::vector< NodeId > &  nodes,
std::vector< WayId > &  ways,
std::vector< RelId > &  relations,
std::list< shared_ptr< Label >> &  labels,
std::list< shared_ptr< Shield >> &  shields,
AssetCache cache 
) const
private

Renders a OSM layer onto the given cairo surface.

Definition at line 170 of file renderer.cpp.

void Renderer::renderShields ( cairo_t *  cr,
std::vector< shared_ptr< Shield > > &  shields 
) const
private

Only renders the shield background, the text is rendered in renderLabels.

Definition at line 262 of file renderer.cpp.

void Renderer::sliceTile ( const shared_ptr< RenderCanvas > &  canvas,
const shared_ptr< MetaIdentifier > &  id,
const shared_ptr< Tile > &  tile 
) const

Definition at line 557 of file renderer.cpp.

void Renderer::sortObjects ( RenderAttributes map,
std::vector< NodeId > &  nodes,
std::vector< WayId > &  ways,
std::vector< RelId > &  relations 
) const
private

Sort objetcs into painting order.

Definition at line 140 of file renderer.cpp.

Member Data Documentation

FloatRect Renderer::bounds
private

Definition at line 68 of file renderer.hpp.

const shared_ptr<Geodata> Renderer::data
private

stores the actual data

Definition at line 67 of file renderer.hpp.

FloatRect Renderer::neighbourRequests[8]
private

Definition at line 70 of file renderer.hpp.

FloatRect Renderer::neighbours[8]
private

Definition at line 69 of file renderer.hpp.

boost::mutex Renderer::renderLock
staticprivate

lock calls to cairo for old versions that are not thread-safe.

This file is part of alaCarte.

alaCarte is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

alaCarte is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with alaCarte. If not, see http://www.gnu.org/licenses/.

Copyright alaCarte 2012-2013 Simon Dreher, Florian Jacob, Tobias Kahlert, Patrick Niklaus, Bernhard Scheirle, Lisa Winter Maintainer: Patrick Niklaus

Definition at line 91 of file renderer.hpp.


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