OpenCPN Partial API docs
Loading...
Searching...
No Matches
route.cpp
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 *
5 ***************************************************************************
6 * Copyright (C) 2013 by David S. Register *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22 **************************************************************************/
23
24// For compilers that support precompilation, includes "wx.h".
25#include <wx/wxprec.h>
26
27#ifndef WX_PRECOMP
28#include <wx/wx.h>
29#endif // precompiled headers
30
31#ifndef WX_PRECOMP
32#include "wx/wx.h"
33#endif // precompiled headers
34
35#include <wx/arrstr.h>
36#include <wx/datetime.h>
37#include <wx/gdicmn.h>
38#include <wx/log.h>
39#include <wx/pen.h>
40#include <wx/string.h>
41
42#include "model/config_vars.h"
43#include "model/cutil.h"
44#include "model/georef.h"
45#include "model/georef.h"
46#include "model/config_vars.h"
47#include "model/nav_object_database.h"
48#include "model/route.h"
49#include "model/routeman.h"
50#include "model/select.h"
51#include "model/navobj_db.h"
52
53WayPointman *pWayPointMan;
54
55#include <wx/listimpl.cpp>
56
57WX_DEFINE_LIST(RouteList);
58
59Route::Route() {
60 m_bRtIsSelected = false;
61 m_bRtIsActive = false;
63 m_bIsBeingEdited = false;
64 m_bIsBeingCreated = false;
65 m_nm_sequence = 1;
66 m_route_length = 0.0;
67 m_route_time = 0.0;
68 m_bVisible = true;
69 m_bListed = true;
70 m_bDeleteOnArrival = false;
71 m_width = WIDTH_UNDEFINED;
72 m_style = wxPENSTYLE_INVALID;
73 m_hiliteWidth = 0;
74
75 pRoutePointList = new RoutePointList;
76 m_GUID = pWayPointMan->CreateGUID(NULL);
77 m_btemp = false;
78
79 m_ArrivalRadius = g_n_arrival_circle_radius; // Nautical Miles
80
81 m_LayerID = 0;
82 m_bIsInLayer = false;
83
84 m_Colour = wxEmptyString;
85
88
89 m_PlannedSpeed = ROUTE_DEFAULT_SPEED;
90 if (g_defaultBoatSpeed != ROUTE_DEFAULT_SPEED)
91 m_PlannedSpeed = g_defaultBoatSpeed;
92
93 m_PlannedDeparture = RTE_UNDEF_DEPARTURE;
94 m_TimeDisplayFormat = RTE_TIME_DISP_PC;
95 m_HyperlinkList = new HyperlinkList;
96
97 m_bsharedWPViz = false;
98}
99
100Route::~Route() {
101 pRoutePointList->DeleteContents(false); // do not delete Marks
102 delete pRoutePointList;
103 delete m_HyperlinkList;
104}
105
106// The following is used only for route splitting, assumes just created, empty
107// route
108//
109void Route::CloneRoute(Route *psourceroute, int start_nPoint, int end_nPoint,
110 const wxString &suffix,
111 const bool duplicate_first_point) {
112 m_RouteNameString = psourceroute->m_RouteNameString + suffix;
114 m_RouteEndString = psourceroute->m_RouteEndString;
115
116 int i;
117 for (i = start_nPoint; i <= end_nPoint; i++) {
118 if (!psourceroute->m_bIsInLayer &&
119 !(i == start_nPoint && duplicate_first_point)) {
120 AddPoint(psourceroute->GetPoint(i), false);
121 } else {
122 RoutePoint *psourcepoint = psourceroute->GetPoint(i);
123 RoutePoint *ptargetpoint = new RoutePoint(
124 psourcepoint->m_lat, psourcepoint->m_lon, psourcepoint->GetIconName(),
125 psourcepoint->GetName(), wxEmptyString, true);
126 ptargetpoint->m_bShowName =
127 psourcepoint->m_bShowName; // do not change new wpt's name visibility
128 AddPoint(ptargetpoint, false);
129 }
130 }
131
132 FinalizeForRendering();
133}
134
135wxString Route::IsPointNameValid(RoutePoint *pPoint,
136 const wxString &name) const {
137 RoutePoint *point;
138 wxRoutePointListNode *node = pRoutePointList->GetFirst();
139 wxString substr = name;
140
141 while (node) {
142 point = node->GetData();
143 wxString exist = point->GetName();
144
145 if (pPoint->m_GUID == point->m_GUID) {
146 node = node->GetNext();
147 } else if (substr == exist) {
148 return _("Name is not unique in route");
149 } else {
150 node = node->GetNext();
151 }
152 }
153
154 return wxEmptyString;
155}
156
157void Route::AddPoint(RoutePoint *pNewPoint, bool b_rename_in_sequence,
158 bool b_deferBoxCalc) {
159 if (pNewPoint->m_bIsolatedMark) {
160 pNewPoint->SetShared(true);
161 }
162 pNewPoint->m_bIsolatedMark = false; // definitely no longer isolated
163 pNewPoint->m_bIsInRoute = true;
164
165 RoutePoint *prev = GetLastPoint();
166 pRoutePointList->Append(pNewPoint);
167
168 if (!b_deferBoxCalc) FinalizeForRendering();
169
170 if (prev) UpdateSegmentDistance(prev, pNewPoint);
171
172 if (b_rename_in_sequence && pNewPoint->GetName().IsEmpty() &&
173 !pNewPoint->IsShared()) {
174 wxString name;
175 name.Printf(_T("%03d"), GetnPoints());
176 pNewPoint->SetName(name);
177 }
178 return;
179}
180
181void Route::AddPointAndSegment(RoutePoint *pNewPoint, bool b_rename_in_sequence,
182 bool b_deferBoxCalc) {
183 int npoints = GetnPoints();
184 RoutePoint *newpoint = pNewPoint;
185 if (newpoint->m_bIsInLayer) {
186 newpoint = new RoutePoint(pNewPoint->m_lat, pNewPoint->m_lon,
187 pNewPoint->GetIconName(), pNewPoint->GetName(),
188 wxEmptyString, false);
189 newpoint->m_bShowName =
190 pNewPoint->m_bShowName; // do not change new wpt's name visibility
191 }
192 AddPoint(newpoint, false);
193 if (npoints != 0) {
194 double rlat = GetPoint(npoints)->m_lat;
195 double rlon = GetPoint(npoints)->m_lon;
196 npoints = GetnPoints();
197 pSelect->AddSelectableRouteSegment(
198 rlat, rlon, GetPoint(npoints)->m_lat, GetPoint(npoints)->m_lon,
199 GetPoint(npoints - 1), GetPoint(npoints), this);
200 }
201 m_lastMousePointIndex = GetnPoints();
202}
203
204void Route::InsertPointAndSegment(RoutePoint *pNewPoint, int insert_after,
205 bool bRenamePoints, bool b_deferBoxCalc) {
206 {
207 bool add = false;
208
209 if (pNewPoint->m_bIsolatedMark) {
210 pNewPoint->SetShared(true);
211 }
212 pNewPoint->m_bIsolatedMark = false; // definitely no longer isolated
213 pNewPoint->m_bIsInRoute = true;
214
215 if (insert_after >= GetnPoints() - 1) {
216 wxLogMessage(wxT("Error insert after last point"));
217 return;
218 }
219
220 int insert = insert_after++;
221 pNewPoint->m_bIsInRoute = true;
222 pNewPoint->SetNameShown(false);
223 pRoutePointList->Insert(insert, pNewPoint);
224 if (bRenamePoints) RenameRoutePoints();
225 m_lastMousePointIndex = GetnPoints();
226 FinalizeForRendering();
227 UpdateSegmentDistances();
228 return;
229 }
230}
231
232RoutePoint *Route::GetPoint(int nWhichPoint) {
233 RoutePoint *prp;
234 wxRoutePointListNode *node = pRoutePointList->GetFirst();
235
236 int i = 1;
237 while (node) {
238 prp = node->GetData();
239 if (i == nWhichPoint) {
240 return prp;
241 }
242 i++;
243 node = node->GetNext();
244 }
245
246 return (NULL);
247}
248
249RoutePoint *Route::GetPoint(const wxString &guid) {
250 RoutePoint *prp;
251 wxRoutePointListNode *node = pRoutePointList->GetFirst();
252
253 while (node) {
254 prp = node->GetData();
255 if (guid == prp->m_GUID) return prp;
256
257 node = node->GetNext();
258 }
259
260 return (NULL);
261}
262
263static void TestLongitude(double lon, double min, double max, bool &lonl,
264 bool &lonr) {
265 double clon = (min + max) / 2;
266 if (min - lon > 180) lon += 360;
267
268 lonl = lonr = false;
269 if (lon < min) {
270 if (lon < clon - 180)
271 lonr = true;
272 else
273 lonl = true;
274 } else if (lon > max) {
275 if (lon > clon + 180)
276 lonl = true;
277 else
278 lonr = true;
279 }
280}
281
282bool Route::ContainsSharedWP() {
283 for (wxRoutePointListNode *node = pRoutePointList->GetFirst(); node;
284 node = node->GetNext()) {
285 RoutePoint *prp = node->GetData();
286 if (prp->IsShared()) return true;
287 }
288 return false;
289}
290
291// FIXME (leamas): can this be moved to GUI?
292int s_arrow_icon[] = {0, 0, 5, 2, 18, 6, 12, 0, 18, -6, 5, -2, 0, 0};
293void Route::ClearHighlights(void) {
294 RoutePoint *prp = NULL;
295 wxRoutePointListNode *node = pRoutePointList->GetFirst();
296
297 while (node) {
298 prp = node->GetData();
299 if (prp) prp->m_bPtIsSelected = false;
300 node = node->GetNext();
301 }
302}
303
304RoutePoint *Route::InsertPointBefore(RoutePoint *pRP, double rlat, double rlon,
305 bool bRenamePoints) {
306 RoutePoint *newpoint = new RoutePoint(rlat, rlon, g_default_routepoint_icon,
307 GetNewMarkSequenced(), wxEmptyString);
308 newpoint->m_bIsInRoute = true;
309 newpoint->SetNameShown(false);
310
311 int nRP = pRoutePointList->IndexOf(pRP);
312 pRoutePointList->Insert(nRP, newpoint);
313
314 if (bRenamePoints) RenameRoutePoints();
315
316 FinalizeForRendering();
317 UpdateSegmentDistances();
318
319 return (newpoint);
320}
321
322RoutePoint *Route::InsertPointAfter(RoutePoint *pRP, double rlat, double rlon,
323 bool bRenamePoints) {
324 int nRP = pRoutePointList->IndexOf(pRP);
325 if (nRP >= GetnPoints() - 1) return NULL;
326 nRP++;
327
328 RoutePoint *newpoint = new RoutePoint(rlat, rlon, g_default_routepoint_icon,
329 GetNewMarkSequenced(), wxEmptyString);
330 newpoint->m_bIsInRoute = true;
331 newpoint->SetNameShown(false);
332
333 pRoutePointList->Insert(nRP, newpoint);
334
335 if (bRenamePoints) RenameRoutePoints();
336
337 FinalizeForRendering();
338 UpdateSegmentDistances();
339
340 return (newpoint);
341}
342
343wxString Route::GetNewMarkSequenced(void) {
344 wxString ret;
345 ret.Printf(_T ( "NM%03d" ), m_nm_sequence);
346 m_nm_sequence++;
347
348 return ret;
349}
350
351RoutePoint *Route::GetLastPoint() {
352 if (pRoutePointList->IsEmpty()) return NULL;
353
354 return pRoutePointList->GetLast()->GetData();
355}
356
357int Route::GetIndexOf(RoutePoint *prp) {
358 int ret = pRoutePointList->IndexOf(prp) + 1;
359 if (ret == wxNOT_FOUND)
360 return 0;
361 else
362 return ret;
363}
364
365void Route::DeletePoint(RoutePoint *rp, bool bRenamePoints) {
366 // n.b. must delete Selectables and update config before deleting the
367 // point
368 if (rp->m_bIsInLayer) return;
369
370 pSelect->DeleteAllSelectableRoutePoints(this);
371 pSelect->DeleteAllSelectableRouteSegments(this);
372
373 pRoutePointList->DeleteObject(rp);
374
375 delete rp;
376
377 if (bRenamePoints) RenameRoutePoints();
378
379 if (GetnPoints() > 1) {
380 pSelect->AddAllSelectableRouteSegments(this);
381 pSelect->AddAllSelectableRoutePoints(this);
382
383 FinalizeForRendering();
384 UpdateSegmentDistances();
385 }
386}
387
388void Route::RemovePoint(RoutePoint *rp, bool bRenamePoints) {
389 if (rp->m_bIsActive && this->IsActive()) // FS#348
390 g_pRouteMan->DeactivateRoute();
391
392 pSelect->DeleteAllSelectableRoutePoints(this);
393 pSelect->DeleteAllSelectableRouteSegments(this);
394
395 // Arrange to remove all references to the same routepoint
396 // within the route. This can happen with circular or "round-trip" routes.
397 pRoutePointList->DeleteContents(false);
398 bool deleted = pRoutePointList->DeleteObject(rp);
399 while (deleted) {
400 deleted = pRoutePointList->DeleteObject(rp);
401 }
402
403 // check all other routes to see if this point appears in any other route
404 Route *pcontainer_route = FindRouteContainingWaypoint(rp);
405
406 if (pcontainer_route == NULL) {
407 rp->m_bIsInRoute = false; // Take this point out of this (and only) route
408 rp->m_bIsolatedMark = true; // This has become an isolated mark
409 NavObj_dB::GetInstance().UpdateRoutePoint(rp);
410 }
411
412 if (bRenamePoints) RenameRoutePoints();
413
414 // if ( m_nPoints > 1 )
415 {
416 pSelect->AddAllSelectableRouteSegments(this);
417 pSelect->AddAllSelectableRoutePoints(this);
418
419 // NavObjectChanges::getInstance()->UpdateRoute(this);
420 NavObj_dB::GetInstance().UpdateRoute(this);
421 FinalizeForRendering();
422 UpdateSegmentDistances();
423 }
424}
425
426void Route::DeSelectRoute() {
427 wxRoutePointListNode *node = pRoutePointList->GetFirst();
428
429 RoutePoint *rp;
430 while (node) {
431 rp = node->GetData();
432 rp->m_bPtIsSelected = false;
433
434 node = node->GetNext();
435 }
436}
437
438void Route::ReloadRoutePointIcons() {
439 wxRoutePointListNode *node = pRoutePointList->GetFirst();
440
441 RoutePoint *rp;
442 while (node) {
443 rp = node->GetData();
444 rp->ReLoadIcon();
445
446 node = node->GetNext();
447 }
448}
449
450void Route::FinalizeForRendering() { RBBox.Invalidate(); }
451
452LLBBox &Route::GetBBox(void) {
453 if (RBBox.GetValid()) return RBBox;
454
455 double bbox_lonmin, bbox_lonmax, bbox_latmin, bbox_latmax;
456
457 wxRoutePointListNode *node = pRoutePointList->GetFirst();
458 RoutePoint *data = node->GetData();
459
460 if (data->m_wpBBox.GetValid()) {
461 bbox_lonmax = data->m_wpBBox.GetMaxLon();
462 bbox_lonmin = data->m_wpBBox.GetMinLon();
463 bbox_latmax = data->m_wpBBox.GetMaxLat();
464 bbox_latmin = data->m_wpBBox.GetMinLat();
465 } else {
466 bbox_lonmax = bbox_lonmin = data->m_lon;
467 bbox_latmax = bbox_latmin = data->m_lat;
468 }
469
470 double lastlon = data->m_lon, wrap = 0;
471
472 node = node->GetNext();
473 while (node) {
474 data = node->GetData();
475
476 if (lastlon - data->m_lon > 180)
477 wrap += 360;
478 else if (data->m_lon - lastlon > 180)
479 wrap -= 360;
480
481 double lon = data->m_lon + wrap;
482
483 if (lon > bbox_lonmax) bbox_lonmax = lon;
484 if (lon < bbox_lonmin) bbox_lonmin = lon;
485
486 if (data->m_lat > bbox_latmax) bbox_latmax = data->m_lat;
487 if (data->m_lat < bbox_latmin) bbox_latmin = data->m_lat;
488
489 lastlon = data->m_lon;
490 node = node->GetNext();
491 }
492
493 if (bbox_lonmin < -360)
494 bbox_lonmin += 360, bbox_lonmax += 360;
495 else if (bbox_lonmax > 360)
496 bbox_lonmin -= 360, bbox_lonmax -= 360;
497
498 if (bbox_lonmax - bbox_lonmin > 360) bbox_lonmin = -180, bbox_lonmax = 180;
499
500 RBBox.Set(bbox_latmin, bbox_lonmin, bbox_latmax, bbox_lonmax);
501
502 return RBBox;
503}
504
505/*
506 Update a single route segment lengths
507 Also, compute total route length by summing segment distances.
508 */
510 double planspeed) {
511 double slat1 = prp0->m_lat, slon1 = prp0->m_lon;
512 double slat2 = prp->m_lat, slon2 = prp->m_lon;
513
514 // Calculate the absolute distance from 1->2
515
516 double dd;
517 double br;
518 // why are we using mercator rather than great circle here?? [sean 8-11-2015]
519 DistanceBearingMercator(slat2, slon2, slat1, slon1, &br, &dd);
520
521 prp->SetCourse(br);
522 prp->SetDistance(dd);
523
524 // And store in Point 2
525 prp->m_seg_len = dd;
526
527 m_route_length += dd;
528
529 // If Point1 Description contains VMG, store it for Properties Dialog in
530 // Point2 If Point1 Description contains ETD, store it in Point1
531
532 if (planspeed > 0.) {
533 wxDateTime etd;
534
535 double legspeed = planspeed;
536 if (prp->GetPlannedSpeed() > 0.1 && prp->GetPlannedSpeed() < 1000.)
537 legspeed = prp->GetPlannedSpeed();
538 if (legspeed > 0.1 && legspeed < 1000.) {
539 m_route_time += 3600. * dd / legspeed;
540 prp->m_seg_vmg = legspeed;
541 }
542 wxLongLong duration = wxLongLong(3600.0 * prp->m_seg_len / prp->m_seg_vmg);
543 prp->SetETE(duration);
544 wxTimeSpan ts(0, 0, duration);
545 if (!prp0->GetManualETD().IsValid()) {
546 prp0->m_manual_etd = false;
547 if (prp0->GetETA().IsValid()) {
548 prp0->m_seg_etd = prp0->GetETA();
549 } else {
550 prp0->m_seg_etd =
551 m_PlannedDeparture + wxTimeSpan(0, 0, m_route_time - duration);
552 }
553 }
554
555 prp->m_seg_eta = prp0->GetETD() + ts;
556 if (!prp->m_manual_etd || !prp->GetETD().IsValid()) {
557 prp->m_seg_etd = prp->m_seg_eta;
558 prp->m_manual_etd = false;
559 }
560 }
561}
562
563/*
564 Update the route segment lengths, storing each segment length in <destination>
565 point. Also, compute total route length by summing segment distances.
566 */
567void Route::UpdateSegmentDistances(double planspeed) {
568 wxPoint rpt, rptn;
569
570 m_route_length = 0.0;
571 m_route_time = 0.0;
572
573 wxRoutePointListNode *node = pRoutePointList->GetFirst();
574
575 if (node) {
576 // Route start point
577 RoutePoint *prp0 = node->GetData();
578 if (!prp0->m_manual_etd) {
581 }
582 node = node->GetNext();
583
584 while (node) {
585 RoutePoint *prp = node->GetData();
586 UpdateSegmentDistance(prp0, prp, planspeed);
587
588 prp0 = prp;
589
590 node = node->GetNext();
591 }
592 }
593}
594
595void Route::Reverse(bool bRenamePoints) {
596 // Reverse the GUID list
597 wxArrayString RoutePointGUIDList;
598
599 int ncount = pRoutePointList->GetCount();
600 for (int i = 0; i < ncount; i++)
601 RoutePointGUIDList.Add(GetPoint(ncount - i)->m_GUID);
602
603 pRoutePointList->DeleteContents(false);
604 pRoutePointList->Clear();
605 m_route_length = 0.0;
606
607 // iterate over the RoutePointGUIDs
608 for (unsigned int ip = 0; ip < RoutePointGUIDList.GetCount(); ip++) {
609 wxString GUID = RoutePointGUIDList[ip];
610
611 // And on the RoutePoints themselves
612 wxRoutePointListNode *prpnode = pWayPointMan->GetWaypointList()->GetFirst();
613 while (prpnode) {
614 RoutePoint *prp = prpnode->GetData();
615
616 if (prp->m_GUID == GUID) {
617 AddPoint(prp);
618 break;
619 }
620 prpnode = prpnode->GetNext(); // RoutePoint
621 }
622 }
623
624 if (bRenamePoints) RenameRoutePoints();
625
626 // Switch start/end strings. anders, 2010-01-29
627 wxString tmp = m_RouteStartString;
629 m_RouteEndString = tmp;
630}
631
632void Route::SetVisible(bool visible, bool includeWpts) {
633 m_bVisible = visible;
634
635 if (!includeWpts) return;
636
637 wxRoutePointListNode *node = pRoutePointList->GetFirst();
638 RoutePoint *rp;
639 while (node) {
640 rp = node->GetData();
641
642 // if this is a "shared" point, then do not turn off visibility.
643 // This step keeps the point available for selection to other routes,
644 // or may be manaully hidden in route-manager dialog.
645 if (rp->IsShared()) {
646 if (visible) rp->SetVisible(visible);
647 }
648 node = node->GetNext();
649 }
650}
651
652void Route::SetListed(bool visible) { m_bListed = visible; }
653
654void Route::AssembleRoute(void) {}
655
656void Route::ShowWaypointNames(bool bshow) {
657 wxRoutePointListNode *node = pRoutePointList->GetFirst();
658
659 while (node) {
660 RoutePoint *prp = node->GetData();
661 prp->SetNameShown(bshow);
662
663 node = node->GetNext();
664 }
665}
666
667bool Route::AreWaypointNamesVisible() {
668 bool bvis = false;
669 wxRoutePointListNode *node = pRoutePointList->GetFirst();
670
671 while (node) {
672 RoutePoint *prp = node->GetData();
673 if (prp->GetNameShown()) bvis = true;
674
675 node = node->GetNext();
676 }
677
678 return bvis;
679}
680
681void Route::RenameRoutePoints(void) {
682 // iterate on the route points.
683 // If dynamically named, rename according to current list position
684
685 wxRoutePointListNode *node = pRoutePointList->GetFirst();
686
687 int i = 1;
688 while (node) {
689 RoutePoint *prp = node->GetData();
690 if (prp->IsNameDynamic()) {
691 wxString name = prp->GetName();
692 if (name.Len() == 3) {
693 name.Printf(_T ( "%03d" ), i);
694 } else if (name.Left(2) == "NM") {
695 name.Printf(_T ( "%03d" ), i);
696 if (prp->GetName().Len() >= 5) {
697 name.Append(prp->GetName().Mid(5));
698 }
699 } else {
700 name.Printf(_T ( "%03d" ), i);
701 name.Append(prp->GetName().Mid(3));
702 }
703 prp->SetName(name);
704 }
705
706 node = node->GetNext();
707 i++;
708 }
709}
710
711// Is this route equal to another, meaning,
712// Do all routepoint positions and names match?
713bool Route::IsEqualTo(Route *ptargetroute) {
714 wxRoutePointListNode *pthisnode = (this->pRoutePointList)->GetFirst();
715 wxRoutePointListNode *pthatnode = (ptargetroute->pRoutePointList)->GetFirst();
716
717 if (NULL == pthisnode) return false;
718
719 if (this->m_bIsInLayer || ptargetroute->m_bIsInLayer) return false;
720
721 if (this->GetnPoints() != ptargetroute->GetnPoints()) return false;
722
723 while (pthisnode) {
724 if (NULL == pthatnode) return false;
725
726 RoutePoint *pthisrp = pthisnode->GetData();
727 RoutePoint *pthatrp = pthatnode->GetData();
728
729 if ((fabs(pthisrp->m_lat - pthatrp->m_lat) > 1.0e-6) ||
730 (fabs(pthisrp->m_lon - pthatrp->m_lon) > 1.0e-6))
731 return false;
732
733 if (!pthisrp->GetName().IsSameAs(pthatrp->GetName())) return false;
734
735 pthisnode = pthisnode->GetNext();
736 pthatnode = pthatnode->GetNext();
737 }
738
739 return true; // success, they are the same
740}
Represents a waypoint or mark within the navigation system.
Definition route_point.h:70
LLBBox m_wpBBox
Bounding box for the waypoint.
wxString m_GUID
Globally Unique Identifier for the waypoint.
wxDateTime GetETD()
Retrieves the Estimated Time of Departure for this waypoint, in UTC.
bool IsNameDynamic()
bool m_bIsolatedMark
Flag indicating if the waypoint is a standalone mark.
bool m_bIsActive
Flag indicating if this waypoint is active for navigation.
wxDateTime GetManualETD()
Retrieves the manually set Estimated Time of Departure for this waypoint, in UTC.
wxDateTime m_seg_etd
Estimated Time of Departure from this waypoint, in UTC.
bool m_bIsInRoute
Flag indicating if this waypoint is part of a route.
double m_seg_len
Length of the leg from previous waypoint to this waypoint in nautical miles.
bool m_bShowName
Flag indicating if the waypoint name should be shown.
double GetPlannedSpeed()
Return the planned speed associated with this waypoint.
bool m_bPtIsSelected
Flag indicating if this waypoint is currently selected.
bool m_bIsInLayer
Flag indicating if the waypoint belongs to a layer.
bool m_manual_etd
Flag indicating whether the ETD has been manually set by the user.
double m_seg_vmg
Planned speed for traveling FROM this waypoint TO the next waypoint.
wxDateTime m_seg_eta
Estimated Time of Arrival at this waypoint, in UTC.
wxDateTime GetETA()
Retrieves the Estimated Time of Arrival for this waypoint, in UTC.
Represents a navigational route in the navigation system.
Definition route.h:98
int m_hiliteWidth
Width in pixels for highlighting the route when selected.
Definition route.h:355
bool m_bRtIsSelected
Flag indicating whether this route is currently selected in the UI.
Definition route.h:202
double m_PlannedSpeed
Default planned speed for the route in knots.
Definition route.h:320
wxString m_RouteStartString
Name or description of the route's starting point.
Definition route.h:251
bool m_bIsBeingCreated
Flag indicating that the route is currently being created by the user.
Definition route.h:218
void UpdateSegmentDistance(RoutePoint *prp0, RoutePoint *prp, double planspeed=-1.0)
Updates the navigation data for a single route segment between two waypoints.
Definition route.cpp:509
RoutePointList * pRoutePointList
Ordered list of waypoints (RoutePoints) that make up this route.
Definition route.h:335
double m_route_length
Total length of the route in nautical miles, calculated using rhumb line (Mercator) distances.
Definition route.h:236
bool m_bRtIsActive
Flag indicating whether this route is currently active for navigation.
Definition route.h:207
wxString m_Colour
Color name for rendering the route on the chart.
Definition route.h:345
bool m_bDeleteOnArrival
Flag indicating whether the route should be deleted once navigation reaches the end.
Definition route.h:267
wxString m_RouteEndString
Name or description of the route's ending point.
Definition route.h:256
RoutePoint * m_pRouteActivePoint
Pointer to the currently active waypoint within this route.
Definition route.h:213
bool m_btemp
Flag indicating if this is a temporary route.
Definition route.h:350
wxPenStyle m_style
Style of the route line when rendered on the chart.
Definition route.h:292
wxString m_TimeDisplayFormat
Format for displaying times in the UI.
Definition route.h:330
int m_width
Width of the route line in pixels when rendered on the chart.
Definition route.h:287
wxString m_RouteNameString
User-assigned name for the route.
Definition route.h:246
wxString m_GUID
Globally unique identifier for this route.
Definition route.h:272
wxDateTime m_PlannedDeparture
Planned departure time for the route, in UTC.
Definition route.h:325
bool m_bIsInLayer
Flag indicating whether this route belongs to a layer.
Definition route.h:277
double m_route_time
Total estimated time to complete the route in seconds.
Definition route.h:241
int m_lastMousePointIndex
Index of the most recently interacted with route point.
Definition route.h:297
HyperlinkList * m_HyperlinkList
List of hyperlinks associated with this route.
Definition route.h:360
bool m_bIsBeingEdited
Flag indicating that the route is currently being edited by the user.
Definition route.h:223
bool m_NextLegGreatCircle
Flag indicating whether the next leg should be calculated using great circle navigation or rhumb line...
Definition route.h:314
int m_LayerID
Identifier of the layer containing this route.
Definition route.h:282
Global variables stored in configuration file.
Class NavObj_dB.