OpenCPN Partial API docs
Loading...
Searching...
No Matches
route_point.h
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#ifndef _ROUTEPOINT_H__
25#define _ROUTEPOINT_H__
26
27#include <functional>
28
29#include <wx/bitmap.h>
30#include <wx/colour.h>
31#include <wx/datetime.h>
32#include <wx/string.h>
33
34#include "model/hyperlink.h"
35
36#include "bbox.h"
37
38#define MAX_INT_VAL 2147483647 // max possible integer value before 'rollover'
39
40// minimal allowed ScaMin setting. prevents always hiding
41#define SCAMIN_MIN 800
42
43#define ETA_FORMAT_STR "%x %H:%M"
44//"%d/%m/%Y %H:%M" //"%Y-%m-%d %H:%M"
45
46// Default color, global state
47extern wxColour g_colourWaypointRangeRingsColour;
48
49extern int g_LayerIdx;
51extern wxRect g_blink_rect;
52
71 friend class RoutePointGui;
72
73public:
74 RoutePoint(double lat, double lon, const wxString &icon_ident,
75 const wxString &name, const wxString &pGUID = wxEmptyString,
76 bool bAddToList = true);
78 RoutePoint();
79 virtual ~RoutePoint(void);
80
87 static std::function<void(unsigned, const unsigned *)> delete_gl_textures;
88
89 void ReLoadIcon() { m_IconIsDirty = true; }
90
91 void SetPosition(double lat, double lon);
92 double GetLatitude() { return m_lat; };
93 double GetLongitude() { return m_lon; };
94 LLBBox &GetBBox() { return m_wpBBox; }
95
96 bool IsSame(RoutePoint *pOtherRP); // toh, 2009.02.11
97 bool IsVisible() { return m_bIsVisible; }
98 bool IsListed() { return m_bIsListed; }
99 bool IsNameShown() { return m_bShowName; }
100 bool IsNameDynamic();
101
102 bool IsShared() { return m_bsharedMark; }
103 void SetShared(bool bshared) { m_bsharedMark = bshared; }
104
105 bool IsSharedInVisibleRoute(void);
106
107 bool IsVisibleSelectable(double scale_val, bool boverrideViz = false);
108 void SetVisible(bool viz = true) { m_bIsVisible = viz; }
109 void SetListed(bool viz = true) { m_bIsListed = viz; }
110 void SetNameShown(bool viz = true) { m_bShowName = viz; }
111 bool GetNameShown() { return m_bShowName; }
112 virtual wxString GetName(void) { return m_MarkName; }
113 wxString GetDescription(void) { return m_MarkDescription; }
114
115 wxDateTime GetCreateTime(void);
116 void SetCreateTime(wxDateTime dt);
117
118 wxString GetIconName(void) { return m_IconName; }
119 void SetIconName(wxString name) { m_IconName = name; }
120
121 void *GetSelectNode(void) { return m_SelectNode; }
122 void SetSelectNode(void *node) { m_SelectNode = node; }
123
124 void *GetManagerListNode(void) { return m_ManagerNode; }
125 void SetManagerListNode(void *node) { m_ManagerNode = node; }
126
127 void SetName(const wxString &name);
128 void CalculateNameExtents(void);
129
130 void SetCourse(double course) { m_routeprop_course = course; };
131 double GetCourse() { return m_routeprop_course; };
132 void SetDistance(double distance) { m_routeprop_distance = distance; };
133 double GetDistance() { return m_routeprop_distance; };
134
135 void SetWaypointArrivalRadius(double dArrivalDistance) {
136 m_WaypointArrivalRadius = dArrivalDistance;
137 };
138 void SetWaypointArrivalRadius(wxString wxArrivalDistance) {
139 wxArrivalDistance.ToDouble(&m_WaypointArrivalRadius);
140 };
141 double GetWaypointArrivalRadius();
142 bool GetShowWaypointRangeRings(void) { return m_bShowWaypointRangeRings; };
143 int GetWaypointRangeRingsNumber(void);
144 float GetWaypointRangeRingsStep(void);
145 int GetWaypointRangeRingsStepUnits(void);
146 void SetShowWaypointRangeRings(bool b_showWaypointRangeRings) {
147 m_bShowWaypointRangeRings = b_showWaypointRangeRings;
148 };
149 void SetWaypointRangeRingsNumber(int i_WaypointRangeRingsNumber) {
150 m_iWaypointRangeRingsNumber = i_WaypointRangeRingsNumber;
151 };
152 void SetWaypointRangeRingsStep(float f_WaypointRangeRingsStep) {
153 m_fWaypointRangeRingsStep = f_WaypointRangeRingsStep;
154 };
155 void SetWaypointRangeRingsStepUnits(int i_WaypointRangeRingsStepUnits) {
156 m_iWaypointRangeRingsStepUnits = i_WaypointRangeRingsStepUnits;
157 };
158 void SetWaypointRangeRingsColour(wxColour wxc_WaypointRangeRingsColour) {
159 m_wxcWaypointRangeRingsColour = wxc_WaypointRangeRingsColour;
160 };
161 void SetScaMin(wxString str);
162 void SetScaMin(long val);
163 long GetScaMin() { return m_ScaMin; };
164 void SetScaMax(wxString str);
165 void SetScaMax(long val);
166 long GetScaMax() { return m_ScaMax; };
167 bool GetUseSca() { return b_UseScamin; };
168 void SetUseSca(bool value) { b_UseScamin = value; };
169 bool IsDragHandleEnabled() { return m_bDrawDragHandle; }
170 void SetPlannedSpeed(double spd);
171 double GetPlannedSpeed();
182 wxDateTime GetETD();
199 wxDateTime GetManualETD();
209 void SetETD(const wxDateTime &etd);
229 bool SetETD(const wxString &ts);
255 wxDateTime GetETA();
266 wxString GetETE();
267 void SetETE(wxLongLong secs);
268
269 double m_lat, m_lon;
270 double m_seg_len; // length in NMI to this point
271 // undefined for starting point
272
288 double m_seg_vmg;
307 wxDateTime m_seg_etd;
308
329 wxDateTime m_seg_eta;
345 wxLongLong m_seg_ete = 0;
354 bool m_manual_etd{false};
355
356 bool m_bPtIsSelected;
357 bool m_bRPIsBeingEdited;
358
359 bool m_bIsInRoute;
362
363 bool m_bIsVisible; // true if should be drawn, false if invisible
364 bool m_bIsListed;
365 bool m_bIsActive;
366 bool m_IconIsDirty;
367 wxString m_MarkDescription;
368 wxString m_GUID;
369
370 wxString m_TideStation;
371
372 wxFont *m_pMarkFont;
373 wxColour m_FontColor;
374
375 wxSize m_NameExtents;
376
377 bool m_bBlink;
378 bool m_bShowName, m_bShowNameData;
379 wxRect CurrentRect_in_DC;
380 int m_NameLocationOffsetX;
381 int m_NameLocationOffsetY;
382 bool m_bIsInLayer;
383 int m_LayerID;
384
385 double m_routeprop_course; // course from this waypoint to the next waypoint
386 // if in a route.
387 double m_routeprop_distance; // distance from this waypoint to the next
388 // waypoint if in a route.
389
390 bool m_btemp;
391
392 bool m_bShowWaypointRangeRings;
393 int m_iWaypointRangeRingsNumber;
394
395 float m_fWaypointRangeRingsStep;
396 int m_iWaypointRangeRingsStepUnits;
397 wxColour m_wxcWaypointRangeRingsColour;
398
399 unsigned int m_iTextTexture;
400 int m_iTextTextureWidth, m_iTextTextureHeight;
401
402 LLBBox m_wpBBox;
403 double m_wpBBox_view_scale_ppm, m_wpBBox_rotation;
404
405 bool m_pos_on_screen;
406 wxPoint2DDouble m_screen_pos; // cached for arrows and points
407
408 double m_WaypointArrivalRadius;
409 HyperlinkList *m_HyperlinkList;
410
411 wxString m_timestring;
412
413 wxDateTime m_CreateTimeX;
414
415private:
416 wxString m_MarkName;
417 wxBitmap *m_pbmIcon;
418 wxString m_IconName;
419
420 void *m_SelectNode;
421 void *m_ManagerNode;
422
423 float m_IconScaleFactor;
424 wxBitmap m_ScaledBMP;
425 bool m_bPreScaled;
426 bool m_bDrawDragHandle;
427 wxBitmap m_dragIcon;
428 int m_drag_line_length_man, m_drag_icon_offset;
429 double m_dragHandleLat, m_dragHandleLon;
430 int m_draggingOffsetx, m_draggingOffsety;
431 bool b_UseScamin;
432 long m_ScaMin;
433 long m_ScaMax;
448 double m_PlannedSpeed;
449
450 bool m_bsharedMark /*m_bKeepXRoute*/; // This is an isolated mark which is
451 // also part of a route. It should not
452 // be deleted with route.
453 unsigned int m_dragIconTexture;
454 int m_dragIconTextureWidth, m_dragIconTextureHeight;
455};
456
457WX_DECLARE_LIST(RoutePoint, RoutePointList); // establish class as list member
458
459#endif // _ROUTEPOINT_H__
Represents a waypoint or mark within the navigation system.
Definition route_point.h:70
static std::function< void(unsigned, const unsigned *)> delete_gl_textures
Horrible Hack (tm).
Definition route_point.h:50
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.
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.
wxString GetETE()
Retrieves the Estimated Time En route as a formatted string.
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.
wxLongLong m_seg_ete
Estimated Time Enroute for the leg leading to this waypoint.
void SetETD(const wxDateTime &etd)
Sets the Estimated Time of Departure for this waypoint, in UTC.
wxDateTime GetETA()
Retrieves the Estimated Time of Arrival for this waypoint, in UTC.