1 #ifndef ExoViewer_OverviewMapDialog_h
2 #define ExoViewer_OverviewMapDialog_h
4 #include "OpenGL_Includes.h"
20 OverviewMapDialog(
const std::vector<std::shared_ptr<geAstro::System>>& _systems, QWidget * parent = 0, Qt::WindowFlags f = 0);
40 RenderArea(
const std::vector<std::shared_ptr<geAstro::System>>& _systems,
int _size, QWidget *parent = 0) : QWidget(parent){ systems = &_systems; size = _size; systemInFocus = NULL; };
47 QPainter painter(
this);
48 painter.setBrush(Qt::gray);
49 painter.drawRect(QRect(0, 0, width() - 1, height() - 1));
57 double min = std::numeric_limits<double>::max();
60 for (
int i = 1; i < systems->size(); i++){
62 vmml::Vector3d pos = systems->at(i)->getWorldPosition();
68 if (pos.x() > max){ max = pos.x(); }
69 if (pos.x() < min){ min = pos.x(); }
70 if (pos.y() > max){ max = pos.y(); }
71 if (pos.y() < min){ min = pos.y(); }
77 int newUpperBound = size - margin;
78 int newLowerBound = 0 + margin;
81 for (
int i = 1; i < systems->size(); i++){
83 vmml::Vector3d pos = systems->at(i)->getWorldPosition();
84 painter.setPen(QColor(1.0, 0.0, 0.0, 1.0));
85 painter.setBrush(Qt::red);
89 double x = ((pos.x() - min) / (max - min))*(newUpperBound - newLowerBound) + newLowerBound;
90 double y = ((pos.y() - min) / (max - min))*(newUpperBound - newLowerBound) + newLowerBound;
92 painter.drawEllipse(QRectF(x + diameter / 2, y - diameter / 2, diameter, diameter));
97 painter.setBrush(Qt::yellow);
98 painter.drawEllipse(QRectF(((0 - min) / (max - min))*(newUpperBound - newLowerBound) + newLowerBound + diameter / 2, ((0 - min) / (max - min))*(newUpperBound - newLowerBound) + newLowerBound - diameter / 2, diameter, diameter));
102 if (systemInFocus != NULL){
103 painter.setBrush(Qt::blue);
104 painter.drawEllipse(QRectF(((systemInFocus->getWorldPosition().x() - min) / (max - min))*(newUpperBound - newLowerBound) + newLowerBound + diameter / 2, ((systemInFocus->getWorldPosition().y() - min) / (max - min))*(newUpperBound - newLowerBound) + newLowerBound - diameter / 2, diameter, diameter));
111 const std::vector<std::shared_ptr<geAstro::System>>* systems;
113 std::shared_ptr<geAstro::System> systemInFocus;
RenderArea(const std::vector< std::shared_ptr< geAstro::System >> &_systems, int _size, QWidget *parent=0)
Definition: OverviewMapDialog.h:40
void setSystemInFocus(std::shared_ptr< geAstro::System > _sif)
Definition: OverviewMapDialog.h:41
void setSystemInFocus(geAstro::System *_sif)
Definition: OverviewMapDialog.cpp:25
Definition: OverviewMapDialog.h:37
OverviewMapDialog(const std::vector< std::shared_ptr< geAstro::System >> &_systems, QWidget *parent=0, Qt::WindowFlags f=0)
Definition: OverviewMapDialog.cpp:4
~OverviewMapDialog()
Definition: OverviewMapDialog.cpp:16
Definition: OverviewMapDialog.h:15
void paintEvent(QPaintEvent *event)
Definition: OverviewMapDialog.h:45
Definition: BodySelectionDialog.h:12