alaCarte Maps
Renderer for OpenStreetMap tiles
stylesheet.hpp
Go to the documentation of this file.
1 
21 #pragma once
22 #ifndef STYLESHEET_HPP
23 #define STYLESHEET_HPP
24 
25 #include "settings.hpp"
26 #include <boost/filesystem/path.hpp>
27 
28 class Geodata;
29 class RenderAttributes;
30 class TileIdentifier;
31 class Rule;
32 class StyleTemplate;
33 
39 class Stylesheet : public boost::enable_shared_from_this<Stylesheet>
40 {
41  friend struct MapCssParser;
42 public:
43  Stylesheet(const shared_ptr<Geodata>& geodata, const std::vector<shared_ptr<Rule> >& rules, const shared_ptr<StyleTemplate>& canvasStyle);
44 
45 
52  static shared_ptr<Stylesheet> Load(const boost::filesystem::path& path, const shared_ptr<Geodata>& geodata, int timeout);
53 
60  TESTABLE void match(const shared_ptr<std::vector<NodeId> >& nodeIDs,
61  const shared_ptr<std::vector<WayId> >& wayIDs,
62  const shared_ptr<std::vector<RelId> >& relIDs,
63  const shared_ptr<TileIdentifier>& ti,
64  RenderAttributes* styleMap) const;
65 
69  TESTABLE const boost::filesystem::path getPath() const;
70 
71 private:
72  shared_ptr<Geodata> geodata;
73  const std::vector<shared_ptr<Rule> > rules;
74  shared_ptr<StyleTemplate> canvasStyle;
75  boost::filesystem::path path;
76 };
77 
78 #endif
A StyleTemplate is the "raw" / "unevaluated" form of a Style specified by a single MapCSS rule...
Stylesheet(const shared_ptr< Geodata > &geodata, const std::vector< shared_ptr< Rule > > &rules, const shared_ptr< StyleTemplate > &canvasStyle)
This file is part of alaCarte.
Definition: stylesheet.cpp:33
A RenderAttributes object contains mappings from NodeIDs and WayIDs to Style objects which define how...
Definition: rule.hpp:34
boost::filesystem::path path
Definition: stylesheet.hpp:75
A Stylesheet parses a given MapCSS Stylesheet file and stores the defined rules.
Definition: stylesheet.hpp:39
shared_ptr< Geodata > geodata
Definition: stylesheet.hpp:72
A TileIdentifier identifies a Tile.
const std::vector< shared_ptr< Rule > > rules
Definition: stylesheet.hpp:73
TESTABLE const boost::filesystem::path getPath() const
Definition: stylesheet.cpp:74
shared_ptr< StyleTemplate > canvasStyle
Definition: stylesheet.hpp:74
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.
Definition: stylesheet.cpp:41
#define TESTABLE
Definition: settings.hpp:85
static shared_ptr< Stylesheet > Load(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 ru...