forked from organicmaps/organicmaps
[router] Review fixes.
This commit is contained in:
parent
01cde563ce
commit
45e86d8ccb
7 changed files with 19 additions and 19 deletions
|
@ -104,8 +104,8 @@ using namespace uber;
|
|||
{
|
||||
NSAssert(completion && failure, @"Completion and failure blocks must be not nil!");
|
||||
m_products.clear();
|
||||
m_from = latlonMWMRoutePoint(from);
|
||||
m_to = latlonMWMRoutePoint(to);
|
||||
m_from = routePointLatLon(from);
|
||||
m_to = routePointLatLon(to);
|
||||
auto cv = self.collectionView;
|
||||
cv.hidden = YES;
|
||||
cv.pageControl.hidden = YES;
|
||||
|
|
|
@ -225,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:makeMWMRoutePoint(p1.m_org, @(p1.m_name.c_str()))
|
||||
toPoint:makeMWMRoutePoint(p2.m_org, @(p2.m_name.c_str()))
|
||||
[[MWMRouter router] buildFromPoint:routePoint(p1.m_org, @(p1.m_name.c_str()))
|
||||
toPoint:routePoint(p2.m_org, @(p2.m_name.c_str()))
|
||||
bestRouter:NO];
|
||||
[self showMap];
|
||||
[self.mapViewController showAPIBar];
|
||||
|
|
|
@ -4,23 +4,23 @@
|
|||
#include "geometry/mercator.hpp"
|
||||
#include "geometry/point2d.hpp"
|
||||
|
||||
static inline MWMRoutePoint * makeMWMRoutePoint(m2::PointD const & point, NSString * name)
|
||||
static inline MWMRoutePoint * routePoint(m2::PointD const & point, NSString * name)
|
||||
{
|
||||
return [[MWMRoutePoint alloc] initWithX:point.x y:point.y name:name isMyPosition:false];
|
||||
}
|
||||
|
||||
static inline MWMRoutePoint * makeMWMRoutePoint(m2::PointD const & point)
|
||||
static inline MWMRoutePoint * routePoint(m2::PointD const & point)
|
||||
{
|
||||
return [[MWMRoutePoint alloc] initWithX:point.x y:point.y];
|
||||
}
|
||||
|
||||
static inline MWMRoutePoint * makeMWMRoutePointZero() { return [[MWMRoutePoint alloc] init]; }
|
||||
static inline MWMRoutePoint * zeroRoutePoint() { return [[MWMRoutePoint alloc] init]; }
|
||||
static inline m2::PointD mercatorMWMRoutePoint(MWMRoutePoint * point)
|
||||
{
|
||||
return m2::PointD(point.x, point.y);
|
||||
}
|
||||
|
||||
static inline ms::LatLon latlonMWMRoutePoint(MWMRoutePoint * point)
|
||||
static inline ms::LatLon routePointLatLon(MWMRoutePoint * point)
|
||||
{
|
||||
return MercatorBounds::ToLatLon(mercatorMWMRoutePoint(point));
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ char const * kRenderAltitudeImagesQueueLabel = "mapsme.mwmrouter.renderAltitudeI
|
|||
MWMRoutePoint * lastLocationPoint()
|
||||
{
|
||||
CLLocation * lastLocation = [MWMLocationManager lastLocation];
|
||||
return lastLocation ? makeMWMRoutePoint(lastLocation.mercator) : makeMWMRoutePointZero();
|
||||
return lastLocation ? routePoint(lastLocation.mercator) : zeroRoutePoint();
|
||||
}
|
||||
|
||||
bool isMarkerPoint(MWMRoutePoint * point) { return point.isValid && !point.isMyPosition; }
|
||||
|
@ -76,8 +76,8 @@ bool isMarkerPoint(MWMRoutePoint * point) { return point.isValid && !point.isMyP
|
|||
|
||||
auto taxiDataSource = [MWMNavigationDashboardManager manager].taxiDataSource;
|
||||
auto eventName = taxiDataSource.isTaxiInstalled ? kStatRoutingTaxiOrder : kStatRoutingTaxiInstall;
|
||||
auto const sLatLon = latlonMWMRoutePoint(router.startPoint);
|
||||
auto const fLatLon = latlonMWMRoutePoint(router.finishPoint);
|
||||
auto const sLatLon = routePointLatLon(router.startPoint);
|
||||
auto const fLatLon = routePointLatLon(router.finishPoint);
|
||||
|
||||
[Statistics logEvent:eventName
|
||||
withParameters:@{
|
||||
|
@ -114,7 +114,7 @@ bool isMarkerPoint(MWMRoutePoint * point) { return point.isValid && !point.isMyP
|
|||
- (void)resetPoints
|
||||
{
|
||||
self.startPoint = lastLocationPoint();
|
||||
self.finishPoint = makeMWMRoutePointZero();
|
||||
self.finishPoint = zeroRoutePoint();
|
||||
}
|
||||
|
||||
- (void)setType:(MWMRouterType)type
|
||||
|
@ -459,7 +459,7 @@ bool isMarkerPoint(MWMRoutePoint * point) { return point.isValid && !point.isMyP
|
|||
return;
|
||||
_startPoint = startPoint;
|
||||
if (startPoint == self.finishPoint)
|
||||
self.finishPoint = makeMWMRoutePointZero();
|
||||
self.finishPoint = zeroRoutePoint();
|
||||
[[MWMNavigationDashboardManager manager].routePreview reloadData];
|
||||
}
|
||||
|
||||
|
@ -469,7 +469,7 @@ bool isMarkerPoint(MWMRoutePoint * point) { return point.isValid && !point.isMyP
|
|||
return;
|
||||
_finishPoint = finishPoint;
|
||||
if (finishPoint == self.startPoint)
|
||||
self.startPoint = makeMWMRoutePointZero();
|
||||
self.startPoint = zeroRoutePoint();
|
||||
[[MWMNavigationDashboardManager manager].routePreview reloadData];
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ static NSString * const kETAKey = @"eta";
|
|||
if (endPointData && eta)
|
||||
{
|
||||
[endPointData getBytes:&point length:size];
|
||||
_restorePoint = makeMWMRoutePoint(point, @"Destination");
|
||||
_restorePoint = routePoint(point, @"Destination");
|
||||
if ([eta compare:[NSDate date]] == NSOrderedDescending)
|
||||
_forceStateChange = MWMRouterForceStateChange::Rebuild;
|
||||
}
|
||||
|
|
|
@ -203,7 +203,7 @@
|
|||
name = L(@"placepage_unknown_place");
|
||||
|
||||
m2::PointD const & org = self.data.mercator;
|
||||
return self.data.isMyPosition ? makeMWMRoutePoint(org) : makeMWMRoutePoint(org, name);
|
||||
return self.data.isMyPosition ? routePoint(org) : routePoint(org, name);
|
||||
}
|
||||
|
||||
- (void)share
|
||||
|
|
|
@ -199,7 +199,7 @@ typedef NS_ENUM(NSUInteger, MWMSearchManagerActionBarState) {
|
|||
- (void)tapMyPositionFromHistory
|
||||
{
|
||||
MapsAppDelegate * a = MapsAppDelegate.theApp;
|
||||
auto p = makeMWMRoutePoint([MWMLocationManager lastLocation].mercator);
|
||||
auto p = routePoint([MWMLocationManager lastLocation].mercator);
|
||||
if (a.routingPlaneMode == MWMRoutingPlaneModeSearchSource)
|
||||
[[MWMRouter router] buildFromPoint:p bestRouter:YES];
|
||||
else if (a.routingPlaneMode == MWMRoutingPlaneModeSearchDestination)
|
||||
|
@ -218,12 +218,12 @@ typedef NS_ENUM(NSUInteger, MWMSearchManagerActionBarState) {
|
|||
MWMRoutingPlaneMode const m = a.routingPlaneMode;
|
||||
if (m == MWMRoutingPlaneModeSearchSource)
|
||||
{
|
||||
auto p = makeMWMRoutePoint(result.GetFeatureCenter(), @(result.GetString().c_str()));
|
||||
auto p = routePoint(result.GetFeatureCenter(), @(result.GetString().c_str()));
|
||||
[[MWMRouter router] buildFromPoint:p bestRouter:YES];
|
||||
}
|
||||
else if (m == MWMRoutingPlaneModeSearchDestination)
|
||||
{
|
||||
auto p = makeMWMRoutePoint(result.GetFeatureCenter(), @(result.GetString().c_str()));
|
||||
auto p = routePoint(result.GetFeatureCenter(), @(result.GetString().c_str()));
|
||||
[[MWMRouter router] buildToPoint:p bestRouter:YES];
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue