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())
|
||||
_suggestion = @(result.GetSuggestionString().c_str());
|
||||
|
||||
auto const & pivot = result.GetFeatureCenter();
|
||||
_point = CGPointMake(pivot.x, pivot.y);
|
||||
auto const location = mercator::ToLatLon(pivot);
|
||||
_coordinate = CLLocationCoordinate2DMake(location.m_lat, location.m_lon);
|
||||
_distanceText = nil;
|
||||
if (result.HasPoint()) {
|
||||
auto const center = result.GetFeatureCenter();
|
||||
_point = CGPointMake(center.x, center.y);
|
||||
auto const [centerLat, centerLon] = mercator::ToLatLon(center);
|
||||
_coordinate = CLLocationCoordinate2DMake(centerLat, centerLon);
|
||||
|
||||
CLLocation * lastLocation = [MWMLocationManager lastLocation];
|
||||
if (lastLocation && result.HasPoint()) {
|
||||
double distanceInMeters = mercator::DistanceOnEarth(lastLocation.mercator, result.GetFeatureCenter());
|
||||
std::string distanceStr = platform::Distance::CreateFormatted(distanceInMeters).ToString();
|
||||
if (lastLocation) {
|
||||
double const distanceM = mercator::DistanceOnEarth(lastLocation.mercator, center);
|
||||
std::string const distanceStr = platform::Distance::CreateFormatted(distanceM).ToString();
|
||||
_distanceText = @(distanceStr.c_str());
|
||||
} else {
|
||||
_distanceText = nil;
|
||||
}
|
||||
}
|
||||
|
||||
switch (result.IsOpenNow()) {
|
||||
|
||||
Reference in New Issue
Block a user