Renamed methods by removing pretty obvious Mercator word.

This commit is contained in:
Alex Zolotarev 2016-02-05 16:46:11 +03:00 committed by Sergey Yershov
parent 8d425df9d5
commit 5e80faf98e
10 changed files with 21 additions and 21 deletions

View file

@ -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());
}

View file

@ -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);
}

View file

@ -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<UserMark *>(bookmark)->SetFeature(f.GetFeatureAtMercatorPoint(mercator));
const_cast<UserMark *>(bookmark)->SetFeature(f.GetFeatureAtPoint(mercator));
m_userMark.reset(new UserMarkCopy(bookmark, false));
[NSNotificationCenter.defaultCenter postNotificationName:kBookmarksChangedNotification
object:nil

View file

@ -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)];
}

View file

@ -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.

View file

@ -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<FeatureType> Framework::GetFeatureAtMercatorPoint(m2::PointD const & mercator) const
unique_ptr<FeatureType> Framework::GetFeatureAtPoint(m2::PointD const & mercator) const
{
unique_ptr<FeatureType> 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<UserMark *>(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;
}

View file

@ -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<string> GetPrintableFeatureTypes(FeatureType const & ft) const;
@ -492,9 +492,9 @@ public:
vector<string> 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<FeatureType> GetFeatureAtMercatorPoint(m2::PointD const & mercator) const;
unique_ptr<FeatureType> GetFeatureAtPoint(m2::PointD const & mercator) const;
using TFeatureTypeFn = function<void(FeatureType &)>;
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<FeatureType> GetFeatureByID(FeatureID const & fid, bool parse = true) const;

View file

@ -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, ());

View file

@ -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), ());
}

View file

@ -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);