alaCarte Maps
Renderer for OpenStreetMap tiles
Stylesheet Class Reference

A Stylesheet parses a given MapCSS Stylesheet file and stores the defined rules. More...

#include <stylesheet.hpp>

Inheritance diagram for Stylesheet:

Public Member Functions

 Stylesheet (const shared_ptr< Geodata > &geodata, const std::vector< shared_ptr< Rule > > &rules, const shared_ptr< StyleTemplate > &canvasStyle)
 This file is part of alaCarte. More...
 
TESTABLE void match (const shared_ptr< std::vector< NodeId > > &nodeIDs, const shared_ptr< std::vector< WayId > > &wayIDs, const shared_ptr< std::vector< RelId > > &relIDs, const shared_ptr< TileIdentifier > &ti, RenderAttributes *styleMap) const
 Returns a new RenderAttributes with a Style object for each given Node and Way. More...
 
TESTABLE const boost::filesystem::path getPath () const
 

Static Public Member Functions

static shared_ptr< StylesheetLoad (const boost::filesystem::path &path, const shared_ptr< Geodata > &geodata, int timeout)
 Parses the MapCSS Stylesheet at the given path and returns a new Stylesheet containing the defined rules. More...
 

Private Attributes

shared_ptr< Geodatageodata
 
const std::vector< shared_ptr< Rule > > rules
 
shared_ptr< StyleTemplatecanvasStyle
 
boost::filesystem::path path
 

Friends

struct MapCssParser
 

Detailed Description

A Stylesheet parses a given MapCSS Stylesheet file and stores the defined rules.

Additionally, for a given set of GeoObjects, the Stylesheet generates a RenderAttributes object containing all MapCSS attributes needed to draw the GeoObjects.

Definition at line 39 of file stylesheet.hpp.

Constructor & Destructor Documentation

Stylesheet::Stylesheet ( const shared_ptr< Geodata > &  geodata,
const std::vector< shared_ptr< Rule > > &  rules,
const shared_ptr< StyleTemplate > &  canvasStyle 
)

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: Florian Jacob

Definition at line 33 of file stylesheet.cpp.

Member Function Documentation

const boost::filesystem::path Stylesheet::getPath ( ) const
Returns
the path to this stylesheet, including the file name

Definition at line 74 of file stylesheet.cpp.

shared_ptr< Stylesheet > Stylesheet::Load ( const boost::filesystem::path &  path,
const shared_ptr< Geodata > &  geodata,
int  timeout 
)
static

Parses the MapCSS Stylesheet at the given path and returns a new Stylesheet containing the defined rules.

Creates a stylesheet using a specified file.

Parameters
paththe absolute or relative path to the stylesheet
dataa reference to the geodata object to use to resolve GeoObject IDs to the actual Geoobject
pathto the mapcss file
geodataused by in this stylesheet
Returns
The created stylesheet

Definition at line 415 of file mapcss_parser.cpp.

void Stylesheet::match ( const shared_ptr< std::vector< NodeId > > &  nodeIDs,
const shared_ptr< std::vector< WayId > > &  wayIDs,
const shared_ptr< std::vector< RelId > > &  relIDs,
const shared_ptr< TileIdentifier > &  ti,
RenderAttributes styleMap 
) const

Returns a new RenderAttributes with a Style object for each given Node and Way.

The Style object contains all MapCSS Attributes from this Stylesheet that apply to it.

Parameters
styleMapthe output parameter to return a new RenderAttributes. Has to be deleted manually.

Definition at line 41 of file stylesheet.cpp.

Friends And Related Function Documentation

friend struct MapCssParser
friend

Definition at line 41 of file stylesheet.hpp.

Member Data Documentation

shared_ptr<StyleTemplate> Stylesheet::canvasStyle
private

Definition at line 74 of file stylesheet.hpp.

shared_ptr<Geodata> Stylesheet::geodata
private

Definition at line 72 of file stylesheet.hpp.

boost::filesystem::path Stylesheet::path
private

Definition at line 75 of file stylesheet.hpp.

const std::vector<shared_ptr<Rule> > Stylesheet::rules
private

Definition at line 73 of file stylesheet.hpp.


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