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
69 friend class RoutePointGui;
70
71public:
72 RoutePoint(double lat, double lon, const wxString &icon_ident,
73 const wxString &name, const wxString &pGUID = wxEmptyString,
74 bool bAddToList = true);
76 RoutePoint();
77 virtual ~RoutePoint(void);
78
85 static std::function<void(unsigned, const unsigned *)> delete_gl_textures;
86
87 void ReLoadIcon() { m_IconIsDirty = true; }
88
89 void SetPosition(double lat, double lon);
90 double GetLatitude() { return m_lat; };
91 double GetLongitude() { return m_lon; };
92 LLBBox &GetBBox() { return m_wpBBox; }
93
94 bool IsSame(RoutePoint *pOtherRP); // toh, 2009.02.11
95 bool IsVisible() { return m_bIsVisible; }
96 bool IsListed() { return m_bIsListed; }
97 bool IsNameShown() { return m_bShowName; }
98 bool IsNameDynamic();
99
100 bool IsShared() { return m_bsharedMark; }
101 void SetShared(bool bshared) { m_bsharedMark = bshared; }
102
103 bool IsSharedInVisibleRoute(void);
104
105 bool IsVisibleSelectable(double scale_val, bool boverrideViz = false);
106 void SetVisible(bool viz = true) { m_bIsVisible = viz; }
107 void SetListed(bool viz = true) { m_bIsListed = viz; }
108 void SetNameShown(bool viz = true) { m_bShowName = viz; }
109 bool GetNameShown() { return m_bShowName; }
110 virtual wxString GetName(void) { return m_MarkName; }
111 wxString GetDescription(void) { return m_MarkDescription; }
112
113 wxDateTime GetCreateTime(void);
114 void SetCreateTime(wxDateTime dt);
115
116 wxString GetIconName(void) { return m_IconName; }
117 void SetIconName(wxString name) { m_IconName = name; }
118
119 void *GetSelectNode(void) { return m_SelectNode; }
120 void SetSelectNode(void *node) { m_SelectNode = node; }
121
122 void *GetManagerListNode(void) { return m_ManagerNode; }
123 void SetManagerListNode(void *node) { m_ManagerNode = node; }
124
125 void SetName(const wxString &name);
126 void CalculateNameExtents(void);
127
128 void SetCourse(double course) { m_routeprop_course = course; };
129 double GetCourse() { return m_routeprop_course; };
130 void SetDistance(double distance) { m_routeprop_distance = distance; };
131 double GetDistance() { return m_routeprop_distance; };
132
133 void SetWaypointArrivalRadius(double dArrivalDistance) {
134 m_WaypointArrivalRadius = dArrivalDistance;
135 };
136 void SetWaypointArrivalRadius(wxString wxArrivalDistance) {
137 wxArrivalDistance.ToDouble(&m_WaypointArrivalRadius);
138 };
139 double GetWaypointArrivalRadius();
140 bool GetShowWaypointRangeRings(void) { return m_bShowWaypointRangeRings; };
141 int GetWaypointRangeRingsNumber(void);
142 float GetWaypointRangeRingsStep(void);
143 int GetWaypointRangeRingsStepUnits(void);
144 void SetShowWaypointRangeRings(bool b_showWaypointRangeRings) {
145 m_bShowWaypointRangeRings = b_showWaypointRangeRings;
146 };
147 void SetWaypointRangeRingsNumber(int i_WaypointRangeRingsNumber) {
148 m_iWaypointRangeRingsNumber = i_WaypointRangeRingsNumber;
149 };
150 void SetWaypointRangeRingsStep(float f_WaypointRangeRingsStep) {
151 m_fWaypointRangeRingsStep = f_WaypointRangeRingsStep;
152 };
153 void SetWaypointRangeRingsStepUnits(int i_WaypointRangeRingsStepUnits) {
154 m_iWaypointRangeRingsStepUnits = i_WaypointRangeRingsStepUnits;
155 };
156 void SetWaypointRangeRingsColour(wxColour wxc_WaypointRangeRingsColour) {
157 m_wxcWaypointRangeRingsColour = wxc_WaypointRangeRingsColour;
158 };
159 void SetScaMin(wxString str);
160 void SetScaMin(long val);
161 long GetScaMin() { return m_ScaMin; };
162 void SetScaMax(wxString str);
163 void SetScaMax(long val);
164 long GetScaMax() { return m_ScaMax; };
165 bool GetUseSca() { return b_UseScamin; };
166 void SetUseSca(bool value) { b_UseScamin = value; };
167 bool IsDragHandleEnabled() { return m_bDrawDragHandle; }
168 void SetPlannedSpeed(double spd);
169 double GetPlannedSpeed();
170 wxDateTime GetETD();
171 wxDateTime GetManualETD();
172 void SetETD(const wxDateTime &etd);
173 bool SetETD(const wxString &ts);
174 wxDateTime GetETA();
175 wxString GetETE();
176 void SetETE(wxLongLong secs);
177
178 double m_lat, m_lon;
179 double m_seg_len; // length in NMI to this point
180 // undefined for starting point
181 double m_seg_vmg;
182 wxDateTime m_seg_etd;
183 wxDateTime m_seg_eta;
184 wxLongLong m_seg_ete = 0;
185 bool m_manual_etd{false};
186
187 bool m_bPtIsSelected;
188 bool m_bRPIsBeingEdited;
189
190 bool m_bIsInRoute;
193
194 bool m_bIsVisible; // true if should be drawn, false if invisible
195 bool m_bIsListed;
196 bool m_bIsActive;
197 bool m_IconIsDirty;
198 wxString m_MarkDescription;
199 wxString m_GUID;
200
201 wxString m_TideStation;
202
203 wxFont *m_pMarkFont;
204 wxColour m_FontColor;
205
206 wxSize m_NameExtents;
207
208 bool m_bBlink;
209 bool m_bShowName, m_bShowNameData;
210 wxRect CurrentRect_in_DC;
211 int m_NameLocationOffsetX;
212 int m_NameLocationOffsetY;
213 bool m_bIsInLayer;
214 int m_LayerID;
215
216 double m_routeprop_course; // course from this waypoint to the next waypoint
217 // if in a route.
218 double m_routeprop_distance; // distance from this waypoint to the next
219 // waypoint if in a route.
220
221 bool m_btemp;
222
223 bool m_bShowWaypointRangeRings;
224 int m_iWaypointRangeRingsNumber;
225
226 float m_fWaypointRangeRingsStep;
227 int m_iWaypointRangeRingsStepUnits;
228 wxColour m_wxcWaypointRangeRingsColour;
229
230 unsigned int m_iTextTexture;
231 int m_iTextTextureWidth, m_iTextTextureHeight;
232
233 LLBBox m_wpBBox;
234 double m_wpBBox_view_scale_ppm, m_wpBBox_rotation;
235
236 bool m_pos_on_screen;
237 wxPoint2DDouble m_screen_pos; // cached for arrows and points
238
239 double m_WaypointArrivalRadius;
240 HyperlinkList *m_HyperlinkList;
241
242 wxString m_timestring;
243
244 wxDateTime m_CreateTimeX;
245
246private:
247 wxString m_MarkName;
248 wxBitmap *m_pbmIcon;
249 wxString m_IconName;
250
251 void *m_SelectNode;
252 void *m_ManagerNode;
253
254 float m_IconScaleFactor;
255 wxBitmap m_ScaledBMP;
256 bool m_bPreScaled;
257 bool m_bDrawDragHandle;
258 wxBitmap m_dragIcon;
259 int m_drag_line_length_man, m_drag_icon_offset;
260 double m_dragHandleLat, m_dragHandleLon;
261 int m_draggingOffsetx, m_draggingOffsety;
262 bool b_UseScamin;
263 long m_ScaMin;
264 long m_ScaMax;
265 double m_PlannedSpeed;
266
267 bool m_bsharedMark /*m_bKeepXRoute*/; // This is an isolated mark which is
268 // also part of a route. It should not
269 // be deleted with route.
270 unsigned int m_dragIconTexture;
271 int m_dragIconTextureWidth, m_dragIconTextureHeight;
272};
273
274WX_DECLARE_LIST(RoutePoint, RoutePointList); // establish class as list member
275
276#endif // _ROUTEPOINT_H__
Represents a waypoint or mark within the navigation system.
Definition route_point.h:68
static std::function< void(unsigned, const unsigned *)> delete_gl_textures
Horrible Hack (tm).
Definition route_point.h:50
bool IsNameDynamic()
bool m_bIsolatedMark
Flag indicating if the waypoint is a standalone mark.