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