mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-30 01:24:07 +00:00
[drape] Add FollowAndRotateRoute mode
This adds a new mode to rotate the camera towards the route while driving. This is done by looking ahead X number of seconds along the current route, up to the next turn, and calculating the angle between the current position and then. Squashed commits: [drape] Add bearing calculation via route lookahead while navigating [drape] Extract NavigationContext from OnLocationUpdate params [drape] Increase rotation animation duration during navigation [drape] Seperate route and compass rotation into two modes [drape] Reduce route lookahead maximum to 25 seconds [drape] Fix case where rotation was incorrectly considered invalid [drape] Make FollowAndRotateRoute mode only available during driving navigation [drape] Rewrite FollowedPolyline::GetLookaheadPoint [drape] Cleanup Signed-off-by: Leonardo Bishop <me@leonardobishop.net>
This commit is contained in:
committed by
Konstantin Pastbin
parent
0d01076c0f
commit
515cf98cef
@@ -9,6 +9,7 @@
|
||||
#include "drape/support_manager.hpp"
|
||||
|
||||
#include "platform/settings.hpp"
|
||||
#include "routing/base/followed_polyline.hpp"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -40,7 +41,7 @@ DrapeEngine::DrapeEngine(Params && params)
|
||||
|
||||
using namespace location;
|
||||
EMyPositionMode mode = PendingPosition;
|
||||
if (settings::Get(kLocationStateMode, mode) && mode == FollowAndRotate)
|
||||
if (settings::Get(kLocationStateMode, mode) && mode == FollowAndRotateCompass)
|
||||
{
|
||||
// If the screen rect setting in follow and rotate mode is missing or invalid, it could cause
|
||||
// invalid animations, so the follow and rotate mode should be discarded.
|
||||
@@ -441,13 +442,12 @@ void DrapeEngine::SetCompassInfo(location::CompassInfo const & info)
|
||||
MessagePriority::Normal);
|
||||
}
|
||||
|
||||
void DrapeEngine::SetGpsInfo(location::GpsInfo const & info, bool isNavigable, double distToNextTurn, double speedLimit,
|
||||
void DrapeEngine::SetGpsInfo(location::GpsInfo const & info, df::NavigationContext const & navigationContext,
|
||||
location::RouteMatchingInfo const & routeInfo)
|
||||
{
|
||||
m_threadCommutator->PostMessage(
|
||||
ThreadsCommutator::RenderThread,
|
||||
make_unique_dp<GpsInfoMessage>(info, isNavigable, distToNextTurn, speedLimit, routeInfo),
|
||||
MessagePriority::Normal);
|
||||
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
|
||||
make_unique_dp<GpsInfoMessage>(info, navigationContext, routeInfo),
|
||||
MessagePriority::Normal);
|
||||
}
|
||||
|
||||
void DrapeEngine::SwitchMyPositionNextMode()
|
||||
@@ -474,12 +474,13 @@ void DrapeEngine::StopLocationFollow()
|
||||
MessagePriority::Normal);
|
||||
}
|
||||
|
||||
void DrapeEngine::FollowRoute(int preferredZoomLevel, int preferredZoomLevel3d, bool enableAutoZoom, bool isArrowGlued)
|
||||
void DrapeEngine::FollowRoute(int preferredZoomLevel, int preferredZoomLevel3d, bool enableAutoZoom, bool isArrowGlued,
|
||||
bool allowRouteRotation)
|
||||
{
|
||||
m_threadCommutator->PostMessage(
|
||||
ThreadsCommutator::RenderThread,
|
||||
make_unique_dp<FollowRouteMessage>(preferredZoomLevel, preferredZoomLevel3d, enableAutoZoom, isArrowGlued),
|
||||
MessagePriority::Normal);
|
||||
m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
|
||||
make_unique_dp<FollowRouteMessage>(preferredZoomLevel, preferredZoomLevel3d,
|
||||
enableAutoZoom, isArrowGlued, allowRouteRotation),
|
||||
MessagePriority::Normal);
|
||||
}
|
||||
|
||||
void DrapeEngine::SetModelViewListener(ModelViewChangedHandler && fn)
|
||||
|
||||
Reference in New Issue
Block a user