diff options
author | Mikhail Gorbushin <m.gorbushin@corp.mail.ru> | 2019-05-29 18:31:32 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-06-17 16:40:55 +0300 |
commit | 50064bebebafe8314742de47df0e6d1680f1b73c (patch) | |
tree | 958f005f3838b89b6350ffb088c626004d757b6e /map | |
parent | b899690f3a4b2330ca823f6b9d3a19a43f341632 (diff) |
t# This is a combination of 2 commits.
[qt] review fixes
Diffstat (limited to 'map')
-rw-r--r-- | map/framework.cpp | 33 | ||||
-rw-r--r-- | map/framework.hpp | 4 |
2 files changed, 28 insertions, 9 deletions
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<m2::PointD> 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<m2::PointD> 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<void (place_page::Info const &)>; /// Called to notify UI that object on a map was deselected (UI should hide Place Page). |