mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-04 11:53:47 +00:00
[ios] fix route building error while searching when current location in none
Fixes issue https://github.com/organicmaps/organicmaps/issues/10606 Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
7be49ab00a
commit
8a331c4c67
@@ -36,16 +36,16 @@
|
||||
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);
|
||||
|
||||
CLLocation * lastLocation = [MWMLocationManager lastLocation];
|
||||
if (lastLocation && result.HasPoint()) {
|
||||
double distanceInMeters = mercator::DistanceOnEarth(lastLocation.mercator, result.GetFeatureCenter());
|
||||
std::string distanceStr = platform::Distance::CreateFormatted(distanceInMeters).ToString();
|
||||
_distanceText = @(distanceStr.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);
|
||||
} else {
|
||||
_distanceText = nil;
|
||||
}
|
||||
|
||||
@@ -96,24 +96,24 @@ final class SearchOnMapInteractor: NSObject {
|
||||
searchManager.showResult(at: result.index)
|
||||
case .start:
|
||||
let point = MWMRoutePoint(cgPoint: result.point,
|
||||
title: result.titleText,
|
||||
subtitle: result.addressText,
|
||||
type: .start,
|
||||
intermediateIndex: 0)
|
||||
title: result.titleText,
|
||||
subtitle: result.addressText,
|
||||
type: .start,
|
||||
intermediateIndex: 0)
|
||||
routeManager.build(from: point, bestRouter: false)
|
||||
case .finish:
|
||||
let point = MWMRoutePoint(cgPoint: result.point,
|
||||
title: result.titleText,
|
||||
subtitle: result.addressText,
|
||||
type: .finish,
|
||||
intermediateIndex: 0)
|
||||
title: result.titleText,
|
||||
subtitle: result.addressText,
|
||||
type: .finish,
|
||||
intermediateIndex: 0)
|
||||
routeManager.build(to: point, bestRouter: false)
|
||||
@unknown default:
|
||||
fatalError("Unsupported routingTooltipSearch")
|
||||
}
|
||||
return isIPad ? .none : .setSearchScreenHidden(true)
|
||||
case .suggestion:
|
||||
var suggestionQuery = SearchQuery(result.suggestion,
|
||||
let suggestionQuery = SearchQuery(result.suggestion,
|
||||
locale: query.locale,
|
||||
source: result.isPureSuggest ? .suggestion : .typedText)
|
||||
searchManager.searchQuery(suggestionQuery)
|
||||
|
||||
Reference in New Issue
Block a user