Kinect demo update

Larger texts etc.

Change-Id: I8a418290a84da827557ee19b6387e69150b68a1a
Change-Id: I8a418290a84da827557ee19b6387e69150b68a1a
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
This commit is contained in:
Tomi Korpipää 2014-01-31 09:48:08 +02:00
parent 656ced8399
commit 562cd15dc4
3 changed files with 53 additions and 30 deletions

View File

@ -71,28 +71,37 @@ int main(int argc, char **argv)
hLayout->addLayout(vLayout); hLayout->addLayout(vLayout);
QPushButton *startButton = new QPushButton(widget); QPushButton *startButton = new QPushButton(widget);
startButton->setMinimumHeight(60); startButton->setFont(QFont("Arial", 30));
startButton->setText(QStringLiteral("Start Kinect")); startButton->setText(QStringLiteral("Start Kinect"));
QPushButton *stopButton = new QPushButton(widget); QPushButton *stopButton = new QPushButton(widget);
stopButton->setMinimumHeight(60); stopButton->setFont(QFont("Arial", 30));
stopButton->setText(QStringLiteral("Stop Kinect")); stopButton->setText(QStringLiteral("Stop Kinect"));
QLabel *resolutionLabel = new QLabel(QStringLiteral("Change resolution"));
resolutionLabel->setFont(QFont("Arial", 15));
QComboBox *resolutionBox = new QComboBox(widget); QComboBox *resolutionBox = new QComboBox(widget);
resolutionBox->setMinimumHeight(60); resolutionBox->setFont(QFont("Arial", 30));
resolutionBox->addItem(QStringLiteral("Low")); resolutionBox->addItem(QStringLiteral("Low"));
resolutionBox->addItem(QStringLiteral("Medium")); resolutionBox->addItem(QStringLiteral("Medium"));
resolutionBox->addItem(QStringLiteral("High")); resolutionBox->addItem(QStringLiteral("High"));
resolutionBox->addItem(QStringLiteral("Max")); // Comment this out if demo machine is low-perf resolutionBox->addItem(QStringLiteral("Max")); // Comment this out if demo machine is low-perf
resolutionBox->setCurrentIndex(0); resolutionBox->setCurrentIndex(0);
QLabel *modeLabel = new QLabel(QStringLiteral("Change visualization type"));
modeLabel->setFont(QFont("Arial", 15));
QComboBox *modeBox = new QComboBox(widget); QComboBox *modeBox = new QComboBox(widget);
modeBox->setMinimumHeight(60); modeBox->setFont(QFont("Arial", 30));
modeBox->addItem(QStringLiteral("Surface Plot")); modeBox->addItem(QStringLiteral("Surface Plot"));
modeBox->addItem(QStringLiteral("Scatter Chart")); modeBox->addItem(QStringLiteral("Scatter Chart"));
modeBox->addItem(QStringLiteral("Bar Chart")); modeBox->addItem(QStringLiteral("Bar Chart"));
modeBox->setCurrentIndex(0); modeBox->setCurrentIndex(0);
QLabel *distanceLabel = new QLabel(QStringLiteral("Adjust far distance"));
distanceLabel->setFont(QFont("Arial", 15));
QSlider *distanceSlider = new QSlider(Qt::Horizontal, widget); QSlider *distanceSlider = new QSlider(Qt::Horizontal, widget);
distanceSlider->setMinimumHeight(60); distanceSlider->setMinimumHeight(60);
distanceSlider->setTickInterval(10); distanceSlider->setTickInterval(10);
@ -101,6 +110,9 @@ int main(int argc, char **argv)
distanceSlider->setValue(50); distanceSlider->setValue(50);
distanceSlider->setMaximum(200); distanceSlider->setMaximum(200);
QLabel *gradientLabel = new QLabel(QStringLiteral("Change color scheme"));
gradientLabel->setFont(QFont("Arial", 15));
QLinearGradient gradientOne(0, 0, 200, 1); QLinearGradient gradientOne(0, 0, 200, 1);
gradientOne.setColorAt(0.0, Qt::black); gradientOne.setColorAt(0.0, Qt::black);
gradientOne.setColorAt(0.33, Qt::blue); gradientOne.setColorAt(0.33, Qt::blue);
@ -137,13 +149,13 @@ int main(int argc, char **argv)
vLayout->addWidget(startButton); vLayout->addWidget(startButton);
vLayout->addWidget(stopButton); vLayout->addWidget(stopButton);
vLayout->addWidget(new QLabel(QStringLiteral("Change resolution"))); vLayout->addWidget(resolutionLabel);
vLayout->addWidget(resolutionBox); vLayout->addWidget(resolutionBox);
vLayout->addWidget(new QLabel(QStringLiteral("Change visualization type"))); vLayout->addWidget(modeLabel);
vLayout->addWidget(modeBox); vLayout->addWidget(modeBox);
vLayout->addWidget(new QLabel(QStringLiteral("Adjust far distance"))); vLayout->addWidget(distanceLabel);
vLayout->addWidget(distanceSlider); vLayout->addWidget(distanceSlider);
vLayout->addWidget(new QLabel(QStringLiteral("Change color scheme"))); vLayout->addWidget(gradientLabel);
vLayout->addWidget(gradientOneButton); vLayout->addWidget(gradientOneButton);
vLayout->addWidget(gradientTwoButton); vLayout->addWidget(gradientTwoButton);
vLayout->addWidget(status, 1, Qt::AlignBottom); vLayout->addWidget(status, 1, Qt::AlignBottom);

View File

@ -32,7 +32,7 @@
using namespace QtDataVisualization; using namespace QtDataVisualization;
#define LOW_END_DEVICE // Uncomment for devices with limited processing/grpahics power //#define LOW_END_DEVICE // Uncomment for devices with limited processing/grpahics power
#ifdef LOW_END_DEVICE #ifdef LOW_END_DEVICE
const QSize lowRes = QSize(160, 120); const QSize lowRes = QSize(160, 120);
@ -48,6 +48,8 @@ const QSize maxRes = QSize(640, 480);
SurfaceData::SurfaceData(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars, SurfaceData::SurfaceData(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars,
QTextEdit *statusArea) : QTextEdit *statusArea) :
m_thermalTheme(new Q3DTheme(Q3DTheme::ThemeIsabelle)),
m_highlightTheme(new Q3DTheme(Q3DTheme::ThemeQt)),
m_surface(surface), m_surface(surface),
m_scatter(scatter), m_scatter(scatter),
m_bars(bars), m_bars(bars),
@ -57,8 +59,32 @@ SurfaceData::SurfaceData(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars
m_resolutionLevel(0), m_resolutionLevel(0),
m_mode(Surface) m_mode(Surface)
{ {
// Initialize themes for surface
m_thermalTheme->setGridEnabled(false);
m_thermalTheme->setBackgroundEnabled(false);
m_thermalTheme->setColorStyle(Q3DTheme::ColorStyleRangeGradient);
QLinearGradient thermalGradient;
thermalGradient.setColorAt(0.0, Qt::black);
thermalGradient.setColorAt(0.33, Qt::blue);
thermalGradient.setColorAt(0.67, Qt::red);
thermalGradient.setColorAt(1.0, Qt::yellow);
QList<QLinearGradient> thermalGradients;
thermalGradients.append(thermalGradient);
m_thermalTheme->setBaseGradients(thermalGradients);
m_highlightTheme->setGridEnabled(false);
m_highlightTheme->setBackgroundEnabled(false);
m_highlightTheme->setColorStyle(Q3DTheme::ColorStyleRangeGradient);
QLinearGradient highlightGradient;
highlightGradient.setColorAt(0.0, Qt::white);
highlightGradient.setColorAt(0.8, Qt::red);
highlightGradient.setColorAt(1.0, Qt::green);
QList<QLinearGradient> highlightGradients;
highlightGradients.append(highlightGradient);
m_highlightTheme->setBaseGradients(highlightGradients);
// Initialize surface // Initialize surface
m_surface->activeTheme()->setType(Q3DTheme::ThemeIsabelle); m_surface->setActiveTheme(m_thermalTheme);
QLinearGradient gradient; QLinearGradient gradient;
gradient.setColorAt(0.0, Qt::black); gradient.setColorAt(0.0, Qt::black);
gradient.setColorAt(0.33, Qt::blue); gradient.setColorAt(0.33, Qt::blue);
@ -66,15 +92,11 @@ SurfaceData::SurfaceData(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars
gradient.setColorAt(1.0, Qt::yellow); gradient.setColorAt(1.0, Qt::yellow);
m_surface->setSelectionMode(QAbstract3DGraph::SelectionNone); m_surface->setSelectionMode(QAbstract3DGraph::SelectionNone);
m_surface->setShadowQuality(QAbstract3DGraph::ShadowQualityNone); m_surface->setShadowQuality(QAbstract3DGraph::ShadowQualityNone);
m_surface->activeTheme()->setGridEnabled(false);
m_surface->activeTheme()->setBackgroundEnabled(false);
m_surface->scene()->activeCamera()->setCameraPosition(0.0, 90.0, 150); m_surface->scene()->activeCamera()->setCameraPosition(0.0, 90.0, 150);
m_surface->axisY()->setMax(255); m_surface->axisY()->setMax(255);
QSurface3DSeries *series1 = new QSurface3DSeries(new QHeightMapSurfaceDataProxy()); QSurface3DSeries *series1 = new QSurface3DSeries(new QHeightMapSurfaceDataProxy());
series1->setFlatShadingEnabled(true); series1->setFlatShadingEnabled(true);
series1->setDrawMode(QSurface3DSeries::DrawSurface); series1->setDrawMode(QSurface3DSeries::DrawSurface);
series1->setColorStyle(Q3DTheme::ColorStyleRangeGradient);
series1->setBaseGradient(gradient);
m_surface->addSeries(series1); m_surface->addSeries(series1);
// Initialize scatter // Initialize scatter
@ -82,7 +104,7 @@ SurfaceData::SurfaceData(Q3DSurface *surface, Q3DScatter *scatter, Q3DBars *bars
m_scatter->setSelectionMode(QAbstract3DGraph::SelectionNone); m_scatter->setSelectionMode(QAbstract3DGraph::SelectionNone);
m_scatter->activeTheme()->setGridEnabled(false); m_scatter->activeTheme()->setGridEnabled(false);
m_scatter->setShadowQuality(QAbstract3DGraph::ShadowQualityLow); m_scatter->setShadowQuality(QAbstract3DGraph::ShadowQualityLow);
m_scatter->scene()->activeCamera()->setCameraPosition(0.0, 85.0, 150); m_scatter->scene()->activeCamera()->setCameraPosition(0.0, 60.0, 150);
QScatter3DSeries *series2 = new QScatter3DSeries; QScatter3DSeries *series2 = new QScatter3DSeries;
#ifdef LOW_END_DEVICE #ifdef LOW_END_DEVICE
series2->setMesh(QAbstract3DSeries::MeshPoint); series2->setMesh(QAbstract3DSeries::MeshPoint);
@ -260,26 +282,13 @@ void SurfaceData::scrollDown()
void SurfaceData::useGradientOne() void SurfaceData::useGradientOne()
{ {
m_surface->activeTheme()->setType(Q3DTheme::ThemeIsabelle); m_surface->setActiveTheme(m_thermalTheme);
QLinearGradient gradient;
gradient.setColorAt(0.0, Qt::black);
gradient.setColorAt(0.33, Qt::blue);
gradient.setColorAt(0.67, Qt::red);
gradient.setColorAt(1.0, Qt::yellow);
m_surface->seriesList().at(0)->setBaseGradient(gradient);
m_surface->seriesList().at(0)->setColorStyle(Q3DTheme::ColorStyleRangeGradient);
m_statusArea->append(QStringLiteral("<b>Colors:</b> Thermal image imitation")); m_statusArea->append(QStringLiteral("<b>Colors:</b> Thermal image imitation"));
} }
void SurfaceData::useGradientTwo() void SurfaceData::useGradientTwo()
{ {
m_surface->activeTheme()->setType(Q3DTheme::ThemeQt); m_surface->setActiveTheme(m_highlightTheme);
QLinearGradient gradient;
gradient.setColorAt(0.0, Qt::white);
gradient.setColorAt(0.8, Qt::red);
gradient.setColorAt(1.0, Qt::green);
m_surface->seriesList().at(0)->setBaseGradient(gradient);
m_surface->seriesList().at(0)->setColorStyle(Q3DTheme::ColorStyleRangeGradient);
m_statusArea->append(QStringLiteral("<b>Colors:</b> Highlight foreground")); m_statusArea->append(QStringLiteral("<b>Colors:</b> Highlight foreground"));
} }

View File

@ -63,6 +63,8 @@ public slots:
void changeMode(int mode); void changeMode(int mode);
private: private:
Q3DTheme *m_thermalTheme;
Q3DTheme *m_highlightTheme;
Q3DSurface *m_surface; Q3DSurface *m_surface;
Q3DScatter *m_scatter; Q3DScatter *m_scatter;
Q3DBars *m_bars; Q3DBars *m_bars;