summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Korpipää <tomi.korpipaa@digia.com>2013-04-04 08:03:01 +0300
committerTomi Korpipää <tomi.korpipaa@digia.com>2013-04-04 08:08:49 +0300
commit8098e1c5449da48293613f968a1d8bb2c402a417 (patch)
tree23982d474bce0d1f9d057fde2d2355f8430afcc1
parent3f0309389e900ebfd94b70f97d290dc5fa3a1964 (diff)
Added a data item class
Changed barchart example to use actual data Change-Id: Id19166e3b21877550b7be3cfd2260b57873adb24 Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
-rw-r--r--examples/datavis3d/barchart/main.cpp271
-rw-r--r--src/datavis3d/engine/engine.pri5
-rw-r--r--src/datavis3d/engine/q3dbars.cpp162
-rw-r--r--src/datavis3d/engine/q3dbars.h80
-rw-r--r--src/datavis3d/engine/q3dbars_p.h49
-rw-r--r--src/datavis3d/engine/q3dwindow.cpp67
-rw-r--r--src/datavis3d/engine/qdataitem.cpp116
-rw-r--r--src/datavis3d/engine/qdataitem.h70
-rw-r--r--src/datavis3d/engine/qdataitem_p.h (renamed from src/datavis3d/engine/sampledata_p.h)26
-rw-r--r--src/datavis3d/engine/sampledata.cpp85
-rw-r--r--src/datavis3d/utils/camerahelper.cpp41
-rw-r--r--src/datavis3d/utils/camerahelper_p.h41
-rw-r--r--src/datavis3d/utils/meshloader.cpp41
-rw-r--r--src/datavis3d/utils/meshloader_p.h41
-rw-r--r--src/datavis3d/utils/objecthelper.cpp53
-rw-r--r--src/datavis3d/utils/objecthelper_p.h2
-rw-r--r--src/datavis3d/utils/shaderhelper.cpp53
-rw-r--r--src/datavis3d/utils/shaderhelper_p.h2
-rw-r--r--src/datavis3d/utils/utils.cpp41
-rw-r--r--src/datavis3d/utils/utils_p.h41
-rw-r--r--src/datavis3d/utils/vertexindexer.cpp41
-rw-r--r--src/datavis3d/utils/vertexindexer_p.h41
22 files changed, 1118 insertions, 251 deletions
diff --git a/examples/datavis3d/barchart/main.cpp b/examples/datavis3d/barchart/main.cpp
index 2b28f39a..ecb92820 100644
--- a/examples/datavis3d/barchart/main.cpp
+++ b/examples/datavis3d/barchart/main.cpp
@@ -39,6 +39,7 @@
****************************************************************************/
#include "q3dbars.h"
+#include "qdataitem.h"
#include <QGuiApplication>
#include <QTimer>
@@ -46,8 +47,16 @@
//#define CYCLE_THROUGH_STYLES
//#define CYCLE_THROUGH_PRESET_CAMERAS
-#define CYCLE_THROUGH_THEMES
-#define USE_STATIC_DATA
+//#define CYCLE_THROUGH_THEMES
+#define USE_ACTUAL_DATA
+
+#ifdef USE_ACTUAL_DATA
+const int rows = 13;
+const int columns = 12;
+#else
+const int rows = 9;
+const int columns = 9;
+#endif
using namespace QtDataVis3D;
@@ -80,24 +89,52 @@ ChartDataGenerator::ChartDataGenerator(Q3DBars *barchart)
, m_styleTimer(0)
, m_presetTimer(0)
, m_themeTimer(0)
- , m_columnCount(10)
- , m_rowCount(10)
+ , m_columnCount(columns)
+ , m_rowCount(rows)
{
- // Set up bar specifications; make the bars twice as wide as they are deep,
+ // Set up bar specifications; make the bars as wide as they are deep,
// and add a small space between the bars
m_chart->setBarSpecs(QPointF(1.0f, 1.0f), QPointF(0.2f, 0.2f), true);
- // Set up sample space; make it twice as deep as it's wide
+
+#ifndef USE_ACTUAL_DATA
+ // Set up sample space; make it as deep as it's wide
m_chart->setupSampleSpace(QPoint(m_columnCount, m_rowCount));
+#else
+ // Set up sample space; make it match actual data size
+ m_chart->setupSampleSpace(QPoint(m_columnCount, m_rowCount)
+ , QStringLiteral("year"), QStringLiteral("month")
+ , QStringLiteral("rainfall (in mm)"));
+#endif
+
// Set bar type to smooth bar
#ifndef CYCLE_THROUGH_STYLES
+#ifdef USE_ACTUAL_DATA
+ m_chart->setBarType(Q3DBars::Cylinders, true);
+#else
m_chart->setBarType(Q3DBars::Bars, false);
#endif
+#endif
+
+#ifdef USE_ACTUAL_DATA
+ // Set selection mode to bar and column
+ m_chart->setSelectionMode(Q3DBars::BarAndColumn);
+#else
// Set selection mode to full
m_chart->setSelectionMode(Q3DBars::BarRowAndColumn);
+#endif
+
#ifndef CYCLE_THROUGH_THEMES
+#ifndef USE_ACTUAL_DATA
// Set bar colors
m_chart->setBarColor(QColor(Qt::black), QColor(Qt::red), QColor(Qt::darkBlue));
+#else
+ // Set theme
+ m_chart->setTheme(Q3DBars::ThemeBlueNcs);
#endif
+#endif
+
+ // Set preset camera position
+ m_chart->setCameraPreset(Q3DBars::PresetFront);
}
ChartDataGenerator::~ChartDataGenerator()
@@ -123,7 +160,7 @@ ChartDataGenerator::~ChartDataGenerator()
void ChartDataGenerator::start()
{
-#ifndef USE_STATIC_DATA
+#ifndef USE_ACTUAL_DATA
m_dataTimer = new QTimer();
m_dataTimer->setTimerType(Qt::CoarseTimer);
m_dataTimer->setInterval(100);
@@ -156,26 +193,234 @@ void ChartDataGenerator::start()
// Change theme every 2 seconds
m_themeTimer = new QTimer();
m_themeTimer->setTimerType(Qt::CoarseTimer);
- m_themeTimer->setInterval(2000);
+ m_themeTimer->setInterval(6000);//2000);
QObject::connect(m_themeTimer, &QTimer::timeout, this
, &ChartDataGenerator::changeTheme);
- m_themeTimer->start(2000);
+ m_themeTimer->start(6000);//2000);
#endif
}
void ChartDataGenerator::addDataSet()
{
+#if 0
QVector< QVector<float> > data;
QVector<float> row;
+ // TODO: Keep here for testing
for (int j = 0; j < m_rowCount; j++) {
for (int i = 0; i < m_columnCount; i++) {
- row.append(((float)i / (float)m_columnCount) / 1.5f + (float)(rand() % 30) / 100);
- //row.append(1.0f);
+ //row.prepend(((float)i / (float)m_columnCount) / 1.5f + (float)(rand() % 30) / 100);
+ row.prepend(1.0f);
}
- data.append(row);
+ data.prepend(row);
row.clear();
}
- m_chart->addDataSet(data);
+#else
+ m_chart->setWindowTitle(QStringLiteral("Monthly rainfall in Northern Finland (2000-2012)"));
+ // Fill in rainfall per month from 2000 to 2012 in Northern Finland (Sodankylä, Utsjoki, Kuusamo)
+ QVector< QVector<QDataItem*> > data;
+ QVector<QDataItem*> row;
+ // 2000
+ row.prepend(new QDataItem(72, "mm, January 2000"));
+ row.prepend(new QDataItem(47, "mm, February 2000"));
+ row.prepend(new QDataItem(37, "mm, March 2000"));
+ row.prepend(new QDataItem(79, "mm, April 2000"));
+ row.prepend(new QDataItem(42, "mm, May 2000"));
+ row.prepend(new QDataItem(73, "mm, June 2000"));
+ row.prepend(new QDataItem(94, "mm, July 2000"));
+ row.prepend(new QDataItem(37, "mm, August 2000"));
+ row.prepend(new QDataItem(17, "mm, September 2000"));
+ row.prepend(new QDataItem(69, "mm, October 2000"));
+ row.prepend(new QDataItem(42, "mm, November 2000"));
+ row.prepend(new QDataItem(42, "mm, December 2000"));
+ data.prepend(row);
+ row.clear();
+ // 2001
+ row.prepend(new QDataItem(25, "mm, January 2001"));
+ row.prepend(new QDataItem(47, "mm, February 2001"));
+ row.prepend(new QDataItem(20, "mm, March 2001"));
+ row.prepend(new QDataItem(70, "mm, April 2001"));
+ row.prepend(new QDataItem(27, "mm, May 2001"));
+ row.prepend(new QDataItem(40, "mm, June 2001"));
+ row.prepend(new QDataItem(123, "mm, July 2001"));
+ row.prepend(new QDataItem(39, "mm, August 2001"));
+ row.prepend(new QDataItem(66, "mm, September 2001"));
+ row.prepend(new QDataItem(55, "mm, October 2001"));
+ row.prepend(new QDataItem(29, "mm, November 2001"));
+ row.prepend(new QDataItem(12, "mm, December 2001"));
+ data.prepend(row);
+ row.clear();
+ // 2002
+ row.prepend(new QDataItem(24, "mm, January 2002"));
+ row.prepend(new QDataItem(45, "mm, February 2002"));
+ row.prepend(new QDataItem(27, "mm, March 2002"));
+ row.prepend(new QDataItem(30, "mm, April 2002"));
+ row.prepend(new QDataItem(16, "mm, May 2002"));
+ row.prepend(new QDataItem(98, "mm, June 2002"));
+ row.prepend(new QDataItem(122, "mm, July 2002"));
+ row.prepend(new QDataItem(20, "mm, August 2002"));
+ row.prepend(new QDataItem(50, "mm, September 2002"));
+ row.prepend(new QDataItem(24, "mm, October 2002"));
+ row.prepend(new QDataItem(22, "mm, November 2002"));
+ row.prepend(new QDataItem(12, "mm, December 2002"));
+ data.prepend(row);
+ row.clear();
+ // 2003
+ row.prepend(new QDataItem(43, "mm, January 2003"));
+ row.prepend(new QDataItem(17, "mm, February 2003"));
+ row.prepend(new QDataItem(26, "mm, March 2003"));
+ row.prepend(new QDataItem(22, "mm, April 2003"));
+ row.prepend(new QDataItem(60, "mm, May 2003"));
+ row.prepend(new QDataItem(14, "mm, June 2003"));
+ row.prepend(new QDataItem(86, "mm, July 2003"));
+ row.prepend(new QDataItem(77, "mm, August 2003"));
+ row.prepend(new QDataItem(69, "mm, September 2003"));
+ row.prepend(new QDataItem(49, "mm, October 2003"));
+ row.prepend(new QDataItem(23, "mm, November 2003"));
+ row.prepend(new QDataItem(44, "mm, December 2003"));
+ data.prepend(row);
+ row.clear();
+ // 2004
+ row.prepend(new QDataItem(15, "mm, January 2004"));
+ row.prepend(new QDataItem(19, "mm, February 2004"));
+ row.prepend(new QDataItem(10, "mm, March 2004"));
+ row.prepend(new QDataItem(11, "mm, April 2004"));
+ row.prepend(new QDataItem(41, "mm, May 2004"));
+ row.prepend(new QDataItem(29, "mm, June 2004"));
+ row.prepend(new QDataItem(49, "mm, July 2004"));
+ row.prepend(new QDataItem(72, "mm, August 2004"));
+ row.prepend(new QDataItem(50, "mm, September 2004"));
+ row.prepend(new QDataItem(18, "mm, October 2004"));
+ row.prepend(new QDataItem(19, "mm, November 2004"));
+ row.prepend(new QDataItem(40, "mm, December 2004"));
+ data.prepend(row);
+ row.clear();
+ // 2005
+ row.prepend(new QDataItem(60, "mm, January 2005"));
+ row.prepend(new QDataItem(24, "mm, February 2005"));
+ row.prepend(new QDataItem(12, "mm, March 2005"));
+ row.prepend(new QDataItem(50, "mm, April 2005"));
+ row.prepend(new QDataItem(88, "mm, May 2005"));
+ row.prepend(new QDataItem(32, "mm, June 2005"));
+ row.prepend(new QDataItem(76, "mm, July 2005"));
+ row.prepend(new QDataItem(55, "mm, August 2005"));
+ row.prepend(new QDataItem(92, "mm, September 2005"));
+ row.prepend(new QDataItem(35, "mm, October 2005"));
+ row.prepend(new QDataItem(105, "mm, November 2005"));
+ row.prepend(new QDataItem(59, "mm, December 2005"));
+ data.prepend(row);
+ row.clear();
+ // 2006
+ row.prepend(new QDataItem(27, "mm, January 2006"));
+ row.prepend(new QDataItem(18, "mm, February 2006"));
+ row.prepend(new QDataItem(17, "mm, March 2006"));
+ row.prepend(new QDataItem(26, "mm, April 2006"));
+ row.prepend(new QDataItem(24, "mm, May 2006"));
+ row.prepend(new QDataItem(18, "mm, June 2006"));
+ row.prepend(new QDataItem(35, "mm, July 2006"));
+ row.prepend(new QDataItem(28, "mm, August 2006"));
+ row.prepend(new QDataItem(80, "mm, September 2006"));
+ row.prepend(new QDataItem(52, "mm, October 2006"));
+ row.prepend(new QDataItem(43, "mm, November 2006"));
+ row.prepend(new QDataItem(44, "mm, December 2006"));
+ data.prepend(row);
+ row.clear();
+ // 2007
+ row.prepend(new QDataItem(41, "mm, January 2007"));
+ row.prepend(new QDataItem(21, "mm, February 2007"));
+ row.prepend(new QDataItem(30, "mm, March 2007"));
+ row.prepend(new QDataItem(20, "mm, April 2007"));
+ row.prepend(new QDataItem(53, "mm, May 2007"));
+ row.prepend(new QDataItem(29, "mm, June 2007"));
+ row.prepend(new QDataItem(139, "mm, July 2007"));
+ row.prepend(new QDataItem(52, "mm, August 2007"));
+ row.prepend(new QDataItem(51, "mm, September 2007"));
+ row.prepend(new QDataItem(24, "mm, October 2007"));
+ row.prepend(new QDataItem(47, "mm, November 2007"));
+ row.prepend(new QDataItem(33, "mm, December 2007"));
+ data.prepend(row);
+ row.clear();
+ // 2008
+ row.prepend(new QDataItem(67, "mm, January 2008"));
+ row.prepend(new QDataItem(19, "mm, February 2008"));
+ row.prepend(new QDataItem(30, "mm, March 2008"));
+ row.prepend(new QDataItem(31, "mm, April 2008"));
+ row.prepend(new QDataItem(29, "mm, May 2008"));
+ row.prepend(new QDataItem(79, "mm, June 2008"));
+ row.prepend(new QDataItem(75, "mm, July 2008"));
+ row.prepend(new QDataItem(99, "mm, August 2008"));
+ row.prepend(new QDataItem(34, "mm, September 2008"));
+ row.prepend(new QDataItem(52, "mm, October 2008"));
+ row.prepend(new QDataItem(60, "mm, November 2008"));
+ row.prepend(new QDataItem(20, "mm, December 2008"));
+ data.prepend(row);
+ row.clear();
+ // 2009
+ row.prepend(new QDataItem(9, "mm, January 2009"));
+ row.prepend(new QDataItem(22, "mm, February 2009"));
+ row.prepend(new QDataItem(11, "mm, March 2009"));
+ row.prepend(new QDataItem(10, "mm, April 2009"));
+ row.prepend(new QDataItem(69, "mm, May 2009"));
+ row.prepend(new QDataItem(30, "mm, June 2009"));
+ row.prepend(new QDataItem(78, "mm, July 2009"));
+ row.prepend(new QDataItem(93, "mm, August 2009"));
+ row.prepend(new QDataItem(70, "mm, September 2009"));
+ row.prepend(new QDataItem(32, "mm, October 2009"));
+ row.prepend(new QDataItem(56, "mm, November 2009"));
+ row.prepend(new QDataItem(23, "mm, December 2009"));
+ data.prepend(row);
+ row.clear();
+ // 2010
+ row.prepend(new QDataItem(12, "mm, January 2010"));
+ row.prepend(new QDataItem(28, "mm, February 2010"));
+ row.prepend(new QDataItem(55, "mm, March 2010"));
+ row.prepend(new QDataItem(20, "mm, April 2010"));
+ row.prepend(new QDataItem(65, "mm, May 2010"));
+ row.prepend(new QDataItem(26, "mm, June 2010"));
+ row.prepend(new QDataItem(134, "mm, July 2010"));
+ row.prepend(new QDataItem(57, "mm, August 2010"));
+ row.prepend(new QDataItem(51, "mm, September 2010"));
+ row.prepend(new QDataItem(53, "mm, October 2010"));
+ row.prepend(new QDataItem(8, "mm, November 2010"));
+ row.prepend(new QDataItem(9, "mm, December 2010"));
+ data.prepend(row);
+ row.clear();
+ // 2011
+ row.prepend(new QDataItem(34, "mm, January 2011"));
+ row.prepend(new QDataItem(20, "mm, February 2011"));
+ row.prepend(new QDataItem(30, "mm, March 2011"));
+ row.prepend(new QDataItem(31, "mm, April 2011"));
+ row.prepend(new QDataItem(42, "mm, May 2011"));
+ row.prepend(new QDataItem(78, "mm, June 2011"));
+ row.prepend(new QDataItem(85, "mm, July 2011"));
+ row.prepend(new QDataItem(33, "mm, August 2011"));
+ row.prepend(new QDataItem(42, "mm, September 2011"));
+ row.prepend(new QDataItem(87, "mm, October 2011"));
+ row.prepend(new QDataItem(41, "mm, November 2011"));
+ row.prepend(new QDataItem(72, "mm, December 2011"));
+ data.prepend(row);
+ row.clear();
+ // 2012
+ row.prepend(new QDataItem(32, "mm, January 2012"));
+ row.prepend(new QDataItem(42, "mm, February 2012"));
+ row.prepend(new QDataItem(30, "mm, March 2012"));
+ row.prepend(new QDataItem(50, "mm, April 2012"));
+ row.prepend(new QDataItem(30, "mm, May 2012"));
+ row.prepend(new QDataItem(70, "mm, June 2012"));
+ row.prepend(new QDataItem(52, "mm, July 2012"));
+ row.prepend(new QDataItem(20, "mm, August 2012"));
+ row.prepend(new QDataItem(99, "mm, September 2012"));
+ row.prepend(new QDataItem(70, "mm, October 2012"));
+ row.prepend(new QDataItem(69, "mm, November 2012"));
+ row.prepend(new QDataItem(49, "mm, December 2012"));
+ data.prepend(row);
+ row.clear();
+ // Set up row and column names
+ QVector<QString> months;
+ months << "January" << "February" << "March" << "April" << "May" << "June" << "July" << "August" << "September" << "October" << "November" << "December";
+ QVector<QString> years;
+ years << "2000" << "2001" << "2002" << "2003" << "2004" << "2005" << "2006" << "2007" << "2008" << "2009" << "2010" << "2011" << "2012";
+#endif
+ m_chart->addDataSet(data, years, months);
}
void ChartDataGenerator::addBars()
diff --git a/src/datavis3d/engine/engine.pri b/src/datavis3d/engine/engine.pri
index 4292ae87..54f7cf6b 100644
--- a/src/datavis3d/engine/engine.pri
+++ b/src/datavis3d/engine/engine.pri
@@ -1,11 +1,12 @@
SOURCES += $$PWD/q3dwindow.cpp \
$$PWD/q3dbars.cpp \
- $$PWD/sampledata.cpp
+ $$PWD/qdataitem.cpp
HEADERS += $$PWD/q3dwindow_p.h \
$$PWD/q3dwindow.h \
$$PWD/q3dbars.h \
$$PWD/q3dbars_p.h \
- $$PWD/sampledata_p.h
+ $$PWD/qdataitem.h \
+ $$PWD/qdataitem_p.h
RESOURCES += engine/engine.qrc
diff --git a/src/datavis3d/engine/q3dbars.cpp b/src/datavis3d/engine/q3dbars.cpp
index 83967e43..472ff4e4 100644
--- a/src/datavis3d/engine/q3dbars.cpp
+++ b/src/datavis3d/engine/q3dbars.cpp
@@ -3,36 +3,37 @@
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the QtDataVis3D module.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -41,7 +42,7 @@
#include "q3dbars.h"
#include "q3dbars_p.h"
#include "camerahelper_p.h"
-#include "sampledata_p.h"
+#include "qdataitem_p.h"
#include "shaderhelper_p.h"
#include "objecthelper_p.h"
#include "utils_p.h"
@@ -151,7 +152,7 @@ void Q3DBars::render(QPainter *painter)
// If a bar is selected, display it's value
// TODO: Move text printing to a helper class, so that it can be used from other vis types?
- SampleData *data = d_ptr->m_selectedBar;
+ QDataItem *data = d_ptr->m_selectedBar;
if (data) {
glDisable(GL_DEPTH_TEST);
painter->save();
@@ -168,7 +169,7 @@ void Q3DBars::render(QPainter *painter)
painter->setFont(bgrFont);
QFontMetrics valueFM(valueFont);
QFontMetrics bgrFM(bgrFont);
- int valueStrLen = valueFM.width(data->valueStr());
+ int valueStrLen = valueFM.width(data->d_ptr->valueStr());
int bgrStrLen = 0;
int bgrHeight = valueFM.height() + 6;
QString bgrStr = QString();
@@ -181,19 +182,19 @@ void Q3DBars::render(QPainter *painter)
// , data->position().y() - 30
// , bgrLen, 30, 10.0, 10.0);
// Hack solution, as drawRect doesn't work
- painter->drawText(data->position().x() - (bgrStrLen / 2)
- , data->position().y() - bgrHeight
+ painter->drawText(data->d_ptr->position().x() - (bgrStrLen / 2)
+ , data->d_ptr->position().y() - bgrHeight
, bgrStrLen, bgrHeight
, Qt::AlignCenter | Qt::AlignVCenter
, bgrStr);
//painter->setPen(d_ptr->m_textColor);
painter->setPen(Qt::lightGray); // TODO: Use lightGray, as nothing works
painter->setFont(valueFont);
- painter->drawText(data->position().x() - (valueStrLen / 2)
- , data->position().y() - bgrHeight
+ painter->drawText(data->d_ptr->position().x() - (valueStrLen / 2)
+ , data->d_ptr->position().y() - bgrHeight
, valueStrLen, bgrHeight
, Qt::AlignCenter | Qt::AlignVCenter
- , data->valueStr());
+ , data->d_ptr->valueStr());
painter->restore();
}
}
@@ -279,7 +280,8 @@ void Q3DBars::drawScene()
glDisable(GL_DITHER); // disable dithering, it may affect colors if enabled
for (int row = startRow; row != stopRow; row += stepRow) {
for (int bar = startBar; bar != stopBar; bar += stepBar) {
- float barHeight = d_ptr->m_dataSet.at(row).at(bar);
+ QDataItem *item = d_ptr->m_dataSet.at(row).at(bar);
+ float barHeight = item->d_ptr->value() / d_ptr->m_heightNormalizer;
QMatrix4x4 modelMatrix;
QMatrix4x4 MVPMatrix;
barPos = (bar + 1) * (d_ptr->m_barSpacing.x());
@@ -469,7 +471,8 @@ void Q3DBars::drawScene()
bool barSelectionFound = false;
for (int row = startRow; row != stopRow; row += stepRow) {
for (int bar = startBar; bar != stopBar; bar += stepBar) {
- float barHeight = d_ptr->m_dataSet.at(row).at(bar);
+ QDataItem *item = d_ptr->m_dataSet.at(row).at(bar);
+ float barHeight = item->d_ptr->value() / d_ptr->m_heightNormalizer;
if (barHeight == 0)
continue;
QMatrix4x4 modelMatrix;
@@ -507,11 +510,9 @@ void Q3DBars::drawScene()
// qDebug() << "selected object:" << barIndex << "( row:" << row + 1 << ", column:" << bar + 1 << ")";
// qDebug() /*<< barIndex*/ << "object position:" << modelMatrix.column(3).toVector3D();
//}
- // Save data to SampleData
- if (d_ptr->m_selectedBar)
- delete d_ptr->m_selectedBar;
- d_ptr->m_selectedBar = new SampleData(d_ptr->m_mousePos, barHeight);
- //d_ptr->m_selectedBar->setPosition(QPoint());
+ // Insert data to QDataItem. We have no ownership, don't delete the previous one
+ d_ptr->m_selectedBar = item;
+ d_ptr->m_selectedBar->d_ptr->setPosition(d_ptr->m_mousePos);
barSelectionFound = true;
break;
}
@@ -594,7 +595,7 @@ void Q3DBars::drawScene()
}
}
if (!barSelectionFound) {
- delete d_ptr->m_selectedBar;
+ // We have no ownership, don't delete. Just NULL the pointer.
d_ptr->m_selectedBar = NULL;
}
@@ -759,13 +760,14 @@ void Q3DBars::setMeshFileName(const QString &objFileName)
d_ptr->m_objFile = objFileName;
}
-void Q3DBars::setupSampleSpace(QPoint sampleCount)
+void Q3DBars::setupSampleSpace(QPoint sampleCount, const QString &labelRow
+ , const QString &labelColumn, const QString &labelHeight)
{
d_ptr->m_sampleCount = sampleCount;
// Initialize data set
- QVector<float> row;
+ QVector<QDataItem*> row;
for (int columns = 0; columns < sampleCount.x(); columns ++) {
- row.append(0.0f);
+ row.append(new QDataItem());
}
for (int rows = 0; rows < sampleCount.y(); rows++) {
d_ptr->m_dataSet.append(row);
@@ -1080,7 +1082,13 @@ void Q3DBars::setSelectionMode(SelectionMode mode)
d_ptr->m_selectionMode = mode;
}
-void Q3DBars::addDataRow(const QVector<float> &dataRow)
+void Q3DBars::setWindowTitle(const QString &title)
+{
+ setTitle(title);
+}
+
+void Q3DBars::addDataRow(const QVector<float> &dataRow, const QString &labelRow
+ , const QVector<QString> &labelsColumn)
{
QVector<float> row = dataRow;
// Check that the input data fits into sample space, and resize if it doesn't
@@ -1088,6 +1096,31 @@ void Q3DBars::addDataRow(const QVector<float> &dataRow)
row.resize(d_ptr->m_sampleCount.x());
qWarning("Data set too large for sample space");
}
+ // Convert row of floats into sample data
+ QVector<QDataItem*> sampleRow;
+ for (int i = 0; i < row.size(); i++) {
+ sampleRow.append(new QDataItem(row.at(i)));
+ }
+ d_ptr->findHighestValue(sampleRow);
+ // The vector contains data (=height) for each bar, a row at a time
+ // With each new row, the previous data set (=row) must be moved back
+ // ie. we need as many vectors as we have rows in the sample space
+ d_ptr->m_dataSet.prepend(sampleRow);
+ // if the added data pushed us over sample space, remove the oldest data set
+ if (d_ptr->m_dataSet.size() > d_ptr->m_sampleCount.y())
+ d_ptr->m_dataSet.resize(d_ptr->m_sampleCount.y());
+}
+
+void Q3DBars::addDataRow(const QVector<QDataItem*> &dataRow, const QString &labelRow
+ , const QVector<QString> &labelsColumn)
+{
+ QVector<QDataItem*> row = dataRow;
+ // Check that the input data fits into sample space, and resize if it doesn't
+ if (row.size() > d_ptr->m_sampleCount.x()) {
+ row.resize(d_ptr->m_sampleCount.x());
+ qWarning("Data set too large for sample space");
+ }
+ d_ptr->findHighestValue(row);
// The vector contains data (=height) for each bar, a row at a time
// With each new row, the previous data set (=row) must be moved back
// ie. we need as many vectors as we have rows in the sample space
@@ -1097,7 +1130,26 @@ void Q3DBars::addDataRow(const QVector<float> &dataRow)
d_ptr->m_dataSet.resize(d_ptr->m_sampleCount.y());
}
-void Q3DBars::addDataSet(const QVector< QVector<float> > &data)
+void Q3DBars::addDataSet(const QVector< QVector<float> > &data, const QVector<QString> &labelsRow
+ , const QVector<QString> &labelsColumn)
+{
+ d_ptr->m_dataSet.clear();
+ // Check sizes
+ if (data.at(0).size() > d_ptr->m_sampleCount.x()) {
+ qCritical("Too much data per row, aborting");
+ return;
+ }
+ for (int i = 0; i < data.size(); i++)
+ addDataRow(data.at(i));
+
+ if (d_ptr->m_dataSet.size() > d_ptr->m_sampleCount.y()) {
+ qWarning("Data set too large for sample space. Cropping it to fit.");
+ d_ptr->m_dataSet.resize(d_ptr->m_sampleCount.y());
+ }
+}
+
+void Q3DBars::addDataSet(const QVector< QVector<QDataItem*> > &data, const QVector<QString> &labelsRow
+ , const QVector<QString> &labeslsColumn)
{
d_ptr->m_dataSet.clear();
// Check sizes
@@ -1105,11 +1157,16 @@ void Q3DBars::addDataSet(const QVector< QVector<float> > &data)
qCritical("Too much data per row, aborting");
return;
}
+
d_ptr->m_dataSet = data;
+
if (d_ptr->m_dataSet.size() > d_ptr->m_sampleCount.y()) {
qWarning("Data set too large for sample space. Cropping it to fit.");
d_ptr->m_dataSet.resize(d_ptr->m_sampleCount.y());
}
+
+ for (int i = 0; i < d_ptr->m_dataSet.size(); i++)
+ d_ptr->findHighestValue(d_ptr->m_dataSet.at(i));
}
Q3DBarsPrivate::Q3DBarsPrivate(Q3DBars *q)
@@ -1130,6 +1187,7 @@ Q3DBarsPrivate::Q3DBarsPrivate(Q3DBars *q)
, m_barThickness(QPointF(0.75f, 0.75f))
, m_barSpacing(m_barThickness * 3.0f)
, m_dataSet(0)
+ , m_heightNormalizer(0.0f)
, m_rowWidth(0)
, m_columnDepth(0)
, m_maxDimension(0)
@@ -1176,6 +1234,16 @@ Q3DBarsPrivate::~Q3DBarsPrivate()
#endif
}
+void Q3DBarsPrivate::findHighestValue(const QVector<QDataItem*> &row)
+{
+ for (int i = 0; i < row.size(); i++) {
+ QDataItem *item = row.at(i);
+ float itemValue = item->d_ptr->value();
+ if (m_heightNormalizer < itemValue)
+ m_heightNormalizer = itemValue;
+ }
+}
+
void Q3DBarsPrivate::loadBarMesh()
{
if (m_barObj)
diff --git a/src/datavis3d/engine/q3dbars.h b/src/datavis3d/engine/q3dbars.h
index 0819a059..b5c0ac22 100644
--- a/src/datavis3d/engine/q3dbars.h
+++ b/src/datavis3d/engine/q3dbars.h
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtDataVis3D module.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef Q3DBARS_H
#define Q3DBARS_H
@@ -9,6 +50,7 @@ class QOpenGLShaderProgram;
QTCOMMERCIALDATAVIS3D_BEGIN_NAMESPACE
class Q3DBarsPrivate;
+class QDataItem;
class QTCOMMERCIALDATAVIS3D_EXPORT Q3DBars : public Q3DWindow
{
@@ -72,35 +114,63 @@ public:
// Add a row of data. Each new row is added to the front of the sample space, moving previous
// rows back (if sample space is more than one row deep)
- void addDataRow(const QVector<float> &dataRow);
+ // TODO: Replace QVector<..> with a data row class (QDataRow)? Move labels to class.
+ void addDataRow(const QVector<float> &dataRow
+ , const QString &labelRow = QString()
+ , const QVector<QString> &labelsColumn = QVector<QString>());
+ // TODO: Replace QVector<..> with a data row class (QDataRow)? Move labels to class.
+ void addDataRow(const QVector<QDataItem*> &dataRow
+ , const QString &labelRow = QString()
+ , const QVector<QString> &labelsColumn = QVector<QString>());
+
// Add complete data set at a time, as a vector of data rows
- void addDataSet(const QVector< QVector<float> > &data);
+ // TODO: Replace QVector<QVector<..>> with a data set class (QDataSet)? Move labels to class.
+ void addDataSet(const QVector< QVector<float> > &data
+ , const QVector<QString> &labelsRow = QVector<QString>()
+ , const QVector<QString> &labelsColumn = QVector<QString>());
+
+ // TODO: Replace QVector<QVector<..>> with a data set class (QDataSet)? Move labels to class.
+ void addDataSet(const QVector< QVector<QDataItem*> > &data
+ , const QVector<QString> &labelsRow = QVector<QString>()
+ , const QVector<QString> &labeslsColumn = QVector<QString>());
+
// bar thickness, spacing between bars, and is spacing relative to thickness or absolute
// y -component sets the thickness/spacing of z -direction
// With relative 0.0f means side-to-side, 1.0f = one thickness in between
void setBarSpecs(QPointF thickness = QPointF(1.0f, 1.0f)
, QPointF spacing = QPointF(1.0f, 1.0f)
, bool relative = true);
+
// bar type; bars (=cubes), pyramids, cones, cylinders, etc.
void setBarType(BarStyle style, bool smooth = false);
+
// override bar type with own mesh
void setMeshFileName(const QString &objFileName);
- // how many samples per row and column
- void setupSampleSpace(QPoint sampleCount);
+
+ // how many samples per row and column, and names for axes
+ void setupSampleSpace(QPoint sampleCount, const QString &labelRow = QString()
+ , const QString &labelColumn = QString(), const QString &labelHeight = QString());
+
// Select preset camera placement
void setCameraPreset(CameraPreset preset);
+
// Set camera rotation if you don't want to use the presets (in horizontal (-180...180) and
// vertical (0...90) angles and distance in percentage (10...500))
void setCameraPosition(float horizontal, float vertical, int distance = 100);
+
// Set theme (bar colors, shaders, window color, background colors, light intensity and text colors are affected)
void setTheme(ColorTheme theme);
+
// Set color if you don't want to use themes. Set uniform to false if you want the (height) color to change from bottom to top
void setBarColor(QColor baseColor, QColor heightColor, QColor depthColor, bool uniform = true);
- // TODO: shaderien vaihto (themet?)
+
// TODO: valon siirto / asetus
// Change selection mode; single bar, bar and row, bar and column, or all
void setSelectionMode(SelectionMode mode);
+ // Set window title
+ void setWindowTitle(const QString &title);
+
protected:
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
diff --git a/src/datavis3d/engine/q3dbars_p.h b/src/datavis3d/engine/q3dbars_p.h
index a3ab3949..b434693b 100644
--- a/src/datavis3d/engine/q3dbars_p.h
+++ b/src/datavis3d/engine/q3dbars_p.h
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtDataVis3D module.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef Q3DBARS_p_H
#define Q3DBARS_p_H
@@ -11,7 +52,7 @@ class QPointF;
QTCOMMERCIALDATAVIS3D_BEGIN_NAMESPACE
class Q3DBars;
-class SampleData;
+class QDataItem;
class ShaderHelper;
class ObjectHelper;
@@ -29,6 +70,7 @@ public:
Q3DBarsPrivate(Q3DBars *q);
~Q3DBarsPrivate();
+ void findHighestValue(const QVector<QDataItem*> &row);
void loadBarMesh();
void loadBackgroundMesh();
void initShaders(const QString &vertexShader, const QString &fragmentShader);
@@ -57,7 +99,8 @@ public:
float m_verticalRotation;
QPointF m_barThickness;
QPointF m_barSpacing;
- QVector< QVector<float> > m_dataSet;
+ QVector< QVector<QDataItem*> > m_dataSet;
+ float m_heightNormalizer;
float m_rowWidth;
float m_columnDepth;
float m_maxDimension;
@@ -86,7 +129,7 @@ public:
// ..
bool m_isInitialized;
Q3DBars::SelectionMode m_selectionMode;
- SampleData *m_selectedBar;
+ QDataItem *m_selectedBar;
};
QTCOMMERCIALDATAVIS3D_END_NAMESPACE
diff --git a/src/datavis3d/engine/q3dwindow.cpp b/src/datavis3d/engine/q3dwindow.cpp
index 5521ce90..a2a7d37d 100644
--- a/src/datavis3d/engine/q3dwindow.cpp
+++ b/src/datavis3d/engine/q3dwindow.cpp
@@ -3,36 +3,37 @@
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the QtDataVis3D module.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -66,9 +67,11 @@ Q3DWindow::Q3DWindow(QWindow *parent)
d_ptr->m_context->setFormat(requestedFormat());
d_ptr->m_context->create();
- //d_ptr->m_context->makeCurrent(this); // doesn't work with Mac
-
- //initializeOpenGLFunctions(); // doesn't work with Mac
+#if !defined(Q_OS_MAC)
+ // These are required here for windows (and linux?), but cause errors on mac
+ d_ptr->m_context->makeCurrent(this);
+ initializeOpenGLFunctions();
+#endif
initialize();
}
@@ -137,10 +140,12 @@ void Q3DWindow::renderNow()
d_ptr->m_updatePending = false;
- d_ptr->m_context->makeCurrent(this); // needed here for Mac
+ d_ptr->m_context->makeCurrent(this);
if (needsInit) {
- initializeOpenGLFunctions(); // needed here for Mac
+#if defined(Q_OS_MAC)
+ initializeOpenGLFunctions();
+#endif
getDevice();
initialize();
needsInit = false;
diff --git a/src/datavis3d/engine/qdataitem.cpp b/src/datavis3d/engine/qdataitem.cpp
new file mode 100644
index 00000000..f24d1055
--- /dev/null
+++ b/src/datavis3d/engine/qdataitem.cpp
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtDataVis3D module.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdataitem.h"
+#include "qdataitem_p.h"
+
+#include <QPoint>
+#include <QString>
+
+QTCOMMERCIALDATAVIS3D_BEGIN_NAMESPACE
+
+QDataItem::QDataItem(float value, const QString &label)
+ : d_ptr(new QDataItemPrivate(this, value, label))
+{
+ qDebug("QDataItem");
+}
+
+QDataItem::~QDataItem()
+{
+ qDebug("~QDataItem");
+ delete d_ptr;
+}
+
+void QDataItem::setLabel(const QString &label, bool prepend)
+{
+ d_ptr->m_label = label;
+ d_ptr->m_prependLabel = prepend;
+}
+
+void QDataItem::setValue(float value)
+{
+ d_ptr->m_value = value;
+}
+
+QDataItemPrivate::QDataItemPrivate(QDataItem *parent, float value, const QString &label)
+ : q_ptr(parent)
+ , m_value(value)
+ , m_label(label)
+ , m_prependLabel(false)
+ , m_position(QPoint(0, 0))
+{
+}
+
+QDataItemPrivate::~QDataItemPrivate()
+{
+}
+
+void QDataItemPrivate::setPosition(const QPoint &position)
+{
+ m_position = position;
+}
+
+QPoint QDataItemPrivate::position()
+{
+ return m_position;
+}
+
+float QDataItemPrivate::value()
+{
+ return m_value;
+}
+
+QString QDataItemPrivate::valueStr()
+{
+ QString strVal;
+ if (m_prependLabel) {
+ strVal.append(m_label);
+ strVal.append(QStringLiteral(" "));
+ strVal.setNum(m_value);
+ }
+ else {
+ strVal.setNum(m_value);
+ strVal.append(m_label);
+ }
+ return strVal;
+}
+
+QTCOMMERCIALDATAVIS3D_END_NAMESPACE
diff --git a/src/datavis3d/engine/qdataitem.h b/src/datavis3d/engine/qdataitem.h
new file mode 100644
index 00000000..7cd10fa3
--- /dev/null
+++ b/src/datavis3d/engine/qdataitem.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtDataVis3D module.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDATAITEM_H
+#define QDATAITEM_H
+
+#include "QtDataVis3D/qdatavis3dglobal.h"
+#include <QScopedPointer>
+#include <QString>
+
+QTCOMMERCIALDATAVIS3D_BEGIN_NAMESPACE
+
+class QDataItemPrivate;
+
+class QTCOMMERCIALDATAVIS3D_EXPORT QDataItem
+{
+public:
+ explicit QDataItem(float value = 0.0f, const QString &label = QString());
+ ~QDataItem();
+
+ void setLabel(const QString &label, bool prepend = false); // label for value, unit for example
+ void setValue(float value);
+
+private:
+ QDataItemPrivate *d_ptr; // TODO: Why doesn't QScopedPointer work here?
+ friend class Q3DBars;
+ friend class Q3DBarsPrivate;
+};
+
+QTCOMMERCIALDATAVIS3D_END_NAMESPACE
+
+#endif
diff --git a/src/datavis3d/engine/sampledata_p.h b/src/datavis3d/engine/qdataitem_p.h
index bcc36a1f..c7bec54f 100644
--- a/src/datavis3d/engine/sampledata_p.h
+++ b/src/datavis3d/engine/qdataitem_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+** This file is part of the QtDataVis3D module.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -39,32 +39,36 @@
**
****************************************************************************/
-#ifndef SAMPLEDATA_P_H
-#define SAMPLEDATA_P_H
+#ifndef QDATAITEM_P_H
+#define QDATAITEM_P_H
#include "qdatavis3dglobal.h"
+#include "qdataitem.h"
#include <QPoint>
-
-//class QPoint;
+#include <QString>
QTCOMMERCIALDATAVIS3D_BEGIN_NAMESPACE
-class SampleData
+class QDataItemPrivate
{
public:
- SampleData(QPoint position, float value = 0.0f);
- ~SampleData();
+ explicit QDataItemPrivate(QDataItem *parent, float value = 0.0f
+ , const QString &label = QString());
+ ~QDataItemPrivate();
void setPosition(const QPoint &position);
- void setValue(float value);
QPoint position();
float value();
- QString valueStr();
+ QString valueStr(); // append value and label. If label has prepend -flag set, append label and value
private:
- QPoint m_position;
+ QDataItem *q_ptr;
float m_value;
+ QString m_label;
+ bool m_prependLabel;
+ QPoint m_position;
+ friend class QDataItem;
};
QTCOMMERCIALDATAVIS3D_END_NAMESPACE
diff --git a/src/datavis3d/engine/sampledata.cpp b/src/datavis3d/engine/sampledata.cpp
deleted file mode 100644
index bdb839a0..00000000
--- a/src/datavis3d/engine/sampledata.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "sampledata_p.h"
-
-//#include <QPoint>
-#include <QString>
-
-QTCOMMERCIALDATAVIS3D_BEGIN_NAMESPACE
-
-SampleData::SampleData(QPoint position, float value)
- : m_position(position)
- , m_value(value)
-{
-}
-
-SampleData::~SampleData()
-{
-}
-
-void SampleData::setPosition(const QPoint &position)
-{
- m_position = position;
-}
-
-void SampleData::setValue(float value)
-{
- m_value = value;
-}
-
-QPoint SampleData::position()
-{
- return m_position;
-}
-
-float SampleData::value()
-{
- return m_value;
-}
-
-QString SampleData::valueStr()
-{
- QString strVal;
- strVal.setNum(m_value);
- return strVal;
-}
-
-QTCOMMERCIALDATAVIS3D_END_NAMESPACE
diff --git a/src/datavis3d/utils/camerahelper.cpp b/src/datavis3d/utils/camerahelper.cpp
index 01627d27..53fa57b4 100644
--- a/src/datavis3d/utils/camerahelper.cpp
+++ b/src/datavis3d/utils/camerahelper.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtDataVis3D module.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "camerahelper_p.h"
#include <qmath.h>
diff --git a/src/datavis3d/utils/camerahelper_p.h b/src/datavis3d/utils/camerahelper_p.h
index bea26a34..f6153def 100644
--- a/src/datavis3d/utils/camerahelper_p.h
+++ b/src/datavis3d/utils/camerahelper_p.h
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtDataVis3D module.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef CAMERAPOSITIONER_P_H
#define CAMERAPOSITIONER_P_H
diff --git a/src/datavis3d/utils/meshloader.cpp b/src/datavis3d/utils/meshloader.cpp
index b1d8c5a2..9c586b17 100644
--- a/src/datavis3d/utils/meshloader.cpp
+++ b/src/datavis3d/utils/meshloader.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtDataVis3D module.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "meshloader_p.h"
#include <QFile>
diff --git a/src/datavis3d/utils/meshloader_p.h b/src/datavis3d/utils/meshloader_p.h
index 511225b1..6051c7ae 100644
--- a/src/datavis3d/utils/meshloader_p.h
+++ b/src/datavis3d/utils/meshloader_p.h
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtDataVis3D module.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef MESHLOADER_P_H
#define MESHLOADER_P_H
diff --git a/src/datavis3d/utils/objecthelper.cpp b/src/datavis3d/utils/objecthelper.cpp
index d2de8ffd..e854836a 100644
--- a/src/datavis3d/utils/objecthelper.cpp
+++ b/src/datavis3d/utils/objecthelper.cpp
@@ -3,36 +3,37 @@
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the QtDataVis3D module.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/src/datavis3d/utils/objecthelper_p.h b/src/datavis3d/utils/objecthelper_p.h
index 34871567..17f2d294 100644
--- a/src/datavis3d/utils/objecthelper_p.h
+++ b/src/datavis3d/utils/objecthelper_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+** This file is part of the QtDataVis3D module.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/datavis3d/utils/shaderhelper.cpp b/src/datavis3d/utils/shaderhelper.cpp
index 4ec4f9a8..e73d77c6 100644
--- a/src/datavis3d/utils/shaderhelper.cpp
+++ b/src/datavis3d/utils/shaderhelper.cpp
@@ -3,36 +3,37 @@
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the QtDataVis3D module.
**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
-** of its contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/src/datavis3d/utils/shaderhelper_p.h b/src/datavis3d/utils/shaderhelper_p.h
index ccca0d0b..14781e76 100644
--- a/src/datavis3d/utils/shaderhelper_p.h
+++ b/src/datavis3d/utils/shaderhelper_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+** This file is part of the QtDataVis3D module.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/datavis3d/utils/utils.cpp b/src/datavis3d/utils/utils.cpp
index ea3cee03..fe0b9c5a 100644
--- a/src/datavis3d/utils/utils.cpp
+++ b/src/datavis3d/utils/utils.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtDataVis3D module.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "utils_p.h"
#include <QVector3D>
diff --git a/src/datavis3d/utils/utils_p.h b/src/datavis3d/utils/utils_p.h
index 67ead1fb..11ddf61f 100644
--- a/src/datavis3d/utils/utils_p.h
+++ b/src/datavis3d/utils/utils_p.h
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtDataVis3D module.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef UTILS_P_H
#define UTILS_P_H
diff --git a/src/datavis3d/utils/vertexindexer.cpp b/src/datavis3d/utils/vertexindexer.cpp
index ebbe45f4..4f80eb1b 100644
--- a/src/datavis3d/utils/vertexindexer.cpp
+++ b/src/datavis3d/utils/vertexindexer.cpp
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtDataVis3D module.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#include "vertexindexer_p.h"
#include <string.h> // for memcmp
diff --git a/src/datavis3d/utils/vertexindexer_p.h b/src/datavis3d/utils/vertexindexer_p.h
index a8350224..4c120af5 100644
--- a/src/datavis3d/utils/vertexindexer_p.h
+++ b/src/datavis3d/utils/vertexindexer_p.h
@@ -1,3 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtDataVis3D module.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
#ifndef VERTEXINDEXER_P_H
#define VERTEXINDEXER_P_H