Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/map
diff options
context:
space:
mode:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2016-10-28 11:36:50 +0300
committerr.kuznetsov <r.kuznetsov@corp.mail.ru>2016-10-28 13:21:07 +0300
commita0ca65e01e70098f0104338c8e898d035bcddc7a (patch)
treeee51f041e5716d19132a4171ab478960fc5c2039 /map
parenta849a297f026ea006bf06f7a39c792522b4848a6 (diff)
Added roads selection to Qt app
Diffstat (limited to 'map')
-rw-r--r--map/framework.cpp39
-rw-r--r--map/framework.hpp3
2 files changed, 42 insertions, 0 deletions
diff --git a/map/framework.cpp b/map/framework.cpp
index 32fa8aba04..3276a0fa46 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -13,6 +13,7 @@
#include "routing/road_graph_router.hpp"
#include "routing/route.hpp"
#include "routing/routing_algorithm.hpp"
+#include "routing/routing_helpers.hpp"
#include "search/downloader_search_callback.hpp"
#include "search/editor_delegate.hpp"
@@ -3137,3 +3138,41 @@ bool Framework::GenerateRouteAltitudeChart(uint32_t width, uint32_t height,
}
return true;
}
+
+namespace
+{
+ vector<dp::Color> colorList = { dp::Color(255, 0, 0, 255), dp::Color(0, 255, 0, 255), dp::Color(0, 0, 255, 255),
+ dp::Color(255, 255, 0, 255), dp::Color(0, 255, 255, 255), dp::Color(255, 0, 255, 255),
+ dp::Color(100, 0, 0, 255), dp::Color(0, 100, 0, 255), dp::Color(0, 0, 100, 255),
+ dp::Color(100, 100, 0, 255), dp::Color(0, 100, 100, 255), dp::Color(100, 0, 100, 255)
+ };
+} // namespace
+
+void Framework::VizualizeRoadsInRect(m2::RectD const & rect)
+{
+ int constexpr kScale = scales::GetUpperScale();
+ size_t counter = 0;
+ m_model.ForEachFeature(rect, [this, &counter, &rect](FeatureType & ft)
+ {
+ if (routing::IsRoad(feature::TypesHolder(ft)))
+ {
+ bool allPointsOutside = true;
+ vector<m2::PointD> points;
+ ft.ForEachPoint([&points, &rect, &allPointsOutside](m2::PointD const & pt)
+ {
+ if (rect.IsPointInside(pt))
+ allPointsOutside = false;
+ points.push_back(pt);
+ }, kScale);
+
+ if (!allPointsOutside)
+ {
+ size_t const colorIndex = counter % colorList.size();
+ m_drapeApi.AddLine(strings::to_string(ft.GetID().m_index),
+ df::DrapeApiLineData(points, colorList[colorIndex])
+ .Width(3.0f).ShowPoints(true).ShowId());
+ counter++;
+ }
+ }
+ }, kScale);
+}
diff --git a/map/framework.hpp b/map/framework.hpp
index 4e509a0d96..b03c6b0036 100644
--- a/map/framework.hpp
+++ b/map/framework.hpp
@@ -303,6 +303,9 @@ public:
m2::PointD GetSearchMarkSize(SearchMarkType searchMarkType);
+ // Utilities
+ void VizualizeRoadsInRect(m2::RectD const & rect);
+
protected:
// search::ViewportSearchCallback::Delegate overrides:
void RunUITask(function<void()> fn) override { GetPlatform().RunOnGuiThread(move(fn)); }