Review fixes.

This commit is contained in:
Daria Volvenkova 2017-04-06 19:14:34 +03:00
parent a36ed6cb69
commit feaeea3495
10 changed files with 34 additions and 30 deletions

View file

@ -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

View file

@ -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));

View file

@ -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<StringsBundle> 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<m2::TriangleD> && 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<StringsBundle> 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<m2::TriangleD> m_boundAreaTriangles;
bool m_isFirstLaunch;
bool m_isLaunchByDeepLink;
bool m_isRoutingActive;
bool m_isAutozoomEnabled;
bool m_simplifiedTrafficColors;

View file

@ -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 \

View file

@ -0,0 +1,10 @@
#pragma once
namespace df
{
struct Hints
{
bool m_isFirstLaunch = false;
bool m_isLaunchByDeepLink = false;
};
} // namespace df

View file

@ -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)
{

View file

@ -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;

View file

@ -1809,11 +1809,10 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::OGLContextFactory> 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));

View file

@ -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<dp::OGLContextFactory> contextFactory, DrapeCreationParams && params);

View file

@ -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 = "<group>"; };
BB035F6D1E3A2AAE00519962 /* drape_measurer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = drape_measurer.cpp; sourceTree = "<group>"; };
BB035F6E1E3A2AAE00519962 /* drape_measurer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = drape_measurer.hpp; sourceTree = "<group>"; };
BBD8F8781E96A51A00BAEB72 /* drape_hints.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = drape_hints.hpp; sourceTree = "<group>"; };
F6B2830B1C1B04680081957A /* gps_track_point.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = gps_track_point.hpp; sourceTree = "<group>"; };
F6B2830C1C1B04680081957A /* gps_track_renderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gps_track_renderer.cpp; sourceTree = "<group>"; };
F6B2830D1C1B04680081957A /* gps_track_renderer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = gps_track_renderer.hpp; sourceTree = "<group>"; };
@ -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 */,