mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-30 09:34:06 +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
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "ge0/url_generator.hpp"
|
||||
|
||||
#include "platform/location.hpp"
|
||||
#include "routing/route.hpp"
|
||||
#include "routing/speed_camera_prohibition.hpp"
|
||||
|
||||
@@ -1453,7 +1454,7 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::GraphicsContextFactory> contextFac
|
||||
GetPlatform().RunTask(Platform::Thread::Gui, [this, mode, routingActive]()
|
||||
{
|
||||
// Deactivate selection (and hide place page) if we return to routing in F&R mode.
|
||||
if (routingActive && mode == location::FollowAndRotate)
|
||||
if (routingActive && (mode == location::FollowAndRotateCompass || mode == location::FollowAndRotateRoute))
|
||||
DeactivateMapSelection();
|
||||
|
||||
if (m_myPositionListener != nullptr)
|
||||
@@ -3208,6 +3209,7 @@ void Framework::ReadFeatures(function<void(FeatureType &)> const & reader, vecto
|
||||
void Framework::OnRouteFollow(routing::RouterType type)
|
||||
{
|
||||
bool const isPedestrianRoute = type == RouterType::Pedestrian;
|
||||
bool const allowRouteRotation = type == RouterType::Vehicle;
|
||||
bool const enableAutoZoom = isPedestrianRoute ? false : LoadAutoZoom();
|
||||
int const scale = isPedestrianRoute ? scales::GetPedestrianNavigationScale() : scales::GetNavigationScale();
|
||||
int scale3d = isPedestrianRoute ? scales::GetPedestrianNavigation3dScale() : scales::GetNavigation3dScale();
|
||||
@@ -3223,7 +3225,7 @@ void Framework::OnRouteFollow(routing::RouterType type)
|
||||
// TODO. We need to sync two enums VehicleType and RouterType to be able to pass
|
||||
// GetRoutingSettings(type).m_matchRoute to the FollowRoute() instead of |isPedestrianRoute|.
|
||||
// |isArrowGlued| parameter fully corresponds to |m_matchRoute| in RoutingSettings.
|
||||
m_drapeEngine->FollowRoute(scale, scale3d, enableAutoZoom, !isPedestrianRoute /* isArrowGlued */);
|
||||
m_drapeEngine->FollowRoute(scale, scale3d, enableAutoZoom, !isPedestrianRoute /* isArrowGlued */, allowRouteRotation);
|
||||
}
|
||||
|
||||
// RoutingManager::Delegate
|
||||
|
||||
Reference in New Issue
Block a user