Renamed Framework::GetAddressInfoForGlobalPoint to GetMercatorAddressInfo.

This commit is contained in:
Alex Zolotarev 2016-01-13 10:50:50 +03:00 committed by Sergey Yershov
parent efb3d4d821
commit 12fd84193f
6 changed files with 14 additions and 32 deletions

View file

@ -814,10 +814,7 @@ extern "C"
JNIEXPORT jstring JNICALL
Java_com_mapswithme_maps_Framework_nativeGetNameAndAddress4Point(JNIEnv * env, jclass clazz, jdouble lat, jdouble lon)
{
search::AddressInfo info;
frm()->GetAddressInfoForGlobalPoint(MercatorBounds::FromLatLon(lat, lon), info);
search::AddressInfo const info = frm()->GetMercatorAddressInfo(MercatorBounds::FromLatLon(lat, lon));
return jni::ToJavaString(env, info.FormatNameAndAddress());
}

View file

@ -85,9 +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 info;
GetFramework().GetAddressInfoForGlobalPoint(m2::PointD(MercatorBounds::LonToX(self.location.longitude),
MercatorBounds::LatToY(self.location.latitude)), info);
search::AddressInfo const info = GetFramework().GetMercatorAddressInfo(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

@ -454,24 +454,20 @@ namespace
}
}
void Framework::GetAddressInfoForGlobalPoint(m2::PointD const & pt, search::AddressInfo & info) const
search::AddressInfo Framework::GetMercatorAddressInfo(m2::PointD const & mercator) const
{
/// @todo Do not returm MWM's name here.
//info.m_country = GetCountryName(pt);
//if (info.m_country.empty())
//{
// LOG(LINFO, ("Can't find region for point ", pt));
// return;
//}
search::AddressInfo info;
// @TODO(vng): insert correct implementation from new search.
//info.m_country = GetCountryName(mercator);
// @TODO(vng): Rewrite code to get it from LocalityFinder.
//GetLocality(pt, info);
search::ReverseGeocoder coder(m_model.GetIndex());
search::ReverseGeocoder::Address addr;
coder.GetNearbyAddress(pt, addr);
coder.GetNearbyAddress(mercator, addr);
info.m_house = addr.GetHouseNumber();
info.m_street = addr.GetStreetName();
/// @todo Rewrite code to get it from LocalityFinder.
//GetLocality(pt, info);
return info;
}
search::AddressInfo Framework::GetFeatureAddressInfo(FeatureType const & ft) const

View file

@ -469,21 +469,14 @@ public:
/// Get classificator types for nearest features.
/// @param[in] pxPoint Current touch point in device pixel coordinates.
void GetFeatureTypes(m2::PointD const & pxPoint, vector<string> & types) const;
/// Get address information for the point on map.
/// Fill only house number and street name. All other params stay unchanged.
//@{
inline void GetAddressInfoForPixelPoint(m2::PointD const & pxPoint, search::AddressInfo & info) const
{
GetAddressInfoForGlobalPoint(PtoG(pxPoint), info);
}
void GetAddressInfoForGlobalPoint(m2::PointD const & pt, search::AddressInfo & info) const;
//@}
private:
void GetLocality(m2::PointD const & pt, search::AddressInfo & info) const;
public:
/// Please use this method for debug purposes only. It always tries to find closest street.
search::AddressInfo GetMercatorAddressInfo(m2::PointD const & mercator) const;
search::AddressInfo GetFeatureAddressInfo(FeatureType const & ft) const;
/// Get feature at given point even if it's invisible on the screen.
/// TODO(AlexZ): Refactor out other similar methods.

View file

@ -394,8 +394,7 @@ namespace
void CheckPlace(Framework const & fm, double lat, double lon, POIInfo const & poi)
{
search::AddressInfo info;
fm.GetAddressInfoForGlobalPoint(MercatorBounds::FromLatLon(lat, lon), info);
search::AddressInfo const info = fm.GetMercatorAddressInfo(MercatorBounds::FromLatLon(lat, lon));
TEST_EQUAL(info.m_street, poi.m_street, ());
TEST_EQUAL(info.m_house, poi.m_house, ());

View file

@ -495,8 +495,7 @@ void DrawWidget::ShowInfoPopup(QMouseEvent * e, m2::PointD const & pt)
menu.addAction(QString::fromUtf8(s.c_str()));
};
search::AddressInfo info;
m_framework->GetAddressInfoForPixelPoint(pt, info);
search::AddressInfo const info = m_framework->GetMercatorAddressInfo(m_framework->PtoG(pt));
// Get feature types under cursor.
vector<string> types;