MCPcopy Create free account
hub / github.com/comaps/comaps / Collect

Method Collect

generator/collector_boundary_postcode.cpp:25–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25void BoundaryPostcodeCollector::Collect(OsmElement const & el)
26{
27 /// @todo Add postal_code for highways processing (along a street).
28
29 // https://wiki.openstreetmap.org/wiki/Key:postal_code
30 if (el.m_type != OsmElement::EntityType::Relation || el.GetTag("type") != "boundary")
31 return;
32
33 auto postcode = el.GetTag("postal_code");
34 if (postcode.empty())
35 postcode = el.GetTag("addr:postcode");
36
37 // Filter dummy tags like here: https://www.openstreetmap.org/relation/7444
38 if (postcode.empty() || postcode.find_first_of(";,") != std::string::npos)
39 return;
40
41 /// @todo We don't override CollectFeature instead, because of FeatureMakerSimple?
42 auto osmElementCopy = el;
43 feature::FeatureBuilder feature;
44 m_featureMakerSimple.Add(osmElementCopy);
45
46 while (m_featureMakerSimple.GetNextFeature(feature))
47 {
48 /// @todo Make move geometry?
49 if (feature.IsGeometryClosed())
50 m_data.emplace_back(postcode, feature.GetOuterGeometry());
51 }
52}
53
54void BoundaryPostcodeCollector::Save()
55{

Callers

nothing calls this directly

Calls 6

GetTagMethod · 0.80
GetNextFeatureMethod · 0.80
IsGeometryClosedMethod · 0.80
emptyMethod · 0.45
AddMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected