diff --git a/search/street_vicinity_loader.cpp b/search/street_vicinity_loader.cpp index fb588366f4..76c71e5cfd 100644 --- a/search/street_vicinity_loader.cpp +++ b/search/street_vicinity_loader.cpp @@ -54,14 +54,24 @@ void StreetVicinityLoader::LoadStreet(uint32_t featureId, Street & street) if (!isStreet && !isSquareOrSuburb) return; - auto const & points = (feature->GetGeomType() == feature::GeomType::Area) ? - feature->GetTrianglesAsPoints(FeatureType::BEST_GEOMETRY) : - feature->GetPoints(FeatureType::BEST_GEOMETRY); - ASSERT(!points.empty(), ()); - /// @todo Can be optimized here. Do not aggregate rect, but aggregate covering intervals for each segment, instead. - for (auto const & point : points) - street.m_rect.Add(mercator::RectByCenterXYAndSizeInMeters(point, m_offsetMeters)); + auto const sumRect = [&street, this](m2::PointD const & pt) + { + street.m_rect.Add(mercator::RectByCenterXYAndSizeInMeters(pt, m_offsetMeters)); + }; + + if (feature->GetGeomType() == feature::GeomType::Area) + { + feature->ForEachTriangle([&sumRect](m2::PointD const & p1, m2::PointD const & p2, m2::PointD const & p3) + { + sumRect(p1); + sumRect(p2); + sumRect(p3); + }, FeatureType::BEST_GEOMETRY); + } + else + feature->ForEachPoint(sumRect, FeatureType::BEST_GEOMETRY); + ASSERT(street.m_rect.IsValid(), ()); covering::CoveringGetter coveringGetter(street.m_rect, covering::ViewportWithLowLevels); auto const & intervals = coveringGetter.Get(m_scale); diff --git a/search/street_vicinity_loader.hpp b/search/street_vicinity_loader.hpp index d2c24edac1..d8ed41b00d 100644 --- a/search/street_vicinity_loader.hpp +++ b/search/street_vicinity_loader.hpp @@ -27,9 +27,6 @@ class StreetVicinityLoader public: struct Street { - Street() = default; - Street(Street && street) = default; - inline bool IsEmpty() const { return m_rect.IsEmptyInterior(); } std::vector m_features; @@ -38,8 +35,6 @@ public: /// @todo Cache GetProjection results for features here, because /// feature::GetCenter and ProjectionOnStreetCalculator::GetProjection are not so fast. - - DISALLOW_COPY(Street); }; StreetVicinityLoader(int scale, double offsetMeters);