mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
[ios] Fixed wrong coordinates access for pure suggestion search results
Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
committed by
Yannik Bloscheck
parent
2cd1d9df3c
commit
9a50b3b147
@@ -36,18 +36,19 @@
|
|||||||
if (result.IsSuggest())
|
if (result.IsSuggest())
|
||||||
_suggestion = @(result.GetSuggestionString().c_str());
|
_suggestion = @(result.GetSuggestionString().c_str());
|
||||||
|
|
||||||
auto const & pivot = result.GetFeatureCenter();
|
_distanceText = nil;
|
||||||
_point = CGPointMake(pivot.x, pivot.y);
|
if (result.HasPoint()) {
|
||||||
auto const location = mercator::ToLatLon(pivot);
|
auto const center = result.GetFeatureCenter();
|
||||||
_coordinate = CLLocationCoordinate2DMake(location.m_lat, location.m_lon);
|
_point = CGPointMake(center.x, center.y);
|
||||||
|
auto const [centerLat, centerLon] = mercator::ToLatLon(center);
|
||||||
|
_coordinate = CLLocationCoordinate2DMake(centerLat, centerLon);
|
||||||
|
|
||||||
CLLocation * lastLocation = [MWMLocationManager lastLocation];
|
CLLocation * lastLocation = [MWMLocationManager lastLocation];
|
||||||
if (lastLocation && result.HasPoint()) {
|
if (lastLocation) {
|
||||||
double distanceInMeters = mercator::DistanceOnEarth(lastLocation.mercator, result.GetFeatureCenter());
|
double const distanceM = mercator::DistanceOnEarth(lastLocation.mercator, center);
|
||||||
std::string distanceStr = platform::Distance::CreateFormatted(distanceInMeters).ToString();
|
std::string const distanceStr = platform::Distance::CreateFormatted(distanceM).ToString();
|
||||||
_distanceText = @(distanceStr.c_str());
|
_distanceText = @(distanceStr.c_str());
|
||||||
} else {
|
}
|
||||||
_distanceText = nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (result.IsOpenNow()) {
|
switch (result.IsOpenNow()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user