forked from organicmaps/organicmaps
[router] [ios] Exposed MWMRouter to Swift.
This commit is contained in:
parent
a5ee251280
commit
9aaf301b95
22 changed files with 234 additions and 126 deletions
|
@ -12,6 +12,7 @@
|
|||
#import "MWMLocationManager.h"
|
||||
#import "MWMNoMapsViewController.h"
|
||||
#import "MWMPushNotifications.h"
|
||||
#import "MWMRouter.h"
|
||||
#import "MWMSearchNoResults.h"
|
||||
#import "MWMTableViewCell.h"
|
||||
#import "MWMTypes.h"
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
#import "MWMNavigationDashboardManager.h"
|
||||
#import "MWMSearchManager.h"
|
||||
|
||||
#include "MWMRoutePoint.h"
|
||||
|
||||
#include "map/user_mark.hpp"
|
||||
#include "platform/location.hpp"
|
||||
|
||||
|
|
|
@ -409,7 +409,7 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
|
||||
- (void)onRouteReady
|
||||
{
|
||||
if (![MWMRouter router].startPoint.IsMyPosition())
|
||||
if (![MWMRouter router].startPoint.isMyPosition)
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
GetFramework().DisableFollowMode();
|
||||
|
|
|
@ -156,14 +156,14 @@ using TInfoDisplays = NSHashTable<__kindof TInfoDisplay>;
|
|||
auto showError = ^(NSString * errorMessage)
|
||||
{
|
||||
[self.routePreview stateError];
|
||||
[self.routePreview router:routing::RouterType::Taxi setState:MWMCircularProgressStateFailed];
|
||||
[self.routePreview router:MWMRouterTypeTaxi setState:MWMCircularProgressStateFailed];
|
||||
[self setMenuErrorStateWithErrorMessage:errorMessage];
|
||||
};
|
||||
|
||||
auto r = [MWMRouter router];
|
||||
auto const & start = r.startPoint;
|
||||
auto const & finish = r.finishPoint;
|
||||
if (start.IsValid() && finish.IsValid())
|
||||
if (start.isValid && finish.isValid)
|
||||
{
|
||||
if (!Platform::IsConnected())
|
||||
{
|
||||
|
|
|
@ -374,7 +374,7 @@ BOOL defaultOrientation(CGSize const & size)
|
|||
{
|
||||
_isVisible = isVisible;
|
||||
[self setNeedsLayout];
|
||||
if (isVisible && [MWMRouter router].type == routing::RouterType::Pedestrian)
|
||||
if (isVisible && [MWMRouter router].type == MWMRouterTypePedestrian)
|
||||
[MWMLocationManager addObserver:self];
|
||||
else
|
||||
[MWMLocationManager removeObserver:self];
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#import "MWMCircularProgress.h"
|
||||
#import "MWMNavigationDashboardInfoProtocol.h"
|
||||
#import "MWMNavigationView.h"
|
||||
|
||||
#include "routing/router.hpp"
|
||||
#import "MWMRouterType.h"
|
||||
|
||||
@class MWMNavigationDashboardEntity;
|
||||
@class MWMNavigationDashboardManager;
|
||||
|
@ -18,8 +17,8 @@
|
|||
- (void)stateError;
|
||||
- (void)stateReady;
|
||||
- (void)reloadData;
|
||||
- (void)selectRouter:(routing::RouterType)routerType;
|
||||
- (void)router:(routing::RouterType)routerType setState:(MWMCircularProgressState)state;
|
||||
- (void)router:(routing::RouterType)routerType setProgress:(CGFloat)progress;
|
||||
- (void)selectRouter:(MWMRouterType)routerType;
|
||||
- (void)router:(MWMRouterType)routerType setState:(MWMCircularProgressState)state;
|
||||
- (void)router:(MWMRouterType)routerType setProgress:(CGFloat)progress;
|
||||
|
||||
@end
|
||||
|
|
|
@ -56,7 +56,7 @@ CGFloat constexpr kAdditionalHeight = 20.;
|
|||
|
||||
@implementation MWMRoutePreview
|
||||
{
|
||||
map<routing::RouterType, MWMCircularProgress *> m_progresses;
|
||||
map<MWMRouterType, MWMCircularProgress *> m_progresses;
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
|
@ -75,16 +75,15 @@ CGFloat constexpr kAdditionalHeight = 20.;
|
|||
|
||||
- (void)setupProgresses
|
||||
{
|
||||
using type = routing::RouterType;
|
||||
[self addProgress:self.vehicle imageName:@"ic_car" routerType:type::Vehicle];
|
||||
[self addProgress:self.pedestrian imageName:@"ic_pedestrian" routerType:type::Pedestrian];
|
||||
[self addProgress:self.bicycle imageName:@"ic_bike" routerType:type::Bicycle];
|
||||
[self addProgress:self.taxi imageName:@"ic_taxi" routerType:type::Taxi];
|
||||
[self addProgress:self.vehicle imageName:@"ic_car" routerType:MWMRouterTypeVehicle];
|
||||
[self addProgress:self.pedestrian imageName:@"ic_pedestrian" routerType:MWMRouterTypePedestrian];
|
||||
[self addProgress:self.bicycle imageName:@"ic_bike" routerType:MWMRouterTypeBicycle];
|
||||
[self addProgress:self.taxi imageName:@"ic_taxi" routerType:MWMRouterTypeTaxi];
|
||||
}
|
||||
|
||||
- (void)addProgress:(UIView *)parentView
|
||||
imageName:(NSString *)imageName
|
||||
routerType:(routing::RouterType)routerType
|
||||
routerType:(MWMRouterType)routerType
|
||||
{
|
||||
MWMCircularProgress * progress = [[MWMCircularProgress alloc] initWithParentView:parentView];
|
||||
MWMCircularProgressStateVec const imageStates = {MWMCircularProgressStateNormal,
|
||||
|
@ -220,7 +219,7 @@ CGFloat constexpr kAdditionalHeight = 20.;
|
|||
}
|
||||
|
||||
- (void)reloadData { [self.collectionView reloadData]; }
|
||||
- (void)selectRouter:(routing::RouterType)routerType
|
||||
- (void)selectRouter:(MWMRouterType)routerType
|
||||
{
|
||||
for (auto const & progress : m_progresses)
|
||||
progress.second.state = MWMCircularProgressStateNormal;
|
||||
|
@ -235,12 +234,12 @@ CGFloat constexpr kAdditionalHeight = 20.;
|
|||
[super layoutSubviews];
|
||||
}
|
||||
|
||||
- (void)router:(routing::RouterType)routerType setState:(MWMCircularProgressState)state
|
||||
- (void)router:(MWMRouterType)routerType setState:(MWMCircularProgressState)state
|
||||
{
|
||||
m_progresses[routerType].state = state;
|
||||
}
|
||||
|
||||
- (void)router:(routing::RouterType)routerType setProgress:(CGFloat)progress
|
||||
- (void)router:(MWMRouterType)routerType setProgress:(CGFloat)progress
|
||||
{
|
||||
m_progresses[routerType].progress = progress;
|
||||
}
|
||||
|
@ -259,26 +258,26 @@ CGFloat constexpr kAdditionalHeight = 20.;
|
|||
{
|
||||
if (prg.second != progress)
|
||||
continue;
|
||||
routing::RouterType const routerType = prg.first;
|
||||
auto const routerType = prg.first;
|
||||
[self selectRouter:routerType];
|
||||
MWMRouter * router = [MWMRouter router];
|
||||
router.type = routerType;
|
||||
[router rebuildWithBestRouter:NO];
|
||||
switch (routerType)
|
||||
{
|
||||
case routing::RouterType::Vehicle:
|
||||
case MWMRouterTypeVehicle:
|
||||
[Statistics logEvent:kStatPointToPoint
|
||||
withParameters:@{kStatAction : kStatChangeRoutingMode, kStatValue : kStatVehicle}];
|
||||
break;
|
||||
case routing::RouterType::Pedestrian:
|
||||
case MWMRouterTypePedestrian:
|
||||
[Statistics logEvent:kStatPointToPoint
|
||||
withParameters:@{kStatAction : kStatChangeRoutingMode, kStatValue : kStatPedestrian}];
|
||||
break;
|
||||
case routing::RouterType::Bicycle:
|
||||
case MWMRouterTypeBicycle:
|
||||
[Statistics logEvent:kStatPointToPoint
|
||||
withParameters:@{kStatAction : kStatChangeRoutingMode, kStatValue : kStatBicycle}];
|
||||
break;
|
||||
case routing::RouterType::Taxi:
|
||||
case MWMRouterTypeTaxi:
|
||||
[Statistics logEvent:kStatPointToPoint
|
||||
withParameters:@{kStatAction : kStatChangeRoutingMode, kStatValue : kStatUber}];
|
||||
break;
|
||||
|
@ -469,12 +468,12 @@ CGFloat constexpr kAdditionalHeight = 20.;
|
|||
cell.number.text = @(indexPath.row + 1).stringValue;
|
||||
if (indexPath.row == 0)
|
||||
{
|
||||
cell.title.text = [MWMRouter router].startPoint.Name();
|
||||
cell.title.text = [MWMRouter router].startPoint.name;
|
||||
cell.title.placeholder = L(@"p2p_from");
|
||||
}
|
||||
else
|
||||
{
|
||||
cell.title.text = [MWMRouter router].finishPoint.Name();
|
||||
cell.title.text = [MWMRouter router].finishPoint.name;
|
||||
cell.title.placeholder = L(@"p2p_to");
|
||||
}
|
||||
cell.delegate = self;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class MWMRoutePoint;
|
||||
@class MWMRoutePoint;
|
||||
|
||||
@interface MWMTaxiCollectionView : UICollectionView
|
||||
|
||||
|
@ -11,10 +11,10 @@ class MWMRoutePoint;
|
|||
|
||||
- (instancetype)initWithCollectionView:(MWMTaxiCollectionView *)collectionView;
|
||||
|
||||
- (void)requestTaxiFrom:(MWMRoutePoint const &)from
|
||||
to:(MWMRoutePoint const &)to
|
||||
completion:(TMWMVoidBlock)completion
|
||||
failure:(MWMStringBlock)failure;
|
||||
- (void)requestTaxiFrom:(MWMRoutePoint *)from
|
||||
to:(MWMRoutePoint *)to
|
||||
completion:(TMWMVoidBlock)completion
|
||||
failure:(MWMStringBlock)failure;
|
||||
|
||||
- (NSURL *)taxiURL;
|
||||
- (BOOL)isTaxiInstalled;
|
||||
|
|
|
@ -97,15 +97,15 @@ using namespace uber;
|
|||
self.collectionView = nil;
|
||||
}
|
||||
|
||||
- (void)requestTaxiFrom:(MWMRoutePoint const &)from
|
||||
to:(MWMRoutePoint const &)to
|
||||
completion:(TMWMVoidBlock)completion
|
||||
failure:(MWMStringBlock)failure
|
||||
- (void)requestTaxiFrom:(MWMRoutePoint *)from
|
||||
to:(MWMRoutePoint *)to
|
||||
completion:(TMWMVoidBlock)completion
|
||||
failure:(MWMStringBlock)failure
|
||||
{
|
||||
NSAssert(completion && failure, @"Completion and failure blocks must be not nil!");
|
||||
m_products.clear();
|
||||
m_from = MercatorBounds::ToLatLon(from.Point());
|
||||
m_to = MercatorBounds::ToLatLon(to.Point());
|
||||
m_from = latlonMWMRoutePoint(from);
|
||||
m_to = latlonMWMRoutePoint(to);
|
||||
auto cv = self.collectionView;
|
||||
cv.hidden = YES;
|
||||
cv.pageControl.hidden = YES;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#import "MWMLocationManager.h"
|
||||
#import "MWMMapViewControlsManager.h"
|
||||
#import "MWMPushNotifications.h"
|
||||
#import "MWMRoutePoint.h"
|
||||
#import "MWMRouter.h"
|
||||
#import "MWMRouterSavedState.h"
|
||||
#import "MWMSearch+CoreSpotlight.h"
|
||||
|
@ -224,8 +225,8 @@ using namespace osm_auth_ios;
|
|||
auto const points = parsedData.m_points;
|
||||
auto const & p1 = points[0];
|
||||
auto const & p2 = points[1];
|
||||
[[MWMRouter router] buildFromPoint:MWMRoutePoint(p1.m_org, @(p1.m_name.c_str()))
|
||||
toPoint:MWMRoutePoint(p2.m_org, @(p2.m_name.c_str()))
|
||||
[[MWMRouter router] buildFromPoint:makeMWMRoutePoint(p1.m_org, @(p1.m_name.c_str()))
|
||||
toPoint:makeMWMRoutePoint(p2.m_org, @(p2.m_name.c_str()))
|
||||
bestRouter:NO];
|
||||
[self showMap];
|
||||
[self.mapViewController showAPIBar];
|
||||
|
|
23
iphone/Maps/Common/Types.swift
Normal file
23
iphone/Maps/Common/Types.swift
Normal file
|
@ -0,0 +1,23 @@
|
|||
typealias MercatorCoordinate = Double
|
||||
|
||||
struct MercatorCoordinate2D {
|
||||
var x: MercatorCoordinate
|
||||
var y: MercatorCoordinate
|
||||
|
||||
init() {
|
||||
x = 0
|
||||
y = 0
|
||||
}
|
||||
|
||||
init(x: MercatorCoordinate, y: MercatorCoordinate) {
|
||||
self.x = x
|
||||
self.y = y
|
||||
}
|
||||
}
|
||||
|
||||
extension MercatorCoordinate2D: Equatable {
|
||||
static func == (lhs: MercatorCoordinate2D, rhs: MercatorCoordinate2D) -> Bool {
|
||||
let eps = 1e-8
|
||||
return abs(lhs.x - rhs.x) < eps && abs(lhs.y - rhs.y) < eps
|
||||
}
|
||||
}
|
25
iphone/Maps/Core/Routing/MWMCoreRouterType.h
Normal file
25
iphone/Maps/Core/Routing/MWMCoreRouterType.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
#import "MWMRouterType.h"
|
||||
|
||||
#include "routing/router.hpp"
|
||||
|
||||
static inline routing::RouterType coreRouterType(MWMRouterType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MWMRouterTypeVehicle: return routing::RouterType::Vehicle;
|
||||
case MWMRouterTypePedestrian: return routing::RouterType::Pedestrian;
|
||||
case MWMRouterTypeBicycle: return routing::RouterType::Bicycle;
|
||||
case MWMRouterTypeTaxi: return routing::RouterType::Taxi;
|
||||
}
|
||||
}
|
||||
|
||||
static inline MWMRouterType routerType(routing::RouterType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case routing::RouterType::Vehicle: return MWMRouterTypeVehicle;
|
||||
case routing::RouterType::Pedestrian: return MWMRouterTypePedestrian;
|
||||
case routing::RouterType::Bicycle: return MWMRouterTypeBicycle;
|
||||
case routing::RouterType::Taxi: return MWMRouterTypeTaxi;
|
||||
}
|
||||
}
|
|
@ -1,35 +1,26 @@
|
|||
#pragma once
|
||||
#import "SwiftBridge.h"
|
||||
|
||||
#include "geometry/latlon.hpp"
|
||||
#include "geometry/mercator.hpp"
|
||||
#include "geometry/point2d.hpp"
|
||||
|
||||
class MWMRoutePoint
|
||||
static inline MWMRoutePoint * makeMWMRoutePoint(m2::PointD const & point, NSString * name)
|
||||
{
|
||||
public:
|
||||
MWMRoutePoint() = default;
|
||||
return [[MWMRoutePoint alloc] initWithX:point.x y:point.y name:name isMyPosition:false];
|
||||
}
|
||||
|
||||
MWMRoutePoint(m2::PointD const & p, NSString * n) : m_point(p), m_name(n), m_isMyPosition(false)
|
||||
{
|
||||
}
|
||||
static inline MWMRoutePoint * makeMWMRoutePoint(m2::PointD const & point)
|
||||
{
|
||||
return [[MWMRoutePoint alloc] initWithX:point.x y:point.y];
|
||||
}
|
||||
|
||||
explicit MWMRoutePoint(m2::PointD const & p)
|
||||
: m_point(p), m_name(L(@"p2p_your_location")), m_isMyPosition(true)
|
||||
{
|
||||
}
|
||||
static inline MWMRoutePoint * makeMWMRoutePointZero() { return [[MWMRoutePoint alloc] init]; }
|
||||
static inline m2::PointD mercatorMWMRoutePoint(MWMRoutePoint * point)
|
||||
{
|
||||
return m2::PointD(point.x, point.y);
|
||||
}
|
||||
|
||||
bool operator==(MWMRoutePoint const & p) const
|
||||
{
|
||||
return m_point.EqualDxDy(p.m_point, 0.00000001) && [m_name isEqualToString:p.m_name] &&
|
||||
m_isMyPosition == p.m_isMyPosition;
|
||||
}
|
||||
|
||||
bool operator!=(MWMRoutePoint const & p) const { return !(*this == p); }
|
||||
static MWMRoutePoint MWMRoutePointZero() { return MWMRoutePoint(m2::PointD::Zero(), @""); }
|
||||
m2::PointD const & Point() const { return m_point; }
|
||||
NSString * Name() const { return m_name; }
|
||||
bool IsMyPosition() const { return m_isMyPosition; }
|
||||
bool IsValid() const { return *this != MWMRoutePoint::MWMRoutePointZero(); }
|
||||
private:
|
||||
m2::PointD m_point;
|
||||
NSString * m_name;
|
||||
bool m_isMyPosition = false;
|
||||
};
|
||||
static inline ms::LatLon latlonMWMRoutePoint(MWMRoutePoint * point)
|
||||
{
|
||||
return MercatorBounds::ToLatLon(mercatorMWMRoutePoint(point));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "MWMRoutePoint.h"
|
||||
#import "MWMRouterType.h"
|
||||
|
||||
#include "routing/router.hpp"
|
||||
@class MWMRoutePoint;
|
||||
|
||||
typedef void (^MWMImageHeightBlock)(UIImage *, NSString *);
|
||||
|
||||
|
@ -13,15 +13,15 @@ typedef void (^MWMImageHeightBlock)(UIImage *, NSString *);
|
|||
+ (void)startRouting;
|
||||
+ (void)stopRouting;
|
||||
|
||||
@property(nonatomic, readonly) MWMRoutePoint startPoint;
|
||||
@property(nonatomic, readonly) MWMRoutePoint finishPoint;
|
||||
@property(nonatomic) routing::RouterType type;
|
||||
@property(nonatomic, readonly) MWMRoutePoint * startPoint;
|
||||
@property(nonatomic, readonly) MWMRoutePoint * finishPoint;
|
||||
@property(nonatomic) MWMRouterType type;
|
||||
|
||||
- (void)swapPointsAndRebuild;
|
||||
- (void)buildFromPoint:(MWMRoutePoint const &)start bestRouter:(BOOL)bestRouter;
|
||||
- (void)buildToPoint:(MWMRoutePoint const &)finish bestRouter:(BOOL)bestRouter;
|
||||
- (void)buildFromPoint:(MWMRoutePoint const &)start
|
||||
toPoint:(MWMRoutePoint const &)finish
|
||||
- (void)buildFromPoint:(MWMRoutePoint *)start bestRouter:(BOOL)bestRouter;
|
||||
- (void)buildToPoint:(MWMRoutePoint *)finish bestRouter:(BOOL)bestRouter;
|
||||
- (void)buildFromPoint:(MWMRoutePoint *)start
|
||||
toPoint:(MWMRoutePoint *)finish
|
||||
bestRouter:(BOOL)bestRouter;
|
||||
- (void)rebuildWithBestRouter:(BOOL)bestRouter;
|
||||
- (void)routeAltitudeImageForSize:(CGSize)size completion:(MWMImageHeightBlock)block;
|
||||
|
|
|
@ -2,12 +2,14 @@
|
|||
#import <Pushwoosh/PushNotificationManager.h>
|
||||
#import "CLLocation+Mercator.h"
|
||||
#import "MWMAlertViewController.h"
|
||||
#import "MWMCoreRouterType.h"
|
||||
#import "MWMFrameworkListener.h"
|
||||
#import "MWMLocationHelpers.h"
|
||||
#import "MWMLocationManager.h"
|
||||
#import "MWMLocationObserver.h"
|
||||
#import "MWMMapViewControlsManager.h"
|
||||
#import "MWMNavigationDashboardManager.h"
|
||||
#import "MWMRoutePoint.h"
|
||||
#import "MWMRouterSavedState.h"
|
||||
#import "MWMSearch.h"
|
||||
#import "MWMSettings.h"
|
||||
|
@ -29,19 +31,19 @@ namespace
|
|||
{
|
||||
char const * kRenderAltitudeImagesQueueLabel = "mapsme.mwmrouter.renderAltitudeImagesQueue";
|
||||
|
||||
MWMRoutePoint lastLocationPoint()
|
||||
MWMRoutePoint * lastLocationPoint()
|
||||
{
|
||||
CLLocation * lastLocation = [MWMLocationManager lastLocation];
|
||||
return lastLocation ? MWMRoutePoint(lastLocation.mercator) : MWMRoutePoint::MWMRoutePointZero();
|
||||
return lastLocation ? makeMWMRoutePoint(lastLocation.mercator) : makeMWMRoutePointZero();
|
||||
}
|
||||
|
||||
bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !point.IsMyPosition(); }
|
||||
bool isMarkerPoint(MWMRoutePoint * point) { return point.isValid && !point.isMyPosition; }
|
||||
} // namespace
|
||||
|
||||
@interface MWMRouter ()<MWMLocationObserver, MWMFrameworkRouteBuilderObserver>
|
||||
|
||||
@property(nonatomic, readwrite) MWMRoutePoint startPoint;
|
||||
@property(nonatomic, readwrite) MWMRoutePoint finishPoint;
|
||||
@property(nonatomic, readwrite) MWMRoutePoint * startPoint;
|
||||
@property(nonatomic, readwrite) MWMRoutePoint * finishPoint;
|
||||
|
||||
@property(nonatomic) NSMutableDictionary<NSValue *, NSData *> * altitudeImagesData;
|
||||
@property(nonatomic) NSString * altitudeElevation;
|
||||
|
@ -74,8 +76,8 @@ bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !poi
|
|||
|
||||
auto taxiDataSource = [MWMNavigationDashboardManager manager].taxiDataSource;
|
||||
auto eventName = taxiDataSource.isTaxiInstalled ? kStatRoutingTaxiOrder : kStatRoutingTaxiInstall;
|
||||
auto const & sLatLon = MercatorBounds::ToLatLon(router.startPoint.Point());
|
||||
auto const & fLatLon = MercatorBounds::ToLatLon(router.finishPoint.Point());
|
||||
auto const sLatLon = latlonMWMRoutePoint(router.startPoint);
|
||||
auto const fLatLon = latlonMWMRoutePoint(router.finishPoint);
|
||||
|
||||
[Statistics logEvent:eventName
|
||||
withParameters:@{
|
||||
|
@ -112,23 +114,21 @@ bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !poi
|
|||
- (void)resetPoints
|
||||
{
|
||||
self.startPoint = lastLocationPoint();
|
||||
self.finishPoint = MWMRoutePoint::MWMRoutePointZero();
|
||||
self.finishPoint = makeMWMRoutePointZero();
|
||||
}
|
||||
|
||||
- (void)setType:(RouterType)type
|
||||
- (void)setType:(MWMRouterType)type
|
||||
{
|
||||
if (type == self.type)
|
||||
return;
|
||||
[self doStop];
|
||||
GetFramework().SetRouter(type);
|
||||
GetFramework().SetRouter(coreRouterType(type));
|
||||
}
|
||||
|
||||
- (RouterType)type { return GetFramework().GetRouter(); }
|
||||
- (MWMRouterType)type { return routerType(GetFramework().GetRouter()); }
|
||||
- (BOOL)arePointsValidForRouting
|
||||
{
|
||||
MWMRoutePoint const zeroPoint = MWMRoutePoint::MWMRoutePointZero();
|
||||
return self.startPoint != zeroPoint && self.finishPoint != zeroPoint &&
|
||||
self.startPoint != self.finishPoint;
|
||||
return self.startPoint.isValid && self.finishPoint.isValid && self.startPoint != self.finishPoint;
|
||||
}
|
||||
|
||||
- (void)swapPointsAndRebuild
|
||||
|
@ -138,22 +138,22 @@ bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !poi
|
|||
[self rebuildWithBestRouter:NO];
|
||||
}
|
||||
|
||||
- (void)buildFromPoint:(MWMRoutePoint const &)startPoint bestRouter:(BOOL)bestRouter
|
||||
- (void)buildFromPoint:(MWMRoutePoint *)startPoint bestRouter:(BOOL)bestRouter
|
||||
{
|
||||
self.startPoint = startPoint;
|
||||
[self rebuildWithBestRouter:bestRouter];
|
||||
}
|
||||
|
||||
- (void)buildToPoint:(MWMRoutePoint const &)finishPoint bestRouter:(BOOL)bestRouter
|
||||
- (void)buildToPoint:(MWMRoutePoint *)finishPoint bestRouter:(BOOL)bestRouter
|
||||
{
|
||||
if (!self.startPoint.IsValid() && !finishPoint.IsMyPosition())
|
||||
if (!self.startPoint.isValid && !finishPoint.isMyPosition)
|
||||
self.startPoint = lastLocationPoint();
|
||||
self.finishPoint = finishPoint;
|
||||
[self rebuildWithBestRouter:bestRouter];
|
||||
}
|
||||
|
||||
- (void)buildFromPoint:(MWMRoutePoint const &)start
|
||||
toPoint:(MWMRoutePoint const &)finish
|
||||
- (void)buildFromPoint:(MWMRoutePoint *)start
|
||||
toPoint:(MWMRoutePoint *)finish
|
||||
bestRouter:(BOOL)bestRouter
|
||||
{
|
||||
self.startPoint = start;
|
||||
|
@ -166,13 +166,13 @@ bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !poi
|
|||
[self clearAltitudeImagesData];
|
||||
|
||||
bool isP2P = false;
|
||||
if (self.startPoint.IsMyPosition())
|
||||
if (self.startPoint.isMyPosition)
|
||||
{
|
||||
[Statistics logEvent:kStatPointToPoint
|
||||
withParameters:@{kStatAction : kStatBuildRoute, kStatValue : kStatFromMyPosition}];
|
||||
self.startPoint = lastLocationPoint();
|
||||
}
|
||||
else if (self.finishPoint.IsMyPosition())
|
||||
else if (self.finishPoint.isMyPosition)
|
||||
{
|
||||
[Statistics logEvent:kStatPointToPoint
|
||||
withParameters:@{kStatAction : kStatBuildRoute, kStatValue : kStatToMyPosition}];
|
||||
|
@ -190,11 +190,11 @@ bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !poi
|
|||
if (![self arePointsValidForRouting])
|
||||
return;
|
||||
auto & f = GetFramework();
|
||||
auto const & startPoint = self.startPoint.Point();
|
||||
auto const & finishPoint = self.finishPoint.Point();
|
||||
auto startPoint = mercatorMWMRoutePoint(self.startPoint);
|
||||
auto finishPoint = mercatorMWMRoutePoint(self.finishPoint);
|
||||
// Taxi can't be used as best router.
|
||||
if (bestRouter && ![[self class] isTaxi])
|
||||
self.type = GetFramework().GetBestRouter(startPoint, finishPoint);
|
||||
self.type = routerType(GetFramework().GetBestRouter(startPoint, finishPoint));
|
||||
f.BuildRoute(startPoint, finishPoint, isP2P, 0 /* timeoutSec */);
|
||||
f.SetRouteStartPoint(startPoint, isMarkerPoint(self.startPoint));
|
||||
f.SetRouteFinishPoint(finishPoint, isMarkerPoint(self.finishPoint));
|
||||
|
@ -204,17 +204,17 @@ bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !poi
|
|||
- (void)start
|
||||
{
|
||||
auto const doStart = ^{
|
||||
if (self.startPoint.IsMyPosition())
|
||||
if (self.startPoint.isMyPosition)
|
||||
[Statistics logEvent:kStatEventName(kStatPointToPoint, kStatGo)
|
||||
withParameters:@{kStatValue : kStatFromMyPosition}];
|
||||
else if (self.finishPoint.IsMyPosition())
|
||||
else if (self.finishPoint.isMyPosition)
|
||||
[Statistics logEvent:kStatEventName(kStatPointToPoint, kStatGo)
|
||||
withParameters:@{kStatValue : kStatToMyPosition}];
|
||||
else
|
||||
[Statistics logEvent:kStatEventName(kStatPointToPoint, kStatGo)
|
||||
withParameters:@{kStatValue : kStatPointToPoint}];
|
||||
|
||||
if (self.startPoint.IsMyPosition())
|
||||
if (self.startPoint.isMyPosition)
|
||||
{
|
||||
GetFramework().FollowRoute();
|
||||
[[MWMMapViewControlsManager manager] onRouteStart];
|
||||
|
@ -230,7 +230,7 @@ bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !poi
|
|||
CLLocation * lastLocation = [MWMLocationManager lastLocation];
|
||||
BOOL const needToRebuild = lastLocation &&
|
||||
!location_helpers::isMyPositionPendingOrNoPosition() &&
|
||||
!self.finishPoint.IsMyPosition();
|
||||
!self.finishPoint.isMyPosition;
|
||||
[alertController presentPoint2PointAlertWithOkBlock:^{
|
||||
[self buildFromPoint:lastLocationPoint() bestRouter:NO];
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !poi
|
|||
if (state.forceStateChange == MWMRouterForceStateChange::Rebuild)
|
||||
{
|
||||
state.forceStateChange = MWMRouterForceStateChange::Start;
|
||||
self.type = GetFramework().GetLastUsedRouter();
|
||||
self.type = routerType(GetFramework().GetLastUsedRouter());
|
||||
[self buildToPoint:state.restorePoint bestRouter:NO];
|
||||
}
|
||||
}
|
||||
|
@ -453,23 +453,23 @@ bool isMarkerPoint(MWMRoutePoint const & point) { return point.IsValid() && !poi
|
|||
|
||||
#pragma mark - Properties
|
||||
|
||||
- (void)setStartPoint:(MWMRoutePoint)startPoint
|
||||
- (void)setStartPoint:(MWMRoutePoint *)startPoint
|
||||
{
|
||||
if (_startPoint == startPoint)
|
||||
return;
|
||||
_startPoint = startPoint;
|
||||
if (startPoint == self.finishPoint)
|
||||
self.finishPoint = MWMRoutePoint::MWMRoutePointZero();
|
||||
self.finishPoint = makeMWMRoutePointZero();
|
||||
[[MWMNavigationDashboardManager manager].routePreview reloadData];
|
||||
}
|
||||
|
||||
- (void)setFinishPoint:(MWMRoutePoint)finishPoint
|
||||
- (void)setFinishPoint:(MWMRoutePoint *)finishPoint
|
||||
{
|
||||
if (_finishPoint == finishPoint)
|
||||
return;
|
||||
_finishPoint = finishPoint;
|
||||
if (finishPoint == self.startPoint)
|
||||
self.startPoint = MWMRoutePoint::MWMRoutePointZero();
|
||||
self.startPoint = makeMWMRoutePointZero();
|
||||
[[MWMNavigationDashboardManager manager].routePreview reloadData];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
#include "MWMRoutePoint.h"
|
||||
|
||||
#include "geometry/point2d.hpp"
|
||||
@class MWMRoutePoint;
|
||||
|
||||
enum class MWMRouterForceStateChange
|
||||
{
|
||||
|
@ -11,7 +9,7 @@ enum class MWMRouterForceStateChange
|
|||
|
||||
@interface MWMRouterSavedState : NSObject
|
||||
|
||||
@property(nonatomic, readonly) MWMRoutePoint restorePoint;
|
||||
@property(nonatomic, readonly) MWMRoutePoint * restorePoint;
|
||||
@property(nonatomic) MWMRouterForceStateChange forceStateChange;
|
||||
|
||||
+ (instancetype)state;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#import "MWMRouterSavedState.h"
|
||||
#import "MWMRoutePoint.h"
|
||||
#import "MWMRouter.h"
|
||||
|
||||
#include "Framework.h"
|
||||
|
@ -36,7 +37,7 @@ static NSString * const kETAKey = @"eta";
|
|||
if (endPointData && eta)
|
||||
{
|
||||
[endPointData getBytes:&point length:size];
|
||||
_restorePoint = MWMRoutePoint(point, @"Destination");
|
||||
_restorePoint = makeMWMRoutePoint(point, @"Destination");
|
||||
if ([eta compare:[NSDate date]] == NSOrderedDescending)
|
||||
_forceStateChange = MWMRouterForceStateChange::Rebuild;
|
||||
}
|
||||
|
|
6
iphone/Maps/Core/Routing/MWMRouterType.h
Normal file
6
iphone/Maps/Core/Routing/MWMRouterType.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
typedef NS_ENUM(NSUInteger, MWMRouterType) {
|
||||
MWMRouterTypeVehicle,
|
||||
MWMRouterTypePedestrian,
|
||||
MWMRouterTypeBicycle,
|
||||
MWMRouterTypeTaxi
|
||||
};
|
44
iphone/Maps/Core/Routing/RoutePoint.swift
Normal file
44
iphone/Maps/Core/Routing/RoutePoint.swift
Normal file
|
@ -0,0 +1,44 @@
|
|||
import CoreLocation
|
||||
|
||||
@objc(MWMRoutePoint)
|
||||
final class RoutePoint: NSObject {
|
||||
|
||||
let point: MercatorCoordinate2D
|
||||
let name: String
|
||||
let isMyPosition: Bool
|
||||
var isValid: Bool { return self != RoutePoint() }
|
||||
var x: MercatorCoordinate { return point.x }
|
||||
var y: MercatorCoordinate { return point.y }
|
||||
|
||||
init(point: MercatorCoordinate2D, name: String, isMyPosition: Bool = false) {
|
||||
self.point = point
|
||||
self.name = name
|
||||
self.isMyPosition = isMyPosition
|
||||
super.init()
|
||||
}
|
||||
convenience init(x: MercatorCoordinate, y: MercatorCoordinate, name: String, isMyPosition: Bool = false) {
|
||||
self.init(point: MercatorCoordinate2D(x: x, y: y), name: name, isMyPosition: isMyPosition)
|
||||
}
|
||||
|
||||
convenience init(point: MercatorCoordinate2D) {
|
||||
self.init(point: point, name: L("p2p_your_location"), isMyPosition: true)
|
||||
}
|
||||
convenience init(x: MercatorCoordinate, y: MercatorCoordinate) {
|
||||
self.init(point: MercatorCoordinate2D(x: x, y: y))
|
||||
}
|
||||
|
||||
convenience override init() {
|
||||
self.init(point: MercatorCoordinate2D(), name: "", isMyPosition: false)
|
||||
}
|
||||
|
||||
override func isEqual(_ other: Any?) -> Bool {
|
||||
guard let other = other as? RoutePoint else { return false }
|
||||
return self == other
|
||||
}
|
||||
}
|
||||
|
||||
func == (lhs: RoutePoint, rhs: RoutePoint) -> Bool {
|
||||
return lhs.isMyPosition == rhs.isMyPosition &&
|
||||
lhs.point == rhs.point &&
|
||||
lhs.name == rhs.name
|
||||
}
|
|
@ -400,10 +400,16 @@
|
|||
34D4FA671E265749003F53EF /* WhatsNewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34D4FA651E265749003F53EF /* WhatsNewController.swift */; };
|
||||
34D4FA681E265749003F53EF /* WhatsNewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34D4FA651E265749003F53EF /* WhatsNewController.swift */; };
|
||||
34EB5E7E1C900159002C4D37 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 845C89301C89837900940D7F /* AssetsLibrary.framework */; };
|
||||
34ED298A1E3BB9B40054D003 /* RoutePoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34ED29891E3BB9B40054D003 /* RoutePoint.swift */; };
|
||||
34ED298B1E3BB9B40054D003 /* RoutePoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34ED29891E3BB9B40054D003 /* RoutePoint.swift */; };
|
||||
34ED298C1E3BB9B40054D003 /* RoutePoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34ED29891E3BB9B40054D003 /* RoutePoint.swift */; };
|
||||
34EF94291C05A6F30050B714 /* MWMSegue.mm in Sources */ = {isa = PBXBuildFile; fileRef = F607C18D1C047FDC00B53A87 /* MWMSegue.mm */; };
|
||||
34F5E0D31E3F254800B1C415 /* UIView+Hierarchy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F5E0D21E3F254800B1C415 /* UIView+Hierarchy.swift */; };
|
||||
34F5E0D41E3F254800B1C415 /* UIView+Hierarchy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F5E0D21E3F254800B1C415 /* UIView+Hierarchy.swift */; };
|
||||
34F5E0D51E3F254800B1C415 /* UIView+Hierarchy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F5E0D21E3F254800B1C415 /* UIView+Hierarchy.swift */; };
|
||||
34F5E0D71E3F334700B1C415 /* Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F5E0D61E3F334700B1C415 /* Types.swift */; };
|
||||
34F5E0D81E3F334700B1C415 /* Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F5E0D61E3F334700B1C415 /* Types.swift */; };
|
||||
34F5E0D91E3F334700B1C415 /* Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F5E0D61E3F334700B1C415 /* Types.swift */; };
|
||||
34F73F9B1E082FF800AC1FD6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 34F73F5F1E082FF700AC1FD6 /* InfoPlist.strings */; };
|
||||
34F73F9C1E082FF800AC1FD6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 34F73F5F1E082FF700AC1FD6 /* InfoPlist.strings */; };
|
||||
34F73F9D1E082FF800AC1FD6 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 34F73F5F1E082FF700AC1FD6 /* InfoPlist.strings */; };
|
||||
|
@ -1431,7 +1437,6 @@
|
|||
3404752F1E081A4600C92850 /* MWMLocationPredictor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMLocationPredictor.mm; sourceTree = "<group>"; };
|
||||
340475311E081A4600C92850 /* MWMNetworkPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMNetworkPolicy.h; sourceTree = "<group>"; };
|
||||
340475321E081A4600C92850 /* MWMNetworkPolicy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMNetworkPolicy.mm; sourceTree = "<group>"; };
|
||||
340475341E081A4600C92850 /* MWMRoutePoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMRoutePoint.h; sourceTree = "<group>"; };
|
||||
340475351E081A4600C92850 /* MWMRouter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMRouter.h; sourceTree = "<group>"; };
|
||||
340475361E081A4600C92850 /* MWMRouter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMRouter.mm; sourceTree = "<group>"; };
|
||||
340475371E081A4600C92850 /* MWMRouterSavedState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMRouterSavedState.h; sourceTree = "<group>"; };
|
||||
|
@ -1652,6 +1657,11 @@
|
|||
34D4FA611E26572D003F53EF /* FirstLaunchController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FirstLaunchController.swift; sourceTree = "<group>"; };
|
||||
34D4FA651E265749003F53EF /* WhatsNewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WhatsNewController.swift; sourceTree = "<group>"; };
|
||||
34F5E0D21E3F254800B1C415 /* UIView+Hierarchy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Hierarchy.swift"; sourceTree = "<group>"; };
|
||||
34ED29891E3BB9B40054D003 /* RoutePoint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RoutePoint.swift; sourceTree = "<group>"; };
|
||||
34F5E0D61E3F334700B1C415 /* Types.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Types.swift; sourceTree = "<group>"; };
|
||||
34F5E0DA1E3F3ED300B1C415 /* MWMRoutePoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMRoutePoint.h; sourceTree = "<group>"; };
|
||||
34F5E0DB1E3F511300B1C415 /* MWMRouterType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMRouterType.h; sourceTree = "<group>"; };
|
||||
34F5E0DC1E3F51AF00B1C415 /* MWMCoreRouterType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMCoreRouterType.h; sourceTree = "<group>"; };
|
||||
34F73F601E082FF700AC1FD6 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
34F73F621E082FF800AC1FD6 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
34F73F631E082FF800AC1FD6 /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
|
@ -2514,14 +2524,15 @@
|
|||
children = (
|
||||
340475151E081A4600C92850 /* AppInfo.h */,
|
||||
340475161E081A4600C92850 /* AppInfo.mm */,
|
||||
34845DB51E166084003D55B9 /* Common.swift */,
|
||||
340475171E081A4600C92850 /* Keyboard */,
|
||||
3404751B1E081A4600C92850 /* MWMCommon.h */,
|
||||
3404751C1E081A4600C92850 /* MWMMacros.h */,
|
||||
3404751D1E081A4600C92850 /* MWMTypes.h */,
|
||||
3404751E1E081A4600C92850 /* Statistics */,
|
||||
34F5E0D61E3F334700B1C415 /* Types.swift */,
|
||||
340475261E081A4600C92850 /* WebViewController.h */,
|
||||
340475271E081A4600C92850 /* WebViewController.mm */,
|
||||
34845DB51E166084003D55B9 /* Common.swift */,
|
||||
);
|
||||
path = Common;
|
||||
sourceTree = "<group>";
|
||||
|
@ -2592,11 +2603,14 @@
|
|||
340475331E081A4600C92850 /* Routing */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
340475341E081A4600C92850 /* MWMRoutePoint.h */,
|
||||
34F5E0DC1E3F51AF00B1C415 /* MWMCoreRouterType.h */,
|
||||
34F5E0DA1E3F3ED300B1C415 /* MWMRoutePoint.h */,
|
||||
340475351E081A4600C92850 /* MWMRouter.h */,
|
||||
340475361E081A4600C92850 /* MWMRouter.mm */,
|
||||
340475371E081A4600C92850 /* MWMRouterSavedState.h */,
|
||||
340475381E081A4600C92850 /* MWMRouterSavedState.mm */,
|
||||
34F5E0DB1E3F511300B1C415 /* MWMRouterType.h */,
|
||||
34ED29891E3BB9B40054D003 /* RoutePoint.swift */,
|
||||
);
|
||||
path = Routing;
|
||||
sourceTree = "<group>";
|
||||
|
@ -2992,9 +3006,9 @@
|
|||
340537621BBED98600D452C6 /* MWMMapViewControlsCommon.h */,
|
||||
34BC72101B0DECAE0012A34B /* MWMMapViewControlsManager.h */,
|
||||
34BC72111B0DECAE0012A34B /* MWMMapViewControlsManager.mm */,
|
||||
3497A9321B5CF8A900F51E55 /* NavigationDashboard */,
|
||||
345C34661CE9D32500BB2224 /* SideButtons */,
|
||||
3463BA621DE81D760082417F /* TrafficButton */,
|
||||
3497A9321B5CF8A900F51E55 /* NavigationDashboard */,
|
||||
);
|
||||
name = MapViewControls;
|
||||
path = CustomViews/MapViewControls;
|
||||
|
@ -4833,6 +4847,7 @@
|
|||
3454D7BB1E07F045004AF2AD /* CLLocation+Mercator.mm in Sources */,
|
||||
F6E2FF4D1E097BA00083EBEC /* MWMAboutController.mm in Sources */,
|
||||
34F5E0D31E3F254800B1C415 /* UIView+Hierarchy.swift in Sources */,
|
||||
34ED298A1E3BB9B40054D003 /* RoutePoint.swift in Sources */,
|
||||
3497A93A1B5CF8A900F51E55 /* MWMNavigationDashboardManager.mm in Sources */,
|
||||
F6E2FED81E097BA00083EBEC /* MWMSearchContentView.mm in Sources */,
|
||||
F6E2FD881E097BA00083EBEC /* MWMMapDownloaderViewController.mm in Sources */,
|
||||
|
@ -4894,6 +4909,7 @@
|
|||
F6E2FF171E097BA00083EBEC /* MWMSearchTabbedCollectionViewCell.mm in Sources */,
|
||||
F64F199B1AB81A00006EAF7E /* MWMAlert.mm in Sources */,
|
||||
ED48BBB517C267F5003E7E92 /* ColorPickerView.mm in Sources */,
|
||||
34F5E0D71E3F334700B1C415 /* Types.swift in Sources */,
|
||||
F6E2FF561E097BA00083EBEC /* MWMMobileInternetViewController.mm in Sources */,
|
||||
ED48BBBA17C2B1E2003E7E92 /* CircleView.mm in Sources */,
|
||||
F6E2FEEA1E097BA00083EBEC /* MWMSearchTextField.mm in Sources */,
|
||||
|
@ -5090,6 +5106,7 @@
|
|||
3454D7BC1E07F045004AF2AD /* CLLocation+Mercator.mm in Sources */,
|
||||
F6E2FF4E1E097BA00083EBEC /* MWMAboutController.mm in Sources */,
|
||||
34F5E0D41E3F254800B1C415 /* UIView+Hierarchy.swift in Sources */,
|
||||
34ED298B1E3BB9B40054D003 /* RoutePoint.swift in Sources */,
|
||||
6741AA0B1BF340DE002C974C /* MWMMapViewControlsManager.mm in Sources */,
|
||||
F6E2FED91E097BA00083EBEC /* MWMSearchContentView.mm in Sources */,
|
||||
F6E2FD891E097BA00083EBEC /* MWMMapDownloaderViewController.mm in Sources */,
|
||||
|
@ -5151,6 +5168,7 @@
|
|||
34AB39C21D2BD8310021857D /* MWMStopButton.mm in Sources */,
|
||||
6741AA281BF340DE002C974C /* MWMAlert.mm in Sources */,
|
||||
F6E2FF571E097BA00083EBEC /* MWMMobileInternetViewController.mm in Sources */,
|
||||
34F5E0D81E3F334700B1C415 /* Types.swift in Sources */,
|
||||
6741AA291BF340DE002C974C /* ColorPickerView.mm in Sources */,
|
||||
6741AA2B1BF340DE002C974C /* CircleView.mm in Sources */,
|
||||
F6E2FEEB1E097BA00083EBEC /* MWMSearchTextField.mm in Sources */,
|
||||
|
@ -5347,6 +5365,7 @@
|
|||
849CF71A1DE842290024A8A5 /* MWMDropDown.mm in Sources */,
|
||||
F6E2FF4F1E097BA00083EBEC /* MWMAboutController.mm in Sources */,
|
||||
34F5E0D51E3F254800B1C415 /* UIView+Hierarchy.swift in Sources */,
|
||||
34ED298C1E3BB9B40054D003 /* RoutePoint.swift in Sources */,
|
||||
849CF71D1DE842290024A8A5 /* MWMNavigationDashboardManager.mm in Sources */,
|
||||
3454D7C91E07F045004AF2AD /* UIButton+RuntimeAttributes.mm in Sources */,
|
||||
F6E2FEDA1E097BA00083EBEC /* MWMSearchContentView.mm in Sources */,
|
||||
|
@ -5408,6 +5427,7 @@
|
|||
F6E2FF191E097BA00083EBEC /* MWMSearchTabbedCollectionViewCell.mm in Sources */,
|
||||
3404754E1E081A4600C92850 /* MWMKeyboard.mm in Sources */,
|
||||
849CF7631DE842290024A8A5 /* MWMAlert.mm in Sources */,
|
||||
34F5E0D91E3F334700B1C415 /* Types.swift in Sources */,
|
||||
F6E2FF581E097BA00083EBEC /* MWMMobileInternetViewController.mm in Sources */,
|
||||
849CF7651DE842290024A8A5 /* ColorPickerView.mm in Sources */,
|
||||
F6E2FEEC1E097BA00083EBEC /* MWMSearchTextField.mm in Sources */,
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#import "MWMLocationObserver.h"
|
||||
#import "MWMPlacePageData.h"
|
||||
#import "MWMPlacePageLayout.h"
|
||||
#import "MWMRoutePoint.h"
|
||||
#import "MWMRouter.h"
|
||||
#import "MWMSideButtons.h"
|
||||
#import "MWMStorage.h"
|
||||
|
@ -182,11 +183,11 @@
|
|||
withParameters:@{kStatProvider : kStatUber, kStatTags : self.data.statisticsTags}];
|
||||
[self close];
|
||||
auto router = [MWMRouter router];
|
||||
router.type = routing::RouterType::Taxi;
|
||||
router.type = MWMRouterTypeTaxi;
|
||||
[router buildToPoint:self.target bestRouter:NO];
|
||||
}
|
||||
|
||||
- (MWMRoutePoint)target
|
||||
- (MWMRoutePoint *)target
|
||||
{
|
||||
NSString * name = nil;
|
||||
auto d = self.data;
|
||||
|
@ -202,7 +203,7 @@
|
|||
name = L(@"placepage_unknown_place");
|
||||
|
||||
m2::PointD const & org = self.data.mercator;
|
||||
return self.data.isMyPosition ? MWMRoutePoint(org) : MWMRoutePoint(org, name);
|
||||
return self.data.isMyPosition ? makeMWMRoutePoint(org) : makeMWMRoutePoint(org, name);
|
||||
}
|
||||
|
||||
- (void)share
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#import "MWMLocationManager.h"
|
||||
#import "MWMMapViewControlsManager.h"
|
||||
#import "MWMNoMapsViewController.h"
|
||||
#import "MWMRoutePoint.h"
|
||||
#import "MWMRouter.h"
|
||||
#import "MWMSearch.h"
|
||||
#import "MWMSearchChangeModeView.h"
|
||||
|
@ -198,7 +199,7 @@ typedef NS_ENUM(NSUInteger, MWMSearchManagerActionBarState) {
|
|||
- (void)tapMyPositionFromHistory
|
||||
{
|
||||
MapsAppDelegate * a = MapsAppDelegate.theApp;
|
||||
MWMRoutePoint const p = MWMRoutePoint::MWMRoutePoint([MWMLocationManager lastLocation].mercator);
|
||||
auto p = makeMWMRoutePoint([MWMLocationManager lastLocation].mercator);
|
||||
if (a.routingPlaneMode == MWMRoutingPlaneModeSearchSource)
|
||||
[[MWMRouter router] buildFromPoint:p bestRouter:YES];
|
||||
else if (a.routingPlaneMode == MWMRoutingPlaneModeSearchDestination)
|
||||
|
@ -217,12 +218,12 @@ typedef NS_ENUM(NSUInteger, MWMSearchManagerActionBarState) {
|
|||
MWMRoutingPlaneMode const m = a.routingPlaneMode;
|
||||
if (m == MWMRoutingPlaneModeSearchSource)
|
||||
{
|
||||
MWMRoutePoint const p = { result.GetFeatureCenter(), @(result.GetString().c_str()) };
|
||||
auto p = makeMWMRoutePoint(result.GetFeatureCenter(), @(result.GetString().c_str()));
|
||||
[[MWMRouter router] buildFromPoint:p bestRouter:YES];
|
||||
}
|
||||
else if (m == MWMRoutingPlaneModeSearchDestination)
|
||||
{
|
||||
MWMRoutePoint const p = { result.GetFeatureCenter(), @(result.GetString().c_str()) };
|
||||
auto p = makeMWMRoutePoint(result.GetFeatureCenter(), @(result.GetString().c_str()));
|
||||
[[MWMRouter router] buildToPoint:p bestRouter:YES];
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue