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
diff options
context:
space:
mode:
authorArsentiy Milchakov <milcars@mapswithme.com>2018-10-30 18:16:40 +0300
committerRoman Kuznetsov <r.kuznetsow@gmail.com>2018-10-31 16:01:09 +0300
commitb415753017fb208eea396e1b2c274fd385d0c147 (patch)
tree20af2d652126c71e3e1af5807ccf81739b936643 /metrics
parent9308c996d5a5f02e30f3f509f7988ceafa11bb0b (diff)
[eye] save mercator pos instead of latlon
Diffstat (limited to 'metrics')
-rw-r--r--metrics/eye.cpp42
-rw-r--r--metrics/eye.hpp22
-rw-r--r--metrics/eye_info.hpp7
-rw-r--r--metrics/eye_serdes.cpp4
-rw-r--r--metrics/metrics_tests/eye_tests.cpp28
-rw-r--r--metrics/metrics_tests_support/eye_for_testing.cpp2
-rw-r--r--metrics/metrics_tests_support/eye_for_testing.hpp2
7 files changed, 54 insertions, 53 deletions
diff --git a/metrics/eye.cpp b/metrics/eye.cpp
index 942a4bf5e7..5d0e3c6fa2 100644
--- a/metrics/eye.cpp
+++ b/metrics/eye.cpp
@@ -307,7 +307,7 @@ void Eye::RegisterLayerShown(Layer::Type type)
}
void Eye::RegisterMapObjectEvent(MapObject const & mapObject, MapObject::Event::Type type,
- ms::LatLon const & userPos)
+ m2::PointD const & userPos)
{
auto const info = m_info.Get();
auto editableInfo = std::make_shared<Info>(*info);
@@ -400,55 +400,55 @@ void Eye::Event::LayerShown(Layer::Type type)
}
// static
-void Eye::Event::PlacePageOpened(std::string const & bestType, ms::LatLon const & latLon,
- ms::LatLon const & userPos)
+void Eye::Event::PlacePageOpened(std::string const & bestType, m2::PointD const & pos,
+ m2::PointD const & userPos)
{
- GetPlatform().RunTask(Platform::Thread::File, [bestType, latLon, userPos]
+ GetPlatform().RunTask(Platform::Thread::File, [bestType, pos, userPos]
{
- Instance().RegisterMapObjectEvent({bestType, latLon}, MapObject::Event::Type::Open, userPos);
+ Instance().RegisterMapObjectEvent({bestType, pos}, MapObject::Event::Type::Open, userPos);
});
}
// static
-void Eye::Event::UgcEditorOpened(std::string const & bestType, ms::LatLon const & latLon,
- ms::LatLon const & userPos)
+void Eye::Event::UgcEditorOpened(std::string const & bestType, m2::PointD const & pos,
+ m2::PointD const & userPos)
{
- GetPlatform().RunTask(Platform::Thread::File, [bestType, latLon, userPos]
+ GetPlatform().RunTask(Platform::Thread::File, [bestType, pos, userPos]
{
- Instance().RegisterMapObjectEvent({bestType, latLon}, MapObject::Event::Type::UgcEditorOpened,
+ Instance().RegisterMapObjectEvent({bestType, pos}, MapObject::Event::Type::UgcEditorOpened,
userPos);
});
}
// static
-void Eye::Event::UgcSaved(std::string const & bestType, ms::LatLon const & latLon,
- ms::LatLon const & userPos)
+void Eye::Event::UgcSaved(std::string const & bestType, m2::PointD const & pos,
+ m2::PointD const & userPos)
{
- GetPlatform().RunTask(Platform::Thread::File, [bestType, latLon, userPos]
+ GetPlatform().RunTask(Platform::Thread::File, [bestType, pos, userPos]
{
- Instance().RegisterMapObjectEvent({bestType, latLon}, MapObject::Event::Type::UgcSaved,
+ Instance().RegisterMapObjectEvent({bestType, pos}, MapObject::Event::Type::UgcSaved,
userPos);
});
}
// static
-void Eye::Event::AddToBookmarkClicked(std::string const & bestType, ms::LatLon const & latLon,
- ms::LatLon const & userPos)
+void Eye::Event::AddToBookmarkClicked(std::string const & bestType, m2::PointD const & pos,
+ m2::PointD const & userPos)
{
- GetPlatform().RunTask(Platform::Thread::File, [bestType, latLon, userPos]
+ GetPlatform().RunTask(Platform::Thread::File, [bestType, pos, userPos]
{
- Instance().RegisterMapObjectEvent({bestType, latLon}, MapObject::Event::Type::AddToBookmark,
+ Instance().RegisterMapObjectEvent({bestType, pos}, MapObject::Event::Type::AddToBookmark,
userPos);
});
}
// static
-void Eye::Event::RouteCreatedToObject(std::string const & bestType, ms::LatLon const & latLon,
- ms::LatLon const & userPos)
+void Eye::Event::RouteCreatedToObject(std::string const & bestType, m2::PointD const & pos,
+ m2::PointD const & userPos)
{
- GetPlatform().RunTask(Platform::Thread::File, [bestType, latLon, userPos]
+ GetPlatform().RunTask(Platform::Thread::File, [bestType, pos, userPos]
{
- Instance().RegisterMapObjectEvent({bestType, latLon}, MapObject::Event::Type::RouteToCreated,
+ Instance().RegisterMapObjectEvent({bestType, pos}, MapObject::Event::Type::RouteToCreated,
userPos);
});
}
diff --git a/metrics/eye.hpp b/metrics/eye.hpp
index b603973fa8..03dd2ca3c6 100644
--- a/metrics/eye.hpp
+++ b/metrics/eye.hpp
@@ -44,16 +44,16 @@ public:
static void DiscoveryShown();
static void DiscoveryItemClicked(Discovery::Event event);
static void LayerShown(Layer::Type type);
- static void PlacePageOpened(std::string const & bestType, ms::LatLon const & latLon,
- ms::LatLon const & userPos);
- static void UgcEditorOpened(std::string const & bestType, ms::LatLon const & latLon,
- ms::LatLon const & userPos);
- static void UgcSaved(std::string const & bestType, ms::LatLon const & latLon,
- ms::LatLon const & userPos);
- static void AddToBookmarkClicked(std::string const & bestType, ms::LatLon const & latLon,
- ms::LatLon const & userPos);
- static void RouteCreatedToObject(std::string const & bestType, ms::LatLon const & latLon,
- ms::LatLon const & userPos);
+ static void PlacePageOpened(std::string const & bestType, m2::PointD const & pos,
+ m2::PointD const & userPos);
+ static void UgcEditorOpened(std::string const & bestType, m2::PointD const & pos,
+ m2::PointD const & userPos);
+ static void UgcSaved(std::string const & bestType, m2::PointD const & pos,
+ m2::PointD const & userPos);
+ static void AddToBookmarkClicked(std::string const & bestType, m2::PointD const & pos,
+ m2::PointD const & userPos);
+ static void RouteCreatedToObject(std::string const & bestType, m2::PointD const & pos,
+ m2::PointD const & userPos);
};
static Eye & Instance();
@@ -78,7 +78,7 @@ private:
void IncrementDiscoveryItem(Discovery::Event event);
void RegisterLayerShown(Layer::Type type);
void RegisterMapObjectEvent(MapObject const & mapObject, MapObject::Event::Type type,
- ms::LatLon const & userPos);
+ m2::PointD const & userPos);
base::AtomicSharedPtr<Info> m_info;
std::vector<Subscriber *> m_subscribers;
diff --git a/metrics/eye_info.hpp b/metrics/eye_info.hpp
index 6c5e35d9ec..b2d939bf5d 100644
--- a/metrics/eye_info.hpp
+++ b/metrics/eye_info.hpp
@@ -2,7 +2,6 @@
#include "storage/index.hpp"
-#include "geometry/latlon.hpp"
#include "geometry/point2d.hpp"
#include "base/visitor.hpp"
@@ -178,7 +177,7 @@ struct MapObject
visitor(m_eventTime, "event_time"));
Type m_type;
- ms::LatLon m_userPos;
+ m2::PointD m_userPos;
Time m_eventTime;
};
@@ -188,7 +187,7 @@ struct MapObject
{
size_t operator()(MapObject const & p) const
{
- return base::Hash(base::Hash(p.m_pos.lat, p.m_pos.lon),
+ return base::Hash(base::Hash(p.m_pos.x, p.m_pos.y),
base::Hash(p.m_bestType, p.m_bestType));
}
};
@@ -202,7 +201,7 @@ struct MapObject
visitor(m_readableName, "name"));
std::string m_bestType;
- ms::LatLon m_pos;
+ m2::PointD m_pos;
std::string m_readableName;
};
diff --git a/metrics/eye_serdes.cpp b/metrics/eye_serdes.cpp
index 3b87c0c38f..80f7e3b6f3 100644
--- a/metrics/eye_serdes.cpp
+++ b/metrics/eye_serdes.cpp
@@ -5,6 +5,8 @@
#include "coding/write_to_sink.hpp"
#include "coding/writer.hpp"
+#include "geometry/point2d.hpp"
+
#include "base/logging.hpp"
#include <sstream>
@@ -19,7 +21,7 @@ struct MapObjectEvent
visitor(m_event, "event"));
std::string m_bestPoiType;
- ms::LatLon m_poiPos;
+ m2::PointD m_poiPos;
eye::MapObject::Event m_event;
};
} // namespace
diff --git a/metrics/metrics_tests/eye_tests.cpp b/metrics/metrics_tests/eye_tests.cpp
index 4ef630b244..9731988739 100644
--- a/metrics/metrics_tests/eye_tests.cpp
+++ b/metrics/metrics_tests/eye_tests.cpp
@@ -458,8 +458,8 @@ UNIT_CLASS_TEST(ScopedEyeForTesting, TrimExpiredMapObjectEvents)
TEST(it != mapObjects.end(), ());
TEST_EQUAL(it->second.size(), 3, ());
TEST_EQUAL(it->second[0].m_type, MapObject::Event::Type::Open, ());
- TEST_EQUAL(it->second[1].m_userPos, ms::LatLon(72.045400, 81.408200), ());
- TEST_EQUAL(it->second[2].m_userPos, ms::LatLon(72.045450, 81.408201), ());
+ TEST_EQUAL(it->second[1].m_userPos, m2::PointD(72.045400, 81.408200), ());
+ TEST_EQUAL(it->second[2].m_userPos, m2::PointD(72.045450, 81.408201), ());
}
{
@@ -472,8 +472,8 @@ UNIT_CLASS_TEST(ScopedEyeForTesting, TrimExpiredMapObjectEvents)
TEST(it != mapObjects.end(), ());
TEST_EQUAL(it->second.size(), 3, ());
TEST_EQUAL(it->second[0].m_type, MapObject::Event::Type::Open, ());
- TEST_EQUAL(it->second[1].m_userPos, ms::LatLon(53.016347, 158.683327), ());
- TEST_EQUAL(it->second[2].m_userPos, ms::LatLon(53.116347, 158.783327), ());
+ TEST_EQUAL(it->second[1].m_userPos, m2::PointD(53.016347, 158.683327), ());
+ TEST_EQUAL(it->second[2].m_userPos, m2::PointD(53.116347, 158.783327), ());
}
}
@@ -503,10 +503,10 @@ UNIT_CLASS_TEST(ScopedEyeForTesting, TrimExpiredMapObjectEvents)
TEST(it != mapObjects.end(), ());
TEST_EQUAL(it->second.size(), 2, ());
- TEST_EQUAL(it->second[0].m_userPos, ms::LatLon(53.016347, 158.683327), ());
+ TEST_EQUAL(it->second[0].m_userPos, m2::PointD(53.016347, 158.683327), ());
TEST_EQUAL(it->second[0].m_type, MapObject::Event::Type::UgcEditorOpened, ());
- TEST_EQUAL(it->second[1].m_userPos, ms::LatLon(53.116347, 158.783327), ());
+ TEST_EQUAL(it->second[1].m_userPos, m2::PointD(53.116347, 158.783327), ());
TEST_EQUAL(it->second[1].m_type, MapObject::Event::Type::UgcSaved, ());
}
}
@@ -518,7 +518,7 @@ UNIT_CLASS_TEST(ScopedEyeForTesting, RegisterMapObjectEvent)
MapObject poi;
poi.m_bestType = "cafe";
poi.m_pos = {53.652005, 108.143448};
- ms::LatLon userPos = {53.016347, 158.683327};
+ m2::PointD userPos = {53.016347, 158.683327};
EyeForTesting::RegisterMapObjectEvent(poi, MapObject::Event::Type::Open, userPos);
@@ -530,7 +530,7 @@ UNIT_CLASS_TEST(ScopedEyeForTesting, RegisterMapObjectEvent)
MapObject poi;
poi.m_bestType = "shop";
poi.m_pos = {53.652005, 108.143448};
- ms::LatLon userPos = {0.0, 0.0};
+ m2::PointD userPos = {0.0, 0.0};
EyeForTesting::RegisterMapObjectEvent(poi, MapObject::Event::Type::RouteToCreated, userPos);
@@ -543,7 +543,7 @@ UNIT_CLASS_TEST(ScopedEyeForTesting, RegisterMapObjectEvent)
MapObject poi;
poi.m_bestType = "amenity-bench";
poi.m_pos = {53.652005, 108.143448};
- ms::LatLon userPos = {0.0, 0.0};
+ m2::PointD userPos = {0.0, 0.0};
EyeForTesting::RegisterMapObjectEvent(poi, MapObject::Event::Type::Open, userPos);
}
@@ -562,10 +562,10 @@ UNIT_CLASS_TEST(ScopedEyeForTesting, RegisterMapObjectEvent)
TEST(it != mapObjects.end(), ());
TEST_EQUAL(it->second.size(), 2, ());
- TEST_EQUAL(it->second[0].m_userPos, ms::LatLon(53.016347, 158.683327), ());
+ TEST_EQUAL(it->second[0].m_userPos, m2::PointD(53.016347, 158.683327), ());
TEST_EQUAL(it->second[0].m_type, MapObject::Event::Type::Open, ());
- TEST_EQUAL(it->second[1].m_userPos, ms::LatLon(53.016345, 158.683329), ());
+ TEST_EQUAL(it->second[1].m_userPos, m2::PointD(53.016345, 158.683329), ());
TEST_EQUAL(it->second[1].m_type, MapObject::Event::Type::RouteToCreated, ());
}
@@ -578,10 +578,10 @@ UNIT_CLASS_TEST(ScopedEyeForTesting, RegisterMapObjectEvent)
TEST(it != mapObjects.end(), ());
TEST_EQUAL(it->second.size(), 2, ());
- TEST_EQUAL(it->second[0].m_userPos, ms::LatLon(0.0, 0.0), ());
+ TEST_EQUAL(it->second[0].m_userPos, m2::PointD(0.0, 0.0), ());
TEST_EQUAL(it->second[0].m_type, MapObject::Event::Type::RouteToCreated, ());
- TEST_EQUAL(it->second[1].m_userPos, ms::LatLon(158.016345, 53.683329), ());
+ TEST_EQUAL(it->second[1].m_userPos, m2::PointD(158.016345, 53.683329), ());
TEST_EQUAL(it->second[1].m_type, MapObject::Event::Type::AddToBookmark, ());
}
@@ -594,7 +594,7 @@ UNIT_CLASS_TEST(ScopedEyeForTesting, RegisterMapObjectEvent)
TEST(it != mapObjects.end(), ());
TEST_EQUAL(it->second.size(), 1, ());
- TEST_EQUAL(it->second[0].m_userPos, ms::LatLon(0.0, 0.0), ());
+ TEST_EQUAL(it->second[0].m_userPos, m2::PointD(0.0, 0.0), ());
TEST_EQUAL(it->second[0].m_type, MapObject::Event::Type::Open, ());
}
}
diff --git a/metrics/metrics_tests_support/eye_for_testing.cpp b/metrics/metrics_tests_support/eye_for_testing.cpp
index cc6abb1776..b6506cefec 100644
--- a/metrics/metrics_tests_support/eye_for_testing.cpp
+++ b/metrics/metrics_tests_support/eye_for_testing.cpp
@@ -80,7 +80,7 @@ void EyeForTesting::TrimExpiredMapObjectEvents()
// static
void EyeForTesting::RegisterMapObjectEvent(MapObject const & mapObject, MapObject::Event::Type type,
- ms::LatLon const & userPos)
+ m2::PointD const & userPos)
{
Eye::Instance().RegisterMapObjectEvent(mapObject, type, userPos);
}
diff --git a/metrics/metrics_tests_support/eye_for_testing.hpp b/metrics/metrics_tests_support/eye_for_testing.hpp
index 5180e1ccea..0672acd0fe 100644
--- a/metrics/metrics_tests_support/eye_for_testing.hpp
+++ b/metrics/metrics_tests_support/eye_for_testing.hpp
@@ -19,7 +19,7 @@ public:
static void AppendLayer(Layer::Type type);
static void TrimExpiredMapObjectEvents();
static void RegisterMapObjectEvent(MapObject const & mapObject, MapObject::Event::Type type,
- ms::LatLon const & userPos);
+ m2::PointD const & userPos);
};
class ScopedEyeForTesting