diff options
Diffstat (limited to 'iphone/Maps/Classes/MapViewController.mm')
-rw-r--r-- | iphone/Maps/Classes/MapViewController.mm | 132 |
1 files changed, 116 insertions, 16 deletions
diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 821d94dfb1..4fba52455b 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -18,10 +18,9 @@ #import "3party/Alohalytics/src/alohalytics_objc.h" #include "Framework.h" -#include "RenderContext.hpp" #include "anim/controller.hpp" -#include "gui/controller.hpp" +#include "../Statistics/Statistics.h" #include "map/country_status_display.hpp" #include "map/user_mark.hpp" @@ -323,8 +322,8 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction) if ([event allTouches].count == 1) { - if (f.GetGuiController()->OnTapStarted(m_Pt1)) - return; + //if (f.GetGuiController()->OnTapStarted(m_Pt1)) + // return; self.userTouchesAction = UserTouchesActionDrag; // Start long-tap timer @@ -363,8 +362,9 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction) Framework & f = GetFramework(); - if (f.GetGuiController()->OnTapMoved(m_Pt1)) - return; + ///@TODO UVR +// if (f.GetGuiController()->OnTapMoved(m_Pt1)) +// return; if (m_isSticking) { @@ -424,8 +424,9 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction) // TapCount could be zero if it was a single long (or moving) tap. if (tapCount < 2) { - if (f.GetGuiController()->OnTapEnded(m_Pt1)) - return; + ///@TODO UVR +// if (f.GetGuiController()->OnTapEnded(m_Pt1)) +// return; } if (tapCount == 1) @@ -649,8 +650,8 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction) SEL locationStateModeSelector = @selector(onLocationStateModeChanged:); LocationStateModeFnT locationStateModeFn = (LocationStateModeFnT)[self methodForSelector:locationStateModeSelector]; - f.GetLocationState()->AddStateModeListener(bind(locationStateModeFn, self, locationStateModeSelector, _1)); - + ///@TODO UVR +// f.GetLocationState()->AddStateModeListener(bind(locationStateModeFn, self, locationStateModeSelector, _1)); m_predictor = [[LocationPredictor alloc] initWithObserver:self]; m_StickyThreshold = 10; @@ -663,10 +664,12 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction) if (!f.LoadState()) f.SetMaxWorldRect(); - f.Invalidate(); + ///@TODO UVR + //f.Invalidate(); f.LoadBookmarks(); - f.GetCountryStatusDisplay()->SetDownloadCountryListener([self, &f](storage::TIndex const & idx, int opt) + ///@TODO UVR + //f.GetCountryStatusDisplay()->SetDownloadCountryListener([self, &f](storage::TIndex const & idx, int opt) { ActiveMapsLayout & layout = f.GetCountryTree().GetActiveMapLayout(); if (opt == -1) @@ -702,7 +705,7 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction) layout.DownloadMap(idx, static_cast<MapOptions>(opt)); } - }); + });*/ f.SetRouteBuildingListener([self, &f](routing::IRouter::ResultCode code, vector<storage::TIndex> const & absentCountries, vector<storage::TIndex> const & absentRoutes) { @@ -876,6 +879,102 @@ typedef NS_ENUM(NSUInteger, UserTouchesAction) return _alertController; } +#pragma mark - Map state + +- (void)checkCurrentLocationMap +{ + Framework & f = GetFramework(); + ActiveMapsLayout & activeMapLayout = f.GetCountryTree().GetActiveMapLayout(); + int const mapsCount = activeMapLayout.GetCountInGroup(ActiveMapsLayout::TGroup::EOutOfDate) + activeMapLayout.GetCountInGroup(ActiveMapsLayout::TGroup::EUpToDate); + self.haveMap = mapsCount > 0; +} + +#pragma mark - SearchViewDelegate + +- (void)searchViewWillEnterState:(SearchViewState)state +{ + [self checkCurrentLocationMap]; + switch (state) + { + case SearchViewStateHidden: + self.controlsManager.hidden = NO; + break; + case SearchViewStateResults: + self.controlsManager.hidden = NO; + break; + case SearchViewStateAlpha: + self.controlsManager.hidden = NO; + break; + case SearchViewStateFullscreen: + self.controlsManager.hidden = YES; + GetFramework().ActivateUserMark(NULL); + break; + } +} + +- (void)searchViewDidEnterState:(SearchViewState)state +{ + switch (state) + { + case SearchViewStateResults: + [self setMapInfoViewFlag:MapInfoViewSearch]; + break; + case SearchViewStateHidden: + case SearchViewStateAlpha: + case SearchViewStateFullscreen: + [self clearMapInfoViewFlag:MapInfoViewSearch]; + break; + } + [self updateStatusBarStyle]; +} + +#pragma mark - MWMNavigationDelegate + +- (void)pushDownloadMaps +{ + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"downloader"]; + CountryTreeVC * vc = [[CountryTreeVC alloc] initWithNodePosition:-1]; + [self.navigationController pushViewController:vc animated:YES]; +} + +#pragma mark - MWMPlacePageViewManagerDelegate + +- (void)addPlacePageViews:(NSArray *)views +{ + [views enumerateObjectsUsingBlock:^(UIView * view, NSUInteger idx, BOOL *stop) + { + if ([self.view.subviews containsObject:view]) + return; + [self.view insertSubview:view belowSubview:self.searchView]; + }]; +} + +#pragma mark - ActiveMapsObserverProtocol + +- (void)countryStatusChangedAtPosition:(int)position inGroup:(ActiveMapsLayout::TGroup const &)group +{ + auto const status = GetFramework().GetCountryTree().GetActiveMapLayout().GetCountryStatus(group, position); + if (status == TStatus::EDownloadFailed) + { + [self.searchView downloadFailed]; + } + else if (status == TStatus::EOnDisk) + { + [self checkCurrentLocationMap]; + [self.searchView downloadComplete]; + } +} + +- (void)countryDownloadingProgressChanged:(LocalAndRemoteSizeT const &)progress atPosition:(int)position inGroup:(ActiveMapsLayout::TGroup const &)group +{ + //if (self.searchView.state != SearchViewStateFullscreen) + // return; + //CGFloat const normProgress = (CGFloat)progress.first / (CGFloat)progress.second; + //ActiveMapsLayout & activeMapLayout = GetFramework().GetCountryTree().GetActiveMapLayout(); + //NSString * countryName = [NSString stringWithUTF8String:activeMapLayout.GetFormatedCountryName(activeMapLayout.GetCoreIndex(group, position)).c_str()]; + //[self.searchView downloadProgress:normProgress countryName:countryName]; +} + #pragma mark - Public methods - (void)setupMeasurementSystem @@ -892,9 +991,10 @@ NSInteger compareAddress(id l, id r, void * context) - (void)invalidate { - Framework & f = GetFramework(); - if (!f.SetUpdatesEnabled(true)) - f.Invalidate(); + ///@TODO UVR +// Framework & f = GetFramework(); +// if (!f.SetUpdatesEnabled(true)) +// f.Invalidate(); } - (void)destroyPopover |