GlobeEngine
ExoViewerGLWidget.h
Go to the documentation of this file.
1 #ifndef ExoViewer_GLWidget_h
2 #define ExoViewer_GLWidget_h
3 
4 #include "OpenGL_Includes.h"
5 #include "ExoEngine.h"
8 #include "Comparisoner.h"
9 
10 #include <math.h>
11 
12 namespace geExoViewer {
14  bool visible;
15  QColor textColor;
16  QFont textFont;
17  QFontMetrics* metric;
18 
19  void set(bool _visible, QColor _textColor, QFont _textFont) {
20  this->visible = _visible;
21  this->textColor = _textColor;
22  this->textFont = _textFont;
23  metric = new QFontMetrics(_textFont);
24  }
25  };
26 
28  {
29  Q_OBJECT
30 
31  public:
32  ExoViewerGLWidget(std::string _path, geAstro::ExoEngine* _engine, ExoViewerInputControl* _input);
34 
35  // overrides
36  void initialize();
37  void drawGL();
38  void updateScene();
39  void drawUI();
40  void resize(int width, int height);
41 
42  void mousePressEvent(QMouseEvent *event);
43  void mouseDoubleClickEvent(QMouseEvent * event);
44 
45  void updateLabelBounds();
46 
47  void toggleNames(bool _suns, bool _planets, bool _moons, bool _smallbodies, bool _systems, bool _selected,
48  bool _comparisonAxis, bool _comparisonPlanets, bool _comparisonMarked);
49  void setLabelSizes(int _suns, int _planets, int _moons, int _smallbodies, int _systems);
50  void setLabelColors(QColor _suns, QColor _planets, QColor _moons, QColor _smallbodies, QColor _systems, QColor _selected);
52 
53  std::vector<bool> getNamesVisiblility();
54  std::vector<int> getNamesSizes();
55  std::vector<QColor> getNamesColors();
56 
57 #ifdef __APPLE__
58  public slots:
59  void onMessageLogged( QOpenGLDebugMessage message );
60 #else
61  // only for qt5
62 #endif
63 
64  signals:
65  void updateInfoWidget();
66  void updateDate();
68 
69  private:
70  void drawSystemLabels();
71  void drawStarLabels();
72  void drawMoonLabels();
73  void drawSmallBodyObjectLabels();
74  void drawLabelsFromBodyInfos(const ExoViewerLabelCategory& _style, const std::vector<geAstro::UIBodyInfo>& _bodyInfos, int _labelidx);
75  void drawLabelOfSelectedObject();
76  void drawLabelWithShadow(vmml::Vector2d _position, QColor _color, QFont _font, QString _name);
77  void drawLabelWithBackground(vmml::Vector2d _position, QColor _color, QFont _font, QString _name);
78 
79  void drawComparisonAxisLabels();
80  void drawComparisonPlanetAxisLabels();
81  void drawComparisonPlanetNameLabels();
82  void drawComparisonMarkedPlanetAxisLabels();
83  void drawComparisonMarkedPlanetNameLabels();
84 
85  QRectF drawPopUpSystemInfoBox(std::shared_ptr<geAstro::System> _system, vmml::Vector2d _p, QFont* _font_, QFontMetrics* _metrics);
86 
87  ExoViewerLabelCategory sunLabelCat;
88  ExoViewerLabelCategory planetLabelCat;
89  ExoViewerLabelCategory moonLabelCat;
90  ExoViewerLabelCategory smallbodiesLabelCat;
91  ExoViewerLabelCategory systemLabelCat;
92  ExoViewerLabelCategory selectedLabelCat;
93 
94  ExoViewerLabelCategory comparisonAxisCat;
95  ExoViewerLabelCategory comparisonPlanetCat;
96  ExoViewerLabelCategory comparisonMarkedCat;
97 
98  // contains all labels in the current system
99  std::vector<QRectF> labelbounds;
100  std::vector<std::pair<QRectF, int> >rectVector_bodies;
101  std::vector<std::pair<QRectF, int> >rectVector_systems;
102 
103  //comparison view planet labels
104  std::vector<geAstro::ComparisonLabelInfo> comparisonPlanetNameLabelInfos;
105  std::vector<QRectF> comparisonPlanetLabelBounds;
106 
107 #ifdef __APPLE__
108  QOpenGLDebugLogger* logger;
109 #else
110  // only for qt5
111 #endif
112  std::string path;
113  };
114 }
115 #endif
Definition: ExoViewerGLWidget.h:27
void mousePressEvent(QMouseEvent *event)
Definition: ExoViewerGLWidget.cpp:267
std::vector< int > getNamesSizes()
Definition: ExoViewerGLWidget.cpp:387
Definition: ExoViewerInputControl.h:19
void resize(int width, int height)
Definition: ExoViewerGLWidget.cpp:263
std::vector< QColor > getNamesColors()
Definition: ExoViewerGLWidget.cpp:398
void drawUI()
Definition: ExoViewerGLWidget.cpp:83
geAstro::ExoEngine * getEngineLayer()
Definition: ExoViewerGLWidget.cpp:410
QFontMetrics * metric
Definition: ExoViewerGLWidget.h:17
std::vector< bool > getNamesVisiblility()
Definition: ExoViewerGLWidget.cpp:372
QFont textFont
Definition: ExoViewerGLWidget.h:16
void initialize()
Definition: ExoViewerGLWidget.cpp:30
ExoViewerGLWidget(std::string _path, geAstro::ExoEngine *_engine, ExoViewerInputControl *_input)
Definition: ExoViewerGLWidget.cpp:9
Definition: SimpleQTViewerGLWidget.h:24
void setLabelSizes(int _suns, int _planets, int _moons, int _smallbodies, int _systems)
Definition: ExoViewerGLWidget.cpp:355
bool visible
Definition: ExoViewerGLWidget.h:14
void toggleNames(bool _suns, bool _planets, bool _moons, bool _smallbodies, bool _systems, bool _selected, bool _comparisonAxis, bool _comparisonPlanets, bool _comparisonMarked)
Definition: ExoViewerGLWidget.cpp:342
void updateScene()
Definition: ExoViewerGLWidget.cpp:74
void mouseDoubleClickEvent(QMouseEvent *event)
Definition: ExoViewerGLWidget.cpp:302
void drawGL()
Definition: ExoViewerGLWidget.cpp:69
void set(bool _visible, QColor _textColor, QFont _textFont)
Definition: ExoViewerGLWidget.h:19
void setLabelColors(QColor _suns, QColor _planets, QColor _moons, QColor _smallbodies, QColor _systems, QColor _selected)
Definition: ExoViewerGLWidget.cpp:363
~ExoViewerGLWidget()
Definition: ExoViewerGLWidget.cpp:25
Definition: ExoEngine.h:50
Definition: ExoViewerGLWidget.h:13
void updateLabelBounds()
Definition: ExoViewerGLWidget.cpp:40
Definition: BodySelectionDialog.h:12
QColor textColor
Definition: ExoViewerGLWidget.h:15