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