-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
109 lines (77 loc) · 3.13 KB
/
Copy pathmain.cpp
File metadata and controls
109 lines (77 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include <QApplication>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <QThread>
#include <QMapboxGL>
#include "u2_window.h"
#include "mapwindow.hpp"
#include "location.h"
//maybe encapsulate outside here
#include <QtWidgets/QMessageBox>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QVBoxLayout>
#include <QtGui/QScreen>
//move to scatter.h later on
#include "scatterdatamodifier.h"
#include <QtDataVisualization/q3dscatter.h>
#include <QtDataVisualization/qabstract3dseries.h>
#include <QSlider>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QMapboxGLSettings settings;
settings.setCacheDatabasePath("/tmp/mbgl-cache.db");
settings.setCacheDatabaseMaximumSize(20 * 1024 * 1024);
QCommandLineParser parser;
parser.addHelpOption();
parser.process(app);
//scatter
QtDataVisualization::Q3DScatter *graph = new QtDataVisualization::Q3DScatter();
QWidget *container = QWidget::createWindowContainer(graph);
if (!graph->hasContext()) {
QMessageBox msgBox;
msgBox.setText("Couldn't initialize the OpenGL context.");
msgBox.exec();
return -1;
}
QSize screenSize = graph->screen()->size();
container->setMinimumSize(QSize(screenSize.width() / 3, screenSize.height() / 3));
container->setMaximumSize(screenSize);
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
container->setFocusPolicy(Qt::StrongFocus);
QSlider *sliderX = new QSlider(Qt::Orientation::Horizontal);
sliderX->setRange(-360,360);
QSlider *sliderY = new QSlider(Qt::Orientation::Horizontal);
sliderY->setRange(-360,360);
QWidget *widget = new QWidget;
QHBoxLayout *hLayout = new QHBoxLayout(widget);
QVBoxLayout *vLayout = new QVBoxLayout();
vLayout->addWidget(sliderX);
vLayout->addWidget(sliderY);
hLayout->addWidget(container, 1);
hLayout->addLayout(vLayout);
//scatter
Location *location = new Location();
MapWindow *mapwindow = new MapWindow(settings, location);
mapwindow->setGeometry(2000,900,1200,1200);
// mapwindow->resize(800, 600);
ScatterDataModifier *modifier = new ScatterDataModifier(graph, location);
QObject::connect(sliderX, &QSlider::valueChanged, modifier,
&ScatterDataModifier::rotateXAxis);
QObject::connect(sliderY, &QSlider::valueChanged, modifier,
&ScatterDataModifier::rotateYAxis);
QThread *thread = new QThread;
location->moveToThread(thread);
QObject::connect(thread, &QThread::started, location, &Location::handle_message);
QObject::connect(location, SIGNAL (newMsg()), modifier, SLOT (recvMsg()));
QObject::connect(thread, &QThread::started, location, &Location::handle_message);
QObject::connect(location, SIGNAL (newMsg()), mapwindow, SLOT (recvMsg()));
thread->start();
U2Window *u2window = new U2Window();
// u2window->resize(800, 600);
// u2window->show();
widget->setGeometry(2000,70,container->minimumSize().width(), container->minimumSize().height());
widget->show();
mapwindow->show();
return app.exec();
}