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

Method LoadStreet

libs/search/street_vicinity_loader.cpp:63–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63void StreetVicinityLoader::LoadStreet(uint32_t featureId, Street & street, bool ignoreEditedStatus)
64{
65 auto feature = m_context->GetFeature(featureId, ignoreEditedStatus);
66 if (!feature || !IsStreet(*feature))
67 return;
68
69 /// @todo Can be optimized here. Do not aggregate rect, but aggregate covering intervals for each segment, instead.
70 auto const sumRect = [&street, this](m2::PointD const & pt)
71 { street.m_rect.Add(mercator::RectByCenterXYAndSizeInMeters(pt, m_offsetMeters)); };
72
73 if (feature->GetGeomType() == feature::GeomType::Area)
74 {
75 feature->ForEachTriangle([&sumRect](m2::PointD const & p1, m2::PointD const & p2, m2::PointD const & p3)
76 {
77 sumRect(p1);
78 sumRect(p2);
79 sumRect(p3);
80 }, FeatureType::BEST_GEOMETRY);
81 }
82 else
83 feature->ForEachPoint(sumRect, FeatureType::BEST_GEOMETRY);
84 ASSERT(street.m_rect.IsValid(), ());
85
86 covering::CoveringGetter coveringGetter(street.m_rect, covering::ViewportWithLowLevels);
87 auto const & intervals = coveringGetter.Get<RectId::DEPTH_LEVELS>(m_scale);
88 m_context->ForEachIndex(intervals, m_scale, [this, &street, featureId](uint32_t id)
89 {
90 if (m_context->GetStreet(id) == featureId)
91 street.m_features.push_back(id);
92 });
93
94 // street.m_calculator = std::make_unique<ProjectionOnStreetCalculator>(points);
95}
96} // namespace search

Callers

nothing calls this directly

Calls 11

ASSERTFunction · 0.85
ForEachIndexMethod · 0.80
GetFeatureMethod · 0.45
AddMethod · 0.45
GetGeomTypeMethod · 0.45
ForEachTriangleMethod · 0.45
ForEachPointMethod · 0.45
IsValidMethod · 0.45
GetStreetMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected