diff options
-rw-r--r-- | android/jni/com/mapswithme/maps/Framework.cpp | 8 | ||||
-rw-r--r-- | android/jni/com/mapswithme/maps/Framework.hpp | 2 | ||||
-rw-r--r-- | drape_frontend/drape_engine.cpp | 8 | ||||
-rw-r--r-- | drape_frontend/drape_engine.hpp | 3 | ||||
-rwxr-xr-x | drape_frontend/frontend_renderer.cpp | 6 | ||||
-rw-r--r-- | drape_frontend/message_subclasses.hpp | 9 | ||||
-rw-r--r-- | iphone/Maps/Classes/Components/MWMAddPlaceNavigationBar.h | 6 | ||||
-rw-r--r-- | iphone/Maps/Classes/Components/MWMAddPlaceNavigationBar.mm | 12 | ||||
-rw-r--r-- | iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.h | 2 | ||||
-rw-r--r-- | iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm | 2 | ||||
-rw-r--r-- | iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm | 10 | ||||
-rw-r--r-- | iphone/Maps/Classes/MWMPlacePageViewManager.mm | 4 | ||||
-rw-r--r-- | iphone/Maps/Classes/MWMPlacePageViewManagerDelegate.h | 3 | ||||
-rw-r--r-- | map/framework.cpp | 5 | ||||
-rw-r--r-- | map/framework.hpp | 2 | ||||
-rw-r--r-- | qt/draw_widget.cpp | 4 |
16 files changed, 49 insertions, 37 deletions
diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index bc0f02652b..be4e891825 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -203,11 +203,12 @@ void Framework::Get3dMode(bool & allow3d, bool & allow3dBuildings) m_work.Load3dMode(allow3d, allow3dBuildings); } -void Framework::SetChoosePositionMode(bool isChoosePositionMode, bool isBusiness) +void Framework::SetChoosePositionMode(bool isChoosePositionMode, bool isBusiness, + bool hasPosition, m2::PointD const & position) { m_isChoosePositionMode = isChoosePositionMode; m_work.BlockTapEvents(isChoosePositionMode); - m_work.EnableChoosePositionMode(isChoosePositionMode, isBusiness); + m_work.EnableChoosePositionMode(isChoosePositionMode, isBusiness, hasPosition, position); } Storage & Framework::Storage() @@ -988,7 +989,8 @@ Java_com_mapswithme_maps_Framework_nativeOnBookmarkCategoryChanged(JNIEnv * env, JNIEXPORT void JNICALL Java_com_mapswithme_maps_Framework_nativeTurnChoosePositionMode(JNIEnv *, jclass, jboolean turnOn, jboolean isBusiness) { - g_framework->SetChoosePositionMode(turnOn, isBusiness); + //TODO(Android team): implement positioning + g_framework->SetChoosePositionMode(turnOn, isBusiness, false /* hasPosition */, m2::PointD()); } JNIEXPORT jboolean JNICALL diff --git a/android/jni/com/mapswithme/maps/Framework.hpp b/android/jni/com/mapswithme/maps/Framework.hpp index c892769d25..754571d3f9 100644 --- a/android/jni/com/mapswithme/maps/Framework.hpp +++ b/android/jni/com/mapswithme/maps/Framework.hpp @@ -137,7 +137,7 @@ namespace android void Set3dMode(bool allow3d, bool allow3dBuildings); void Get3dMode(bool & allow3d, bool & allow3dBuildings); - void SetChoosePositionMode(bool isChoosePositionMode, bool isBusiness); + void SetChoosePositionMode(bool isChoosePositionMode, bool isBusiness, bool hasPosition, m2::PointD const & position); void SetupWidget(gui::EWidget widget, float x, float y, dp::Anchor anchor); void ApplyWidgets(); diff --git a/drape_frontend/drape_engine.cpp b/drape_frontend/drape_engine.cpp index ee519d5d6b..992c35ec54 100644 --- a/drape_frontend/drape_engine.cpp +++ b/drape_frontend/drape_engine.cpp @@ -70,7 +70,7 @@ DrapeEngine::DrapeEngine(Params && params) RecacheGui(false); if (params.m_showChoosePositionMark) - EnableChoosePositionMode(true, move(params.m_boundAreaTriangles)); + EnableChoosePositionMode(true, move(params.m_boundAreaTriangles), false, m2::PointD()); ResizeImpl(m_viewport.GetWidth(), m_viewport.GetHeight()); } @@ -436,7 +436,8 @@ void DrapeEngine::ClearGpsTrackPoints() MessagePriority::Normal); } -void DrapeEngine::EnableChoosePositionMode(bool enable, vector<m2::TriangleD> && boundAreaTriangles) +void DrapeEngine::EnableChoosePositionMode(bool enable, vector<m2::TriangleD> && boundAreaTriangles, + bool hasPosition, m2::PointD const & position) { m_choosePositionMode = enable; bool kineticScroll = m_kineticScrollEnabled; @@ -453,7 +454,8 @@ void DrapeEngine::EnableChoosePositionMode(bool enable, vector<m2::TriangleD> && RecacheGui(true); } m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, - make_unique_dp<SetAddNewPlaceModeMessage>(enable, move(boundAreaTriangles), kineticScroll), + make_unique_dp<SetAddNewPlaceModeMessage>(enable, move(boundAreaTriangles), + kineticScroll, hasPosition, position), MessagePriority::High); } diff --git a/drape_frontend/drape_engine.hpp b/drape_frontend/drape_engine.hpp index 2b63f0d237..dbfecf1933 100644 --- a/drape_frontend/drape_engine.hpp +++ b/drape_frontend/drape_engine.hpp @@ -133,7 +133,8 @@ public: void UpdateGpsTrackPoints(vector<df::GpsTrackPoint> && toAdd, vector<uint32_t> && toRemove); void ClearGpsTrackPoints(); - void EnableChoosePositionMode(bool enable, vector<m2::TriangleD> && boundAreaTriangles); + void EnableChoosePositionMode(bool enable, vector<m2::TriangleD> && boundAreaTriangles, + bool hasPosition, m2::PointD const & position); void BlockTapEvents(bool block); void SetKineticScrollEnabled(bool enabled); diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index a10ece95c9..d2ab707c47 100755 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -718,10 +718,8 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message) } else { - ScreenBase const & screen = m_userEventStream.GetCurrentScreen(); - m2::PointD pt = screen.GlobalRect().Center(); - if (!m_myPositionController->IsWaitingForLocation()) - pt = m_myPositionController->GetDrawablePosition(); + m2::PointD const pt = msg->HasPosition()? msg->GetPosition() : + m_userEventStream.GetCurrentScreen().GlobalRect().Center(); AddUserEvent(SetCenterEvent(pt, scales::GetAddNewPlaceScale(), true)); } } diff --git a/drape_frontend/message_subclasses.hpp b/drape_frontend/message_subclasses.hpp index a7ede94906..b42da8c053 100644 --- a/drape_frontend/message_subclasses.hpp +++ b/drape_frontend/message_subclasses.hpp @@ -332,21 +332,28 @@ private: class SetAddNewPlaceModeMessage : public Message { public: - SetAddNewPlaceModeMessage(bool enable, vector<m2::TriangleD> && boundArea, bool enableKineticScroll) + SetAddNewPlaceModeMessage(bool enable, vector<m2::TriangleD> && boundArea, bool enableKineticScroll, + bool hasPosition, m2::PointD const & position) : m_enable(enable) , m_boundArea(move(boundArea)) , m_enableKineticScroll(enableKineticScroll) + , m_hasPosition(hasPosition) + , m_position(position) {} Type GetType() const override { return Message::SetAddNewPlaceMode; } vector<m2::TriangleD> && AcceptBoundArea() { return move(m_boundArea); } bool IsEnabled() const { return m_enable; } bool IsKineticScrollEnabled() const { return m_enableKineticScroll; } + bool HasPosition() const { return m_hasPosition; } + m2::PointD const & GetPosition() const { return m_position; } private: bool m_enable; vector<m2::TriangleD> m_boundArea; bool m_enableKineticScroll; + bool m_hasPosition; + m2::PointD m_position; }; class BlockTapEventsMessage : public Message diff --git a/iphone/Maps/Classes/Components/MWMAddPlaceNavigationBar.h b/iphone/Maps/Classes/Components/MWMAddPlaceNavigationBar.h index 6430329a7c..b3fc3166dc 100644 --- a/iphone/Maps/Classes/Components/MWMAddPlaceNavigationBar.h +++ b/iphone/Maps/Classes/Components/MWMAddPlaceNavigationBar.h @@ -1,5 +1,9 @@ +#include "geometry/point2d.hpp" + @interface MWMAddPlaceNavigationBar : SolidTouchView -+ (void)showInSuperview:(nonnull UIView *)superview isBusiness:(BOOL)isBusiness doneBlock:(nonnull TMWMVoidBlock)done cancelBlock:(nonnull TMWMVoidBlock)cancel; ++ (void)showInSuperview:(UIView *)superview isBusiness:(BOOL)isBusiness + applyPosition:(BOOL)applyPosition position:(m2::PointD const &)position + doneBlock:(TMWMVoidBlock)done cancelBlock:(TMWMVoidBlock)cancel; @end diff --git a/iphone/Maps/Classes/Components/MWMAddPlaceNavigationBar.mm b/iphone/Maps/Classes/Components/MWMAddPlaceNavigationBar.mm index 69321b169f..3fd88dae6e 100644 --- a/iphone/Maps/Classes/Components/MWMAddPlaceNavigationBar.mm +++ b/iphone/Maps/Classes/Components/MWMAddPlaceNavigationBar.mm @@ -12,7 +12,9 @@ @implementation MWMAddPlaceNavigationBar -+ (void)showInSuperview:(UIView *)superview isBusiness:(BOOL)isBusiness doneBlock:(TMWMVoidBlock)done cancelBlock:(TMWMVoidBlock)cancel ++ (void)showInSuperview:(UIView *)superview isBusiness:(BOOL)isBusiness + applyPosition:(BOOL)applyPosition position:(m2::PointD const &)position + doneBlock:(TMWMVoidBlock)done cancelBlock:(TMWMVoidBlock)cancel { MWMAddPlaceNavigationBar * navBar = [[[NSBundle mainBundle] loadNibNamed:self.className owner:nil options:nil] firstObject]; navBar.width = superview.width; @@ -22,13 +24,13 @@ [navBar setNeedsLayout]; navBar.origin = {0., -navBar.height}; [superview addSubview:navBar]; - [navBar show:isBusiness]; + [navBar show:isBusiness applyPosition:applyPosition position:position]; } -- (void)show:(BOOL)enableBounds +- (void)show:(BOOL)enableBounds applyPosition:(BOOL)applyPosition position:(m2::PointD const &)position { auto & f = GetFramework(); - f.EnableChoosePositionMode(true /* enable */, enableBounds); + f.EnableChoosePositionMode(true /* enable */, enableBounds, applyPosition, position); f.BlockTapEvents(true); [UIView animateWithDuration:kDefaultAnimationDuration animations:^ @@ -40,7 +42,7 @@ - (void)dismiss { auto & f = GetFramework(); - f.EnableChoosePositionMode(false /* enable */, false /* enableBounds */); + f.EnableChoosePositionMode(false /* enable */, false /* enableBounds */, false /* applyPosition */, m2::PointD()); f.BlockTapEvents(false); [UIView animateWithDuration:kDefaultAnimationDuration animations:^ diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.h b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.h index 365e4ffd40..b7cda5a317 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.h +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.h @@ -9,7 +9,7 @@ - (void)actionDownloadMaps:(mwm::DownloaderMode)mode; - (void)closeInfoScreens; -- (void)addPlace:(BOOL)isBusiness; +- (void)addPlace:(BOOL)isBusiness hasPoint:(BOOL)hasPoint point:(m2::PointD const &)point; - (void)didFinishAddingPlace; @end diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm index 237a5cab90..2ad3c43d8c 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm @@ -351,7 +351,7 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) { [Statistics logEvent:kStatEditorAddClick withParameters:@{kStatValue : kStatMenu}]; self.state = self.restoreState; - [self.delegate addPlace:NO]; + [self.delegate addPlace:NO hasPoint:NO point:m2::PointD()]; } - (void)menuActionDownloadMaps diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm index 56457b5211..70a41a3a94 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm @@ -305,14 +305,15 @@ extern NSString * const kAlohalyticsTapEventKey; #pragma mark - MWMBottomMenuControllerProtocol && MWMPlacePageViewManagerProtocol -- (void)addPlace:(BOOL)isBusiness +- (void)addPlace:(BOOL)isBusiness hasPoint:(BOOL)hasPoint point:(m2::PointD const &)point { self.menuState = MWMBottomMenuStateHidden; static_cast<EAGLView *>(self.ownerController.view).widgetsManager.fullScreen = YES; [self.placePageManager dismissPlacePage]; self.searchManager.state = MWMSearchManagerStateHidden; - [MWMAddPlaceNavigationBar showInSuperview:self.ownerController.view isBusiness:isBusiness doneBlock:^ + [MWMAddPlaceNavigationBar showInSuperview:self.ownerController.view + isBusiness:isBusiness applyPosition:hasPoint position:point doneBlock:^ { auto & f = GetFramework(); @@ -361,11 +362,6 @@ extern NSString * const kAlohalyticsTapEventKey; } } -- (void)addBusiness -{ - [self addPlace:YES]; -} - - (void)updateStatusBarStyle { [self.ownerController updateStatusBarStyle]; diff --git a/iphone/Maps/Classes/MWMPlacePageViewManager.mm b/iphone/Maps/Classes/MWMPlacePageViewManager.mm index 5e8d699295..0e9c81ff09 100644 --- a/iphone/Maps/Classes/MWMPlacePageViewManager.mm +++ b/iphone/Maps/Classes/MWMPlacePageViewManager.mm @@ -260,12 +260,12 @@ extern NSString * const kBookmarksChangedNotification; - (void)addBusiness { - [self.delegate addBusiness]; + [self.delegate addPlace:YES hasPoint:NO point:m2::PointD()]; } - (void)addPlace { - [self.delegate addPlace]; + [self.delegate addPlace:NO hasPoint:YES point:self.entity.mercator]; } - (void)addBookmark diff --git a/iphone/Maps/Classes/MWMPlacePageViewManagerDelegate.h b/iphone/Maps/Classes/MWMPlacePageViewManagerDelegate.h index db9ffaaf27..6421213899 100644 --- a/iphone/Maps/Classes/MWMPlacePageViewManagerDelegate.h +++ b/iphone/Maps/Classes/MWMPlacePageViewManagerDelegate.h @@ -9,7 +9,6 @@ - (void)updateStatusBarStyle; - (void)apiBack; - (void)placePageDidClose; -- (void)addBusiness; -- (void)addPlace; +- (void)addPlace:(BOOL)isBusiness hasPoint:(BOOL)hasPoint point:(m2::PointD const &)point; @end
\ No newline at end of file diff --git a/map/framework.cpp b/map/framework.cpp index 3271619489..4732fe88d4 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -2417,10 +2417,11 @@ void Framework::Load3dMode(bool & allow3d, bool & allow3dBuildings) allow3dBuildings = true; } -void Framework::EnableChoosePositionMode(bool enable, bool enableBounds) +void Framework::EnableChoosePositionMode(bool enable, bool enableBounds, bool applyPosition, m2::PointD const & position) { if (m_drapeEngine != nullptr) - m_drapeEngine->EnableChoosePositionMode(enable, enableBounds ? GetBoundAreaTriangles() : vector<m2::TriangleD>()); + m_drapeEngine->EnableChoosePositionMode(enable, enableBounds ? GetBoundAreaTriangles() : vector<m2::TriangleD>(), + applyPosition, position); } vector<m2::TriangleD> Framework::GetBoundAreaTriangles() const diff --git a/map/framework.hpp b/map/framework.hpp index dd7aa08ab9..bf135d55c1 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -276,7 +276,7 @@ public: void InvalidateRendering(); - void EnableChoosePositionMode(bool enable, bool enableBounds); + void EnableChoosePositionMode(bool enable, bool enableBounds, bool applyPosition, m2::PointD const & position); void BlockTapEvents(bool block); using TCurrentCountryChanged = function<void(storage::TCountryId const &)>; diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp index 5424a39368..916abe3185 100644 --- a/qt/draw_widget.cpp +++ b/qt/draw_widget.cpp @@ -231,12 +231,12 @@ void DrawWidget::SliderReleased() void DrawWidget::ChoosePositionModeEnable() { m_framework->BlockTapEvents(true); - m_framework->EnableChoosePositionMode(true, false); + m_framework->EnableChoosePositionMode(true, false, false, m2::PointD()); } void DrawWidget::ChoosePositionModeDisable() { - m_framework->EnableChoosePositionMode(false, false); + m_framework->EnableChoosePositionMode(false, false, false, m2::PointD()); m_framework->BlockTapEvents(false); } |