From 5e80faf98ea21ed334499c5052aac5b7d0ecc434 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Fri, 5 Feb 2016 16:46:11 +0300 Subject: [PATCH] Renamed methods by removing pretty obvious Mercator word. --- android/jni/com/mapswithme/maps/Framework.cpp | 2 +- .../maps/bookmarks/data/BookmarkManager.cpp | 2 +- iphone/Maps/Classes/MWMPlacePageViewManager.mm | 2 +- .../Classes/Share/MWMShareLocationActivityItem.mm | 2 +- map/address_finder.cpp | 2 +- map/framework.cpp | 14 +++++++------- map/framework.hpp | 6 +++--- map/map_tests/bookmarks_test.cpp | 2 +- map/map_tests/feature_getters_tests.cpp | 8 ++++---- qt/draw_widget.cpp | 2 +- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index 9b9d40e8f1..f8f8ab3fce 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -646,7 +646,7 @@ extern "C" JNIEXPORT jstring JNICALL Java_com_mapswithme_maps_Framework_nativeGetNameAndAddress(JNIEnv * env, jclass clazz, jdouble lat, jdouble lon) { - search::AddressInfo const info = frm()->GetMercatorAddressInfo(MercatorBounds::FromLatLon(lat, lon)); + search::AddressInfo const info = frm()->GetAddressInfoAtPoint(MercatorBounds::FromLatLon(lat, lon)); return jni::ToJavaString(env, info.FormatNameAndAddress()); } diff --git a/android/jni/com/mapswithme/maps/bookmarks/data/BookmarkManager.cpp b/android/jni/com/mapswithme/maps/bookmarks/data/BookmarkManager.cpp index 5e13be0bfa..cec06388a2 100644 --- a/android/jni/com/mapswithme/maps/bookmarks/data/BookmarkManager.cpp +++ b/android/jni/com/mapswithme/maps/bookmarks/data/BookmarkManager.cpp @@ -103,7 +103,7 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeAddBookmarkToLastE BookmarkCategory::Guard guard(*f->GetBookmarkManager().GetBmCategory(bmkAndCat.first)); UserMark * newBookmark = guard.m_controller.GetUserMarkForEdit(bmkAndCat.second); // TODO @deathbaba or @yunikkk - remove that hack after BookmarkManager will correctly set features for bookmarks. - newBookmark->SetFeature(f->GetFeatureAtMercatorPoint(glbPoint)); + newBookmark->SetFeature(f->GetFeatureAtPoint(glbPoint)); g_framework->SetActiveUserMark(newBookmark); return usermark_helper::CreateMapObject(newBookmark); } diff --git a/iphone/Maps/Classes/MWMPlacePageViewManager.mm b/iphone/Maps/Classes/MWMPlacePageViewManager.mm index a35ad9d70c..a9723bb256 100644 --- a/iphone/Maps/Classes/MWMPlacePageViewManager.mm +++ b/iphone/Maps/Classes/MWMPlacePageViewManager.mm @@ -311,7 +311,7 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState) UserMark const * bookmark = guard.m_controller.GetUserMark(bookmarkIndex); // TODO(AlexZ): Refactor bookmarks code together to hide this code in the Framework/Drape. // UI code should never know about any guards, pointers to UserMark etc. - const_cast(bookmark)->SetFeature(f.GetFeatureAtMercatorPoint(mercator)); + const_cast(bookmark)->SetFeature(f.GetFeatureAtPoint(mercator)); m_userMark.reset(new UserMarkCopy(bookmark, false)); [NSNotificationCenter.defaultCenter postNotificationName:kBookmarksChangedNotification object:nil diff --git a/iphone/Maps/Classes/Share/MWMShareLocationActivityItem.mm b/iphone/Maps/Classes/Share/MWMShareLocationActivityItem.mm index 915ade3464..b416547bfb 100644 --- a/iphone/Maps/Classes/Share/MWMShareLocationActivityItem.mm +++ b/iphone/Maps/Classes/Share/MWMShareLocationActivityItem.mm @@ -85,7 +85,7 @@ NSString * httpGe0Url(NSString * shortUrl) NSString * url = [self url:NO]; if (!self.myPosition) return [NSString stringWithFormat:L(@"bookmark_share_email"), self.title, url, httpGe0Url(url)]; - search::AddressInfo const info = GetFramework().GetMercatorAddressInfo(MercatorBounds::FromLatLon(self.location.longitude, self.location.latitude)); + search::AddressInfo const info = GetFramework().GetAddressInfoAtPoint(MercatorBounds::FromLatLon(self.location.longitude, self.location.latitude)); NSString * nameAndAddress = @(info.FormatNameAndAddress().c_str()); return [NSString stringWithFormat:L(@"my_position_share_email"), nameAndAddress, url, httpGe0Url(url)]; } diff --git a/map/address_finder.cpp b/map/address_finder.cpp index ac56294447..7b4f74b80f 100644 --- a/map/address_finder.cpp +++ b/map/address_finder.cpp @@ -453,7 +453,7 @@ namespace } } */ -search::AddressInfo Framework::GetMercatorAddressInfo(m2::PointD const & mercator) const +search::AddressInfo Framework::GetAddressInfoAtPoint(m2::PointD const & mercator) const { search::AddressInfo info; // @TODO(vng): insert correct implementation from new search. diff --git a/map/framework.cpp b/map/framework.cpp index c90d61d868..77bb83248b 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1229,7 +1229,7 @@ void Framework::ShowSearchResult(search::Result const & res) if (ft) mark->SetFeature(move(ft)); else - mark->SetFeature(GetFeatureAtMercatorPoint(center)); + mark->SetFeature(GetFeatureAtPoint(center)); ActivateUserMark(mark, false); } @@ -1687,7 +1687,7 @@ bool Framework::ShowMapForURL(string const & url) return false; } -size_t Framework::ForEachFeatureAtMercatorPoint(TFeatureTypeFn && fn, m2::PointD const & mercator) const +size_t Framework::ForEachFeatureAtPoint(TFeatureTypeFn && fn, m2::PointD const & mercator) const { constexpr double kSelectRectWidthInMeters = 1.1; constexpr double kMetersToLinearFeature = 3; @@ -1727,10 +1727,10 @@ size_t Framework::ForEachFeatureAtMercatorPoint(TFeatureTypeFn && fn, m2::PointD return processedFeaturesCount; } -unique_ptr Framework::GetFeatureAtMercatorPoint(m2::PointD const & mercator) const +unique_ptr Framework::GetFeatureAtPoint(m2::PointD const & mercator) const { unique_ptr poi, line, area; - ForEachFeatureAtMercatorPoint([&](FeatureType & ft) + ForEachFeatureAtPoint([&](FeatureType & ft) { switch (ft.GetFeatureType()) { @@ -1844,7 +1844,7 @@ PoiMarkPoint * Framework::GetAddressMark(m2::PointD const & globalPoint) const { PoiMarkPoint * mark = UserMarkContainer::UserMarkForPoi(); mark->SetPtOrg(globalPoint); - mark->SetFeature(GetFeatureAtMercatorPoint(globalPoint)); + mark->SetFeature(GetFeatureAtPoint(globalPoint)); return mark; } @@ -1963,7 +1963,7 @@ UserMark const * Framework::OnTapEventImpl(m2::PointD pxPoint, bool isLong, bool { const_cast(mark)->SetFeature(fid.IsValid() ? GetFeatureByID(fid) : - GetFeatureAtMercatorPoint(mark->GetPivot())); + GetFeatureAtPoint(mark->GetPivot())); } return mark; } @@ -1982,7 +1982,7 @@ UserMark const * Framework::OnTapEventImpl(m2::PointD pxPoint, bool isLong, bool { mercatorPivot = m_currentModelView.PtoG(pxPoint2d); // TODO(AlexZ): Should we change mercatorPivot to found feature's center? - feature = GetFeatureAtMercatorPoint(mercatorPivot); + feature = GetFeatureAtPoint(mercatorPivot); needMark = true; } diff --git a/map/framework.hpp b/map/framework.hpp index 723e03468f..51175d52ed 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -482,7 +482,7 @@ private: bool ParseEditorDebugCommand(search::SearchParams const & params); public: /// @returns address of nearby building with house number in approx 1km distance. - search::AddressInfo GetMercatorAddressInfo(m2::PointD const & mercator) const; + search::AddressInfo GetAddressInfoAtPoint(m2::PointD const & mercator) const; /// @returns valid street address only if it was specified in OSM for given feature; used in the editor. search::AddressInfo GetFeatureAddressInfo(FeatureType const & ft) const; vector GetPrintableFeatureTypes(FeatureType const & ft) const; @@ -492,9 +492,9 @@ public: vector GetNearbyFeatureStreets(FeatureType const & ft) const; /// Get "best for the user" feature at given point even if it's invisible on the screen. /// @returns nullptr if no feature was found at the given mercator point. - unique_ptr GetFeatureAtMercatorPoint(m2::PointD const & mercator) const; + unique_ptr GetFeatureAtPoint(m2::PointD const & mercator) const; using TFeatureTypeFn = function; - size_t ForEachFeatureAtMercatorPoint(TFeatureTypeFn && fn, m2::PointD const & mercator) const; + size_t ForEachFeatureAtPoint(TFeatureTypeFn && fn, m2::PointD const & mercator) const; /// Set parse to false if you don't need all feature fields ready. unique_ptr GetFeatureByID(FeatureID const & fid, bool parse = true) const; diff --git a/map/map_tests/bookmarks_test.cpp b/map/map_tests/bookmarks_test.cpp index c52c5db7f3..7e652c8935 100644 --- a/map/map_tests/bookmarks_test.cpp +++ b/map/map_tests/bookmarks_test.cpp @@ -394,7 +394,7 @@ namespace void CheckPlace(Framework const & fm, double lat, double lon, POIInfo const & poi) { - search::AddressInfo const info = fm.GetMercatorAddressInfo(MercatorBounds::FromLatLon(lat, lon)); + search::AddressInfo const info = fm.GetAddressInfoAtPoint(MercatorBounds::FromLatLon(lat, lon)); TEST_EQUAL(info.m_street, poi.m_street, ()); TEST_EQUAL(info.m_house, poi.m_house, ()); diff --git a/map/map_tests/feature_getters_tests.cpp b/map/map_tests/feature_getters_tests.cpp index ba9b977c4c..9e4f9309d1 100644 --- a/map/map_tests/feature_getters_tests.cpp +++ b/map/map_tests/feature_getters_tests.cpp @@ -11,7 +11,7 @@ #include "std/algorithm.hpp" #include "std/vector.hpp" -UNIT_TEST(Framework_ForEachFeatureAtMercatorPoint_And_Others) +UNIT_TEST(Framework_ForEachFeatureAtPoint_And_Others) { Framework frm; frm.DeregisterAllMaps(); @@ -25,7 +25,7 @@ UNIT_TEST(Framework_ForEachFeatureAtMercatorPoint_And_Others) "amenity|parking|", "barrier|lift_gate|" }; - TEST_EQUAL(4, frm.ForEachFeatureAtMercatorPoint([&](FeatureType & ft) + TEST_EQUAL(4, frm.ForEachFeatureAtPoint([&](FeatureType & ft) { ft.ForEachType([&types](uint32_t type) { @@ -40,7 +40,7 @@ UNIT_TEST(Framework_ForEachFeatureAtMercatorPoint_And_Others) ftypes::IsBuildingChecker const & isBuilding = ftypes::IsBuildingChecker::Instance(); { // Restaurant in the building. - auto const feature = frm.GetFeatureAtMercatorPoint(MercatorBounds::FromLatLon(53.89395, 27.567365)); + auto const feature = frm.GetFeatureAtPoint(MercatorBounds::FromLatLon(53.89395, 27.567365)); string name; TEST(feature->GetName(FeatureType::DEFAULT_LANG, name), ()); TEST_EQUAL("Родны Кут", name, ()); @@ -49,7 +49,7 @@ UNIT_TEST(Framework_ForEachFeatureAtMercatorPoint_And_Others) { // Same building as above, very close to the restaurant. - auto const feature = frm.GetFeatureAtMercatorPoint(MercatorBounds::FromLatLon(53.893603, 27.567032)); + auto const feature = frm.GetFeatureAtPoint(MercatorBounds::FromLatLon(53.893603, 27.567032)); TEST(feature, ()); TEST(isBuilding(*feature), ()); } diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp index 96af974f24..8c6c7e9772 100644 --- a/qt/draw_widget.cpp +++ b/qt/draw_widget.cpp @@ -494,7 +494,7 @@ void DrawWidget::ShowInfoPopup(QMouseEvent * e, m2::PointD const & pt) menu.addAction(QString::fromUtf8(s.c_str())); }; - m_framework->ForEachFeatureAtMercatorPoint([&](FeatureType const & ft) + m_framework->ForEachFeatureAtPoint([&](FeatureType const & ft) { search::AddressInfo const info = m_framework->GetFeatureAddressInfo(ft);