OpenCPN Partial API docs
Loading...
Searching...
No Matches
compass.h
Go to the documentation of this file.
1/**************************************************************************
2 * Copyright (C) 2010 by David S. Register *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, see <https://www.gnu.org/licenses/>. *
16 **************************************************************************/
17#ifndef GUI_COMPASS_H
18#define GUI_COMPASS_H
19
26#include "chcanv.h"
27#include "color_types.h"
28#include "ocpndc.h"
29
30class ChartCanvas; // circular
31
40public:
41 ocpnCompass(ChartCanvas *parent, bool bShowGPS = true);
43
44 bool IsShown() const { return m_shown; }
45 void Show(bool show) { m_shown = show; }
46 void Paint(ocpnDC &dc);
47
48 void UpdateStatus(bool newColorScheme = false);
49
50 bool MouseEvent(wxMouseEvent &event);
51 void SetColorScheme(ColorScheme cs);
52 int GetXOffset(void) const { return m_xoffset; }
53 int GetYOffset(void) const { return m_yoffset; }
54 float GetScaleFactor() { return m_scale; }
55 void SetScaleFactor(float factor);
56
57 void Move(const wxPoint &pt) { m_rect.SetPosition(pt); }
63 wxRect GetRect(void) const { return m_rect; }
68 wxRect GetLogicalRect(void) const;
69
70private:
71 void CreateBmp(bool bnew = false);
72 void CreateTexture();
73 void UpdateTexture();
74
75 ChartCanvas *m_parent;
76 wxBitmap m_StatBmp;
77 wxBitmap m_MaskBmp;
78 wxStaticBitmap *m_pStatBoxToolStaticBmp;
79
80 wxString m_lastgpsIconName;
81 double m_rose_angle;
82
83 wxBitmap _img_compass;
84 wxBitmap _img_gpsRed;
85 int m_xoffset;
86 int m_yoffset;
87 float m_scale;
88
93 wxRect m_rect;
94 bool m_shown;
95 bool m_bshowGPS;
96 ColorScheme m_cs;
97 bool m_texOK;
98
99#ifdef ocpnUSE_GL
100 unsigned int m_texobj;
101 int m_tex_w, m_tex_h;
102 int m_image_width, m_image_height;
103#endif
104};
105
106#endif // GUI_COMPASS_H
Generic Chart canvas base.
ChartCanvas - Main chart display and interaction component.
Definition chcanv.h:151
Represents a compass display in the OpenCPN navigation system.
Definition compass.h:39
wxRect GetRect(void) const
Return the coordinates of the compass widget, in physical pixels relative to the canvas window.
Definition compass.h:63
wxRect GetLogicalRect(void) const
Return the coordinates of the compass widget, in logical pixels.
Definition compass.cpp:193
Device context class that can use either wxDC or OpenGL for drawing.
Definition ocpndc.h:60