diff --git a/map/framework.cpp b/map/framework.cpp index d793bd0d43..ac73fb36b3 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -3497,7 +3497,7 @@ void VisualizeFeatureInRect(m2::RectD const & rect, FeatureType & ft, df::DrapeA } } // namespace -void VisualizeMwmBorder(df::DrapeApi & drapeApi, std::string const & mwmName) +void Framework::VisualizeMwmBorderByPolyFiles(std::string const & mwmName) { static std::string const kPathToBorders = base::JoinPath(GetPlatform().ResourcesDir(), "borders"); @@ -3513,35 +3513,50 @@ void VisualizeMwmBorder(df::DrapeApi & drapeApi, std::string const & mwmName) double lon = 0.0; double lat = 0.0; + uint32_t mwmNameNumber = 0; while (std::getline(input, line)) { if (line == "END") - break; + { + DrawMwmBorder(points, + mwmName + (mwmNameNumber ? "_" + std::to_string(mwmNameNumber) : "")); + ++mwmNameNumber; + points.clear(); + continue; + } strings::SimpleTokenizer iter(line, "\t"); - if (!strings::to_double(*iter, lon)) - return; + if (!iter || !strings::to_double(*iter, lon)) + continue; ++iter; - if (!strings::to_double(*iter, lat)) - return; + if (!iter || !strings::to_double(*iter, lat)) + continue; points.emplace_back(MercatorBounds::FromLatLon(lat, lon)); } +} + +void Framework::DrawMwmBorder(std::vector const & points, + std::string const & mwmName) +{ + if (points.empty()) + return; static uint32_t kColorCounter = 0; - drapeApi.AddLine(mwmName, - df::DrapeApiLineData(points, colorList[kColorCounter]).Width(3.0f).ShowId()); + m_drapeApi.AddLine(mwmName, + df::DrapeApiLineData(points, colorList[kColorCounter]).Width(4.0f).ShowId()); kColorCounter = (kColorCounter + 1) % colorList.size(); } + void Framework::VisualizeMwmsBordersInRect(m2::RectD const & rect) { auto mwmNames = m_infoGetter->GetRegionsCountryIdByRect(rect, false /* rough */); for (auto const & mwmName : mwmNames) - VisualizeMwmBorder(m_drapeApi, mwmName); + VisualizeMwmBorderByPolyFiles(mwmName); } void Framework::VisualizeRoadsInRect(m2::RectD const & rect) diff --git a/map/framework.hpp b/map/framework.hpp index 7df79015f9..86813b1bad 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -397,6 +397,8 @@ public: double GetMinDistanceBetweenResults() const override; private: + void VisualizeMwmBorderByPolyFiles(std::string const & mwmName); + void ActivateMapSelection(bool needAnimation, df::SelectionShape::ESelectedObject selectionType, place_page::Info const & info); @@ -407,6 +409,8 @@ public: /// Used to "refresh" UI in some cases (e.g. feature editing). void UpdatePlacePageInfoForCurrentSelection(); + void DrawMwmBorder(std::vector const & points, std::string const & mwmName); + /// Called to notify UI that object on a map was selected (UI should show Place Page, for example). using TActivateMapSelectionFn = function; /// Called to notify UI that object on a map was deselected (UI should hide Place Page).