alaCarte Maps
Renderer for OpenStreetMap tiles
render_attributes.hpp
Go to the documentation of this file.
1 
21 #pragma once
22 #ifndef RENDER_ATTRIBUTES_HPP
23 #define RENDER_ATTRIBUTES_HPP
24 
25 #include "settings.hpp"
26 #include <boost/unordered_map.hpp>
27 #include <boost/pool/object_pool.hpp>
28 #include "server/style.hpp"
29 
37 {
38 public:
39  static const unsigned int ChunkSize = 1024;
40 
41  TESTABLE inline const boost::unordered_map<WayId, Style*>& getWayMap() const
42  {
43  return wayStyles;
44  }
45  TESTABLE inline const boost::unordered_map<NodeId, Style*>& getNodeMap() const
46  {
47  return nodeStyles;
48  }
49  TESTABLE inline const boost::unordered_map<RelId, Style*>& getRelationMap() const
50  {
51  return relationStyles;
52  }
54  {
55  return &canvasStyle;
56  }
57 
61 
62 private:
63  template<typename IdType>
64  Style* newStyle(IdType id, boost::unordered_map<IdType, Style*>& map)
65  {
66  Style* newStyle = stylePool.construct();
67  map.insert(std::make_pair(id, newStyle));
68  return newStyle;
69  }
70 
71  boost::unordered_map<NodeId, Style*> nodeStyles;
72  boost::unordered_map<WayId, Style*> wayStyles;
73  boost::unordered_map<RelId, Style*> relationStyles;
74 
75  boost::object_pool<Style> stylePool;
76 
78 };
79 
80 
81 #endif
boost::object_pool< Style > stylePool
TESTABLE const boost::unordered_map< WayId, Style * > & getWayMap() const
A RenderAttributes object contains mappings from NodeIDs and WayIDs to Style objects which define how...
TESTABLE Style * getCanvasStyle()
boost::unordered_map< NodeId, Style * > nodeStyles
TESTABLE Style * getNewStyle(NodeId id)
TESTABLE const boost::unordered_map< RelId, Style * > & getRelationMap() const
TESTABLE const boost::unordered_map< NodeId, Style * > & getNodeMap() const
TESTABLE Style * getNewStyle(WayId id)
static const unsigned int ChunkSize
A Style stores the MapCSS properties for a single Node or Way, or a Relation of type multipolygon...
Definition: style.hpp:35
boost::unordered_map< RelId, Style * > relationStyles
Style * newStyle(IdType id, boost::unordered_map< IdType, Style * > &map)
boost::unordered_map< WayId, Style * > wayStyles
#define TESTABLE
Definition: settings.hpp:85
TESTABLE Style * getNewStyle(RelId id)