alaCarte Maps
Renderer for OpenStreetMap tiles
area_selector.cpp
Go to the documentation of this file.
1 
24 #include "general/geodata.hpp"
25 #include "general/node.hpp"
26 #include "general/way.hpp"
27 #include "general/relation.hpp"
29 
31 
32 AreaSelector::AreaSelector(const shared_ptr<Rule>& rule, const shared_ptr<Selector>& next) : Selector(rule, next)
33 {
34 }
35 
36 void AreaSelector::matchNode(NodeId nodeID, const shared_ptr<TileIdentifier>& ti, RenderAttributes* attributes) const {
37 }
38 
39 
40 void AreaSelector::matchWay(WayId wayID, const shared_ptr<TileIdentifier>& ti, RenderAttributes* attributes) const {
41  Way* way = geodata->getWay(wayID);
42  auto& nodes = way->getNodeIDs();
43  auto entry = way->getTags().find(precached_area);
44 
45  // match if way is closed and (area tag isn't set or set to yes)
46  if (nodes.front() == nodes.back()) {
47  if (entry == way->getTags().end() || entry->second == precached_yes) {
48  next->matchWay(wayID, ti, attributes);
49  }
50  }
51 }
52 
53 void AreaSelector::matchRelation(RelId relID, const shared_ptr<TileIdentifier>& ti, RenderAttributes* attributes) const {
54 }
A RenderAttributes object contains mappings from NodeIDs and WayIDs to Style objects which define how...
TESTABLE const DataMap< CachedString, CachedString > & getTags() const
Returns a map with key-to-tag-mapping for osm-tags.
Definition: geo_object.cpp:30
AreaSelector(const shared_ptr< Rule > &rule, const shared_ptr< Selector > &next)
This file is part of alaCarte.
virtual void matchNode(NodeId nodeID, const shared_ptr< TileIdentifier > &ti, RenderAttributes *attributes) const
const shared_ptr< Selector > next
Definition: selector.hpp:54
const shared_ptr< Geodata > geodata
Definition: selector.hpp:55
CachedString precached_yes("yes")
virtual void matchRelation(RelId relID, const shared_ptr< TileIdentifier > &ti, RenderAttributes *attributes) const
CachedString precached_area("area")
Definition: way.hpp:31
virtual void matchWay(WayId wayID, const shared_ptr< TileIdentifier > &ti, RenderAttributes *attributes) const
const std::vector< NodeId > & getNodeIDs() const
Definition: way.hpp:45