diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuView.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuView.mm index 89f1c583bf..95a5e156a8 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuView.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuView.mm @@ -177,9 +177,11 @@ CGFloat const contentScaleFactor = superView.contentScaleFactor; m2::PointD const pivot(superView.width * contentScaleFactor - 36.0, (superView.height - self.mainButtons.height) * contentScaleFactor - 24.0); - auto & infoDisplay = GetFramework().GetInformationDisplay(); - infoDisplay.SetWidgetPivot(InformationDisplay::WidgetType::Ruler, pivot); - infoDisplay.SetWidgetPivot(InformationDisplay::WidgetType::CopyrightLabel, pivot); + + gui::TWidgetsLayoutInfo layout; + layout[gui::WIDGET_RULER] = pivot; + layout[gui::WIDGET_COPYRIGHT] = pivot; + GetFramework().SetWidgetLayout(move(layout)); } - (void)layoutGeometry diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.h b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.h index e52c0819db..5e9bad036e 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.h @@ -1,6 +1,8 @@ #import "MWMBottomMenuView.h" +#include "platform/location.hpp" + @class MapViewController; @protocol MWMBottomMenuControllerProtocol @@ -28,4 +30,6 @@ - (void)refreshLayout; +- (void)onLocationStateModeChanged:(location::EMyPositionMode)state; + @end diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm index 01314ff151..48dadf9108 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm @@ -52,10 +52,6 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) @property (nonatomic) MWMBottomMenuState restoreState; -@property (nonatomic) int locationListenerSlot; - -@property (nonatomic) location::State::Mode locationState; - @property (nonatomic, readonly) NSUInteger additionalButtonsCount; @end @@ -104,20 +100,11 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) { [super viewWillAppear:animated]; [self refreshLayout]; - - [self configLocationListener]; - [self onLocationStateModeChanged:GetFramework().GetLocationState()->GetMode()]; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; - GetFramework().GetLocationState()->RemoveStateModeListener(self.locationListenerSlot); -} - -- (void)onEnterForeground -{ - [self onLocationStateModeChanged:GetFramework().GetLocationState()->GetMode()]; } #pragma mark - Refresh Collection View layout @@ -175,30 +162,18 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) #pragma mark - Location button -- (void)configLocationListener +- (void)onLocationStateModeChanged:(location::EMyPositionMode)state { - typedef void (*LocationStateModeFnT)(id, SEL, location::State::Mode); - SEL locationStateModeSelector = @selector(onLocationStateModeChanged:); - LocationStateModeFnT locationStateModeFn = - (LocationStateModeFnT)[self methodForSelector:locationStateModeSelector]; - - self.locationListenerSlot = GetFramework().GetLocationState()->AddStateModeListener( - bind(locationStateModeFn, self, locationStateModeSelector, _1)); -} - -- (void)onLocationStateModeChanged:(location::State::Mode)state -{ - self.locationState = state; UIButton * locBtn = self.locationButton; [locBtn.imageView stopAnimating]; [locBtn.imageView.layer removeAllAnimations]; switch (state) { - case location::State::Mode::UnknownPosition: - case location::State::Mode::NotFollow: - case location::State::Mode::Follow: + case location::MODE_UNKNOWN_POSITION: + case location::MODE_NOT_FOLLOW: + case location::MODE_FOLLOW: break; - case location::State::Mode::PendingPosition: + case location::MODE_PENDING_POSITION: { [locBtn setImage:[UIImage imageNamed:@"ic_menu_location_pending"] forState:UIControlStateNormal]; @@ -211,7 +186,7 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) [locBtn.imageView.layer addAnimation:rotation forKey:@"locationImage"]; break; } - case location::State::Mode::RotateAndFollow: + case location::MODE_ROTATE_AND_FOLLOW: { NSUInteger const morphImagesCount = 6; NSUInteger const endValue = morphImagesCount + 1; @@ -241,18 +216,18 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) UIButton * locBtn = self.locationButton; switch (self.locationState) { - case location::State::Mode::PendingPosition: + case location::MODE_PENDING_POSITION: break; case location::State::Mode::UnknownPosition: [locBtn setImage:[UIImage imageNamed:@"ic_menu_location_off_mode_light"] forState:UIControlStateNormal]; break; - case location::State::Mode::NotFollow: + case location::MODE_NOT_FOLLOW: [locBtn setImage:[UIImage imageNamed:@"ic_menu_location_get_position"] forState:UIControlStateNormal]; break; - case location::State::Mode::Follow: + case location::MODE_FOLLOW: [locBtn setImage:[UIImage imageNamed:@"ic_menu_location_follow"] forState:UIControlStateNormal]; break; - case location::State::Mode::RotateAndFollow: + case location::MODE_ROTATE_AND_FOLLOW: [locBtn setImage:[UIImage imageNamed:@"ic_menu_location_follow_and_rotate"] forState:UIControlStateNormal]; break; } @@ -411,7 +386,7 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) - (IBAction)locationButtonTouchUpInside:(UIButton *)sender { [[Statistics instance] logEvent:kStatMenu withParameters:@{kStatButton : kStatLocation}]; - GetFramework().GetLocationState()->SwitchToNextMode(); + GetFramework().SwitchMyPositionNextMode(); } - (IBAction)point2PointButtonTouchUpInside:(UIButton *)sender diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm index a606c6d51d..27e51053e9 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm @@ -46,7 +46,7 @@ extern NSString * const kAlohalyticsTapEventKey; - (void)setMyPositionMode:(location::EMyPositionMode) mode { - [self.locationButton setMyPositionMode:mode]; + [self.menuController onLocationStateModeChanged:mode]; } - (instancetype)initWithParentController:(MapViewController *)controller diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/ZoomButtons/MWMZoomButtonsView.h b/iphone/Maps/Classes/CustomViews/MapViewControls/ZoomButtons/MWMZoomButtonsView.h index 6db6a0700a..b2f12ac653 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/ZoomButtons/MWMZoomButtonsView.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/ZoomButtons/MWMZoomButtonsView.h @@ -5,8 +5,6 @@ @property (nonatomic) CGFloat topBound; @property (nonatomic) CGFloat bottomBound; -@property (nonatomic) location::EMyPositionMode myPositionMode; - - (instancetype)initWithFrame:(CGRect)frame __attribute__((unavailable("initWithFrame is not available"))); - (instancetype)init __attribute__((unavailable("init is not available"))); diff --git a/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm b/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm index 5317c28005..c1cdffd37a 100644 --- a/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm +++ b/iphone/Maps/Classes/MWMiPhoneLandscapePlacePage.mm @@ -188,7 +188,8 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState) __weak MWMiPhoneLandscapePlacePage * weakSelf = self; BOOL const stateClosed = self.state == MWMiPhoneLandscapePlacePageStateClosed; if (stateClosed) - GetFramework().GetBalloonManager().RemovePin(); + GetFramework().DeactivateUserMark(); + self.panRecognizer.enabled = !stateClosed; [self startAnimatingPlacePage:self initialVelocity:CGPointMake(self.panVelocity, 0.0) completion:^ { diff --git a/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm b/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm index 9b0dc6ea31..e7e813b038 100644 --- a/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm +++ b/iphone/Maps/Classes/MWMiPhonePortraitPlacePage.mm @@ -333,7 +333,8 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState) _targetPoint = targetPoint; __weak MWMiPhonePortraitPlacePage * weakSelf = self; if (self.state == MWMiPhonePortraitPlacePageStateClosed) - GetFramework().GetBalloonManager().RemovePin(); + GetFramework().DeactivateUserMark(); + [self startAnimatingPlacePage:self initialVelocity:{0.0, self.panVelocity} completion:^ { __strong MWMiPhonePortraitPlacePage * self = weakSelf; diff --git a/map/framework.cpp b/map/framework.cpp index 9f61bec3bb..eb2ab0664a 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -916,7 +916,7 @@ void Framework::EnterForeground() m_drapeEngine->SetRenderingEnabled(true); } -search::Engine * Framework::GetSearchEngine() const +void Framework::InitCountryInfoGetter() { ASSERT(!m_infoGetter.get(), ("InitCountryInfoGetter() must be called only once.")); Platform const & platform = GetPlatform(); @@ -1915,7 +1915,7 @@ void Framework::CheckLocationForRouting(GpsInfo const & info) if (!IsRoutingActive()) return; - RoutingSession::State state = m_routingSession.OnLocationPositionChanged(info); + RoutingSession::State state = m_routingSession.OnLocationPositionChanged(info, m_model.GetIndex()); if (state == RoutingSession::RouteNeedRebuild) { auto readyCallback = [this] (Route const & route, IRouter::ResultCode code) diff --git a/routing/routing_session.cpp b/routing/routing_session.cpp index f8f2be1a3f..74320bcc87 100644 --- a/routing/routing_session.cpp +++ b/routing/routing_session.cpp @@ -142,9 +142,7 @@ void RoutingSession::Reset() m_speedWarningSignal = false; } -RoutingSession::State RoutingSession::OnLocationPositionChanged(m2::PointD const & position, - GpsInfo const & info, - Index const & index) +RoutingSession::State RoutingSession::OnLocationPositionChanged(GpsInfo const & info, Index const & index) { ASSERT(m_state != RoutingNotActive, ()); ASSERT(m_router != nullptr, ()); @@ -194,7 +192,7 @@ RoutingSession::State RoutingSession::OnLocationPositionChanged(m2::PointD const } } } - m_lastGoodPosition = position; + m_lastGoodPosition = m_userCurrentPosition; } else { @@ -365,21 +363,6 @@ void RoutingSession::MatchLocationToRoute(location::GpsInfo & location, m_route.MatchLocationToRoute(location, routeMatchingInfo); } -bool RoutingSession::GetMercatorDistanceFromBegin(double & distance) const -{ - if (m_state != State::OnRoute) - { - distance = 0.0; - return false; - } - - threads::MutexGuard guard(m_routeSessionMutex); - UNUSED_VALUE(guard); - - distance = m_route.GetMercatorDistanceFromBegin(); - return true; -} - bool RoutingSession::DisableFollowMode() { if (m_state == RouteNotStarted || m_state == OnRoute) @@ -389,6 +372,7 @@ bool RoutingSession::DisableFollowMode() } return false; } + void RoutingSession::SetRoutingSettings(RoutingSettings const & routingSettings) { threads::MutexGuard guard(m_routeSessionMutex); diff --git a/routing/routing_session.hpp b/routing/routing_session.hpp index ff38cf1f8d..e7fa212ebc 100644 --- a/routing/routing_session.hpp +++ b/routing/routing_session.hpp @@ -90,8 +90,7 @@ public: bool IsOnRoute() const { return (m_state == OnRoute); } void Reset(); - State OnLocationPositionChanged(m2::PointD const & position, location::GpsInfo const & info, - Index const & index); + State OnLocationPositionChanged(location::GpsInfo const & info, Index const & index); void GetRouteFollowingInfo(location::FollowingInfo & info) const; void MatchLocationToRoute(location::GpsInfo & location,