OpenCPN Partial API docs
Loading...
Searching...
No Matches
chcanv.h
1
2/***************************************************************************
3 *
4 * Project: OpenCPN
5 * Purpose: Chart Canvas
6 * Author: David Register
7 *
8 ***************************************************************************
9 * Copyright (C) 2010 by David S. Register *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * GNU General Public License for more details. *
20 * *
21 * You should have received a copy of the GNU General Public License *
22 * along with this program; if not, write to the *
23 * Free Software Foundation, Inc., *
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
25 **************************************************************************/
26
27#ifndef _CHCANV_H__
28#define _CHCANV_H__
29
30#include "bbox.h"
31
32#include <wx/datetime.h>
33#include <wx/treectrl.h>
34#include <wx/dirctrl.h>
35#include <wx/sound.h>
36#include <wx/grid.h>
37#include <wx/wxhtml.h>
38
39#include "ocpndc.h"
40#include "undo.h"
41
42#include "ocpCursor.h"
43#include "timers.h"
44#include "emboss_data.h"
45#include "S57Sector.h"
46#include "gshhs.h"
47
48class wxGLContext;
49class GSHHSChart;
50class IDX_entry;
51class ocpnCompass;
52class TimedPopupWin;
53class Track;
55
56// Useful static routines
57void ShowAISTargetQueryDialog(wxWindow *parent, int mmsi);
58
59//--------------------------------------------------------
60// Screen Brightness Control Support Routines
61//
62//--------------------------------------------------------
63
64int InitScreenBrightness(void);
65int RestoreScreenBrightness(void);
66int SetScreenBrightness(int brightness);
67
68// Set up the preferred quilt type
69#define QUILT_TYPE_2
70
71//----------------------------------------------------------------------------
72// Forward Declarations
73//----------------------------------------------------------------------------
74class Route;
75class TCWin;
76class RoutePoint;
77class SelectItem;
78class BoundingBox;
79class ocpnBitmap;
80class WVSChart;
81class MyFrame;
82class ChartBaseBSB;
83class ChartBase;
84class AisTargetData;
85class S57ObjectTree;
86class S57ObjectDesc;
87class RolloverWin;
88class Quilt;
89class PixelCache;
90class ChInfoWin;
91class glChartCanvas;
93class ChartStack;
94class Piano;
95class canvasConfig;
96class MUIBar;
97
98enum // specify the render behaviour of SetViewPoint()
99{
100 CURRENT_RENDER, // use the current render type
101 FORCE_SUBSAMPLE // force sub-sampled render, with re-render timer
102};
103
104// Cursor region enumerator
105enum {
106 CENTER,
107 MID_RIGHT,
108 MID_LEFT,
109 MID_TOP,
110 MID_BOT,
111};
112
113typedef enum ownship_state_t {
114 SHIP_NORMAL = 0,
115 SHIP_LOWACCURACY,
116 SHIP_INVALID
117} _ownship_state_t;
118
119enum { ID_S57QUERYTREECTRL = 10000, ID_AISDIALOGOK };
120
121enum { ID_PIANO_DISABLE_QUILT_CHART = 32000, ID_PIANO_ENABLE_QUILT_CHART };
122
123enum { NORTH_UP_MODE, COURSE_UP_MODE, HEAD_UP_MODE };
124
125//----------------------------------------------------------------------------
126// ChartCanvas
127//----------------------------------------------------------------------------
128class ChartCanvas : public wxWindow {
129 friend class glChartCanvas;
130
131public:
132 ChartCanvas(wxFrame *frame, int canvasIndex);
133 ~ChartCanvas();
134
135 void SetupGlCanvas();
136
137 // Methods
138 void OnKeyDown(wxKeyEvent &event);
139 void OnKeyUp(wxKeyEvent &event);
140 void OnKeyChar(wxKeyEvent &event);
141 void OnPaint(wxPaintEvent &event);
142 void PaintCleanup();
143 void Scroll(int dx, int dy);
144 void OnToolLeftClick(wxCommandEvent &event);
145
146 bool MouseEventOverlayWindows(wxMouseEvent &event);
147 bool MouseEventChartBar(wxMouseEvent &event);
148 bool MouseEventSetup(wxMouseEvent &event, bool b_handle_dclick = true);
149 bool MouseEventProcessObjects(wxMouseEvent &event);
150 bool MouseEventProcessCanvas(wxMouseEvent &event);
151 void SetCanvasCursor(wxMouseEvent &event);
152 void OnKillFocus(wxFocusEvent &WXUNUSED(event));
153 void OnSetFocus(wxFocusEvent &WXUNUSED(event));
154#ifdef HAVE_WX_GESTURE_EVENTS
155 void OnZoom(wxZoomGestureEvent& event);
156 void OnLongPress(wxLongPressEvent& event);
157 void OnPressAndTap(wxPressAndTapEvent& event);
158
159 void OnLeftDown(wxMouseEvent& evt);
160 void OnLeftUp(wxMouseEvent& evt);
161
162 void OnRightUp(wxMouseEvent& event);
163 void OnRightDown(wxMouseEvent& event);
164
165 void OnDoubleLeftClick(wxMouseEvent& event);
166
167 void OnWheel(wxMouseEvent& event);
168 void OnMotion(wxMouseEvent& event);
169#endif /* HAVE_WX_GESTURE_EVENTS */
170
171 void PopupMenuHandler(wxCommandEvent &event);
172 bool IsPrimaryCanvas() { return (m_canvasIndex == 0); }
173
174 bool SetUserOwnship();
175
176 double GetCanvasRangeMeters();
177 void SetCanvasRangeMeters(double range);
178
179 void EnablePaint(bool b_enable);
180 virtual bool SetCursor(const wxCursor &c);
181 virtual void Refresh(bool eraseBackground = true,
182 const wxRect *rect = (const wxRect *)NULL);
183 virtual void Update();
184
185 void LostMouseCapture(wxMouseCaptureLostEvent &event);
186
187 void CancelMouseRoute();
188 void SetDisplaySizeMM(double size);
189 double GetDisplaySizeMM() { return m_display_size_mm; }
190
191 bool SetVPScale(double sc, bool b_refresh = true);
192 bool SetVPProjection(int projection);
193 bool SetViewPoint(double lat, double lon);
194 bool SetViewPointByCorners(double latSW, double lonSW, double latNE,
195 double lonNE);
196 bool SetViewPoint(double lat, double lon, double scale_ppm, double skew,
197 double rotation, int projection = 0, bool b_adjust = true,
198 bool b_refresh = true);
199 void ReloadVP(bool b_adjust = true);
200 void LoadVP(ViewPort &vp, bool b_adjust = true);
201
202 ChartStack *GetpCurrentStack() { return m_pCurrentStack; }
203 void SetGroupIndex(int index, bool autoswitch = false);
204 bool CheckGroup(int igroup);
205 void canvasRefreshGroupIndex(void);
206 void canvasChartsRefresh(int dbi_hint);
207
208 void CheckGroupValid(bool showMessage = true, bool switchGroup0 = true);
209
210 void UpdateCanvasS52PLIBConfig();
211
212 void TriggerDeferredFocus();
213 void OnDeferredFocusTimerEvent(wxTimerEvent &event);
214 void OnRouteFinishTimerEvent(wxTimerEvent &event);
215
216 void ClearS52PLIBStateHash() { m_s52StateHash = 0; }
217 void SetupCanvasQuiltMode(void);
218 void ApplyCanvasConfig(canvasConfig *pcc);
219
220 bool SetVPRotation(double angle);
221 double GetVPRotation(void) { return GetVP().rotation; }
222 double GetVPSkew(void) { return GetVP().skew; }
223 double GetVPTilt(void) { return GetVP().tilt; }
224 void ClearbFollow(void);
225 void SetbFollow(void);
226 void TogglebFollow(void);
227 void JumpToPosition(double lat, double lon, double scale);
228 void SetFirstAuto(bool b_auto) { m_bFirstAuto = b_auto; }
229
230 void GetDoubleCanvasPointPix(double rlat, double rlon, wxPoint2DDouble *r);
231 void GetDoubleCanvasPointPixVP(ViewPort &vp, double rlat, double rlon,
232 wxPoint2DDouble *r);
233 bool GetCanvasPointPix(double rlat, double rlon, wxPoint *r);
234 bool GetCanvasPointPixVP(ViewPort &vp, double rlat, double rlon, wxPoint *r);
235
236 void GetCanvasPixPoint(double x, double y, double &lat, double &lon);
237 void WarpPointerDeferred(int x, int y);
238 void UpdateShips();
239 void UpdateAIS();
240 void UpdateAlerts(); // pjotrc 2010.02.22
241 void ToggleCPAWarn();
242
243 bool IsMeasureActive() { return m_bMeasure_Active; }
244 wxBitmap &GetTideBitmap() { return m_cTideBitmap; }
245
246 void UnlockQuilt();
247 void SetQuiltMode(bool b_quilt);
248 bool GetQuiltMode(void);
249 std::vector<int> GetQuiltIndexArray(void);
250 bool IsQuiltDelta(void);
251 void SetQuiltChartHiLiteIndex(int dbIndex);
252 int GetQuiltReferenceChartIndex(void);
253 double GetBestStartScale(int dbi_hint, const ViewPort &vp);
254 void ConfigureChartBar();
255
256 int GetNextContextMenuId();
257
258 TCWin *getTCWin() { return pCwin; }
259
260 bool StartTimedMovement(bool stoptimer = true);
261 void DoTimedMovement();
262 void DoMovement(long dt);
263 void StopMovement();
264
265 void SetColorScheme(ColorScheme cs);
266 ColorScheme GetColorScheme() { return m_cs; }
267
268 void CanvasApplyLocale();
269 void RebuildCursors();
270
271 // Accessors
272 int GetCanvasWidth() { return m_canvas_width; }
273 int GetCanvasHeight() { return m_canvas_height; }
274 float GetVPScale() { return GetVP().view_scale_ppm; }
275 float GetVPChartScale() { return GetVP().chart_scale; }
276 double GetCanvasScaleFactor() { return m_canvas_scale_factor; }
277 double GetCanvasTrueScale() { return m_true_scale_ppm; }
278 double GetAbsoluteMinScalePpm() { return m_absolute_min_scale_ppm; }
279 ViewPort &GetVP();
280 ViewPort *GetpVP() { return &VPoint; }
281 void SetVP(ViewPort &);
282 ChartBase *GetChartAtCursor();
283 ChartBase *GetOverlayChartAtCursor();
284 Piano *GetPiano() { return m_Piano; }
285 int GetPianoHeight();
286
287 bool isRouteEditing(void) {
288 return m_bRouteEditing && m_pRoutePointEditTarget;
289 }
290 bool isMarkEditing(void) { return m_bMarkEditing && m_pRoutePointEditTarget; }
291
292 GSHHSChart *GetWorldBackgroundChart() { return pWorldBackgroundChart; }
293 void ResetWorldBackgroundChart() { pWorldBackgroundChart->Reset(); }
294
295 void SetbTCUpdate(bool f) { m_bTCupdate = f; }
296 bool GetbTCUpdate() { return m_bTCupdate; }
297 void SetbShowCurrent(bool f) { m_bShowCurrent = f; }
298 bool GetbShowCurrent() { return m_bShowCurrent; }
299 void SetbShowTide(bool f) { m_bShowTide = f; }
300 bool GetbShowTide() { return m_bShowTide; }
301 void SetShowVisibleSectors(bool val) { m_bShowVisibleSectors = val; }
302 bool GetShowVisibleSectors() { return m_bShowVisibleSectors; }
303
304 double GetPixPerMM() { return m_pix_per_mm; }
305
306 void SetOwnShipState(ownship_state_t state) { m_ownship_state = state; }
307 void SetCursorStatus(double cursor_lat, double cursor_lon);
308 void GetCursorLatLon(double *lat, double *lon);
309
310 bool PanCanvas(double dx, double dy);
311 void StopAutoPan(void);
312
313 void ZoomCanvas(double factor, bool can_zoom_to_cursor = true,
314 bool stoptimer = true);
315 void ZoomCanvasSimple(double factor);
316 void DoZoomCanvas(double factor, bool can_zoom_to_cursor = true);
317
318 void RotateCanvas(double dir);
319 void DoRotateCanvas(double rotation);
320 void DoTiltCanvas(double tilt);
321
322 void ShowAISTargetList(void);
323
324 void ShowGoToPosition(void);
325 void HideGlobalToolbar();
326 void ShowGlobalToolbar();
327
328 ChartBase *GetLargestScaleQuiltChart();
329 ChartBase *GetFirstQuiltChart();
330 ChartBase *GetNextQuiltChart();
331 int GetQuiltChartCount();
332 void InvalidateAllQuiltPatchs(void);
333 void SetQuiltRefChart(int dbIndex);
334 std::vector<int> GetQuiltCandidatedbIndexArray(bool flag1 = true,
335 bool flag2 = true);
336 std::vector<int> GetQuiltExtendedStackdbIndexArray();
337 std::vector<int> GetQuiltEclipsedStackdbIndexArray();
338 int GetQuiltRefChartdbIndex(void);
339 void InvalidateQuilt(void);
340 double GetQuiltMaxErrorFactor();
341 bool IsChartQuiltableRef(int db_index);
342 bool IsChartLargeEnoughToRender(ChartBase *chart, ViewPort &vp);
343 int GetCanvasChartNativeScale();
344 int FindClosestCanvasChartdbIndex(int scale);
345 void UpdateCanvasOnGroupChange(void);
346 void SetUpMode(int mode);
347 void ToggleLookahead();
348 void SetShowGPS(bool show);
349
350 void ShowObjectQueryWindow(int x, int y, float zlat, float zlon);
351 void ShowMarkPropertiesDialog(RoutePoint *markPoint);
352 void ShowRoutePropertiesDialog(wxString title, Route *selected);
353 void ShowTrackPropertiesDialog(Track *selected);
354 void DrawTCWindow(int x, int y, void *pIDX);
355
356 void UpdateGPSCompassStatusBox(bool b_force_new);
357 ocpnCompass *GetCompass() { return m_Compass; }
358
359 wxColour GetFogColor() { return m_fog_color; }
360
361 void ShowChartInfoWindow(int x, int dbIndex);
362 void HideChartInfoWindow(void);
363
364 void StartMeasureRoute();
365 void CancelMeasureRoute();
366
367 bool DoCanvasUpdate(void);
368 void SelectQuiltRefdbChart(int db_index, bool b_autoscale = true);
369 void SelectQuiltRefChart(int selected_index);
370 double GetBestVPScale(ChartBase *pchart);
371 void selectCanvasChartDisplay(int type, int family);
372 void RemoveChartFromQuilt(int dbIndex);
373
374 void HandlePianoClick(int selected_index, int selected_dbIndex);
375 void HandlePianoRClick(int x, int y, int selected_index,
376 int selected_dbIndex);
377 void HandlePianoRollover(int selected_index, int selected_dbIndex);
378 void UpdateCanvasControlBar(void);
379 void FormatPianoKeys(void);
380 void PianoPopupMenu(int x, int y, int selected_index, int selected_dbIndex);
381 void OnPianoMenuDisableChart(wxCommandEvent &event);
382 void OnPianoMenuEnableChart(wxCommandEvent &event);
383 bool IsPianoContextMenuActive() { return m_piano_ctx_menu != 0; }
384 void SetCanvasToolbarItemState(int tool_id, bool state);
385 bool DoCanvasCOGSet(void);
386 void UpdateFollowButtonState(void);
387 void ApplyGlobalSettings();
388 void SetShowGPSCompassWindow(bool bshow);
389
390 void FreezePiano() { m_pianoFrozen = true; }
391 void ThawPiano() { m_pianoFrozen = false; }
392
393 // Todo build more accessors
394 bool m_bFollow;
395 wxCursor *pCursorPencil;
396 wxCursor *pCursorArrow;
397 wxCursor *pCursorCross;
398 wxCursor *pPlugIn_Cursor;
399 TCWin *pCwin;
400 wxBitmap *pscratch_bm;
401 bool m_brepaint_piano;
402 double m_cursor_lon, m_cursor_lat;
403 Undo *undo;
404 wxPoint r_rband;
405 double m_prev_rlat;
406 double m_prev_rlon;
407 RoutePoint *m_prev_pMousePoint;
408 Quilt *m_pQuilt;
409 bool m_bShowNavobjects;
410 int m_canvasIndex;
411 int m_groupIndex;
412 int m_routeState;
413 ChartBase *m_singleChart;
414 int m_upMode;
415 bool m_bLookAhead;
416 double m_VPRotate;
417
418#ifdef HAVE_WX_GESTURE_EVENTS
419 double m_oldVPSScale;
420 bool m_popupWanted;
421 bool m_leftdown;
422 wxPoint m_zoomStartPoint;
423#endif /* HAVE_WX_GESTURE_EVENTS */
424
425 void DrawBlinkObjects(void);
426
427 void StartRoute(void);
428 void FinishRoute(void);
429
430 void InvalidateGL();
431
432#ifdef ocpnUSE_GL
433 glChartCanvas *GetglCanvas() { return m_glcc; }
434#endif
435
436 void JaggyCircle(ocpnDC &dc, wxPen pen, int x, int y, int radius);
437
438 bool CheckEdgePan(int x, int y, bool bdragging, int margin, int delta);
439
440 Route *m_pMouseRoute;
441 bool m_FinishRouteOnKillFocus;
442 bool m_bMeasure_Active;
443 bool m_bMeasure_DistCircle;
444 wxString m_active_upload_port;
445 bool m_bAppendingRoute;
446 int m_nMeasureState;
447 Route *m_pMeasureRoute;
448 MyFrame *parent_frame;
449 wxString FindValidUploadPort();
450 CanvasMenuHandler *m_canvasMenu;
451 int GetMinAvailableGshhgQuality() {
452 return pWorldBackgroundChart->GetMinAvailableQuality();
453 }
454 int GetMaxAvailableGshhgQuality() {
455 return pWorldBackgroundChart->GetMaxAvailableQuality();
456 }
457 Route *GetSelectedRoute() const { return m_pSelectedRoute; }
458 Track *GetSelectedTrack() const { return m_pSelectedTrack; }
459 RoutePoint *GetSelectedRoutePoint() const { return m_pFoundRoutePoint; }
460
461 ocpnFloatingToolbarDialog *RequestNewCanvasToolbar(bool bforcenew = true);
462 void UpdateToolbarColorScheme(ColorScheme cs);
463 void SetAISCanvasDisplayStyle(int StyleIndx);
464 void TouchAISToolActive(void);
465 void UpdateAISTBTool(void);
466 void SetToolbarScaleFactor(double scale_factor) {
467 m_toolbar_scalefactor = scale_factor;
468 }
469 ocpnFloatingToolbarDialog *GetToolbar() { return m_toolBar; }
470 void SetToolbarConfigString(wxString &config) { m_toolbarConfig = config; }
471 wxString GetToolbarConfigString() { return m_toolbarConfig; }
472
473 void SetToolbarPosition(wxPoint position);
474 wxPoint GetToolbarPosition();
475 void SetToolbarOrientation(long orient);
476 long GetToolbarOrientation();
477
478 void SubmergeToolbar(void);
479 void SurfaceToolbar(void);
480 void ToggleToolbar(bool b_smooth = false);
481 bool IsToolbarShown();
482 void DestroyToolbar();
483
484 void SelectChartFromStack(int index, bool bDir = false,
485 ChartTypeEnum New_Type = CHART_TYPE_DONTCARE,
486 ChartFamilyEnum New_Family = CHART_FAMILY_DONTCARE);
487 void SelectdbChart(int dbindex);
488
489 void ShowTides(bool bShow);
490 void ShowCurrents(bool bShow);
491
492 void DoCanvasStackDelta(int direction);
493
494 void ProcessNewGUIScale();
495
496 bool GetShowDepthUnits() { return m_bShowDepthUnits; }
497 void SetShowDepthUnits(bool show) { m_bShowDepthUnits = show; }
498 bool GetShowGrid() { return m_bDisplayGrid; }
499 void SetShowGrid(bool show) { m_bDisplayGrid = show; }
500 bool GetShowOutlines() { return m_bShowOutlines; }
501 void SetShowOutlines(bool show) { m_bShowOutlines = show; }
502 bool GetShowChartbar() { return true; }
503 bool GetToolbarEnable() { return m_bToolbarEnable; }
504 void SetToolbarEnable(bool show);
505 wxRect GetMUIBarRect();
506 void SetMUIBarPosition();
507 void DestroyMuiBar();
508 void CreateMUIBar();
509
510 void ToggleChartOutlines(void);
511 void ToggleCanvasQuiltMode(void);
512
513 wxString GetScaleText() { return m_scaleText; }
514 double GetScaleValue() { return m_scaleValue; }
515
516 bool m_b_paint_enable;
517
518 bool GetShowENCText() { return m_encShowText; }
519 void SetShowENCText(bool show);
520
521 bool GetShowENCDepth() { return m_encShowDepth; }
522 void SetShowENCDepth(bool show);
523
524 bool GetShowENCLightDesc() { return m_encShowLightDesc; }
525 void SetShowENCLightDesc(bool show);
526
527 bool GetShowENCBuoyLabels() { return m_encShowBuoyLabels; }
528 void SetShowENCBuoyLabels(bool show);
529
530 bool GetShowENCLights() { return m_encShowLights; }
531 void SetShowENCLights(bool show);
532
533 int GetENCDisplayCategory() { return m_encDisplayCategory; }
534 void SetENCDisplayCategory(int category);
535
536 bool GetShowENCAnchor() { return m_encShowAnchor; }
537 void SetShowENCAnchor(bool show);
538
539 bool GetShowENCDataQual() { return m_encShowDataQual; }
540 void SetShowENCDataQual(bool show);
541
542 int GetUpMode() { return m_upMode; }
543 bool GetLookahead() { return m_bLookAhead; }
544
545 bool GetShowAIS() { return m_bShowAIS; }
546 void SetShowAIS(bool show);
547 bool GetAttenAIS() { return m_bShowAISScaled; }
548 void SetAttenAIS(bool show);
549
550 MUIBar *GetMUIBar() { return m_muiBar; }
551
552 void SetAlertString(wxString str) { m_alertString = str; }
553 wxString GetAlertString() { return m_alertString; }
554
555 wxRect GetScaleBarRect() { return m_scaleBarRect; }
556 void RenderAlertMessage(wxDC &dc, const ViewPort &vp);
557
558 std::vector<int> m_tile_noshow_index_array;
559 std::vector<int> m_tile_yesshow_index_array;
560 std::vector<int> m_quilt_noshow_index_array;
561
562 bool IsTileOverlayIndexInYesShow(int index);
563 bool IsTileOverlayIndexInNoShow(int index);
564 void AddTileOverlayIndexToNoShow(int index);
565
566 std::vector<int> GetQuiltNoshowIindexArray() {
567 return m_quilt_noshow_index_array;
568 }
569 double GetDisplayScale(){ return m_displayScale; }
570
571private:
572 int AdjustQuiltRefChart();
573
574 bool UpdateS52State();
575
576 void CallPopupMenu(int x, int y);
577
578 bool IsTempMenuBarEnabled();
579 bool InvokeCanvasMenu(int x, int y, int seltype);
580
581 ViewPort VPoint;
582 void PositionConsole(void);
583
584 wxColour PredColor();
585 wxColour ShipColor();
586
587 void ComputeShipScaleFactor(float icon_hdt, int ownShipWidth,
588 int ownShipLength, wxPoint &lShipMidPoint,
589 wxPoint &GpsOffsetPixels, wxPoint lGPSPoint,
590 float &scale_factor_x, float &scale_factor_y);
591
592 void ShipDrawLargeScale(ocpnDC &dc, wxPoint lShipMidPoint);
593 void ShipIndicatorsDraw(ocpnDC &dc, int img_height, wxPoint GPSOffsetPixels,
594 wxPoint lGPSPoint);
595
596 ChInfoWin *m_pCIWin;
597
598 bool m_bShowCurrent;
599 bool m_bShowTide;
600 int cursor_region;
601 bool m_bTCupdate;
602 wxString m_scaleText;
603 double m_scaleValue;
604 bool m_bShowScaleInStatusBar;
605 wxRect bbRect;
606
607 wxPoint LastShipPoint;
608 wxPoint LastPredPoint;
609 bool m_bDrawingRoute;
610 bool m_bRouteEditing;
611 bool m_bMarkEditing;
612 bool m_bRoutePoinDragging;
613 bool m_bIsInRadius;
614 bool m_bMayToggleMenuBar;
615
616 RoutePoint *m_pRoutePointEditTarget;
617 RoutePoint *m_lastRoutePointEditTarget;
618 SelectItem *m_pFoundPoint;
619 bool m_bChartDragging;
620 Route *m_pSelectedRoute;
621 Track *m_pSelectedTrack;
622 wxArrayPtrVoid *m_pEditRouteArray;
623 RoutePoint *m_pFoundRoutePoint;
624
625 int m_FoundAIS_MMSI;
626
627 wxCursor *pCursorLeft;
628 wxCursor *pCursorRight;
629 wxCursor *pCursorUp;
630 wxCursor *pCursorDown;
631
632 wxCursor *pCursorUpLeft;
633 wxCursor *pCursorUpRight;
634 wxCursor *pCursorDownLeft;
635 wxCursor *pCursorDownRight;
636
637 int popx, popy;
638
639 wxBitmap *pThumbDIBShow;
640 wxBitmap *pThumbShowing;
641
642 bool bShowingCurrent;
643 bool bShowingTide;
644
645 double
646 m_canvas_scale_factor; // converter....
647 // useage....
648 // true_chart_scale_on_display =
649 // m_canvas_scale_factor / pixels_per_meter of
650 // displayed chart also may be considered as the
651 // "pixels-per-meter" of the canvas on-screen
652 double m_pix_per_mm; // pixels per millimeter on the screen
653 double m_display_size_mm;
654
655 double m_absolute_min_scale_ppm;
656
657 bool singleClickEventIsValid;
658 wxMouseEvent singleClickEvent;
659
660 std::vector<s57Sector_t> extendedSectorLegs;
661 wxFont m_overzoomFont;
662 int m_overzoomTextWidth;
663 int m_overzoomTextHeight;
664
665 // Methods
666 void OnActivate(wxActivateEvent &event);
667 void OnSize(wxSizeEvent &event);
668 void MouseTimedEvent(wxTimerEvent &event);
669 void MouseEvent(wxMouseEvent &event);
670 void ShipDraw(ocpnDC &dc);
671 void DrawArrow(ocpnDC &dc, int x, int y, double rot_angle, double scale);
672 void OnRolloverPopupTimerEvent(wxTimerEvent &event);
673 void FindRoutePointsAtCursor(float selectRadius, bool setBeingEdited);
674
675 void RotateTimerEvent(wxTimerEvent &event);
676 void PanTimerEvent(wxTimerEvent &event);
677 void MovementTimerEvent(wxTimerEvent &);
678 void MovementStopTimerEvent(wxTimerEvent &);
679 void OnCursorTrackTimerEvent(wxTimerEvent &event);
680
681 void DrawAllTracksInBBox(ocpnDC &dc, LLBBox &BltBBox);
682 void DrawActiveTrackInBBox(ocpnDC &dc, LLBBox &BltBBox);
683 void DrawAllRoutesInBBox(ocpnDC &dc, LLBBox &BltBBox);
684 void DrawActiveRouteInBBox(ocpnDC &dc, LLBBox &BltBBox);
685 void DrawAllWaypointsInBBox(ocpnDC &dc, LLBBox &BltBBox);
686 void DrawAnchorWatchPoints(ocpnDC &dc);
687 double GetAnchorWatchRadiusPixels(RoutePoint *pAnchorWatchPoint);
688
689 void DrawAllTidesInBBox(ocpnDC &dc, LLBBox &BBox);
690 void DrawAllCurrentsInBBox(ocpnDC &dc, LLBBox &BBox);
691 void RebuildTideSelectList(LLBBox &BBox);
692 void RebuildCurrentSelectList(LLBBox &BBox);
693
694 void RenderAllChartOutlines(ocpnDC &dc, ViewPort &vp);
695 void RenderChartOutline(ocpnDC &dc, int dbIndex, ViewPort &vp);
696 void RenderRouteLegs(ocpnDC &dc);
697 void RenderVisibleSectorLights(ocpnDC &dc);
698
699 void AlertDraw(ocpnDC &dc); // pjotrc 2010.02.22
700
701 void GridDraw(ocpnDC &dc); // Display lat/lon Grid in chart display
702 void ScaleBarDraw(ocpnDC &dc);
703
704 void DrawOverlayObjects(ocpnDC &dc, const wxRegion &ru);
705 void RenderShipToActive(ocpnDC &dc, bool Use_Opengl);
706
707 emboss_data *EmbossDepthScale();
708 emboss_data *CreateEmbossMapData(wxFont &font, int width, int height,
709 const wxString &str, ColorScheme cs);
710 void CreateDepthUnitEmbossMaps(ColorScheme cs);
711 wxBitmap CreateDimBitmap(wxBitmap &Bitmap, double factor);
712
713 void CreateOZEmbossMapData(ColorScheme cs);
714 emboss_data *EmbossOverzoomIndicator(ocpnDC &dc);
715 void SetOverzoomFont();
716
717 // void CreateCM93OffsetEmbossMapData(ColorScheme cs);
718 // void EmbossCM93Offset ( wxMemoryDC *pdc);
719
720 void DrawEmboss(ocpnDC &dc, emboss_data *pemboss);
721
722 void ShowBrightnessLevelTimedPopup(int brightness, int min, int max);
723
724 // Data
725 int m_canvas_width, m_canvas_height;
726
727 int xr_margin; // chart scroll margins, control cursor, etc.
728 int xl_margin;
729 int yt_margin;
730 int yb_margin;
731
732 wxPoint last_drag;
733
734 wxMemoryDC *pmemdc;
735
736 int warp_x, warp_y;
737 bool warp_flag;
738
739 wxTimer *
740 pPanTimer; // This timer used for auto panning on route creation and edit
741 wxTimer *
742 pMovementTimer; // This timer used for smooth movement in non-opengl mode
743 wxTimer *pMovementStopTimer; // This timer used to stop movement if a keyup
744 // event is lost
745 wxTimer *pCurTrackTimer; // This timer used to update the status window on
746 // mouse idle
747 wxTimer *pRotDefTimer; // This timer used to control rotaion rendering on
748 // mouse moves
749 wxTimer *m_DoubleClickTimer;
750 wxTimer m_routeFinishTimer;
751
752 wxTimer m_RolloverPopupTimer;
753
754 int m_wheelzoom_stop_oneshot;
755 int m_last_wheel_dir;
756 wxStopWatch m_wheelstopwatch;
757 double m_zoom_target;
758
759 int m_curtrack_timer_msec;
760 int m_rollover_popup_timer_msec;
761
762 GSHHSChart *pWorldBackgroundChart;
763
764 ChartBaseBSB *pCBSB;
765 wxBitmap *pss_overlay_bmp;
766 wxMask *pss_overlay_mask;
767
768 wxRect ship_draw_rect;
769 wxRect ship_draw_last_rect;
770 wxRect ais_draw_rect;
771 wxRect alert_draw_rect; // pjotrc 2010.02.22
772
773 wxBitmap *proute_bm; // a bitmap and dc used to calculate route bounding box
774 wxMemoryDC m_dc_route; // seen in mouse->edit->route
775
776 emboss_data *m_pEM_Feet; // maps for depth unit emboss pattern
777 emboss_data *m_pEM_Meters;
778 emboss_data *m_pEM_Fathoms;
779
780 emboss_data *m_pEM_OverZoom;
781 // emboss_data *m_pEM_CM93Offset; // Flav
782
783 double m_true_scale_ppm;
784
785 ownship_state_t m_ownship_state;
786
787 ColorScheme m_cs;
788
789 wxBitmap m_bmTideDay;
790 wxBitmap m_bmTideDusk;
791 wxBitmap m_bmTideNight;
792 wxBitmap m_bmCurrentDay;
793 wxBitmap m_bmCurrentDusk;
794 wxBitmap m_bmCurrentNight;
795 wxBitmap m_cTideBitmap;
796 wxBitmap m_cCurrentBitmap;
797
798 RolloverWin *m_pRouteRolloverWin;
799 RolloverWin *m_pTrackRolloverWin;
800 RolloverWin *m_pAISRolloverWin;
801
802 TimedPopupWin *m_pBrightPopup;
803
804 wxImage m_os_image_red_day;
805 wxImage m_os_image_red_dusk;
806 wxImage m_os_image_red_night;
807 wxImage m_os_image_grey_day;
808 wxImage m_os_image_grey_dusk;
809 wxImage m_os_image_grey_night;
810 wxImage m_os_image_yellow_day;
811 wxImage m_os_image_yellow_dusk;
812 wxImage m_os_image_yellow_night;
813
814 wxImage *m_pos_image_red;
815 wxImage *m_pos_image_grey;
816 wxImage *m_pos_image_yellow;
817
818 wxImage *m_pos_image_user;
819 wxImage *m_pos_image_user_grey;
820 wxImage *m_pos_image_user_yellow;
821
822 wxImage *m_pos_image_user_day;
823 wxImage *m_pos_image_user_dusk;
824 wxImage *m_pos_image_user_night;
825 wxImage *m_pos_image_user_grey_day;
826 wxImage *m_pos_image_user_grey_dusk;
827 wxImage *m_pos_image_user_grey_night;
828 wxImage *m_pos_image_user_yellow_day;
829 wxImage *m_pos_image_user_yellow_dusk;
830 wxImage *m_pos_image_user_yellow_night;
831
832 wxImage m_ship_pix_image; // cached ship draw image for high overzoom
833 int m_cur_ship_pix;
834 bool m_cur_ship_pix_isgrey;
835 ColorScheme m_ship_cs;
836
837 ViewPort m_cache_vp;
838 wxBitmap *m_prot_bm;
839 wxPoint m_roffset;
840
841 bool m_b_rot_hidef;
842
843 SelectItem *m_pRolloverRouteSeg;
844 SelectItem *m_pRolloverTrackSeg;
845
846 double m_wheel_lat, m_wheel_lon;
847 int m_wheel_x, m_wheel_y;
848
849 ViewPort m_bm_cache_vp;
850 wxBitmap m_working_bm; // Used to build quilt in OnPaint()
851 wxBitmap m_cached_chart_bm; // A cached copy of the fully drawn quilt
852
853 bool m_bbrightdir;
854 int m_brightmod;
855
856 bool m_bzooming, m_bzooming_to_cursor;
857 IDX_entry *m_pIDXCandidate;
858
859 //#ifdef ocpnUSE_GL
860 glChartCanvas *m_glcc;
861 //#endif
862
863 // Smooth movement member variables
864 wxPoint m_pan_drag;
865 int m_panx, m_pany, m_modkeys;
866 double m_panspeed;
867 bool m_bmouse_key_mod;
868 double m_zoom_factor, m_rotation_speed;
869 int m_mustmove;
870
871 wxDateTime m_last_movement_time;
872
873 int m_AISRollover_MMSI;
874 bool m_bsectors_shown;
875 bool m_bedge_pan;
876 double m_displayed_scale_factor;
877
878 wxColour m_fog_color;
879 bool m_disable_edge_pan;
880 wxFont *m_pgridFont;
881
882 bool m_dragoffsetSet;
883
884 ocpnFloatingToolbarDialog *m_toolBar;
885 double m_toolbar_scalefactor;
886 wxString m_toolbarConfig;
887 wxPoint m_toolbarPosition;
888 long m_toolbarOrientation;
889
890 bool m_bautofind;
891 bool m_bFirstAuto;
892 double m_vLat, m_vLon;
893 ChartStack *m_pCurrentStack;
894 Piano *m_Piano;
895 bool m_bpersistent_quilt;
896
897 wxMenu *m_piano_ctx_menu;
898 int menu_selected_dbIndex, menu_selected_index;
899
900 ocpnCompass *m_Compass;
901 bool m_bShowGPS;
902
903 wxRect m_mainlast_tb_rect;
904 int m_restore_dbindex;
905 int m_restore_group;
906
907 MUIBar *m_muiBar;
908 wxSize m_muiBarHOSize;
909
910 bool m_bShowOutlines;
911 bool m_bDisplayGrid;
912 bool m_bShowDepthUnits;
913 bool m_bToolbarEnable;
914 bool m_bShowAIS;
915 bool m_bShowAISScaled;
916
917 // S52PLib state storage
918 long m_s52StateHash;
919 bool m_encShowText;
920 bool m_encShowDepth;
921 bool m_encShowLightDesc;
922 bool m_encShowBuoyLabels;
923 int m_encDisplayCategory;
924 bool m_encShowLights;
925 bool m_encShowAnchor;
926 bool m_encShowDataQual;
927
928 wxTimer m_deferredFocusTimer;
929 float m_focus_indicator_pix;
930 bool m_bENCGroup;
931 bool m_last_TBviz;
932
933 double m_OSoffsetx, m_OSoffsety;
934 bool m_MouseDragging;
935
936 wxString m_alertString;
937 wxRect m_scaleBarRect;
938 bool m_bShowCompassWin;
939 bool m_pianoFrozen;
940
941 double m_sector_glat, m_sector_glon;
942 std::vector<s57Sector_t> m_sectorlegsVisible;
943 bool m_bShowVisibleSectors;
944 double m_displayScale;
945
946 DECLARE_EVENT_TABLE()
947};
948
949// CUSTOMIZATION - FORMAT MINUTES
950
951wxString minutesToHoursDays(float timeInMinutes);
952
953// END OF CUSTOMIZATION - FORMAT MINUTES
954
959#ifndef wxCLOSE_BOX
960#define wxCLOSE_BOX 0x1000
961#endif
962#ifndef wxFIXED_MINSIZE
963#define wxFIXED_MINSIZE 0
964#endif
965
966#endif // _CHCANV_H__
bool MouseEventSetup(wxMouseEvent &event, bool b_handle_dclick=true)
Definition: chcanv.cpp:6945
Definition: IDX_entry.h:41
Definition: MUIBar.h:56
Definition: piano.h:49
Definition: Quilt.h:84
Definition: route.h:70
Definition: TCWin.h:46
Definition: track.h:79
Definition: undo.h:60
Definition: ocpndc.h:55
Definition: Quilt.cpp:864