alaCarte Maps
Renderer for OpenStreetMap tiles
hasnottag_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"
28 #include "server/rule.hpp"
30 
32 
33 HasNotTagSelector::HasNotTagSelector(const shared_ptr<Rule>& rule, const shared_ptr<Selector>& next, const string& tag)
34  : Selector(rule, next)
35  , tag(tag)
36 {
37 }
38 
39 
40 void HasNotTagSelector::matchNode(NodeId nodeID, const shared_ptr<TileIdentifier>& ti, RenderAttributes* attributes) const {
41  Node* node = geodata->getNode(nodeID);
42  auto entry = node->getTags().find(tag);
43  if (entry == node->getTags().end() || entry->second == precached_no || entry->second == precached_false) {
44  next->matchNode(nodeID, ti, attributes);
45  }
46 }
47 
48 void HasNotTagSelector::matchWay(WayId wayID, const shared_ptr<TileIdentifier>& ti, RenderAttributes* attributes) const {
49  Way* way = geodata->getWay(wayID);
50  auto entry = way->getTags().find(tag);
51  if (entry == way->getTags().end() || entry->second == precached_no || entry->second == precached_false) {
52  next->matchWay(wayID, ti, attributes);
53  }
54 }
55 
56 void HasNotTagSelector::matchRelation(RelId relID, const shared_ptr<TileIdentifier>& ti, RenderAttributes* attributes) const {
57  Relation* relation = geodata->getRelation(relID);
58  auto entry = relation->getTags().find(tag);
59  if (entry == relation->getTags().end() || entry->second == precached_no || entry->second == precached_false) {
60  next->matchRelation(relID, ti, attributes);
61  }
62 }
virtual void matchRelation(RelId relID, const shared_ptr< TileIdentifier > &ti, RenderAttributes *attributes) const
Definition: node.hpp:28
A RenderAttributes object contains mappings from NodeIDs and WayIDs to Style objects which define how...
CachedString precached_false("false")
TESTABLE const DataMap< CachedString, CachedString > & getTags() const
Returns a map with key-to-tag-mapping for osm-tags.
Definition: geo_object.cpp:30
const CachedString tag
virtual void matchNode(NodeId nodeID, const shared_ptr< TileIdentifier > &ti, RenderAttributes *attributes) const
virtual void matchWay(WayId wayID, const shared_ptr< TileIdentifier > &ti, RenderAttributes *attributes) const
const shared_ptr< Selector > next
Definition: selector.hpp:54
HasNotTagSelector(const shared_ptr< Rule > &rule, const shared_ptr< Selector > &next, const string &tag)
This file is part of alaCarte.
const shared_ptr< Geodata > geodata
Definition: selector.hpp:55
CachedString precached_no("no")
This file is part of alaCarte.
Definition: way.hpp:31