OpenCPN Partial API docs
Loading...
Searching...
No Matches
Route Class Reference

Represents a navigational route in the navigation system. More...

#include <route.h>

Inheritance diagram for Route:

Public Member Functions

virtual int GetnPoints (void)
 
wxString IsPointNameValid (RoutePoint *pRP, const wxString &name) const
 
void AddPoint (RoutePoint *pNewPoint, bool b_rename_in_sequence=true, bool b_deferBoxCalc=false)
 
void InsertPointAndSegment (RoutePoint *pNewPoint, int insert_after, bool b_rename_in_sequence=true, bool b_deferBoxCalc=false)
 
void AddPointAndSegment (RoutePoint *pNewPoint, bool b_rename_in_sequence=true, bool b_deferBoxCalc=false)
 
RoutePointGetPoint (int nPoint)
 
RoutePointGetPoint (const wxString &guid)
 
int GetIndexOf (RoutePoint *prp)
 
RoutePointInsertPointBefore (RoutePoint *pRP, double rlat, double rlon, bool bRenamePoints=false)
 
RoutePointInsertPointAfter (RoutePoint *pRP, double rlat, double rlon, bool bRenamePoints=false)
 
RoutePointGetLastPoint ()
 
void DeletePoint (RoutePoint *rp, bool bRenamePoints=false)
 
void RemovePoint (RoutePoint *rp, bool bRenamePoints=false)
 
void DeSelectRoute ()
 
void FinalizeForRendering ()
 
void UpdateSegmentDistance (RoutePoint *prp0, RoutePoint *prp, double planspeed=-1.0)
 Updates the navigation data for a single route segment between two waypoints.
 
void UpdateSegmentDistances (double planspeed=-1.0)
 
LLBBox & GetBBox ()
 
void SetHiLite (int width)
 
void Reverse (bool bRenamePoints=false)
 
void RebuildGUIDList (void)
 
void RenameRoutePoints ()
 
void ReloadRoutePointIcons ()
 
wxString GetNewMarkSequenced (void)
 
void AssembleRoute ()
 
bool IsEqualTo (Route *ptargetroute)
 
void CloneRoute (Route *psourceroute, int start_nPoint, int end_nPoint, const wxString &suffix, const bool duplicate_first_point=false)
 
void ClearHighlights (void)
 
void SetVisible (bool visible=true, bool includeWpts=true)
 
void SetListed (bool visible=true)
 
bool IsVisible ()
 
bool IsListed ()
 
bool IsActive ()
 
bool IsSelected ()
 
bool ContainsSharedWP ()
 
void SetSharedWPViz (bool sharedWPVIZ)
 
bool GetSharedWPViz ()
 
double GetRouteArrivalRadius (void)
 
void SetRouteArrivalRadius (double radius)
 
void SetDepartureDate (const wxDateTime &dt)
 Set the departure time of the route.
 
wxString GetName () const
 
wxString GetTo () const
 
wxString GetGUID () const
 
void ShowWaypointNames (bool bshow)
 
bool AreWaypointNamesVisible ()
 

Public Attributes

int m_ConfigRouteNum
 Internal configuration/identification number for this route.
 
bool m_bRtIsSelected
 Flag indicating whether this route is currently selected in the UI.
 
bool m_bRtIsActive
 Flag indicating whether this route is currently active for navigation.
 
RoutePointm_pRouteActivePoint
 Pointer to the currently active waypoint within this route.
 
bool m_bIsBeingCreated
 Flag indicating that the route is currently being created by the user.
 
bool m_bIsBeingEdited
 Flag indicating that the route is currently being edited by the user.
 
double m_route_length
 Total length of the route in nautical miles, calculated using rhumb line (Mercator) distances.
 
double m_route_time
 Total estimated time to complete the route in seconds.
 
wxString m_RouteNameString
 User-assigned name for the route.
 
wxString m_RouteStartString
 Name or description of the route's starting point.
 
wxString m_RouteEndString
 Name or description of the route's ending point.
 
wxString m_RouteDescription
 Additional descriptive information about the route.
 
bool m_bDeleteOnArrival
 Flag indicating whether the route should be deleted once navigation reaches the end.
 
wxString m_GUID
 Globally unique identifier for this route.
 
bool m_bIsInLayer
 Flag indicating whether this route belongs to a layer.
 
int m_LayerID
 Identifier of the layer containing this route.
 
int m_width
 Width of the route line in pixels when rendered on the chart.
 
wxPenStyle m_style
 Style of the route line when rendered on the chart.
 
int m_lastMousePointIndex
 Index of the most recently interacted with route point.
 
bool m_NextLegGreatCircle
 Flag indicating whether the next leg should be calculated using great circle navigation or rhumb line navigation.
 
double m_PlannedSpeed
 Default planned speed for the route in knots.
 
wxDateTime m_PlannedDeparture
 Planned departure time for the route, in UTC.
 
wxString m_TimeDisplayFormat
 Format for displaying times in the UI.
 
RoutePointList * pRoutePointList
 Ordered list of waypoints (RoutePoints) that make up this route.
 
wxRect active_pt_rect
 Bounding rectangle for the active point in screen coordinates.
 
wxString m_Colour
 Color name for rendering the route on the chart.
 
bool m_btemp
 Flag indicating if this is a temporary route.
 
int m_hiliteWidth
 Width in pixels for highlighting the route when selected.
 
HyperlinkList * m_HyperlinkList
 List of hyperlinks associated with this route.
 

Friends

class RouteGui
 

Detailed Description

Represents a navigational route in the navigation system.

The Route class manages an ordered list of RoutePoints that define a navigational path between waypoints. It provides functionality for route creation, manipulation, and navigation calculations such as distances, bearings, and estimated times.

A Route can be:

  • Active or inactive for navigation
  • Visible or hidden on the chart
  • Temporary or persistent
  • Part of a layer or standalone

The class supports various route operations like adding, inserting, or removing waypoints, calculating segment distances, and handling waypoint sharing between multiple routes. It also maintains navigation-related attributes like planned speeds, departure times, and style attributes for rendering.

See also
RoutePoint

Definition at line 98 of file route.h.

Constructor & Destructor Documentation

◆ Route()

Route::Route ( )

Definition at line 59 of file route.cpp.

◆ ~Route()

Route::~Route ( )

Definition at line 100 of file route.cpp.

Member Function Documentation

◆ AddPoint()

void Route::AddPoint ( RoutePoint pNewPoint,
bool  b_rename_in_sequence = true,
bool  b_deferBoxCalc = false 
)

Definition at line 157 of file route.cpp.

◆ AddPointAndSegment()

void Route::AddPointAndSegment ( RoutePoint pNewPoint,
bool  b_rename_in_sequence = true,
bool  b_deferBoxCalc = false 
)

Definition at line 181 of file route.cpp.

◆ AreWaypointNamesVisible()

bool Route::AreWaypointNamesVisible ( )

Definition at line 663 of file route.cpp.

◆ AssembleRoute()

void Route::AssembleRoute ( void  )

Definition at line 650 of file route.cpp.

◆ ClearHighlights()

void Route::ClearHighlights ( void  )

Definition at line 293 of file route.cpp.

◆ CloneRoute()

void Route::CloneRoute ( Route psourceroute,
int  start_nPoint,
int  end_nPoint,
const wxString &  suffix,
const bool  duplicate_first_point = false 
)

Definition at line 109 of file route.cpp.

◆ ContainsSharedWP()

bool Route::ContainsSharedWP ( )

Definition at line 282 of file route.cpp.

◆ DeletePoint()

void Route::DeletePoint ( RoutePoint rp,
bool  bRenamePoints = false 
)

Definition at line 365 of file route.cpp.

◆ DeSelectRoute()

void Route::DeSelectRoute ( )

Definition at line 422 of file route.cpp.

◆ FinalizeForRendering()

void Route::FinalizeForRendering ( )

Definition at line 446 of file route.cpp.

◆ GetBBox()

LLBBox & Route::GetBBox ( void  )

Definition at line 448 of file route.cpp.

◆ GetGUID()

wxString Route::GetGUID ( ) const
inline

Definition at line 189 of file route.h.

◆ GetIndexOf()

int Route::GetIndexOf ( RoutePoint prp)

Definition at line 357 of file route.cpp.

◆ GetLastPoint()

RoutePoint * Route::GetLastPoint ( )

Definition at line 351 of file route.cpp.

◆ GetName()

wxString Route::GetName ( ) const
inline

Definition at line 187 of file route.h.

◆ GetNewMarkSequenced()

wxString Route::GetNewMarkSequenced ( void  )

Definition at line 343 of file route.cpp.

◆ GetnPoints()

virtual int Route::GetnPoints ( void  )
inlinevirtual

Definition at line 105 of file route.h.

◆ GetPoint() [1/2]

RoutePoint * Route::GetPoint ( const wxString &  guid)

Definition at line 249 of file route.cpp.

◆ GetPoint() [2/2]

RoutePoint * Route::GetPoint ( int  nPoint)

Definition at line 232 of file route.cpp.

◆ GetRouteArrivalRadius()

double Route::GetRouteArrivalRadius ( void  )
inline

Definition at line 176 of file route.h.

◆ GetSharedWPViz()

bool Route::GetSharedWPViz ( )
inline

Definition at line 174 of file route.h.

◆ GetTo()

wxString Route::GetTo ( ) const
inline

Definition at line 188 of file route.h.

◆ InsertPointAfter()

RoutePoint * Route::InsertPointAfter ( RoutePoint pRP,
double  rlat,
double  rlon,
bool  bRenamePoints = false 
)

Definition at line 322 of file route.cpp.

◆ InsertPointAndSegment()

void Route::InsertPointAndSegment ( RoutePoint pNewPoint,
int  insert_after,
bool  b_rename_in_sequence = true,
bool  b_deferBoxCalc = false 
)

Definition at line 204 of file route.cpp.

◆ InsertPointBefore()

RoutePoint * Route::InsertPointBefore ( RoutePoint pRP,
double  rlat,
double  rlon,
bool  bRenamePoints = false 
)

Definition at line 304 of file route.cpp.

◆ IsActive()

bool Route::IsActive ( )
inline

Definition at line 169 of file route.h.

◆ IsEqualTo()

bool Route::IsEqualTo ( Route ptargetroute)

Definition at line 709 of file route.cpp.

◆ IsListed()

bool Route::IsListed ( )
inline

Definition at line 168 of file route.h.

◆ IsPointNameValid()

wxString Route::IsPointNameValid ( RoutePoint pRP,
const wxString &  name 
) const

Definition at line 135 of file route.cpp.

◆ IsSelected()

bool Route::IsSelected ( )
inline

Definition at line 170 of file route.h.

◆ IsVisible()

bool Route::IsVisible ( )
inline

Definition at line 167 of file route.h.

◆ ReloadRoutePointIcons()

void Route::ReloadRoutePointIcons ( )

Definition at line 434 of file route.cpp.

◆ RemovePoint()

void Route::RemovePoint ( RoutePoint rp,
bool  bRenamePoints = false 
)

Definition at line 391 of file route.cpp.

◆ RenameRoutePoints()

void Route::RenameRoutePoints ( void  )

Definition at line 677 of file route.cpp.

◆ Reverse()

void Route::Reverse ( bool  bRenamePoints = false)

Definition at line 591 of file route.cpp.

◆ SetDepartureDate()

void Route::SetDepartureDate ( const wxDateTime &  dt)
inline

Set the departure time of the route.

Parameters
dtThe departure date and time to set, in UTC.

Definition at line 183 of file route.h.

◆ SetHiLite()

void Route::SetHiLite ( int  width)
inline

Definition at line 152 of file route.h.

◆ SetListed()

void Route::SetListed ( bool  visible = true)

Definition at line 648 of file route.cpp.

◆ SetRouteArrivalRadius()

void Route::SetRouteArrivalRadius ( double  radius)
inline

Definition at line 177 of file route.h.

◆ SetSharedWPViz()

void Route::SetSharedWPViz ( bool  sharedWPVIZ)
inline

Definition at line 173 of file route.h.

◆ SetVisible()

void Route::SetVisible ( bool  visible = true,
bool  includeWpts = true 
)

Definition at line 628 of file route.cpp.

◆ ShowWaypointNames()

void Route::ShowWaypointNames ( bool  bshow)

Definition at line 652 of file route.cpp.

◆ UpdateSegmentDistance()

void Route::UpdateSegmentDistance ( RoutePoint prp0,
RoutePoint prp,
double  planspeed = -1.0 
)

Updates the navigation data for a single route segment between two waypoints.

This function calculates and updates the following data for a route segment:

  • Distance between the two waypoints (stored in the destination waypoint)
  • Course from the source to destination waypoint
  • Contribution to the total route length
  • Segment VMG (Velocity Made Good) based on planned speed
  • ETE (Estimated Time Enroute) for the segment
  • ETD (Estimated Time of Departure) from the source waypoint
  • ETA (Estimated Time of Arrival) at the destination waypoint
Parameters
prp0Pointer to the source waypoint (departure point)
prpPointer to the destination waypoint (arrival point)
planspeedDefault planned speed in knots, used if the destination waypoint doesn't specify its own speed

Definition at line 505 of file route.cpp.

◆ UpdateSegmentDistances()

void Route::UpdateSegmentDistances ( double  planspeed = -1.0)

Definition at line 563 of file route.cpp.

Friends And Related Symbol Documentation

◆ RouteGui

friend class RouteGui
friend

Definition at line 99 of file route.h.

Member Data Documentation

◆ active_pt_rect

wxRect Route::active_pt_rect

Bounding rectangle for the active point in screen coordinates.

Used for hit testing and selection in the UI.

Definition at line 340 of file route.h.

◆ m_bDeleteOnArrival

bool Route::m_bDeleteOnArrival

Flag indicating whether the route should be deleted once navigation reaches the end.

When true, the route will be automatically removed upon completion.

Definition at line 267 of file route.h.

◆ m_bIsBeingCreated

bool Route::m_bIsBeingCreated

Flag indicating that the route is currently being created by the user.

Used to control UI behavior during route creation.

Definition at line 218 of file route.h.

◆ m_bIsBeingEdited

bool Route::m_bIsBeingEdited

Flag indicating that the route is currently being edited by the user.

Used to control UI behavior during route editing.

Definition at line 223 of file route.h.

◆ m_bIsInLayer

bool Route::m_bIsInLayer

Flag indicating whether this route belongs to a layer.

Layers are collections of chart objects that can be managed together.

Definition at line 277 of file route.h.

◆ m_bRtIsActive

bool Route::m_bRtIsActive

Flag indicating whether this route is currently active for navigation.

Only one route can be active at a time in the navigation system.

Definition at line 207 of file route.h.

◆ m_bRtIsSelected

bool Route::m_bRtIsSelected

Flag indicating whether this route is currently selected in the UI.

When true, the route may be highlighted or its properties shown.

Definition at line 202 of file route.h.

◆ m_btemp

bool Route::m_btemp

Flag indicating if this is a temporary route.

Temporary routes might not be saved to persistent storage.

Definition at line 350 of file route.h.

◆ m_Colour

wxString Route::m_Colour

Color name for rendering the route on the chart.

References a named color in the application's color scheme.

Definition at line 345 of file route.h.

◆ m_ConfigRouteNum

int Route::m_ConfigRouteNum

Internal configuration/identification number for this route.

Used to reference the route within the application configuration.

Definition at line 197 of file route.h.

◆ m_GUID

wxString Route::m_GUID

Globally unique identifier for this route.

Used for persistence and cross-referencing in the database.

Definition at line 272 of file route.h.

◆ m_hiliteWidth

int Route::m_hiliteWidth

Width in pixels for highlighting the route when selected.

Zero indicates no highlighting.

Definition at line 355 of file route.h.

◆ m_HyperlinkList

HyperlinkList* Route::m_HyperlinkList

List of hyperlinks associated with this route.

Can contain URLs to external resources or documentation.

Definition at line 360 of file route.h.

◆ m_lastMousePointIndex

int Route::m_lastMousePointIndex

Index of the most recently interacted with route point.

Used for UI interactions and editing operations.

Definition at line 297 of file route.h.

◆ m_LayerID

int Route::m_LayerID

Identifier of the layer containing this route.

Only relevant when m_bIsInLayer is true.

Definition at line 282 of file route.h.

◆ m_NextLegGreatCircle

bool Route::m_NextLegGreatCircle

Flag indicating whether the next leg should be calculated using great circle navigation or rhumb line navigation.

This flag affects the visual rendering of the route segment during route creation, but notably does NOT affect how m_route_length is calculated.

The flag is set automatically during route creation when the difference between great circle and rhumb line distances exceeds a threshold, prompting the user to choose whether to include great circle routing points for the leg.

Great circle routes are visually represented by drawing multiple intermediate points along the great circle path to create a segmented approximation.

Definition at line 314 of file route.h.

◆ m_PlannedDeparture

wxDateTime Route::m_PlannedDeparture

Planned departure time for the route, in UTC.

Used as the starting time for all ETA calculations along the route.

Definition at line 325 of file route.h.

◆ m_PlannedSpeed

double Route::m_PlannedSpeed

Default planned speed for the route in knots.

Used for time calculations when individual waypoint speeds aren't specified.

Definition at line 320 of file route.h.

◆ m_pRouteActivePoint

RoutePoint* Route::m_pRouteActivePoint

Pointer to the currently active waypoint within this route.

When navigating along a route, this indicates the waypoint currently being approached.

Definition at line 213 of file route.h.

◆ m_route_length

double Route::m_route_length

Total length of the route in nautical miles, calculated using rhumb line (Mercator) distances.

This value is the sum of all individual segment lengths between consecutive waypoints. Each segment length is calculated using the Mercator projection formula, which provides distances along rhumb lines.

Rhumb line calculations are used because they maintain a constant bearing, which can be easier to navigate with traditional methods, even though they may result in longer overall distances compared to great circle routes.

Definition at line 236 of file route.h.

◆ m_route_time

double Route::m_route_time

Total estimated time to complete the route in seconds.

Calculated based on segment lengths and planned speeds for each segment.

Definition at line 241 of file route.h.

◆ m_RouteDescription

wxString Route::m_RouteDescription

Additional descriptive information about the route.

User-provided details about the route's purpose or characteristics.

Definition at line 261 of file route.h.

◆ m_RouteEndString

wxString Route::m_RouteEndString

Name or description of the route's ending point.

Typically derived from the last RoutePoint name.

Definition at line 256 of file route.h.

◆ m_RouteNameString

wxString Route::m_RouteNameString

User-assigned name for the route.

Used for display and identification purposes.

Definition at line 246 of file route.h.

◆ m_RouteStartString

wxString Route::m_RouteStartString

Name or description of the route's starting point.

Typically derived from the first RoutePoint name.

Definition at line 251 of file route.h.

◆ m_style

wxPenStyle Route::m_style

Style of the route line when rendered on the chart.

Uses wxPenStyle values to determine solid, dashed, dotted, etc.

Definition at line 292 of file route.h.

◆ m_TimeDisplayFormat

wxString Route::m_TimeDisplayFormat

Format for displaying times in the UI.

Can be UTC, local time, PC time, or follow global settings.

Definition at line 330 of file route.h.

◆ m_width

int Route::m_width

Width of the route line in pixels when rendered on the chart.

A value of WIDTH_UNDEFINED indicates to use the default width.

Definition at line 287 of file route.h.

◆ pRoutePointList

RoutePointList* Route::pRoutePointList

Ordered list of waypoints (RoutePoints) that make up this route.

The sequence defines the path from start to finish.

Definition at line 335 of file route.h.


The documentation for this class was generated from the following files: