From feaeea3495e8653155f3c3237d3ad0a26a423478 Mon Sep 17 00:00:00 2001 From: Daria Volvenkova Date: Thu, 6 Apr 2017 19:14:34 +0300 Subject: [PATCH] Review fixes. --- drape_frontend/CMakeLists.txt | 1 + drape_frontend/drape_engine.cpp | 3 +-- drape_frontend/drape_engine.hpp | 10 ++++------ drape_frontend/drape_frontend.pro | 1 + drape_frontend/drape_hints.hpp | 10 ++++++++++ drape_frontend/my_position_controller.cpp | 12 ++++++------ drape_frontend/my_position_controller.hpp | 12 +++++------- map/framework.cpp | 3 +-- map/framework.hpp | 8 +------- .../drape_frontend.xcodeproj/project.pbxproj | 4 ++++ 10 files changed, 34 insertions(+), 30 deletions(-) create mode 100644 drape_frontend/drape_hints.hpp diff --git a/drape_frontend/CMakeLists.txt b/drape_frontend/CMakeLists.txt index 0094079022..1704e84e38 100644 --- a/drape_frontend/CMakeLists.txt +++ b/drape_frontend/CMakeLists.txt @@ -70,6 +70,7 @@ set( drape_api_renderer.hpp drape_engine.cpp drape_engine.hpp + drape_hints.hpp drape_measurer.cpp drape_measurer.hpp engine_context.cpp diff --git a/drape_frontend/drape_engine.cpp b/drape_frontend/drape_engine.cpp index 25ff76b9e8..e0b5c9f6a2 100644 --- a/drape_frontend/drape_engine.cpp +++ b/drape_frontend/drape_engine.cpp @@ -46,8 +46,7 @@ DrapeEngine::DrapeEngine(Params && params) MyPositionController::Params mpParams(mode, timeInBackground, - params.m_isFirstLaunch, - params.m_isLaunchByDeepLink, + params.m_hints, params.m_isRoutingActive, params.m_isAutozoomEnabled, bind(&DrapeEngine::MyPositionModeChanged, this, _1, _2)); diff --git a/drape_frontend/drape_engine.hpp b/drape_frontend/drape_engine.hpp index b371f215ad..50510f95cf 100644 --- a/drape_frontend/drape_engine.hpp +++ b/drape_frontend/drape_engine.hpp @@ -3,6 +3,7 @@ #include "drape_frontend/backend_renderer.hpp" #include "drape_frontend/color_constants.hpp" #include "drape_frontend/custom_symbol.hpp" +#include "drape_frontend/drape_hints.hpp" #include "drape_frontend/frontend_renderer.hpp" #include "drape_frontend/route_shape.hpp" #include "drape_frontend/overlays_tracker.hpp" @@ -44,6 +45,7 @@ public: ref_ptr stringBundle, Viewport const & viewport, MapDataProvider const & model, + Hints const & hints, double vs, double fontsScaleFactor, gui::TWidgetsInitInfo && info, @@ -54,8 +56,6 @@ public: bool blockTapEvents, bool showChoosePositionMark, vector && boundAreaTriangles, - bool isFirstLaunch, - bool isLaunchByDeepLink, bool isRoutingActive, bool isAutozoomEnabled, bool simplifiedTrafficColors, @@ -64,6 +64,7 @@ public: , m_stringsBundle(stringBundle) , m_viewport(viewport) , m_model(model) + , m_hints(hints) , m_vs(vs) , m_fontsScaleFactor(fontsScaleFactor) , m_info(move(info)) @@ -74,8 +75,6 @@ public: , m_blockTapEvents(blockTapEvents) , m_showChoosePositionMark(showChoosePositionMark) , m_boundAreaTriangles(move(boundAreaTriangles)) - , m_isFirstLaunch(isFirstLaunch) - , m_isLaunchByDeepLink(isLaunchByDeepLink) , m_isRoutingActive(isRoutingActive) , m_isAutozoomEnabled(isAutozoomEnabled) , m_simplifiedTrafficColors(simplifiedTrafficColors) @@ -86,6 +85,7 @@ public: ref_ptr m_stringsBundle; Viewport m_viewport; MapDataProvider m_model; + Hints m_hints; double m_vs; double m_fontsScaleFactor; gui::TWidgetsInitInfo m_info; @@ -96,8 +96,6 @@ public: bool m_blockTapEvents; bool m_showChoosePositionMark; vector m_boundAreaTriangles; - bool m_isFirstLaunch; - bool m_isLaunchByDeepLink; bool m_isRoutingActive; bool m_isAutozoomEnabled; bool m_simplifiedTrafficColors; diff --git a/drape_frontend/drape_frontend.pro b/drape_frontend/drape_frontend.pro index 9010a1bbe8..456d90655a 100755 --- a/drape_frontend/drape_frontend.pro +++ b/drape_frontend/drape_frontend.pro @@ -152,6 +152,7 @@ HEADERS += \ drape_api_builder.hpp \ drape_api_renderer.hpp \ drape_engine.hpp \ + drape_hints.hpp \ drape_measurer.hpp \ engine_context.hpp \ framebuffer.hpp \ diff --git a/drape_frontend/drape_hints.hpp b/drape_frontend/drape_hints.hpp new file mode 100644 index 0000000000..65a1aec534 --- /dev/null +++ b/drape_frontend/drape_hints.hpp @@ -0,0 +1,10 @@ +#pragma once + +namespace df +{ +struct Hints +{ + bool m_isFirstLaunch = false; + bool m_isLaunchByDeepLink = false; +}; +} // namespace df diff --git a/drape_frontend/my_position_controller.cpp b/drape_frontend/my_position_controller.cpp index be3fac3db1..235ca12792 100644 --- a/drape_frontend/my_position_controller.cpp +++ b/drape_frontend/my_position_controller.cpp @@ -127,7 +127,7 @@ MyPositionController::MyPositionController(Params && params) : m_mode(location::PendingPosition) , m_desiredInitMode(params.m_initMode) , m_modeChangeCallback(move(params.m_myPositionModeCallback)) - , m_isFirstLaunch(params.m_isFirstLaunch) + , m_hints(params.m_hints) , m_isInRouting(params.m_isRoutingActive) , m_needBlockAnimation(false) , m_wasRotationInScaling(false) @@ -154,12 +154,12 @@ MyPositionController::MyPositionController(Params && params) , m_needBlockAutoZoom(false) , m_notFollowAfterPending(false) { - if (m_isFirstLaunch) + if (m_hints.m_isFirstLaunch) { m_mode = location::NotFollowNoPosition; m_desiredInitMode = location::NotFollowNoPosition; } - else if (params.m_isLaunchByDeepLink) + else if (m_hints.m_isLaunchByDeepLink) { m_desiredInitMode = location::NotFollow; } @@ -414,8 +414,8 @@ void MyPositionController::OnLocationUpdate(location::GpsInfo const & info, bool } else if (!m_isPositionAssigned) { - ChangeMode(m_isFirstLaunch ? location::Follow : m_desiredInitMode); - if (!m_isFirstLaunch || !AnimationSystem::Instance().AnimationExists(Animation::Object::MapPlane)) + ChangeMode(m_hints.m_isFirstLaunch ? location::Follow : m_desiredInitMode); + if (!m_hints.m_isFirstLaunch || !AnimationSystem::Instance().AnimationExists(Animation::Object::MapPlane)) { if (m_mode == location::Follow) ChangeModelView(m_position, kDoNotChangeZoom); @@ -434,7 +434,7 @@ void MyPositionController::OnLocationUpdate(location::GpsInfo const & info, bool else { ChangeMode(location::Follow); - if (!m_isFirstLaunch) + if (!m_hints.m_isFirstLaunch) { if (GetZoomLevel(screen, m_position, m_errorRadius) <= kMaxScaleZoomLevel) { diff --git a/drape_frontend/my_position_controller.hpp b/drape_frontend/my_position_controller.hpp index 56c3e243b3..68a79ea889 100644 --- a/drape_frontend/my_position_controller.hpp +++ b/drape_frontend/my_position_controller.hpp @@ -1,5 +1,6 @@ #pragma once +#include "drape_frontend/drape_hints.hpp" #include "drape_frontend/my_position.hpp" #include "drape/gpu_program_manager.hpp" @@ -44,15 +45,13 @@ public: { Params(location::EMyPositionMode initMode, double timeInBackground, - bool isFirstLaunch, - bool isLaunchByDeepLink, + Hints const & hints, bool isRoutingActive, bool isAutozoomEnabled, location::TMyPositionModeChanged && fn) : m_initMode(initMode) , m_timeInBackground(timeInBackground) - , m_isFirstLaunch(isFirstLaunch) - , m_isLaunchByDeepLink(isLaunchByDeepLink) + , m_hints(hints) , m_isRoutingActive(isRoutingActive) , m_isAutozoomEnabled(isAutozoomEnabled) , m_myPositionModeCallback(move(fn)) @@ -60,8 +59,7 @@ public: location::EMyPositionMode m_initMode; double m_timeInBackground; - bool m_isFirstLaunch; - bool m_isLaunchByDeepLink; + Hints m_hints; bool m_isRoutingActive; bool m_isAutozoomEnabled; location::TMyPositionModeChanged m_myPositionModeCallback; @@ -158,7 +156,7 @@ private: location::EMyPositionMode m_mode; location::EMyPositionMode m_desiredInitMode; location::TMyPositionModeChanged m_modeChangeCallback; - bool m_isFirstLaunch; + Hints m_hints; bool m_isInRouting; diff --git a/map/framework.cpp b/map/framework.cpp index fb525addd8..71578e518a 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1809,11 +1809,10 @@ void Framework::CreateDrapeEngine(ref_ptr contextFactory, make_ref(&m_stringsBundle), df::Viewport(0, 0, params.m_surfaceWidth, params.m_surfaceHeight), df::MapDataProvider(idReadFn, featureReadFn, isCountryLoadedByNameFn, updateCurrentCountryFn), - params.m_visualScale, fontsScaleFactor, move(params.m_widgetsInitInfo), + params.m_hints, params.m_visualScale, fontsScaleFactor, move(params.m_widgetsInitInfo), make_pair(params.m_initialMyPositionState, params.m_hasMyPositionState), move(myPositionModeChangedFn), allow3dBuildings, trafficEnabled, params.m_isChoosePositionMode, params.m_isChoosePositionMode, GetSelectedFeatureTriangles(), - params.m_hints.m_isFirstLaunch, params.m_hints.m_isLaunchByDeepLink, m_routingSession.IsActive() && m_routingSession.IsFollowing(), isAutozoomEnabled, simplifiedTrafficColors, move(overlaysShowStatsFn)); diff --git a/map/framework.hpp b/map/framework.hpp index c4d4b8afc8..d18b3194ad 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -440,12 +440,6 @@ private: //@} public: - struct DrapeHints - { - bool m_isFirstLaunch = false; - bool m_isLaunchByDeepLink = false; - }; - struct DrapeCreationParams { float m_visualScale = 1.0f; @@ -457,7 +451,7 @@ public: location::EMyPositionMode m_initialMyPositionState = location::PendingPosition; bool m_isChoosePositionMode = false; - DrapeHints m_hints; + df::Hints m_hints; }; void CreateDrapeEngine(ref_ptr contextFactory, DrapeCreationParams && params); diff --git a/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj b/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj index 052036ed46..666cc546d0 100644 --- a/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj +++ b/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj @@ -213,6 +213,7 @@ 67E91C7E1BDFC85E005CEE88 /* visual_params.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6709478F1BDF9BE1005014C0 /* visual_params.cpp */; }; BB035F6F1E3A2AAE00519962 /* drape_measurer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BB035F6D1E3A2AAE00519962 /* drape_measurer.cpp */; }; BB035F701E3A2AAE00519962 /* drape_measurer.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BB035F6E1E3A2AAE00519962 /* drape_measurer.hpp */; }; + BBD8F8791E96A51A00BAEB72 /* drape_hints.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BBD8F8781E96A51A00BAEB72 /* drape_hints.hpp */; }; F6B283101C1B04680081957A /* gps_track_point.hpp in Headers */ = {isa = PBXBuildFile; fileRef = F6B2830B1C1B04680081957A /* gps_track_point.hpp */; }; F6B283111C1B04680081957A /* gps_track_renderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F6B2830C1C1B04680081957A /* gps_track_renderer.cpp */; }; F6B283121C1B04680081957A /* gps_track_renderer.hpp in Headers */ = {isa = PBXBuildFile; fileRef = F6B2830D1C1B04680081957A /* gps_track_renderer.hpp */; }; @@ -431,6 +432,7 @@ 677A2DE41C0DD55D00635A00 /* requested_tiles.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = requested_tiles.hpp; sourceTree = ""; }; BB035F6D1E3A2AAE00519962 /* drape_measurer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = drape_measurer.cpp; sourceTree = ""; }; BB035F6E1E3A2AAE00519962 /* drape_measurer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = drape_measurer.hpp; sourceTree = ""; }; + BBD8F8781E96A51A00BAEB72 /* drape_hints.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = drape_hints.hpp; sourceTree = ""; }; F6B2830B1C1B04680081957A /* gps_track_point.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = gps_track_point.hpp; sourceTree = ""; }; F6B2830C1C1B04680081957A /* gps_track_renderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gps_track_renderer.cpp; sourceTree = ""; }; F6B2830D1C1B04680081957A /* gps_track_renderer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = gps_track_renderer.hpp; sourceTree = ""; }; @@ -483,6 +485,7 @@ 347F520A1DC2334A0064B273 /* drape_api_renderer.hpp */, 347F520B1DC2334A0064B273 /* drape_api.cpp */, 347F520C1DC2334A0064B273 /* drape_api.hpp */, + BBD8F8781E96A51A00BAEB72 /* drape_hints.hpp */, BB035F6D1E3A2AAE00519962 /* drape_measurer.cpp */, BB035F6E1E3A2AAE00519962 /* drape_measurer.hpp */, 34C624BF1DABDB0400510300 /* traffic_generator.cpp */, @@ -765,6 +768,7 @@ 56D545671C74A44900E3719C /* overlay_batcher.hpp in Headers */, 670947B21BDF9BE1005014C0 /* read_mwm_task.hpp in Headers */, 670947C91BDF9BE1005014C0 /* text_shape.hpp in Headers */, + BBD8F8791E96A51A00BAEB72 /* drape_hints.hpp in Headers */, 677A2DE61C0DD55D00635A00 /* requested_tiles.hpp in Headers */, 670947C11BDF9BE1005014C0 /* shape_view_params.hpp in Headers */, 670948461BDF9C48005014C0 /* gui_text.hpp in Headers */,