diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-09-10 11:42:13 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-09-10 12:04:24 +0300 |
commit | a28cdb72a4ea768a898ca07f0df0fa3c17c073a8 (patch) | |
tree | 0bafdcfa99fc783e9f5204539a8242bf6128d795 /src/datavis3d/data | |
parent | f3e38983d77c72f3121c33a149a58fdf9c64158c (diff) |
Module renamed
Task-number: QTRD-2224
Change-Id: Iec18b6121809300b11d85445281d3c626c434f35
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src/datavis3d/data')
56 files changed, 0 insertions, 5380 deletions
diff --git a/src/datavis3d/data/abstractitemmodelhandler.cpp b/src/datavis3d/data/abstractitemmodelhandler.cpp deleted file mode 100644 index c441f0d8..00000000 --- a/src/datavis3d/data/abstractitemmodelhandler.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "abstractitemmodelhandler_p.h" -#include "qabstractdatamapping.h" -#include <QTimer> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -AbstractItemModelHandler::AbstractItemModelHandler(QObject *parent) - : QObject(parent), - m_activeMapping(0), - resolvePending(0) -{ - m_resolveTimer.setSingleShot(true); - QObject::connect(&m_resolveTimer, &QTimer::timeout, - this, &AbstractItemModelHandler::handlePendingResolve); -} - -AbstractItemModelHandler::~AbstractItemModelHandler() -{ -} - -void AbstractItemModelHandler::setItemModel(const QAbstractItemModel *itemModel) -{ - if (!m_itemModel.isNull()) - QObject::disconnect(m_itemModel, 0, this, 0); - - m_itemModel = itemModel; - - if (!m_itemModel.isNull()) { - QObject::connect(m_itemModel.data(), &QAbstractItemModel::columnsInserted, - this, &AbstractItemModelHandler::handleColumnsInserted); - QObject::connect(m_itemModel.data(), &QAbstractItemModel::columnsMoved, - this, &AbstractItemModelHandler::handleColumnsMoved); - QObject::connect(m_itemModel.data(), &QAbstractItemModel::columnsRemoved, - this, &AbstractItemModelHandler::handleColumnsRemoved); - QObject::connect(m_itemModel.data(), &QAbstractItemModel::dataChanged, - this, &AbstractItemModelHandler::handleDataChanged); - QObject::connect(m_itemModel.data(), &QAbstractItemModel::layoutChanged, - this, &AbstractItemModelHandler::handleLayoutChanged); - QObject::connect(m_itemModel.data(), &QAbstractItemModel::modelReset, - this, &AbstractItemModelHandler::handleModelReset); - QObject::connect(m_itemModel.data(), &QAbstractItemModel::rowsInserted, - this, &AbstractItemModelHandler::handleRowsInserted); - QObject::connect(m_itemModel.data(), &QAbstractItemModel::rowsMoved, - this, &AbstractItemModelHandler::handleRowsMoved); - QObject::connect(m_itemModel.data(), &QAbstractItemModel::rowsRemoved, - this, &AbstractItemModelHandler::handleRowsRemoved); - } - if (!m_resolveTimer.isActive()) - m_resolveTimer.start(0); -} - -const QAbstractItemModel *AbstractItemModelHandler::itemModel() const -{ - return m_itemModel.data(); -} - -void AbstractItemModelHandler::setActiveMapping(QAbstractDataMapping *mapping) -{ - if (m_activeMapping) - QObject::disconnect(m_activeMapping, 0, this, 0); - - if (mapping) - addMapping(mapping); - - m_activeMapping = mapping; - - if (m_activeMapping) { - QObject::connect(m_activeMapping, &QAbstractDataMapping::mappingChanged, - this, &AbstractItemModelHandler::handleMappingChanged); - } - - if (!m_resolveTimer.isActive()) - m_resolveTimer.start(0); -} - -QAbstractDataMapping *AbstractItemModelHandler::activeMapping() const -{ - return m_activeMapping; -} - -void AbstractItemModelHandler::addMapping(QAbstractDataMapping *mapping) -{ - Q_ASSERT(mapping); - AbstractItemModelHandler *owner = qobject_cast<AbstractItemModelHandler *>(mapping->parent()); - if (owner != this) { - Q_ASSERT_X(!owner, "addMapping", "Mapping already attached to a proxy."); - mapping->setParent(this); - } - if (!m_mappings.contains(mapping)) - m_mappings.append(mapping); -} - -void AbstractItemModelHandler::releaseMapping(QAbstractDataMapping *mapping) -{ - if (mapping && m_mappings.contains(mapping)) { - // If the mapping is in use, clear the existing mapping - if (m_activeMapping == mapping) - setActiveMapping(0); - - m_mappings.removeAll(mapping); - mapping->setParent(0); - } -} - -QList<QAbstractDataMapping *> AbstractItemModelHandler::mappings() const -{ - return m_mappings; -} - -void AbstractItemModelHandler::handleColumnsInserted(const QModelIndex &parent, - int start, int end) -{ - Q_UNUSED(parent) - Q_UNUSED(start) - Q_UNUSED(end) - - // Resolve new items - if (!m_resolveTimer.isActive()) - m_resolveTimer.start(0); // TODO Resolving entire model is inefficient -} - -void AbstractItemModelHandler::handleColumnsMoved(const QModelIndex &sourceParent, - int sourceStart, - int sourceEnd, - const QModelIndex &destinationParent, - int destinationColumn) -{ - Q_UNUSED(sourceParent) - Q_UNUSED(sourceStart) - Q_UNUSED(sourceEnd) - Q_UNUSED(destinationParent) - Q_UNUSED(destinationColumn) - - // Resolve moved items - if (!m_resolveTimer.isActive()) - m_resolveTimer.start(0); // TODO Resolving entire model is inefficient -} - -void AbstractItemModelHandler::handleColumnsRemoved(const QModelIndex &parent, - int start, int end) -{ - Q_UNUSED(parent) - Q_UNUSED(start) - Q_UNUSED(end) - - // Remove old items - if (!m_resolveTimer.isActive()) - m_resolveTimer.start(0); // TODO Resolving entire model is inefficient -} - -void AbstractItemModelHandler::handleDataChanged(const QModelIndex &topLeft, - const QModelIndex &bottomRight, - const QVector<int> &roles) -{ - Q_UNUSED(topLeft) - Q_UNUSED(bottomRight) - Q_UNUSED(roles) - - // Resolve changed items - if (!m_resolveTimer.isActive()) - m_resolveTimer.start(0); // TODO Resolving entire model is inefficient -} - -void AbstractItemModelHandler::handleLayoutChanged(const QList<QPersistentModelIndex> &parents, - QAbstractItemModel::LayoutChangeHint hint) -{ - Q_UNUSED(parents) - Q_UNUSED(hint) - - // Resolve moved items - if (!m_resolveTimer.isActive()) - m_resolveTimer.start(0); // TODO Resolving entire model is inefficient -} - -void AbstractItemModelHandler::handleModelReset() -{ - // Data cleared, reset array - if (!m_resolveTimer.isActive()) - m_resolveTimer.start(0); // TODO Resolving entire model is inefficient -} - -void AbstractItemModelHandler::handleRowsInserted(const QModelIndex &parent, int start, int end) -{ - Q_UNUSED(parent) - Q_UNUSED(start) - Q_UNUSED(end) - - // Resolve new items - if (!m_resolveTimer.isActive()) - m_resolveTimer.start(0); // TODO Resolving entire model is inefficient -} - -void AbstractItemModelHandler::handleRowsMoved(const QModelIndex &sourceParent, - int sourceStart, - int sourceEnd, - const QModelIndex &destinationParent, - int destinationRow) -{ - Q_UNUSED(sourceParent) - Q_UNUSED(sourceStart) - Q_UNUSED(sourceEnd) - Q_UNUSED(destinationParent) - Q_UNUSED(destinationRow) - - // Resolve moved items - if (!m_resolveTimer.isActive()) - m_resolveTimer.start(0); // TODO Resolving entire model is inefficient -} - -void AbstractItemModelHandler::handleRowsRemoved(const QModelIndex &parent, int start, int end) -{ - Q_UNUSED(parent) - Q_UNUSED(start) - Q_UNUSED(end) - - // Resolve removed items - if (!m_resolveTimer.isActive()) - m_resolveTimer.start(0); // TODO Resolving entire model is inefficient -} - -void AbstractItemModelHandler::handleMappingChanged() -{ - if (!m_resolveTimer.isActive()) - m_resolveTimer.start(0); -} - -void AbstractItemModelHandler::handlePendingResolve() -{ - resolveModel(); -} - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/abstractitemmodelhandler_p.h b/src/datavis3d/data/abstractitemmodelhandler_p.h deleted file mode 100644 index aa49faeb..00000000 --- a/src/datavis3d/data/abstractitemmodelhandler_p.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef ABSTRACTITEMMODELHANDLER_P_H -#define ABSTRACTITEMMODELHANDLER_P_H - -#include "datavis3dglobal_p.h" -#include <QAbstractItemModel> -#include <QPointer> -#include <QTimer> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QAbstractDataMapping; - -class AbstractItemModelHandler : public QObject -{ - Q_OBJECT -public: - AbstractItemModelHandler(QObject *parent = 0); - virtual ~AbstractItemModelHandler(); - - virtual void setItemModel(const QAbstractItemModel *itemModel); - virtual const QAbstractItemModel *itemModel() const; - virtual void setActiveMapping(QAbstractDataMapping *mapping); - virtual QAbstractDataMapping *activeMapping() const; - virtual void addMapping(QAbstractDataMapping *mapping); - virtual void releaseMapping(QAbstractDataMapping *mapping); - virtual QList<QAbstractDataMapping *> mappings() const; - -public slots: - virtual void handleColumnsInserted(const QModelIndex &parent, int start, int end); - virtual void handleColumnsMoved(const QModelIndex &sourceParent, int sourceStart, - int sourceEnd, const QModelIndex &destinationParent, - int destinationColumn); - virtual void handleColumnsRemoved(const QModelIndex &parent, int start, int end); - virtual void handleDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, - const QVector<int> &roles = QVector<int> ()); - virtual void handleLayoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), - QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint); - virtual void handleModelReset(); - virtual void handleRowsInserted(const QModelIndex &parent, int start, int end); - virtual void handleRowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, - const QModelIndex &destinationParent, int destinationRow); - virtual void handleRowsRemoved(const QModelIndex &parent, int start, int end); - - virtual void handleMappingChanged(); - virtual void handlePendingResolve(); - -protected: - virtual void resolveModel() = 0; - - QPointer<const QAbstractItemModel> m_itemModel; // Not owned - QAbstractDataMapping *m_activeMapping; - bool resolvePending; - QTimer m_resolveTimer; - QList<QAbstractDataMapping *> m_mappings; - -private: - Q_DISABLE_COPY(AbstractItemModelHandler) -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/abstractrenderitem.cpp b/src/datavis3d/data/abstractrenderitem.cpp deleted file mode 100644 index 296cebb4..00000000 --- a/src/datavis3d/data/abstractrenderitem.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "abstractrenderitem_p.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -AbstractRenderItem::AbstractRenderItem() - : m_selectionLabelItem(0) -{ -} - -AbstractRenderItem::AbstractRenderItem(const AbstractRenderItem &other) -{ - m_selectionLabel = other.m_selectionLabel; - m_translation = other.m_translation; - m_selectionLabelItem = 0; -} - -AbstractRenderItem::~AbstractRenderItem() -{ - delete m_selectionLabelItem; -} - -LabelItem &AbstractRenderItem::selectionLabelItem() -{ - if (!m_selectionLabelItem) - m_selectionLabelItem = new LabelItem; - return *m_selectionLabelItem; -} - -void AbstractRenderItem::setSelectionLabel(const QString &label) -{ - if (m_selectionLabelItem) - m_selectionLabelItem->clear(); - m_selectionLabel = label; -} - -QString &AbstractRenderItem::selectionLabel() -{ - return m_selectionLabel; -} - - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/abstractrenderitem_p.h b/src/datavis3d/data/abstractrenderitem_p.h deleted file mode 100644 index becacbe5..00000000 --- a/src/datavis3d/data/abstractrenderitem_p.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef ABSTRACTRENDERITEM_P_H -#define ABSTRACTRENDERITEM_P_H - -#include "datavis3dglobal_p.h" -#include "labelitem_p.h" - -#include <QOpenGLFunctions> -#include <QString> -#include <QVector3D> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class AbstractRenderItem -{ -public: - AbstractRenderItem(); - AbstractRenderItem(const AbstractRenderItem &other); - virtual ~AbstractRenderItem(); - - // Position in 3D scene - inline void setTranslation(const QVector3D &translation) { m_translation = translation; } - inline const QVector3D &translation() const {return m_translation; } - - // Selection label item (containing special selection texture, if mode is activated) - LabelItem &selectionLabelItem(); - - // Formatted selection label for item. - void setSelectionLabel(const QString &label); - QString &selectionLabel(); // Formats selection label if not previously formatted - -protected: - QString m_selectionLabel; - QVector3D m_translation; - LabelItem *m_selectionLabelItem; - - friend class QAbstractDataItem; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/baritemmodelhandler.cpp b/src/datavis3d/data/baritemmodelhandler.cpp deleted file mode 100644 index 57f8d7d0..00000000 --- a/src/datavis3d/data/baritemmodelhandler.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "baritemmodelhandler_p.h" -#include <QTimer> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -BarItemModelHandler::BarItemModelHandler(QItemModelBarDataProxy *proxy, QObject *parent) - : AbstractItemModelHandler(parent), - m_proxy(proxy) -{ -} - -BarItemModelHandler::~BarItemModelHandler() -{ -} - -// Resolve entire item model into QBarDataArray. -void BarItemModelHandler::resolveModel() -{ - QItemModelBarDataMapping *mapping = static_cast<QItemModelBarDataMapping *>(m_activeMapping); - if (m_itemModel.isNull() || !mapping) { - m_proxy->resetArray(0); - return; - } - - bool useModelRows(false); - if (!mapping->rowCategories().size() || !mapping->columnCategories().size()) { - useModelRows = true; - } else if (mapping->rowRole().isEmpty() || mapping->columnRole().isEmpty()) { - m_proxy->resetArray(0); - return; - } - - QBarDataArray *newProxyArray = new QBarDataArray; - QHash<int, QByteArray> roleHash = m_itemModel->roleNames(); - // Default to display role if no mapping - int valueRole = roleHash.key(mapping->valueRole().toLatin1(), Qt::DisplayRole); - int rowCount = m_itemModel->rowCount(); - int columnCount = m_itemModel->columnCount(); - - if (useModelRows) { - for (int i = 0; i < rowCount; i++) { - QBarDataRow *newProxyRow = new QBarDataRow(columnCount); - for (int j = 0; j < columnCount; j++) - (*newProxyRow)[j].setValue(m_itemModel->index(i, j).data(valueRole).toReal()); - newProxyArray->append(newProxyRow); - } - } else { - int rowRole = roleHash.key(mapping->rowRole().toLatin1()); - int columnRole = roleHash.key(mapping->columnRole().toLatin1()); - const QStringList &rowList = mapping->rowCategories(); - const QStringList &columnList = mapping->columnCategories(); - - // Sort values into rows and columns - typedef QHash<QString, qreal> ColumnValueMap; - QHash <QString, ColumnValueMap> itemValueMap; - for (int i = 0; i < rowCount; i++) { - for (int j = 0; j < columnCount; j++) { - QModelIndex index = m_itemModel->index(i, j); - itemValueMap[index.data(rowRole).toString()][index.data(columnRole).toString()] - = index.data(valueRole).toReal(); - } - } - - // Create new data array from itemValueMap - foreach (QString rowKey, rowList) { - QBarDataRow *newProxyRow = new QBarDataRow(columnList.size()); - for (int i = 0; i < columnList.size(); i++) - (*newProxyRow)[i].setValue(itemValueMap[rowKey][columnList.at(i)]); - newProxyArray->append(newProxyRow); - } - } - - m_proxy->resetArray(newProxyArray); -} - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/baritemmodelhandler_p.h b/src/datavis3d/data/baritemmodelhandler_p.h deleted file mode 100644 index 0124e56e..00000000 --- a/src/datavis3d/data/baritemmodelhandler_p.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef BARITEMMODELHANDLER_P_H -#define BARITEMMODELHANDLER_P_H - -#include "abstractitemmodelhandler_p.h" -#include "qitemmodelbardataproxy.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class BarItemModelHandler : public AbstractItemModelHandler -{ - Q_OBJECT -public: - BarItemModelHandler(QItemModelBarDataProxy *proxy, QObject *parent = 0); - virtual ~BarItemModelHandler(); - -protected: - void virtual resolveModel(); - - QItemModelBarDataProxy *m_proxy; // Not owned -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/barrenderitem.cpp b/src/datavis3d/data/barrenderitem.cpp deleted file mode 100644 index 3240d19d..00000000 --- a/src/datavis3d/data/barrenderitem.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "barrenderitem_p.h" -#include "bars3drenderer_p.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -BarRenderItem::BarRenderItem() - : AbstractRenderItem(), - m_value(0), - m_height(0.0f), - m_sliceLabelItem(0) -{ -} - -BarRenderItem::BarRenderItem(const BarRenderItem &other) - : AbstractRenderItem(other) -{ - m_value = other.m_value; - m_position = other.m_position; - m_height = other.m_height; - m_sliceLabel = other.m_sliceLabel; - m_sliceLabelItem = 0; -} - -BarRenderItem::~BarRenderItem() -{ - delete m_sliceLabelItem; -} - -LabelItem &BarRenderItem::sliceLabelItem() -{ - if (!m_sliceLabelItem) - m_sliceLabelItem = new LabelItem; - return *m_sliceLabelItem; -} - -void BarRenderItem::setSliceLabel(const QString &label) -{ - if (m_sliceLabelItem) - m_sliceLabelItem->clear(); - m_sliceLabel = label; -} - -QString &BarRenderItem::sliceLabel() -{ - return m_sliceLabel; -} - - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/barrenderitem_p.h b/src/datavis3d/data/barrenderitem_p.h deleted file mode 100644 index b1331b18..00000000 --- a/src/datavis3d/data/barrenderitem_p.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef BARRENDERITEM_P_H -#define BARRENDERITEM_P_H - -#include "abstractrenderitem_p.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class Bars3DRenderer; - -class BarRenderItem : public AbstractRenderItem -{ -public: - BarRenderItem(); - BarRenderItem(const BarRenderItem &other); - virtual ~BarRenderItem(); - - // Position relative to data window (for bar label generation) - inline void setPosition(const QPoint &pos) { m_position = pos; } - inline const QPoint &position() const { return m_position; } - - // Actual cached data value of the bar (needed to trigger label reformats) - inline void setValue(qreal value); - inline qreal value() const { return m_value; } - - // Normalized bar height - inline void setHeight(GLfloat height) { m_height = height; } - inline GLfloat height() const { return m_height; } - - // Label item for formatted label - LabelItem &sliceLabelItem(); - - // Formatted label for item. - void setSliceLabel(const QString &label); - QString &sliceLabel(); // Formats label if not previously formatted - -protected: - qreal m_value; - QPoint m_position; // x = row, y = column - GLfloat m_height; - QString m_sliceLabel; - LabelItem *m_sliceLabelItem; - - friend class QBarDataItem; -}; - -void BarRenderItem::setValue(qreal value) -{ - m_value = value; - // Force reformatting on next access by setting label string to null string - if (!m_sliceLabel.isNull()) - setSliceLabel(QString()); - if (!m_selectionLabel.isNull()) - setSelectionLabel(QString()); -} - -typedef QVector<BarRenderItem> BarRenderItemRow; -typedef QVector<BarRenderItemRow> BarRenderItemArray; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/data.pri b/src/datavis3d/data/data.pri deleted file mode 100644 index 6571aacc..00000000 --- a/src/datavis3d/data/data.pri +++ /dev/null @@ -1,58 +0,0 @@ -HEADERS += \ - $$PWD/labelitem_p.h \ - $$PWD/qabstractdataproxy.h \ - $$PWD/qabstractdataproxy_p.h \ - $$PWD/qbardataproxy.h \ - $$PWD/qbardataproxy_p.h \ - $$PWD/abstractrenderitem_p.h \ - $$PWD/barrenderitem_p.h \ - $$PWD/qbardataitem.h \ - $$PWD/qbardataitem_p.h \ - $$PWD/qitemmodelbardatamapping.h \ - $$PWD/qitemmodelbardatamapping_p.h \ - $$PWD/qitemmodelbardataproxy_p.h \ - $$PWD/qitemmodelbardataproxy.h \ - $$PWD/scatterrenderitem_p.h \ - $$PWD/qscatterdataitem.h \ - $$PWD/qscatterdataitem_p.h \ - $$PWD/qscatterdataproxy.h \ - $$PWD/qscatterdataproxy_p.h \ - $$PWD/qitemmodelscatterdatamapping.h \ - $$PWD/qitemmodelscatterdatamapping_p.h \ - $$PWD/qitemmodelscatterdataproxy.h \ - $$PWD/qitemmodelscatterdataproxy_p.h \ - $$PWD/abstractitemmodelhandler_p.h \ - $$PWD/baritemmodelhandler_p.h \ - $$PWD/qabstractdatamapping.h \ - $$PWD/qabstractdatamapping_p.h \ - $$PWD/scatteritemmodelhandler_p.h \ - $$PWD/qsurfacedataproxy.h \ - $$PWD/qsurfacedataproxy_p.h \ - $$PWD/qitemmodelsurfacedatamapping.h \ - $$PWD/qitemmodelsurfacedatamapping_p.h \ - $$PWD/qitemmodelsurfacedataproxy.h \ - $$PWD/qitemmodelsurfacedataproxy_p.h \ - $$PWD/surfaceitemmodelhandler_p.h - -SOURCES += \ - $$PWD/labelitem.cpp \ - $$PWD/qabstractdataproxy.cpp \ - $$PWD/qbardataproxy.cpp \ - $$PWD/abstractrenderitem.cpp \ - $$PWD/barrenderitem.cpp \ - $$PWD/qbardataitem.cpp \ - $$PWD/qitemmodelbardatamapping.cpp \ - $$PWD/qitemmodelbardataproxy.cpp \ - $$PWD/scatterrenderitem.cpp \ - $$PWD/qscatterdataitem.cpp \ - $$PWD/qscatterdataproxy.cpp \ - $$PWD/qitemmodelscatterdatamapping.cpp \ - $$PWD/qitemmodelscatterdataproxy.cpp \ - $$PWD/abstractitemmodelhandler.cpp \ - $$PWD/baritemmodelhandler.cpp \ - $$PWD/qabstractdatamapping.cpp \ - $$PWD/scatteritemmodelhandler.cpp \ - $$PWD/qsurfacedataproxy.cpp \ - $$PWD/qitemmodelsurfacedatamapping.cpp \ - $$PWD/qitemmodelsurfacedataproxy.cpp \ - $$PWD/surfaceitemmodelhandler.cpp diff --git a/src/datavis3d/data/labelitem.cpp b/src/datavis3d/data/labelitem.cpp deleted file mode 100644 index 1d1bf6f7..00000000 --- a/src/datavis3d/data/labelitem.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "labelitem_p.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -LabelItem::LabelItem() - : m_size(QSize(0, 0)), - m_textureId(0) -{ -} - -LabelItem::~LabelItem() -{ - glDeleteTextures(1, &m_textureId); -} - -void LabelItem::setSize(const QSize &size) -{ - m_size = size; -} - -QSize LabelItem::size() const -{ - return m_size; -} - -void LabelItem::setTextureId(GLuint textureId) -{ - glDeleteTextures(1, &m_textureId); - m_textureId = textureId; -} - -GLuint LabelItem::textureId() const -{ - return m_textureId; -} - -void LabelItem::clear() -{ - if (m_textureId) { - glDeleteTextures(1, &m_textureId); - m_textureId = 0; - } - m_size = QSize(0, 0); -} - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/labelitem_p.h b/src/datavis3d/data/labelitem_p.h deleted file mode 100644 index 84625002..00000000 --- a/src/datavis3d/data/labelitem_p.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef LABELITEM_P_H -#define LABELITEM_P_H - -#include "datavis3dglobal_p.h" -#include <QOpenGLFunctions> -#include <QSize> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class LabelItem -{ -public: - explicit LabelItem(); - ~LabelItem(); - - void setSize(const QSize &size); - QSize size() const; - void setTextureId(GLuint textureId); - GLuint textureId() const; - void clear(); - -private: - Q_DISABLE_COPY(LabelItem); - - QSize m_size; - GLuint m_textureId; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qabstractdatamapping.cpp b/src/datavis3d/data/qabstractdatamapping.cpp deleted file mode 100644 index f85983ec..00000000 --- a/src/datavis3d/data/qabstractdatamapping.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "qabstractdatamapping_p.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -/*! - * \class QAbstractDataMapping - * \inmodule QtDataVis3D - * \brief Abstract base class for QtDataVis3D data mapping classes. - * \since 1.0.0 - * - * Data mapping classes provide a way to map data from an external data source to one of - * QtDataVis3D data proxies. - * \sa QItemModelBarDataMapping, QItemModelScatterDataMapping - */ - -/*! - * \internal - */ -QAbstractDataMapping::QAbstractDataMapping(QAbstractDataMappingPrivate *d, QObject *parent) - : QObject(parent), - d_ptr(d) -{ -} - -/*! - * Destroys QAbstractDataMapping. - */ -QAbstractDataMapping::~QAbstractDataMapping() -{ -} - -/*! - * \fn void QAbstractDataMapping::mappingChanged() - * - * Emitted when any mapping has changed. - */ - -// QItemModelBarDataMappingPrivate - -QAbstractDataMappingPrivate::QAbstractDataMappingPrivate(QAbstractDataMapping *q, - QAbstractDataProxy::DataType type) - : QObject(0), - q_ptr(q), - m_type(type) -{ -} - -QAbstractDataMappingPrivate::~QAbstractDataMappingPrivate() -{ -} - -QT_DATAVIS3D_END_NAMESPACE - diff --git a/src/datavis3d/data/qabstractdatamapping.h b/src/datavis3d/data/qabstractdatamapping.h deleted file mode 100644 index 8e1f3b2a..00000000 --- a/src/datavis3d/data/qabstractdatamapping.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#ifndef QABSTRACTDATAMAPPING_H -#define QABSTRACTDATAMAPPING_H - -#include <QtDataVis3D/qdatavis3denums.h> -#include <QtDataVis3D/qabstractdataproxy.h> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QAbstractDataMappingPrivate; - -class QT_DATAVIS3D_EXPORT QAbstractDataMapping : public QObject -{ - Q_OBJECT - -public: - explicit QAbstractDataMapping(QAbstractDataMappingPrivate *d, QObject *parent = 0); - virtual ~QAbstractDataMapping(); - -signals: - void mappingChanged(); - -private: - QScopedPointer<QAbstractDataMappingPrivate> d_ptr; - - Q_DISABLE_COPY(QAbstractDataMapping) - - friend class QItemModelBarDataMapping; - friend class QItemModelScatterDataMapping; - friend class QItemModelSurfaceDataMapping; -}; - - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qabstractdatamapping_p.h b/src/datavis3d/data/qabstractdatamapping_p.h deleted file mode 100644 index 4b16d7a4..00000000 --- a/src/datavis3d/data/qabstractdatamapping_p.h +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#include "qabstractdatamapping.h" - -#ifndef QABSTRACTDATAMAPPING_P_H -#define QABSTRACTDATAMAPPING_P_H - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QAbstractDataMappingPrivate : public QObject -{ - Q_OBJECT -public: - QAbstractDataMappingPrivate(QAbstractDataMapping *q, QAbstractDataProxy::DataType type); - virtual ~QAbstractDataMappingPrivate(); - -private: - QAbstractDataMapping *q_ptr; - QAbstractDataProxy::DataType m_type; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qabstractdataproxy.cpp b/src/datavis3d/data/qabstractdataproxy.cpp deleted file mode 100644 index 187fa518..00000000 --- a/src/datavis3d/data/qabstractdataproxy.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "qabstractdataproxy.h" -#include "qabstractdataproxy_p.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -/*! - * \class QAbstractDataProxy - * \inmodule QtDataVis3D - * \brief Base class for all QtDataVis3D data proxies. - * \since 1.0.0 - * - * You use the visualization type specific inherited classes instead of the base class. - * \sa QBarDataProxy, QScatterDataProxy, QSurfaceDataProxy - */ - -/*! - * \enum QAbstractDataProxy::DataType - * - * Data type of the proxy. - * - * \value DataTypeNone - * No data type. - * \value DataTypeBar - * Data type for Q3DBars. - * \value DataTypeScatter - * Data type for Q3DScatter. - * \value DataTypeSurface - * Data type for Q3DSurface. - */ - -/*! - * \internal - */ -QAbstractDataProxy::QAbstractDataProxy(QAbstractDataProxyPrivate *d, QObject *parent) : - QObject(parent), - d_ptr(d) -{ -} - -/*! - * Destroys QAbstractDataProxy. - */ -QAbstractDataProxy::~QAbstractDataProxy() -{ -} - -/*! - * \property QAbstractDataProxy::type - */ -QAbstractDataProxy::DataType QAbstractDataProxy::type() const -{ - return d_ptr->m_type; -} - -/*! - * Sets label \a format for data items in this proxy. This format is used for single item labels, - * e.g. when an item is selected. How the format is interpreted depends on proxy type. See - * each proxy class documentation for more information. - * - * \sa QBarDataProxy, QScatterDataProxy, QSurfaceDataProxy - */ -void QAbstractDataProxy::setItemLabelFormat(const QString &format) -{ - d_ptr->setItemLabelFormat(format); - emit itemLabelFormatChanged(); -} - -/*! - * \return label format for data items in this proxy. - */ -QString QAbstractDataProxy::itemLabelFormat() const -{ - return d_ptr->m_itemLabelFormat; -} - -/*! - * \fn void QAbstractDataProxy::itemLabelFormatChanged() - * - * Emitted when label format changes. - */ - -// QAbstractDataProxyPrivate - -QAbstractDataProxyPrivate::QAbstractDataProxyPrivate(QAbstractDataProxy *q, QAbstractDataProxy::DataType type) - : QObject(0), - q_ptr(q), - m_type(type), - m_isDefaultProxy(false) -{ -} - -QAbstractDataProxyPrivate::~QAbstractDataProxyPrivate() -{ -} - -void QAbstractDataProxyPrivate::setItemLabelFormat(const QString &format) -{ - m_itemLabelFormat = format; -} - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/qabstractdataproxy.h b/src/datavis3d/data/qabstractdataproxy.h deleted file mode 100644 index ba190583..00000000 --- a/src/datavis3d/data/qabstractdataproxy.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#ifndef QABSTRACTDATAPROXY_H -#define QABSTRACTDATAPROXY_H - -#include <QtDataVis3D/qdatavis3denums.h> -#include <QObject> -#include <QScopedPointer> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QAbstractDataProxyPrivate; - -class QT_DATAVIS3D_EXPORT QAbstractDataProxy : public QObject -{ - Q_OBJECT - Q_ENUMS(DataType) - Q_PROPERTY(DataType type READ type) - Q_PROPERTY(QString itemLabelFormat READ itemLabelFormat WRITE setItemLabelFormat NOTIFY itemLabelFormatChanged) - -public: - enum DataType { - DataTypeNone = 0, - DataTypeBar = 1, - DataTypeScatter = 2, - DataTypeSurface = 4 - }; - -protected: - explicit QAbstractDataProxy(QAbstractDataProxyPrivate *d, QObject *parent = 0); - -public: - virtual ~QAbstractDataProxy(); - - DataType type() const; - - void setItemLabelFormat(const QString &format); - QString itemLabelFormat() const; - -signals: - void itemLabelFormatChanged(); - -protected: - QScopedPointer<QAbstractDataProxyPrivate> d_ptr; - -private: - Q_DISABLE_COPY(QAbstractDataProxy) - - friend class Abstract3DController; - friend class Bars3DController; - friend class Scatter3DController; - friend class Surface3DController; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif // QABSTRACTDATAPROXY_H diff --git a/src/datavis3d/data/qabstractdataproxy_p.h b/src/datavis3d/data/qabstractdataproxy_p.h deleted file mode 100644 index 6737c681..00000000 --- a/src/datavis3d/data/qabstractdataproxy_p.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#include "datavis3dglobal_p.h" -#include "qabstractdataproxy.h" -#include <QString> - -#ifndef QABSTRACTDATAPROXY_P_H -#define QABSTRACTDATAPROXY_P_H - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QAbstractDataProxyPrivate : public QObject -{ - Q_OBJECT -public: - QAbstractDataProxyPrivate(QAbstractDataProxy *q, QAbstractDataProxy::DataType type); - virtual ~QAbstractDataProxyPrivate(); - - void setItemLabelFormat(const QString &format); - - inline bool isDefaultProxy() { return m_isDefaultProxy; } - inline void setDefaultProxy(bool isDefault) { m_isDefaultProxy = isDefault; } - -protected: - QAbstractDataProxy *q_ptr; - QAbstractDataProxy::DataType m_type; - QString m_itemLabelFormat; - bool m_isDefaultProxy; - -private: - friend class QAbstractDataProxy; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif // QABSTRACTDATAPROXY_P_H diff --git a/src/datavis3d/data/qbardataitem.cpp b/src/datavis3d/data/qbardataitem.cpp deleted file mode 100644 index ffd4f707..00000000 --- a/src/datavis3d/data/qbardataitem.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "qbardataitem_p.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -/*! - * \class QBarDataItem - * \inmodule QtDataVis3D - * \brief The QBarDataItem class provides a container for resolved data to be added to bar graphs. - * \since 1.0.0 - * - * A QBarDataItem holds data for a single rendered bar in a graph. - * Bar data proxies parse data into QBarDataItem instances for visualizing. - * - * \sa QBarDataProxy, {Qt Data Visualization 3D C++ Classes} - */ - -/*! - * Constructs QBarDataItem. - */ -QBarDataItem::QBarDataItem() - : d_ptr(0), // private data doesn't exist by default (optimization) - m_value(0.0) -{ -} - -/*! - * Constructs QBarDataItem with \a value. - */ -QBarDataItem::QBarDataItem(qreal value) - : d_ptr(0), - m_value(value) -{ -} - -/*! - * Constructs a copy of \a other. - */ -QBarDataItem::QBarDataItem(const QBarDataItem &other) -{ - operator=(other); -} - -/*! - * Destroys QBarDataItem. - */ -QBarDataItem::~QBarDataItem() -{ - delete d_ptr; -} - -/*! - * Assigns a copy of \a other to this object. - */ -QBarDataItem &QBarDataItem::operator=(const QBarDataItem &other) -{ - m_value = other.m_value; - if (other.d_ptr) - createExtraData(); - else - d_ptr = 0; - // TODO set extra data - return *this; -} - -/*! - * Sets \a value to this data item. - */ -void QBarDataItem::setValue(qreal value) -{ - m_value = value; -} - -/*! - * \return value of this data item. - */ -qreal QBarDataItem::value() const -{ - return m_value; -} - -/*! - * \internal - */ -void QBarDataItem::createExtraData() -{ - if (!d_ptr) - d_ptr = new QBarDataItemPrivate; -} - -QBarDataItemPrivate::QBarDataItemPrivate() -{ -} - -QBarDataItemPrivate::~QBarDataItemPrivate() -{ -} - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/qbardataitem.h b/src/datavis3d/data/qbardataitem.h deleted file mode 100644 index d7062b66..00000000 --- a/src/datavis3d/data/qbardataitem.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#ifndef QBARDATAITEM_H -#define QBARDATAITEM_H - -#include <QtDataVis3D/qdatavis3denums.h> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QBarDataItemPrivate; - -class QT_DATAVIS3D_EXPORT QBarDataItem -{ -public: - QBarDataItem(); - QBarDataItem(qreal value); - QBarDataItem(const QBarDataItem &other); - ~QBarDataItem(); - - QBarDataItem &operator=(const QBarDataItem &other); - - void setValue(qreal value); - qreal value() const; - - // TODO Set color, label format, ...? - -protected: - virtual void createExtraData(); - - QBarDataItemPrivate *d_ptr; - -private: - qreal m_value; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qbardataitem_p.h b/src/datavis3d/data/qbardataitem_p.h deleted file mode 100644 index e63ce787..00000000 --- a/src/datavis3d/data/qbardataitem_p.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef QBARDATAITEM_P_H -#define QBARDATAITEM_P_H - -#include "datavis3dglobal_p.h" -#include "qbardataitem.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QBarDataItemPrivate -{ -public: - QBarDataItemPrivate(); - virtual ~QBarDataItemPrivate(); - - // TODO stores other data for bars besides value - -protected: - friend class QBarDataItem; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qbardataproxy.cpp b/src/datavis3d/data/qbardataproxy.cpp deleted file mode 100644 index c0ff2f7f..00000000 --- a/src/datavis3d/data/qbardataproxy.cpp +++ /dev/null @@ -1,409 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "qbardataproxy.h" -#include "qbardataproxy_p.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -/*! - * \class QBarDataProxy - * \inmodule QtDataVis3D - * \brief Proxy class for Q3DBars. - * \since 1.0.0 - * - * QBarDataProxy handles adding, inserting, changing and removing rows of data. - * - * The data array is a list of vectors (rows) of QBarDataItem instances. - * Each row can contain different amount of items or even be null. - * - * QBarDataProxy takes ownership of all QBarDataRows passed to it, whether directly or - * in a QBarDataArray container. - * QBarDataRow pointers should not be used to modify data further after they have been passed to - * the proxy, as such modifications will not trigger proper signals. - * - * QBarDataProxy supports the following format tags for QAbstractDataProxy::setItemLabelFormat(): - * \table - * \row - * \li @rowTitle \li Title from row axis - * \row - * \li @colTitle \li Title from column axis - * \row - * \li @valueTitle \li Title from value axis - * \row - * \li @rowIdx \li Visible row index - * \row - * \li @colIdx \li Visible Column index - * \row - * \li @rowLabel \li Label from row axis - * \row - * \li @colLabel \li Label from column axis - * \row - * \li @valueLabel \li Item value formatted using the same format the value axis attached to the graph uses, - * see \l{Q3DValueAxis::setLabelFormat()} for more information. - * \row - * \li %<format spec> \li Item value in specified format. - * \endtable - * - * For example: - * \snippet doc_src_qtdatavis3d.cpp 1 - */ - -/*! - * Constructs QBarDataProxy with the given \a parent. - */ -QBarDataProxy::QBarDataProxy(QObject *parent) : - QAbstractDataProxy(new QBarDataProxyPrivate(this), parent) -{ -} - -/*! - * \internal - */ -QBarDataProxy::QBarDataProxy(QBarDataProxyPrivate *d, QObject *parent) : - QAbstractDataProxy(d, parent) -{ -} - -/*! - * Destroys QBarDataProxy. - */ -QBarDataProxy::~QBarDataProxy() -{ -} - -/*! - * Clears the existing array and takes ownership of the \a newArray. Do not use \a newArray pointer - * to further modify data after QBarDataProxy assumes ownership of it, as such modifications will - * not trigger proper signals. - * Passing null array clears all data. - */ -void QBarDataProxy::resetArray(QBarDataArray *newArray) -{ - if (dptr()->resetArray(newArray)) - emit arrayReset(); -} - -/*! - * Changes existing rows by replacing a row at \a rowIndex with \a row. - */ -void QBarDataProxy::setRow(int rowIndex, QBarDataRow *row) -{ - dptr()->setRow(rowIndex, row); - emit rowsChanged(rowIndex, 1); -} - -/*! - * Changes existing rows by replacing a rows starting at \a rowIndex with \a rows. - */ -void QBarDataProxy::setRows(int rowIndex, const QBarDataArray &rows) -{ - dptr()->setRows(rowIndex, rows); - emit rowsChanged(rowIndex, rows.size()); -} - -/*! - * Changes a single item at \a rowIndex, \a columnIndex with \a item. - */ -void QBarDataProxy::setItem(int rowIndex, int columnIndex, const QBarDataItem &item) -{ - dptr()->setItem(rowIndex, columnIndex, item); - emit itemChanged(rowIndex, columnIndex); -} - -/*! - * Adds a new \a row to the end of array. - * - * \return index of the added row. - */ -int QBarDataProxy::addRow(QBarDataRow *row) -{ - int addIndex = dptr()->addRow(row); - emit rowsAdded(addIndex, 1); - return addIndex; -} - -/*! - * Adds new \a rows to the end of array. - * - * \return index of the first added row. - */ -int QBarDataProxy::addRows(const QBarDataArray &rows) -{ - int addIndex = dptr()->addRows(rows); - emit rowsAdded(addIndex, rows.size()); - return addIndex; -} - -/*! - * Inserts a new \a row to \a rowIndex. If rowIndex is equal to array size, rows are added to end - * of the array. - */ -void QBarDataProxy::insertRow(int rowIndex, QBarDataRow *row) -{ - dptr()->insertRow(rowIndex, row); - emit rowsInserted(rowIndex, 1); -} - -/*! - * Inserts new \a rows to \a rowIndex. If rowIndex is equal to array size, rows are added to end - * of the array. - */ -void QBarDataProxy::insertRows(int rowIndex, const QBarDataArray &rows) -{ - dptr()->insertRows(rowIndex, rows); - emit rowsInserted(rowIndex, rows.size()); -} - -/*! - * Removes \a removeCount rows staring at \a rowIndex. Attempting to remove rows past the end of the - * array does nothing. - */ -void QBarDataProxy::removeRows(int rowIndex, int removeCount) -{ - if (rowIndex < rowCount()) { - dptr()->removeRows(rowIndex, removeCount); - emit rowsRemoved(rowIndex, removeCount); - } -} - -/*! - * \return row count in the array. - */ -int QBarDataProxy::rowCount() const -{ - return dptrc()->m_dataArray->size(); -} - -/*! - * \return pointer to the data array. - */ -const QBarDataArray *QBarDataProxy::array() const -{ - return dptrc()->m_dataArray; -} - -/*! - * \return pointer to the row at \a rowIndex. It is guaranteed to be valid only until next call - * that modifies data. - */ -const QBarDataRow *QBarDataProxy::rowAt(int rowIndex) const -{ - const QBarDataArray &dataArray = *dptrc()->m_dataArray; - Q_ASSERT(rowIndex >= 0 && rowIndex < dataArray.size()); - return dataArray[rowIndex]; -} - -/*! - * \return pointer to the item at \a rowIndex, \a columnIndex. It is guaranteed to be valid only - * until next call that modifies data. - */ -const QBarDataItem *QBarDataProxy::itemAt(int rowIndex, int columnIndex) const -{ - const QBarDataArray &dataArray = *dptrc()->m_dataArray; - Q_ASSERT(rowIndex >= 0 && rowIndex < dataArray.size()); - const QBarDataRow &dataRow = *dataArray[rowIndex]; - Q_ASSERT(columnIndex >= 0 && columnIndex < dataRow.size()); - return &dataRow.at(columnIndex); -} - -/*! - * \internal - */ -QBarDataProxyPrivate *QBarDataProxy::dptr() -{ - return static_cast<QBarDataProxyPrivate *>(d_ptr.data()); -} - -/*! - * \internal - */ -const QBarDataProxyPrivate *QBarDataProxy::dptrc() const -{ - return static_cast<const QBarDataProxyPrivate *>(d_ptr.data()); -} - -/*! - * \fn void QBarDataProxy::arrayReset() - * - * Emitted when data array is reset. - */ - -/*! - * \fn void QBarDataProxy::rowsAdded(int startIndex, int count) - * - * Emitted when rows have been added. Provides \a startIndex and \a count of rows added. - */ - -/*! - * \fn void QBarDataProxy::rowsChanged(int startIndex, int count) - * - * Emitted when rows have changed. Provides \a startIndex and \a count of changed rows. - */ - -/*! - * \fn void QBarDataProxy::rowsRemoved(int startIndex, int count) - * - * Emitted when rows have been removed. Provides \a startIndex and \a count of rows removed. - * Index is the current array size if rows were removed from the end of the array. - */ - -/*! - * \fn void QBarDataProxy::rowsInserted(int startIndex, int count) - * - * Emitted when rows have been inserted. Provides \a startIndex and \a count of inserted rows. - */ - -/*! - * \fn void QBarDataProxy::itemChanged(int rowIndex, int columnIndex) - * - * Emitted when an item has changed. Provides \a rowIndex and \a columnIndex of changed item. - */ - -// QBarDataProxyPrivate - -QBarDataProxyPrivate::QBarDataProxyPrivate(QBarDataProxy *q) - : QAbstractDataProxyPrivate(q, QAbstractDataProxy::DataTypeBar), - m_dataArray(new QBarDataArray) -{ - m_itemLabelFormat = QStringLiteral("@valueTitle: @valueLabel"); -} - -QBarDataProxyPrivate::~QBarDataProxyPrivate() -{ - clearArray(); -} - -bool QBarDataProxyPrivate::resetArray(QBarDataArray *newArray) -{ - if (!m_dataArray->size() && (!newArray || !newArray->size())) - return false; - - clearArray(); - - if (newArray) - m_dataArray = newArray; - else - m_dataArray = new QBarDataArray; - - return true; -} - -void QBarDataProxyPrivate::setRow(int rowIndex, QBarDataRow *row) -{ - Q_ASSERT(rowIndex >= 0 && rowIndex < m_dataArray->size()); - clearRow(rowIndex); - (*m_dataArray)[rowIndex] = row; -} - -void QBarDataProxyPrivate::setRows(int rowIndex, const QBarDataArray &rows) -{ - QBarDataArray &dataArray = *m_dataArray; - Q_ASSERT(rowIndex >= 0 && (rowIndex + rows.size()) <= dataArray.size()); - for (int i = 0; i < rows.size(); i++) { - clearRow(rowIndex); - dataArray[rowIndex] = rows.at(i); - rowIndex++; - } -} - -void QBarDataProxyPrivate::setItem(int rowIndex, int columnIndex, const QBarDataItem &item) -{ - Q_ASSERT(rowIndex >= 0 && rowIndex < m_dataArray->size()); - QBarDataRow &row = *(*m_dataArray)[rowIndex]; - Q_ASSERT(columnIndex < row.size()); - row[columnIndex] = item; -} - -int QBarDataProxyPrivate::addRow(QBarDataRow *row) -{ - int currentSize = m_dataArray->size(); - m_dataArray->append(row); - return currentSize; -} - -int QBarDataProxyPrivate::addRows(const QBarDataArray &rows) -{ - int currentSize = m_dataArray->size(); - for (int i = 0; i < rows.size(); i++) - m_dataArray->append(rows.at(i)); - return currentSize; -} - -void QBarDataProxyPrivate::insertRow(int rowIndex, QBarDataRow *row) -{ - Q_ASSERT(rowIndex >= 0 && rowIndex <= m_dataArray->size()); - m_dataArray->insert(rowIndex, row); -} - -void QBarDataProxyPrivate::insertRows(int rowIndex, const QBarDataArray &rows) -{ - Q_ASSERT(rowIndex >= 0 && rowIndex <= m_dataArray->size()); - for (int i = 0; i < rows.size(); i++) - m_dataArray->insert(rowIndex++, rows.at(i)); -} - -void QBarDataProxyPrivate::removeRows(int rowIndex, int removeCount) -{ - Q_ASSERT(rowIndex >= 0); - int maxRemoveCount = m_dataArray->size() - rowIndex; - removeCount = qMin(removeCount, maxRemoveCount); - for (int i = 0; i < removeCount; i++) { - clearRow(rowIndex); - m_dataArray->removeAt(rowIndex); - } -} - -void QBarDataProxyPrivate::clearRow(int rowIndex) -{ - if (m_dataArray->at(rowIndex)) { - delete m_dataArray->at(rowIndex); - (*m_dataArray)[rowIndex] = 0; - } -} - -void QBarDataProxyPrivate::clearArray() -{ - for (int i = 0; i < m_dataArray->size(); i++) - clearRow(i); - m_dataArray->clear(); - delete m_dataArray; -} - -QPair<GLfloat, GLfloat> QBarDataProxyPrivate::limitValues(int startRow, int endRow, int startColumn, int endColumn) -{ - QPair<GLfloat, GLfloat> limits = qMakePair(0.0f, 0.0f); - endRow = qMin(endRow, m_dataArray->size() - 1); - for (int i = startRow; i <= endRow; i++) { - QBarDataRow *row = m_dataArray->at(i); - if (row) { - endColumn = qMin(endColumn, row->size() - 1); - for (int j = startColumn; j <= endColumn; j++) { - const QBarDataItem &item = m_dataArray->at(i)->at(j); - qreal itemValue = item.value(); - if (limits.second < itemValue) - limits.second = itemValue; - if (limits.first > itemValue) - limits.first = itemValue; - } - } - } - return limits; -} - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/qbardataproxy.h b/src/datavis3d/data/qbardataproxy.h deleted file mode 100644 index 3338bc75..00000000 --- a/src/datavis3d/data/qbardataproxy.h +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#ifndef QBARDATAPROXY_H -#define QBARDATAPROXY_H - -#include <QtDataVis3D/qabstractdataproxy.h> -#include <QtDataVis3D/qbardataitem.h> -#include <QVector> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -typedef QVector<QBarDataItem> QBarDataRow; -typedef QList<QBarDataRow *> QBarDataArray; - -class QBarDataProxyPrivate; - -class QT_DATAVIS3D_EXPORT QBarDataProxy : public QAbstractDataProxy -{ - Q_OBJECT - - Q_PROPERTY(int rowCount READ rowCount) -public: - explicit QBarDataProxy(QObject *parent = 0); - virtual ~QBarDataProxy(); - - // TODO: Replace first part of class description in docs with this once all TODOs are done: - /* - * QBarDataProxy is optimized for adding, inserting, and removing rows of data. - * Adding a column essentially means modifying every row, which is comparatively very inefficient. - * Proxy is also optimized to use cases where the only defining characteristic of an individual - * bar is its value. Modifying other data that might be added in the future such as color of - * individual bar requires allocating additional data object for the bar. - */ - - int rowCount() const; - const QBarDataArray *array() const; - const QBarDataRow *rowAt(int rowIndex) const; - const QBarDataItem *itemAt(int rowIndex, int columnIndex) const; - - void resetArray(QBarDataArray *newArray); - - void setRow(int rowIndex, QBarDataRow *row); - void setRows(int rowIndex, const QBarDataArray &rows); - - // Setting a column is comparatively inefficient as it changes all rows. - // Can resize rows that are shorter than columnIndex. - // TODO void setColumn(int columnIndex, const QBarDataRow &column); - // TODO void setColumns(int columnIndex, const QBarDataArray &columns); - - void setItem(int rowIndex, int columnIndex, const QBarDataItem &item); - // Change block of items - // TODO setItems(int rowIndex, int columnIndex, QBarDataArray *items); - - int addRow(QBarDataRow *row); - int addRows(const QBarDataArray &rows); - // TODO int addColumn(const QBarDataRow &column); // returns the index of the added column - // TODO int addColumns(const QBarDataArray &columns); // returns the index of the first added column - - void insertRow(int rowIndex, QBarDataRow *row); - void insertRows(int rowIndex, const QBarDataArray &rows); - // TODO void insertColumn(int columnIndex, const QBarDataRow &column); - // TODO void insertColumns(int columnIndex, const QBarDataArray &columns); - - void removeRows(int rowIndex, int removeCount); - // TODO void removeColumns(int columnIndex, int removeCount); - -signals: - void arrayReset(); - void rowsAdded(int startIndex, int count); - void rowsChanged(int startIndex, int count); - void rowsRemoved(int startIndex, int count); - void rowsInserted(int startIndex, int count); - // TODO void columnsChanged(int startIndex, int count); - // TODO void columnsAdded(int startIndex, int count); - // TODO void columnsRemoved(int startIndex, int count); - // TODO void columnsInserted(int startIndex, int count); - void itemChanged(int rowIndex, int columnIndex); // TODO remove once itemsChanged is added? - // TODO void itemsChanged(int rowIndex, int columnIndex, int rowCount, int columnCount); - -protected: - explicit QBarDataProxy(QBarDataProxyPrivate *d, QObject *parent = 0); - QBarDataProxyPrivate *dptr(); - const QBarDataProxyPrivate *dptrc() const; - -private: - Q_DISABLE_COPY(QBarDataProxy) - - friend class Bars3DController; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif // QBARDATAPROXY_H diff --git a/src/datavis3d/data/qbardataproxy_p.h b/src/datavis3d/data/qbardataproxy_p.h deleted file mode 100644 index fa6ccd0d..00000000 --- a/src/datavis3d/data/qbardataproxy_p.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef QBARDATAPROXY_P_H -#define QBARDATAPROXY_P_H - -#include "qbardataproxy.h" -#include "qabstractdataproxy_p.h" -#include "qbardataitem.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QBarDataProxyPrivate : public QAbstractDataProxyPrivate -{ - Q_OBJECT -public: - QBarDataProxyPrivate(QBarDataProxy *q); - virtual ~QBarDataProxyPrivate(); - - bool resetArray(QBarDataArray *newArray); - void setRow(int rowIndex, QBarDataRow *row); - void setRows(int rowIndex, const QBarDataArray &rows); - void setItem(int rowIndex, int columnIndex, const QBarDataItem &item); - int addRow(QBarDataRow *row); - int addRows(const QBarDataArray &rows); - void insertRow(int rowIndex, QBarDataRow *row); - void insertRows(int rowIndex, const QBarDataArray &rows); - void removeRows(int rowIndex, int removeCount); - - QPair<GLfloat, GLfloat> limitValues(int startRow, int startColumn, int rowCount, int columnCount); - -private: - void clearRow(int rowIndex); - void clearArray(); - - QBarDataArray *m_dataArray; - -private: - friend class QBarDataProxy; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif // QBARDATAPROXY_P_H diff --git a/src/datavis3d/data/qitemmodelbardatamapping.cpp b/src/datavis3d/data/qitemmodelbardatamapping.cpp deleted file mode 100644 index cefe5b5e..00000000 --- a/src/datavis3d/data/qitemmodelbardatamapping.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "qitemmodelbardatamapping_p.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -/*! - * \class QItemModelBarDataMapping - * \inmodule QtDataVis3D - * \brief Data model mapping for Q3DBars. - * \since 1.0.0 - * - * QItemModelBarDataMapping is used to map roles of QAbstractItemModel to rows, columns, and values - * of Q3DBars. There are two ways to use QItemModelBarDataMapping: - * - * 1) By default, the QItemModelBarDataMapping will map the rows and columns of QAbstractItemModel - * to rows and columns of Q3DBars, and uses the value returned for Qt::DisplayRole as bar value. - * The value role to be used can be redefined if Qt::DisplayRole is not suitable. - * - * 2) For models that do not have data already neatly sorted into rows and columns, such as - * QAbstractListModel based models, you can define a list of categories for both rows and columns, - * and define a role to map for each of row, column and value. - * For example, assume that you have a custom QAbstractItemModel for storing various monthly values - * related to a business. - * Each item in the model has roles "year", "month", "income", and "expenses". - * You could do the following to display the data in a bar chart: - * - * \snippet doc_src_qtdatavis3d.cpp 3 - * - * \sa QItemModelBarDataProxy - */ - -/*! - * Constructs QItemModelBarDataMapping with the given \a parent. - */ -QItemModelBarDataMapping::QItemModelBarDataMapping(QObject *parent) - : QAbstractDataMapping(new QItemModelBarDataMappingPrivate(this), parent) -{ -} - -/*! - * Constructs QItemModelBarDataMapping with \a valueRole and the given \a parent. - */ -QItemModelBarDataMapping::QItemModelBarDataMapping(const QString &valueRole, QObject *parent) - : QAbstractDataMapping(new QItemModelBarDataMappingPrivate(this), parent) -{ - dptr()->m_valueRole = valueRole; -} - -/*! - * Constructs QItemModelBarDataMapping with \a rowRole, \a columnRole, \a valueRole, - * \a rowCategories, \a columnCategories and the given \a parent. - */ -QItemModelBarDataMapping::QItemModelBarDataMapping(const QString &rowRole, - const QString &columnRole, - const QString &valueRole, - const QStringList &rowCategories, - const QStringList &columnCategories, - QObject *parent) - : QAbstractDataMapping(new QItemModelBarDataMappingPrivate(this), parent) -{ - dptr()->m_rowRole = rowRole; - dptr()->m_columnRole = columnRole; - dptr()->m_valueRole = valueRole; - dptr()->m_rowCategories = rowCategories; - dptr()->m_columnCategories = columnCategories; -} - -/*! - * Destroys QItemModelBarDataMapping. - */ -QItemModelBarDataMapping::~QItemModelBarDataMapping() -{ -} - -/*! - * \property QItemModelBarDataMapping::rowRole - * - * Defines the row role for the mapping. - */ -void QItemModelBarDataMapping::setRowRole(const QString &role) -{ - dptr()->m_rowRole = role; - emit mappingChanged(); -} - -QString QItemModelBarDataMapping::rowRole() const -{ - return dptrc()->m_rowRole; -} - -/*! - * \property QItemModelBarDataMapping::columnRole - * - * Defines the column role for the mapping. - */ -void QItemModelBarDataMapping::setColumnRole(const QString &role) -{ - dptr()->m_columnRole = role; - emit mappingChanged(); -} - -QString QItemModelBarDataMapping::columnRole() const -{ - return dptrc()->m_columnRole; -} - -/*! - * \property QItemModelBarDataMapping::valueRole - * - * Defines the value role for the mapping. - */ -void QItemModelBarDataMapping::setValueRole(const QString &role) -{ - dptr()->m_valueRole = role; - emit mappingChanged(); -} - -QString QItemModelBarDataMapping::valueRole() const -{ - return dptrc()->m_valueRole; -} - -/*! - * \property QItemModelBarDataMapping::rowCategories - * - * Defines the row categories for the mapping. - */ -void QItemModelBarDataMapping::setRowCategories(const QStringList &categories) -{ - dptr()->m_rowCategories = categories; - emit mappingChanged(); -} - -QStringList QItemModelBarDataMapping::rowCategories() const -{ - return dptrc()->m_rowCategories; -} - -/*! - * \property QItemModelBarDataMapping::columnCategories - * - * Defines the column categories for the mapping. - */ -void QItemModelBarDataMapping::setColumnCategories(const QStringList &categories) -{ - dptr()->m_columnCategories = categories; - emit mappingChanged(); -} - -QStringList QItemModelBarDataMapping::columnCategories() const -{ - return dptrc()->m_columnCategories; -} - -/*! - * Changes \a rowRole, \a columnRole, \a valueRole, \a rowCategories and \a columnCategories to the - * mapping. - */ -void QItemModelBarDataMapping::remap(const QString &rowRole, - const QString &columnRole, - const QString &valueRole, - const QStringList &rowCategories, - const QStringList &columnCategories) -{ - dptr()->m_rowRole = rowRole; - dptr()->m_columnRole = columnRole; - dptr()->m_valueRole = valueRole; - dptr()->m_rowCategories = rowCategories; - dptr()->m_columnCategories = columnCategories; - - emit mappingChanged(); -} - -/*! - * /return index of the specified \a category in row categories list. - * If the category is not found, -1 is returned. - */ -int QItemModelBarDataMapping::rowCategoryIndex(const QString &category) -{ - return dptr()->m_rowCategories.indexOf(category); -} - -/*! - * /return index of the specified \a category in column categories list. - * If the category is not found, -1 is returned. - */ -int QItemModelBarDataMapping::columnCategoryIndex(const QString &category) -{ - return dptr()->m_columnCategories.indexOf(category); -} - -/*! - * \internal - */ -QItemModelBarDataMappingPrivate *QItemModelBarDataMapping::dptr() -{ - return static_cast<QItemModelBarDataMappingPrivate *>(d_ptr.data()); -} - -/*! - * \internal - */ -const QItemModelBarDataMappingPrivate *QItemModelBarDataMapping::dptrc() const -{ - return static_cast<const QItemModelBarDataMappingPrivate *>(d_ptr.data()); -} - -// QItemModelBarDataMappingPrivate - -QItemModelBarDataMappingPrivate::QItemModelBarDataMappingPrivate(QItemModelBarDataMapping *q) - : QAbstractDataMappingPrivate(q, QAbstractDataProxy::DataTypeBar) -{ -} - -QItemModelBarDataMappingPrivate::~QItemModelBarDataMappingPrivate() -{ -} - - -QT_DATAVIS3D_END_NAMESPACE - diff --git a/src/datavis3d/data/qitemmodelbardatamapping.h b/src/datavis3d/data/qitemmodelbardatamapping.h deleted file mode 100644 index 7a989919..00000000 --- a/src/datavis3d/data/qitemmodelbardatamapping.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#ifndef QITEMMODELBARDATAMAPPING_H -#define QITEMMODELBARDATAMAPPING_H - -#include <QtDataVis3D/qdatavis3denums.h> -#include <QtDataVis3D/qabstractdatamapping.h> -#include <QStringList> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QItemModelBarDataMappingPrivate; - -class QT_DATAVIS3D_EXPORT QItemModelBarDataMapping : public QAbstractDataMapping -{ - Q_OBJECT - Q_PROPERTY(QString rowRole READ rowRole WRITE setRowRole) - Q_PROPERTY(QString columnRole READ columnRole WRITE setColumnRole) - Q_PROPERTY(QString valueRole READ valueRole WRITE setValueRole) - Q_PROPERTY(QStringList rowCategories READ rowCategories WRITE setRowCategories) - Q_PROPERTY(QStringList columnCategories READ columnCategories WRITE setColumnCategories) - -public: - explicit QItemModelBarDataMapping(QObject *parent = 0); - QItemModelBarDataMapping(const QString &valueRole, QObject *parent = 0); - QItemModelBarDataMapping(const QString &rowRole, const QString &columnRole, - const QString &valueRole, const QStringList &rowCategories, - const QStringList &columnCategories, QObject *parent = 0); - virtual ~QItemModelBarDataMapping(); - - void setRowRole(const QString &role); - QString rowRole() const; - void setColumnRole(const QString &role); - QString columnRole() const; - void setValueRole(const QString &role); - QString valueRole() const; - - void setRowCategories(const QStringList &categories); - QStringList rowCategories() const; - void setColumnCategories(const QStringList &categories); - QStringList columnCategories() const; - - void remap(const QString &rowRole, const QString &columnRole, - const QString &valueRole, const QStringList &rowCategories, - const QStringList &columnCategories); - - Q_INVOKABLE int rowCategoryIndex(const QString& category); - Q_INVOKABLE int columnCategoryIndex(const QString& category); - -protected: - QItemModelBarDataMappingPrivate *dptr(); - const QItemModelBarDataMappingPrivate *dptrc() const; - -private: - Q_DISABLE_COPY(QItemModelBarDataMapping) -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qitemmodelbardatamapping_p.h b/src/datavis3d/data/qitemmodelbardatamapping_p.h deleted file mode 100644 index d7db8e62..00000000 --- a/src/datavis3d/data/qitemmodelbardatamapping_p.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#include "qitemmodelbardatamapping.h" -#include "qabstractdatamapping_p.h" - -#ifndef QITEMMODELBARDATAMAPPING_P_H -#define QITEMMODELBARDATAMAPPING_P_H - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QItemModelBarDataMappingPrivate : public QAbstractDataMappingPrivate -{ - Q_OBJECT -public: - QItemModelBarDataMappingPrivate(QItemModelBarDataMapping *q); - virtual ~QItemModelBarDataMappingPrivate(); - -private: - QString m_rowRole; - QString m_columnRole; - QString m_valueRole; - - // For row/column items, sort items into these categories. Other categories are ignored. - QStringList m_rowCategories; - QStringList m_columnCategories; - - friend class QItemModelBarDataMapping; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qitemmodelbardataproxy.cpp b/src/datavis3d/data/qitemmodelbardataproxy.cpp deleted file mode 100644 index 8b72d934..00000000 --- a/src/datavis3d/data/qitemmodelbardataproxy.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "qitemmodelbardataproxy_p.h" -#include "baritemmodelhandler_p.h" -#include <QTimer> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -/*! - * \class QItemModelBarDataProxy - * \inmodule QtDataVis3D - * \brief Proxy class for Q3DBars data model mapping. - * \since 1.0.0 - * - * QItemModelBarDataProxy allows you to use QAbstractItemModel derived models as a data source - * for Q3DBars. It uses QItemModelBarDataMapping instance to map data from the model to Q3DBars - * graph. - * - * \sa QItemModelBarDataMapping - */ - -/*! - * Constructs QItemModelBarDataProxy. - */ -QItemModelBarDataProxy::QItemModelBarDataProxy() : - QBarDataProxy(new QItemModelBarDataProxyPrivate(this)) -{ -} - -/*! - * Constructs QItemModelBarDataProxy with \a itemModel and \a mapping. Proxy takes ownership of the - * \a mapping, but doesn't take ownership of the \a itemModel, as typically item models are owned - * by other controls. - */ -QItemModelBarDataProxy::QItemModelBarDataProxy(const QAbstractItemModel *itemModel, - QItemModelBarDataMapping *mapping) : - QBarDataProxy(new QItemModelBarDataProxyPrivate(this)) -{ - dptr()->m_itemModelHandler->setItemModel(itemModel); - dptr()->m_itemModelHandler->setActiveMapping(mapping); -} - -/*! - * Destroys QItemModelBarDataProxy. - */ -QItemModelBarDataProxy::~QItemModelBarDataProxy() -{ -} - -/*! - * \property QItemModelBarDataProxy::itemModel - * - * Defines item model. Does not take ownership of the model, but does connect to it to listen for - * changes. - */ -void QItemModelBarDataProxy::setItemModel(const QAbstractItemModel *itemModel) -{ - dptr()->m_itemModelHandler->setItemModel(itemModel); -} - -const QAbstractItemModel *QItemModelBarDataProxy::itemModel() const -{ - return dptrc()->m_itemModelHandler->itemModel(); -} - -/*! - * \property QItemModelBarDataProxy::activeMapping - * - * Defines data mapping. Proxy takes ownership of the \a mapping. - * Modifying a mapping that is set to the proxy will trigger data set re-resolving. - */ -void QItemModelBarDataProxy::setActiveMapping(QItemModelBarDataMapping *mapping) -{ - dptr()->m_itemModelHandler->setActiveMapping(mapping); -} - -QItemModelBarDataMapping *QItemModelBarDataProxy::activeMapping() const -{ - return static_cast<QItemModelBarDataMapping *>(dptrc()->m_itemModelHandler->activeMapping()); -} - -/*! - * Transfers the ownership of the \a mapping to this proxy. The mapping is not taken to use yet. - * \sa setActiveMapping(), releaseMapping() - */ -void QItemModelBarDataProxy::addMapping(QItemModelBarDataMapping *mapping) -{ - dptr()->m_itemModelHandler->addMapping(mapping); -} - -/*! - * Releases the ownership of the \a mapping back to the caller. If the mapping was the currently - * active one, no mapping remains active after this call. - */ -void QItemModelBarDataProxy::releaseMapping(QItemModelBarDataMapping *mapping) -{ - dptr()->m_itemModelHandler->releaseMapping(mapping); -} - -/*! - * \return list of mappings owned by the proxy. - */ -QList<QItemModelBarDataMapping *> QItemModelBarDataProxy::mappings() const -{ - QList<QItemModelBarDataMapping *> retList; - QList<QAbstractDataMapping *> abstractList = dptrc()->m_itemModelHandler->mappings(); - foreach (QAbstractDataMapping *mapping, abstractList) - retList.append(static_cast<QItemModelBarDataMapping *>(mapping)); - - return retList; -} - -/*! - * \internal - */ -QItemModelBarDataProxyPrivate *QItemModelBarDataProxy::dptr() -{ - return static_cast<QItemModelBarDataProxyPrivate *>(d_ptr.data()); -} - -/*! - * \internal - */ -const QItemModelBarDataProxyPrivate *QItemModelBarDataProxy::dptrc() const -{ - return static_cast<const QItemModelBarDataProxyPrivate *>(d_ptr.data()); -} - -// QItemModelBarDataProxyPrivate - -QItemModelBarDataProxyPrivate::QItemModelBarDataProxyPrivate(QItemModelBarDataProxy *q) - : QBarDataProxyPrivate(q), - m_itemModelHandler(new BarItemModelHandler(q)) -{ -} - -QItemModelBarDataProxyPrivate::~QItemModelBarDataProxyPrivate() -{ - delete m_itemModelHandler; -} - -QItemModelBarDataProxy *QItemModelBarDataProxyPrivate::qptr() -{ - return static_cast<QItemModelBarDataProxy *>(q_ptr); -} - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/qitemmodelbardataproxy.h b/src/datavis3d/data/qitemmodelbardataproxy.h deleted file mode 100644 index dd9d8353..00000000 --- a/src/datavis3d/data/qitemmodelbardataproxy.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#ifndef QITEMMODELBARDATAPROXY_H -#define QITEMMODELBARDATAPROXY_H - -#include <QtDataVis3D/qbardataproxy.h> -#include <QtDataVis3D/qitemmodelbardatamapping.h> -#include <QAbstractItemModel> -#include <QStringList> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QItemModelBarDataProxyPrivate; - -class QT_DATAVIS3D_EXPORT QItemModelBarDataProxy : public QBarDataProxy -{ - Q_OBJECT - Q_PROPERTY(const QAbstractItemModel* itemModel READ itemModel WRITE setItemModel) - Q_PROPERTY(QItemModelBarDataMapping* activeMapping READ activeMapping WRITE setActiveMapping) - -public: - explicit QItemModelBarDataProxy(); - explicit QItemModelBarDataProxy(const QAbstractItemModel *itemModel, - QItemModelBarDataMapping *mapping); - virtual ~QItemModelBarDataProxy(); - - void setItemModel(const QAbstractItemModel *itemModel); - const QAbstractItemModel *itemModel() const; - - void setActiveMapping(QItemModelBarDataMapping *mapping); - QItemModelBarDataMapping *activeMapping() const; - void addMapping(QItemModelBarDataMapping *mapping); - void releaseMapping(QItemModelBarDataMapping *mapping); - QList<QItemModelBarDataMapping *> mappings() const; - -protected: - QItemModelBarDataProxyPrivate *dptr(); - const QItemModelBarDataProxyPrivate *dptrc() const; - -private: - Q_DISABLE_COPY(QItemModelBarDataProxy) -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qitemmodelbardataproxy_p.h b/src/datavis3d/data/qitemmodelbardataproxy_p.h deleted file mode 100644 index 34ca128b..00000000 --- a/src/datavis3d/data/qitemmodelbardataproxy_p.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef QITEMMODELBARDATAPROXY_P_H -#define QITEMMODELBARDATAPROXY_P_H - -#include "qitemmodelbardataproxy.h" -#include "qbardataproxy_p.h" -#include <QPointer> -#include <QTimer> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class BarItemModelHandler; - -class QItemModelBarDataProxyPrivate : public QBarDataProxyPrivate -{ - Q_OBJECT -public: - QItemModelBarDataProxyPrivate(QItemModelBarDataProxy *q); - virtual ~QItemModelBarDataProxyPrivate(); - -private: - QItemModelBarDataProxy *qptr(); - - BarItemModelHandler *m_itemModelHandler; - - friend class QItemModelBarDataProxy; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qitemmodelscatterdatamapping.cpp b/src/datavis3d/data/qitemmodelscatterdatamapping.cpp deleted file mode 100644 index db8dff9e..00000000 --- a/src/datavis3d/data/qitemmodelscatterdatamapping.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "qitemmodelscatterdatamapping_p.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -/*! - * \class QItemModelScatterDataMapping - * \inmodule QtDataVis3D - * \brief Data model mapping for Q3DScatter. - * \since 1.0.0 - * - * QItemModelScatterDataMapping is used to map roles of QAbstractItemModel to the XYZ-values - * of Q3DScatter points. - * - * QItemModelScatterDataMapping ignores rows and columns of the QAbstractItemModel and treats - * all items equally. It requires the model to provide at least three roles for the data items - * that can be mapped to X, Y, and Z-values for the scatter points. - * - * For example, assume that you have a custom QAbstractItemModel for storing various measurements - * done on material samples, providing data for roles such as "density", "hardness" and - * "conductivity". You could visualize these properties on a scatter chart: - * - * \snippet doc_src_qtdatavis3d.cpp 4 - * - * \sa QItemModelScatterDataProxy - */ - -/*! - * Constructs QItemModelScatterDataMapping with the given \a parent. - */ -QItemModelScatterDataMapping::QItemModelScatterDataMapping(QObject *parent) - : QAbstractDataMapping(new QItemModelScatterDataMappingPrivate(this), parent) -{ -} - -/*! - * Constructs QItemModelScatterDataMapping with \a xPosRole, \a yPosRole, \a zPosRole - * and the given \a parent. - */ -QItemModelScatterDataMapping::QItemModelScatterDataMapping(const QString &xPosRole, - const QString &yPosRole, - const QString &zPosRole, - QObject *parent) - : QAbstractDataMapping(new QItemModelScatterDataMappingPrivate(this), parent) -{ - dptr()->m_xPosRole = xPosRole; - dptr()->m_yPosRole = yPosRole; - dptr()->m_zPosRole = zPosRole; -} - -/*! - * Destroys QItemModelScatterDataMapping. - */ -QItemModelScatterDataMapping::~QItemModelScatterDataMapping() -{ -} - -/*! - * \property QItemModelScatterDataMapping::xPosRole - * - * Defines the X position role for the mapping. - */ -void QItemModelScatterDataMapping::setXPosRole(const QString &role) -{ - dptr()->m_xPosRole = role; - emit mappingChanged(); -} - -QString QItemModelScatterDataMapping::xPosRole() const -{ - return dptrc()->m_xPosRole; -} - -/*! - * \property QItemModelScatterDataMapping::yPosRole - * - * Defines the Y position role for the mapping. - */ -void QItemModelScatterDataMapping::setYPosRole(const QString &role) -{ - dptr()->m_yPosRole = role; - emit mappingChanged(); -} - -QString QItemModelScatterDataMapping::yPosRole() const -{ - return dptrc()->m_yPosRole; -} - -/*! - * \property QItemModelScatterDataMapping::zPosRole - * - * Defines the Z position role for the mapping. - */ -void QItemModelScatterDataMapping::setZPosRole(const QString &role) -{ - dptr()->m_zPosRole = role; - emit mappingChanged(); -} - -QString QItemModelScatterDataMapping::zPosRole() const -{ - return dptrc()->m_zPosRole; -} - -/*! - * Changes \a xPosRole, \a yPosRole and \a zPosRole to the mapping. - * - * Emits mappingChanged() signal after remapping. - */ -void QItemModelScatterDataMapping::remap(const QString &xPosRole, const QString &yPosRole, - const QString &zPosRole) -{ - dptr()->m_xPosRole = xPosRole; - dptr()->m_yPosRole = yPosRole; - dptr()->m_zPosRole = zPosRole; - - emit mappingChanged(); -} - -/*! - * \internal - */ -QItemModelScatterDataMappingPrivate *QItemModelScatterDataMapping::dptr() -{ - return static_cast<QItemModelScatterDataMappingPrivate *>(d_ptr.data()); -} - -/*! - * \internal - */ -const QItemModelScatterDataMappingPrivate *QItemModelScatterDataMapping::dptrc() const -{ - return static_cast<const QItemModelScatterDataMappingPrivate *>(d_ptr.data()); -} - -// QItemModelScatterDataMappingPrivate - -QItemModelScatterDataMappingPrivate::QItemModelScatterDataMappingPrivate( - QItemModelScatterDataMapping *q) - : QAbstractDataMappingPrivate(q, QAbstractDataProxy::DataTypeScatter) -{ -} - -QItemModelScatterDataMappingPrivate::~QItemModelScatterDataMappingPrivate() -{ -} - -QT_DATAVIS3D_END_NAMESPACE - diff --git a/src/datavis3d/data/qitemmodelscatterdatamapping.h b/src/datavis3d/data/qitemmodelscatterdatamapping.h deleted file mode 100644 index 2f64f38c..00000000 --- a/src/datavis3d/data/qitemmodelscatterdatamapping.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#ifndef QITEMMODELSCATTERDATAMAPPING_H -#define QITEMMODELSCATTERDATAMAPPING_H - -#include <QtDataVis3D/qdatavis3denums.h> -#include <QtDataVis3D/qabstractdatamapping.h> -#include <QObject> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QItemModelScatterDataMappingPrivate; - -class QT_DATAVIS3D_EXPORT QItemModelScatterDataMapping : public QAbstractDataMapping -{ - Q_OBJECT - Q_PROPERTY(QString xPosRole READ xPosRole WRITE setXPosRole) - Q_PROPERTY(QString yPosRole READ yPosRole WRITE setYPosRole) - Q_PROPERTY(QString zPosRole READ zPosRole WRITE setZPosRole) - -public: - explicit QItemModelScatterDataMapping(QObject *parent = 0); - QItemModelScatterDataMapping(const QString &xPosRole, const QString &yPosRole, - const QString &zPosRole, QObject *parent = 0); - virtual ~QItemModelScatterDataMapping(); - - void setXPosRole(const QString &role); - QString xPosRole() const; - void setYPosRole(const QString &role); - QString yPosRole() const; - void setZPosRole(const QString &role); - QString zPosRole() const; - - void remap(const QString &xPosRole, const QString &yPosRole, const QString &zPosRole); - -protected: - QItemModelScatterDataMappingPrivate *dptr(); - const QItemModelScatterDataMappingPrivate *dptrc() const; - -private: - Q_DISABLE_COPY(QItemModelScatterDataMapping) -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qitemmodelscatterdatamapping_p.h b/src/datavis3d/data/qitemmodelscatterdatamapping_p.h deleted file mode 100644 index e88fa9be..00000000 --- a/src/datavis3d/data/qitemmodelscatterdatamapping_p.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#include "qitemmodelscatterdatamapping.h" -#include "qabstractdatamapping_p.h" - -#ifndef QITEMMODELSCATTERDATAMAPPING_P_H -#define QITEMMODELSCATTERDATAMAPPING_P_H - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QItemModelScatterDataMappingPrivate : public QAbstractDataMappingPrivate -{ - Q_OBJECT -public: - QItemModelScatterDataMappingPrivate(QItemModelScatterDataMapping *q); - virtual ~QItemModelScatterDataMappingPrivate(); - -private: - //QString m_labelRole; - QString m_xPosRole; - QString m_yPosRole; - QString m_zPosRole; - //QString m_valueRole; - - friend class QItemModelScatterDataMapping; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qitemmodelscatterdataproxy.cpp b/src/datavis3d/data/qitemmodelscatterdataproxy.cpp deleted file mode 100644 index 5a84b7f1..00000000 --- a/src/datavis3d/data/qitemmodelscatterdataproxy.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "qitemmodelscatterdataproxy_p.h" -#include "scatteritemmodelhandler_p.h" -#include <QTimer> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -/*! - * \class QItemModelScatterDataProxy - * \inmodule QtDataVis3D - * \brief Proxy class for Q3DScatter data model mapping. - * \since 1.0.0 - * - * QItemModelScatterDataProxy allows you to use QAbstractItemModel derived models as a data source - * for Q3DScatter. It maps roles defined in QItemModelScatterDataMapping to roles in the model. - */ - -/*! - * Constructs QItemModelScatterDataProxy. - */ -QItemModelScatterDataProxy::QItemModelScatterDataProxy() : - QScatterDataProxy(new QItemModelScatterDataProxyPrivate(this)) -{ -} - -/*! - * Constructs QItemModelScatterDataProxy with \a itemModel and \a mapping. Does not take ownership - * of the model or the mapping, but does connect to them to listen for changes. - */ -QItemModelScatterDataProxy::QItemModelScatterDataProxy(const QAbstractItemModel *itemModel, - QItemModelScatterDataMapping *mapping) : - QScatterDataProxy(new QItemModelScatterDataProxyPrivate(this)) -{ - dptr()->m_itemModelHandler->setItemModel(itemModel); - dptr()->m_itemModelHandler->setActiveMapping(mapping); -} - -/*! - * Destroys QItemModelScatterDataProxy. - */ -QItemModelScatterDataProxy::~QItemModelScatterDataProxy() -{ -} - -/*! - * \property QItemModelScatterDataProxy::itemModel - * - * Defines item model. Does not take ownership of the model, but does connect to it to listen for - * changes. - */ -void QItemModelScatterDataProxy::setItemModel(const QAbstractItemModel *itemModel) -{ - dptr()->m_itemModelHandler->setItemModel(itemModel); -} - -const QAbstractItemModel *QItemModelScatterDataProxy::itemModel() const -{ - return dptrc()->m_itemModelHandler->itemModel(); -} - -/*! - * \property QItemModelScatterDataProxy::activeMapping - * - * Defines data mapping. Proxy takes ownership of the \a mapping. - * Modifying a mapping that is set to the proxy will trigger data set re-resolving. - */ -void QItemModelScatterDataProxy::setActiveMapping(QItemModelScatterDataMapping *mapping) -{ - dptr()->m_itemModelHandler->setActiveMapping(mapping); -} - -QItemModelScatterDataMapping *QItemModelScatterDataProxy::activeMapping() const -{ - return static_cast<QItemModelScatterDataMapping *>(dptrc()->m_itemModelHandler->activeMapping()); -} - -/*! - * Transfers the ownership of the \a mapping to this proxy. The mapping is not taken to use yet. - * \sa setActiveMapping(), releaseMapping() - */ -void QItemModelScatterDataProxy::addMapping(QItemModelScatterDataMapping *mapping) -{ - dptr()->m_itemModelHandler->addMapping(mapping); -} - -/*! - * Releases the ownership of the \a mapping back to the caller. If the mapping was the currently - * active one, no mapping remains active after this call. - */ -void QItemModelScatterDataProxy::releaseMapping(QItemModelScatterDataMapping *mapping) -{ - dptr()->m_itemModelHandler->releaseMapping(mapping); -} - -/*! - * \return list of mappings owned by the proxy. - */ -QList<QItemModelScatterDataMapping *> QItemModelScatterDataProxy::mappings() const -{ - QList<QItemModelScatterDataMapping *> retList; - QList<QAbstractDataMapping *> abstractList = dptrc()->m_itemModelHandler->mappings(); - foreach (QAbstractDataMapping *mapping, abstractList) - retList.append(static_cast<QItemModelScatterDataMapping *>(mapping)); - - return retList; -} - -/*! - * \internal - */ -QItemModelScatterDataProxyPrivate *QItemModelScatterDataProxy::dptr() -{ - return static_cast<QItemModelScatterDataProxyPrivate *>(d_ptr.data()); -} - -/*! - * \internal - */ -const QItemModelScatterDataProxyPrivate *QItemModelScatterDataProxy::dptrc() const -{ - return static_cast<const QItemModelScatterDataProxyPrivate *>(d_ptr.data()); -} - -// QItemModelScatterDataProxyPrivate - -QItemModelScatterDataProxyPrivate::QItemModelScatterDataProxyPrivate(QItemModelScatterDataProxy *q) - : QScatterDataProxyPrivate(q), - m_itemModelHandler(new ScatterItemModelHandler(q)) -{ -} - -QItemModelScatterDataProxyPrivate::~QItemModelScatterDataProxyPrivate() -{ - delete m_itemModelHandler; -} - -QItemModelScatterDataProxy *QItemModelScatterDataProxyPrivate::qptr() -{ - return static_cast<QItemModelScatterDataProxy *>(q_ptr); -} - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/qitemmodelscatterdataproxy.h b/src/datavis3d/data/qitemmodelscatterdataproxy.h deleted file mode 100644 index c5cb73a5..00000000 --- a/src/datavis3d/data/qitemmodelscatterdataproxy.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#ifndef QITEMMODELSCATTERDATAPROXY_H -#define QITEMMODELSCATTERDATAPROXY_H - -#include <QtDataVis3D/qscatterdataproxy.h> -#include <QtDataVis3D/qitemmodelscatterdatamapping.h> -#include <QAbstractItemModel> -#include <QStringList> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QItemModelScatterDataProxyPrivate; - -class QT_DATAVIS3D_EXPORT QItemModelScatterDataProxy : public QScatterDataProxy -{ - Q_OBJECT - Q_PROPERTY(const QAbstractItemModel* itemModel READ itemModel WRITE setItemModel) - Q_PROPERTY(QItemModelScatterDataMapping* activeMapping READ activeMapping WRITE setActiveMapping) - -public: - explicit QItemModelScatterDataProxy(); - explicit QItemModelScatterDataProxy(const QAbstractItemModel *itemModel, - QItemModelScatterDataMapping *mapping); - virtual ~QItemModelScatterDataProxy(); - - void setItemModel(const QAbstractItemModel *itemModel); - const QAbstractItemModel *itemModel() const; - - void setActiveMapping(QItemModelScatterDataMapping *mapping); - QItemModelScatterDataMapping *activeMapping() const; - void addMapping(QItemModelScatterDataMapping *mapping); - void releaseMapping(QItemModelScatterDataMapping *mapping); - QList<QItemModelScatterDataMapping *> mappings() const; - -protected: - QItemModelScatterDataProxyPrivate *dptr(); - const QItemModelScatterDataProxyPrivate *dptrc() const; - -private: - Q_DISABLE_COPY(QItemModelScatterDataProxy) -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qitemmodelscatterdataproxy_p.h b/src/datavis3d/data/qitemmodelscatterdataproxy_p.h deleted file mode 100644 index 6fee2f80..00000000 --- a/src/datavis3d/data/qitemmodelscatterdataproxy_p.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef QITEMMODELSCATTERDATAPROXY_P_H -#define QITEMMODELSCATTERDATAPROXY_P_H - -#include "qitemmodelscatterdataproxy.h" -#include "qscatterdataproxy_p.h" -#include <QPointer> -#include <QTimer> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class ScatterItemModelHandler; - -class QItemModelScatterDataProxyPrivate : public QScatterDataProxyPrivate -{ - Q_OBJECT -public: - QItemModelScatterDataProxyPrivate(QItemModelScatterDataProxy *q); - virtual ~QItemModelScatterDataProxyPrivate(); - -private: - QItemModelScatterDataProxy *qptr(); - - ScatterItemModelHandler *m_itemModelHandler; - - friend class QItemModelScatterDataProxy; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qitemmodelsurfacedatamapping.cpp b/src/datavis3d/data/qitemmodelsurfacedatamapping.cpp deleted file mode 100644 index 2122a570..00000000 --- a/src/datavis3d/data/qitemmodelsurfacedatamapping.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "qitemmodelsurfacedatamapping_p.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -/*! - * \class QItemModelSurfaceDataMapping - * \inmodule QtDataVis3D - * \brief Data model mapping for Q3DSurface. - * \since 1.0.0 - * - * DOCUMENTATION GOES HERE - * - * \sa QItemModelSurfaceDataProxy - */ - -/*! - * Constructs QItemModelSurfaceDataMapping with the given \a parent. - */ -QItemModelSurfaceDataMapping::QItemModelSurfaceDataMapping(QObject *parent) - : QAbstractDataMapping(new QItemModelSurfaceDataMappingPrivate(this), parent) -{ -} - -/*! - * Constructs QItemModelSurfaceDataMapping with \a valueRole and the given \a parent. - */ -QItemModelSurfaceDataMapping::QItemModelSurfaceDataMapping(const QString &valueRole, QObject *parent) - : QAbstractDataMapping(new QItemModelSurfaceDataMappingPrivate(this), parent) -{ - dptr()->m_valueRole = valueRole; -} - -/*! - * Constructs QItemModelSurfaceDataMapping with \a rowRole, \a columnRole, \a valueRole, - * \a rowCategories, \a columnCategories and the given \a parent. - */ -QItemModelSurfaceDataMapping::QItemModelSurfaceDataMapping(const QString &rowRole, - const QString &columnRole, - const QString &valueRole, - const QStringList &rowCategories, - const QStringList &columnCategories, - QObject *parent) - : QAbstractDataMapping(new QItemModelSurfaceDataMappingPrivate(this), parent) -{ - dptr()->m_rowRole = rowRole; - dptr()->m_columnRole = columnRole; - dptr()->m_valueRole = valueRole; - dptr()->m_rowCategories = rowCategories; - dptr()->m_columnCategories = columnCategories; -} - -/*! - * Destroys QItemModelSurfaceDataMapping. - */ -QItemModelSurfaceDataMapping::~QItemModelSurfaceDataMapping() -{ -} - -/*! - * \property QItemModelSurfaceDataMapping::rowRole - * - * Defines the row role for the mapping. - */ -void QItemModelSurfaceDataMapping::setRowRole(const QString &role) -{ - dptr()->m_rowRole = role; - emit mappingChanged(); -} - -QString QItemModelSurfaceDataMapping::rowRole() const -{ - return dptrc()->m_rowRole; -} - -/*! - * \property QItemModelSurfaceDataMapping::columnRole - * - * Defines the column role for the mapping. - */ -void QItemModelSurfaceDataMapping::setColumnRole(const QString &role) -{ - dptr()->m_columnRole = role; - emit mappingChanged(); -} - -QString QItemModelSurfaceDataMapping::columnRole() const -{ - return dptrc()->m_columnRole; -} - -/*! - * \property QItemModelSurfaceDataMapping::valueRole - * - * Defines the value role for the mapping. - */ -void QItemModelSurfaceDataMapping::setValueRole(const QString &role) -{ - dptr()->m_valueRole = role; - emit mappingChanged(); -} - -QString QItemModelSurfaceDataMapping::valueRole() const -{ - return dptrc()->m_valueRole; -} - -/*! - * \property QItemModelSurfaceDataMapping::rowCategories - * - * Defines the row categories for the mapping. - */ -void QItemModelSurfaceDataMapping::setRowCategories(const QStringList &categories) -{ - dptr()->m_rowCategories = categories; - emit mappingChanged(); -} - -QStringList QItemModelSurfaceDataMapping::rowCategories() const -{ - return dptrc()->m_rowCategories; -} - -/*! - * \property QItemModelSurfaceDataMapping::columnCategories - * - * Defines the column categories for the mapping. - */ -void QItemModelSurfaceDataMapping::setColumnCategories(const QStringList &categories) -{ - dptr()->m_columnCategories = categories; - emit mappingChanged(); -} - -QStringList QItemModelSurfaceDataMapping::columnCategories() const -{ - return dptrc()->m_columnCategories; -} - -/*! - * Changes \a rowRole, \a columnRole, \a valueRole, \a rowCategories and \a columnCategories to the - * mapping. - */ -void QItemModelSurfaceDataMapping::remap(const QString &rowRole, - const QString &columnRole, - const QString &valueRole, - const QStringList &rowCategories, - const QStringList &columnCategories) -{ - dptr()->m_rowRole = rowRole; - dptr()->m_columnRole = columnRole; - dptr()->m_valueRole = valueRole; - dptr()->m_rowCategories = rowCategories; - dptr()->m_columnCategories = columnCategories; - - emit mappingChanged(); -} - -/*! - * /return index of the specified \a category in row categories list. - * If the category is not found, -1 is returned. - */ -int QItemModelSurfaceDataMapping::rowCategoryIndex(const QString &category) -{ - return dptr()->m_rowCategories.indexOf(category); -} - -/*! - * /return index of the specified \a category in column categories list. - * If the category is not found, -1 is returned. - */ -int QItemModelSurfaceDataMapping::columnCategoryIndex(const QString &category) -{ - return dptr()->m_columnCategories.indexOf(category); -} - -/*! - * \internal - */ -QItemModelSurfaceDataMappingPrivate *QItemModelSurfaceDataMapping::dptr() -{ - return static_cast<QItemModelSurfaceDataMappingPrivate *>(d_ptr.data()); -} - -/*! - * \internal - */ -const QItemModelSurfaceDataMappingPrivate *QItemModelSurfaceDataMapping::dptrc() const -{ - return static_cast<const QItemModelSurfaceDataMappingPrivate *>(d_ptr.data()); -} - -// QItemModelSurfaceDataMappingPrivate - -QItemModelSurfaceDataMappingPrivate::QItemModelSurfaceDataMappingPrivate(QItemModelSurfaceDataMapping *q) - : QAbstractDataMappingPrivate(q, QAbstractDataProxy::DataTypeSurface) -{ -} - -QItemModelSurfaceDataMappingPrivate::~QItemModelSurfaceDataMappingPrivate() -{ -} - - -QT_DATAVIS3D_END_NAMESPACE - diff --git a/src/datavis3d/data/qitemmodelsurfacedatamapping.h b/src/datavis3d/data/qitemmodelsurfacedatamapping.h deleted file mode 100644 index ff16f296..00000000 --- a/src/datavis3d/data/qitemmodelsurfacedatamapping.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#ifndef QITEMMODELSURFACEDATAMAPPING_H -#define QITEMMODELSURFACEDATAMAPPING_H - -#include <QtDataVis3D/qdatavis3denums.h> -#include <QtDataVis3D/qabstractdatamapping.h> -#include <QStringList> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QItemModelSurfaceDataMappingPrivate; - -class QT_DATAVIS3D_EXPORT QItemModelSurfaceDataMapping : public QAbstractDataMapping -{ - Q_OBJECT - Q_PROPERTY(QString rowRole READ rowRole WRITE setRowRole) - Q_PROPERTY(QString columnRole READ columnRole WRITE setColumnRole) - Q_PROPERTY(QString valueRole READ valueRole WRITE setValueRole) - Q_PROPERTY(QStringList rowCategories READ rowCategories WRITE setRowCategories) - Q_PROPERTY(QStringList columnCategories READ columnCategories WRITE setColumnCategories) - -public: - explicit QItemModelSurfaceDataMapping(QObject *parent = 0); - QItemModelSurfaceDataMapping(const QString &valueRole, QObject *parent = 0); - QItemModelSurfaceDataMapping(const QString &rowRole, const QString &columnRole, - const QString &valueRole, const QStringList &rowCategories, - const QStringList &columnCategories, QObject *parent = 0); - virtual ~QItemModelSurfaceDataMapping(); - - void setRowRole(const QString &role); - QString rowRole() const; - void setColumnRole(const QString &role); - QString columnRole() const; - void setValueRole(const QString &role); - QString valueRole() const; - - void setRowCategories(const QStringList &categories); - QStringList rowCategories() const; - void setColumnCategories(const QStringList &categories); - QStringList columnCategories() const; - - void remap(const QString &rowRole, const QString &columnRole, - const QString &valueRole, const QStringList &rowCategories, - const QStringList &columnCategories); - - Q_INVOKABLE int rowCategoryIndex(const QString& category); - Q_INVOKABLE int columnCategoryIndex(const QString& category); - -protected: - QItemModelSurfaceDataMappingPrivate *dptr(); - const QItemModelSurfaceDataMappingPrivate *dptrc() const; - -private: - Q_DISABLE_COPY(QItemModelSurfaceDataMapping) -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qitemmodelsurfacedatamapping_p.h b/src/datavis3d/data/qitemmodelsurfacedatamapping_p.h deleted file mode 100644 index 26d1fbc7..00000000 --- a/src/datavis3d/data/qitemmodelsurfacedatamapping_p.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#include "qitemmodelsurfacedatamapping.h" -#include "qabstractdatamapping_p.h" - -#ifndef QITEMMODELSURFACEDATAMAPPING_P_H -#define QITEMMODELSURFACEDATAMAPPING_P_H - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QItemModelSurfaceDataMappingPrivate : public QAbstractDataMappingPrivate -{ - Q_OBJECT -public: - QItemModelSurfaceDataMappingPrivate(QItemModelSurfaceDataMapping *q); - virtual ~QItemModelSurfaceDataMappingPrivate(); - -private: - QString m_rowRole; - QString m_columnRole; - QString m_valueRole; - - // For row/column items, sort items into these categories. Other categories are ignored. - QStringList m_rowCategories; - QStringList m_columnCategories; - - friend class QItemModelSurfaceDataMapping; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qitemmodelsurfacedataproxy.cpp b/src/datavis3d/data/qitemmodelsurfacedataproxy.cpp deleted file mode 100644 index 3d2929c1..00000000 --- a/src/datavis3d/data/qitemmodelsurfacedataproxy.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "qitemmodelsurfacedataproxy_p.h" -#include "surfaceitemmodelhandler_p.h" -#include <QTimer> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -// TODO: CHECK DOCUMENTATION! - -/*! - * \class QItemModelSurfaceDataProxy - * \inmodule QtDataVis3D - * \brief Proxy class for Q3DSurface data model mapping. - * \since 1.0.0 - * - * QItemModelSurfaceDataProxy allows you to use QAbstractItemModel derived models as a data source - * for Q3DSurface. It maps roles defined in QItemModelSurfaceDataMapping to roles in the model. - */ - -/*! - * Constructs QItemModelSurfaceDataProxy. - */ -QItemModelSurfaceDataProxy::QItemModelSurfaceDataProxy() : - QSurfaceDataProxy(new QItemModelSurfaceDataProxyPrivate(this)) -{ -} - -/*! - * Constructs QItemModelSurfaceDataProxy with \a itemModel and \a mapping. Does not take ownership - * of the model or the mapping, but does connect to them to listen for changes. - */ -QItemModelSurfaceDataProxy::QItemModelSurfaceDataProxy(const QAbstractItemModel *itemModel, - QItemModelSurfaceDataMapping *mapping) : - QSurfaceDataProxy(new QItemModelSurfaceDataProxyPrivate(this)) -{ - dptr()->m_itemModelHandler->setItemModel(itemModel); - dptr()->m_itemModelHandler->setActiveMapping(mapping); -} - -/*! - * Destroys QItemModelSurfaceDataProxy. - */ -QItemModelSurfaceDataProxy::~QItemModelSurfaceDataProxy() -{ -} - -/*! - * \property QItemModelSurfaceDataProxy::itemModel - * - * Defines item model. Does not take ownership of the model, but does connect to it to listen for - * changes. - */ -void QItemModelSurfaceDataProxy::setItemModel(const QAbstractItemModel *itemModel) -{ - dptr()->m_itemModelHandler->setItemModel(itemModel); -} - -const QAbstractItemModel *QItemModelSurfaceDataProxy::itemModel() const -{ - return dptrc()->m_itemModelHandler->itemModel(); -} - -/*! - * \property QItemModelSurfaceDataProxy::activeMapping - * - * Defines data mapping. Proxy takes ownership of the \a mapping. - * Modifying a mapping that is set to the proxy will trigger data set re-resolving. - */ -void QItemModelSurfaceDataProxy::setActiveMapping(QItemModelSurfaceDataMapping *mapping) -{ - dptr()->m_itemModelHandler->setActiveMapping(mapping); -} - -QItemModelSurfaceDataMapping *QItemModelSurfaceDataProxy::activeMapping() const -{ - return static_cast<QItemModelSurfaceDataMapping *>(dptrc()->m_itemModelHandler->activeMapping()); -} - -/*! - * Transfers the ownership of the \a mapping to this proxy. The mapping is not taken to use yet. - * \sa setActiveMapping(), releaseMapping() - */ -void QItemModelSurfaceDataProxy::addMapping(QItemModelSurfaceDataMapping *mapping) -{ - dptr()->m_itemModelHandler->addMapping(mapping); -} - -/*! - * Releases the ownership of the \a mapping back to the caller. If the mapping was the currently - * active one, no mapping remains active after this call. - */ -void QItemModelSurfaceDataProxy::releaseMapping(QItemModelSurfaceDataMapping *mapping) -{ - dptr()->m_itemModelHandler->releaseMapping(mapping); -} - -/*! - * \return list of mappings owned by the proxy. - */ -QList<QItemModelSurfaceDataMapping *> QItemModelSurfaceDataProxy::mappings() const -{ - QList<QItemModelSurfaceDataMapping *> retList; - QList<QAbstractDataMapping *> abstractList = dptrc()->m_itemModelHandler->mappings(); - foreach (QAbstractDataMapping *mapping, abstractList) - retList.append(static_cast<QItemModelSurfaceDataMapping *>(mapping)); - - return retList; -} - -/*! - * \internal - */ -QItemModelSurfaceDataProxyPrivate *QItemModelSurfaceDataProxy::dptr() -{ - return static_cast<QItemModelSurfaceDataProxyPrivate *>(d_ptr.data()); -} - -/*! - * \internal - */ -const QItemModelSurfaceDataProxyPrivate *QItemModelSurfaceDataProxy::dptrc() const -{ - return static_cast<const QItemModelSurfaceDataProxyPrivate *>(d_ptr.data()); -} - -// QItemModelSurfaceDataProxyPrivate - -QItemModelSurfaceDataProxyPrivate::QItemModelSurfaceDataProxyPrivate(QItemModelSurfaceDataProxy *q) - : QSurfaceDataProxyPrivate(q), - m_itemModelHandler(new SurfaceItemModelHandler(q)) -{ -} - -QItemModelSurfaceDataProxyPrivate::~QItemModelSurfaceDataProxyPrivate() -{ - delete m_itemModelHandler; -} - -QItemModelSurfaceDataProxy *QItemModelSurfaceDataProxyPrivate::qptr() -{ - return static_cast<QItemModelSurfaceDataProxy *>(q_ptr); -} - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/qitemmodelsurfacedataproxy.h b/src/datavis3d/data/qitemmodelsurfacedataproxy.h deleted file mode 100644 index d10e7005..00000000 --- a/src/datavis3d/data/qitemmodelsurfacedataproxy.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#ifndef QITEMMODELSURFACEDATAPROXY_H -#define QITEMMODELSURFACEDATAPROXY_H - -#include <QtDataVis3D/qsurfacedataproxy.h> -#include <QtDataVis3D/qitemmodelsurfacedatamapping.h> -#include <QAbstractItemModel> -#include <QStringList> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QItemModelSurfaceDataProxyPrivate; - -class QT_DATAVIS3D_EXPORT QItemModelSurfaceDataProxy : public QSurfaceDataProxy -{ - Q_OBJECT - Q_PROPERTY(const QAbstractItemModel* itemModel READ itemModel WRITE setItemModel) - Q_PROPERTY(QItemModelSurfaceDataMapping* activeMapping READ activeMapping WRITE setActiveMapping) - -public: - explicit QItemModelSurfaceDataProxy(); - explicit QItemModelSurfaceDataProxy(const QAbstractItemModel *itemModel, - QItemModelSurfaceDataMapping *mapping); - virtual ~QItemModelSurfaceDataProxy(); - - void setItemModel(const QAbstractItemModel *itemModel); - const QAbstractItemModel *itemModel() const; - - void setActiveMapping(QItemModelSurfaceDataMapping *mapping); - QItemModelSurfaceDataMapping *activeMapping() const; - void addMapping(QItemModelSurfaceDataMapping *mapping); - void releaseMapping(QItemModelSurfaceDataMapping *mapping); - QList<QItemModelSurfaceDataMapping *> mappings() const; - -protected: - QItemModelSurfaceDataProxyPrivate *dptr(); - const QItemModelSurfaceDataProxyPrivate *dptrc() const; - -private: - Q_DISABLE_COPY(QItemModelSurfaceDataProxy) -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qitemmodelsurfacedataproxy_p.h b/src/datavis3d/data/qitemmodelsurfacedataproxy_p.h deleted file mode 100644 index f9d12618..00000000 --- a/src/datavis3d/data/qitemmodelsurfacedataproxy_p.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef QITEMMODELSURFACEDATAPROXY_P_H -#define QITEMMODELSURFACEDATAPROXY_P_H - -#include "qitemmodelsurfacedataproxy.h" -#include "qsurfacedataproxy_p.h" -#include <QPointer> -#include <QTimer> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class SurfaceItemModelHandler; - -class QItemModelSurfaceDataProxyPrivate : public QSurfaceDataProxyPrivate -{ - Q_OBJECT -public: - QItemModelSurfaceDataProxyPrivate(QItemModelSurfaceDataProxy *q); - virtual ~QItemModelSurfaceDataProxyPrivate(); - -private: - QItemModelSurfaceDataProxy *qptr(); - - SurfaceItemModelHandler *m_itemModelHandler; - - friend class QItemModelSurfaceDataProxy; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qscatterdataitem.cpp b/src/datavis3d/data/qscatterdataitem.cpp deleted file mode 100644 index c2926811..00000000 --- a/src/datavis3d/data/qscatterdataitem.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "qscatterdataitem_p.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -/*! - * \class QScatterDataItem - * \inmodule QtDataVis3D - * \brief The QScatterDataItem class provides a container for resolved data to be added to scatter - * graphs. - * \since 1.0.0 - * - * A QScatterDataItem holds data for a single rendered item in a scatter graph. - * Scatter data proxies parse data into QScatterDataItem instances for visualizing. - * - * \sa QScatterDataProxy, {Qt Data Visualization 3D C++ Classes} - */ - -/*! - * Constructs QScatterDataItem. - */ -QScatterDataItem::QScatterDataItem() - : d_ptr(0) // private data doesn't exist by default (optimization) - -{ -} - -/*! - * Constructs QScatterDataItem with \a position. - */ -QScatterDataItem::QScatterDataItem(const QVector3D &position) - : d_ptr(0), - m_position(position) -{ -} - -/*! - * Constructs a copy of \a other. - */ -QScatterDataItem::QScatterDataItem(const QScatterDataItem &other) -{ - operator=(other); -} - -/*! - * Destroys QScatterDataItem. - */ -QScatterDataItem::~QScatterDataItem() -{ -} - -/*! - * Assigns a copy of \a other to this object. - */ -QScatterDataItem &QScatterDataItem::operator=(const QScatterDataItem &other) -{ - m_position = other.m_position; - //m_size = other.m_size; - - if (other.d_ptr) - createExtraData(); - else - d_ptr = 0; - // TODO set extra data - - return *this; -} - -/*! - * Sets \a position to this data item. - */ -void QScatterDataItem::setPosition(const QVector3D &position) -{ - m_position = position; -} - -/*! - * \return position of this data item. - */ -QVector3D QScatterDataItem::position() const -{ - return m_position; -} - -//void QScatterDataItem::setSize(qreal size) -//{ -// m_size = size; -//} - -//const qreal &QScatterDataItem::size() const -//{ -// return m_size; -//} - -/*! - * \internal - */ -void QScatterDataItem::createExtraData() -{ - if (!d_ptr) - d_ptr = new QScatterDataItemPrivate; -} - -QScatterDataItemPrivate::QScatterDataItemPrivate() -{ -} - -QScatterDataItemPrivate::~QScatterDataItemPrivate() -{ -} - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/qscatterdataitem.h b/src/datavis3d/data/qscatterdataitem.h deleted file mode 100644 index 96a33eb2..00000000 --- a/src/datavis3d/data/qscatterdataitem.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#ifndef QSCATTERDATAITEM_H -#define QSCATTERDATAITEM_H - -#include <QtDataVis3D/qdatavis3denums.h> -#include <QVector3D> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QScatterDataItemPrivate; - -class QT_DATAVIS3D_EXPORT QScatterDataItem -{ -public: - QScatterDataItem(); - QScatterDataItem(const QVector3D &position); - QScatterDataItem(const QScatterDataItem &other); - ~QScatterDataItem(); - - QScatterDataItem &operator=(const QScatterDataItem &other); - - void setPosition(const QVector3D &position); - QVector3D position() const; - - //void setSize(qreal size); - //qreal size() const; - -protected: - virtual void createExtraData(); - - QScatterDataItemPrivate *d_ptr; - -private: - QVector3D m_position; - //qreal m_size; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qscatterdataitem_p.h b/src/datavis3d/data/qscatterdataitem_p.h deleted file mode 100644 index 3718a185..00000000 --- a/src/datavis3d/data/qscatterdataitem_p.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef QSCATTERDATAITEM_P_H -#define QSCATTERDATAITEM_P_H - -#include "datavis3dglobal_p.h" -#include "qscatterdataitem.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QScatterDataItemPrivate -{ -public: - QScatterDataItemPrivate(); - virtual ~QScatterDataItemPrivate(); - - // TODO stores other data for scatter items besides position - -protected: - friend class QScatterDataItem; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qscatterdataproxy.cpp b/src/datavis3d/data/qscatterdataproxy.cpp deleted file mode 100644 index 16b14621..00000000 --- a/src/datavis3d/data/qscatterdataproxy.cpp +++ /dev/null @@ -1,332 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "qscatterdataproxy.h" -#include "qscatterdataproxy_p.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -/*! - * \class QScatterDataProxy - * \inmodule QtDataVis3D - * \brief Proxy class for Q3DScatter. - * \since 1.0.0 - * - * QScatterDataProxy handles adding, inserting, changing and removing data items. - * - * QScatterDataProxy takes ownership of all QScatterDataArrays and QScatterDataItems passed to it. - * - * QScatterDataProxy supports the following format tags for QAbstractDataProxy::setItemLabelFormat(): - * \table - * \row - * \li @xTitle \li Title from X axis - * \row - * \li @yTitle \li Title from Y axis - * \row - * \li @zTitle \li Title from Z axis - * \row - * \li @xLabel \li Item value formatted using the same format the X axis attached to the graph uses, - * see \l{Q3DValueAxis::setLabelFormat()} for more information. - * \row - * \li @yLabel \li Item value formatted using the same format the Y axis attached to the graph uses, - * see \l{Q3DValueAxis::setLabelFormat()} for more information. - * \row - * \li @zLabel \li Item value formatted using the same format the Z axis attached to the graph uses, - * see \l{Q3DValueAxis::setLabelFormat()} for more information. - * \endtable - * - * For example: - * \snippet doc_src_qtdatavis3d.cpp 2 - */ - -/*! - * Constructs QScatterDataProxy with the given \a parent. - */ -QScatterDataProxy::QScatterDataProxy(QObject *parent) : - QAbstractDataProxy(new QScatterDataProxyPrivate(this), parent) -{ -} - -/*! - * \internal - */ -QScatterDataProxy::QScatterDataProxy(QScatterDataProxyPrivate *d, QObject *parent) : - QAbstractDataProxy(d, parent) -{ -} - -/*! - * Destroys QScatterDataProxy. - */ -QScatterDataProxy::~QScatterDataProxy() -{ -} - -/*! - * Clears the existing array and takes ownership of the \a newArray. Do not use \a newArray pointer - * to further modify data after QScatterDataProxy assumes ownership of it, as such modifications will - * not trigger proper signals. - * Passing null array clears all data. - */ -void QScatterDataProxy::resetArray(QScatterDataArray *newArray) -{ - if (dptr()->resetArray(newArray)) - emit arrayReset(); -} - -/*! - * Changes a single item at \a index with \a item. - */ -void QScatterDataProxy::setItem(int index, const QScatterDataItem &item) -{ - dptr()->setItem(index, item); - emit itemsChanged(index, 1); -} - -/*! - * Changes items starting from \a index with \a items. - */ -void QScatterDataProxy::setItems(int index, const QScatterDataArray &items) -{ - dptr()->setItems(index, items); - emit itemsChanged(index, items.size()); -} - -/*! - * Adds a single \a item to the end of the array. - * - * \return index of the added item. - */ -int QScatterDataProxy::addItem(const QScatterDataItem &item) -{ - int addIndex = dptr()->addItem(item); - emit itemsAdded(addIndex, 1); - return addIndex; -} - -/*! - * Adds \a items to the end of the array. - * - * \return index of the first added item. - */ -int QScatterDataProxy::addItems(const QScatterDataArray &items) -{ - int addIndex = dptr()->addItems(items); - emit itemsAdded(addIndex, items.size()); - return addIndex; -} - -/*! - * Inserts a single \a item to \a index. If index is equal to data array size, item is added to - * the array. - */ -void QScatterDataProxy::insertItem(int index, const QScatterDataItem &item) -{ - dptr()->insertItem(index, item); - emit itemsInserted(index, 1); -} - -/*! - * Inserts \a items to \a index. If index is equal to data array size, items are added to the array. - */ -void QScatterDataProxy::insertItems(int index, const QScatterDataArray &items) -{ - dptr()->insertItems(index, items); - emit itemsInserted(index, items.size()); -} - -/*! - * Removes \a removeCount items starting from \a index. Attempting to remove items past the end of - * the array does nothing. - */ -void QScatterDataProxy::removeItems(int index, int removeCount) -{ - dptr()->removeItems(index, removeCount); - emit itemsRemoved(index, removeCount); -} - -/*! - * \return item count in the array. - */ -int QScatterDataProxy::itemCount() const -{ - return dptrc()->m_dataArray->size(); -} - -/*! - * \return pointer to the data array. - */ -const QScatterDataArray *QScatterDataProxy::array() const -{ - return dptrc()->m_dataArray; -} - -/*! - * \return pointer to the item at \a index. It is guaranteed to be valid only until next call - * that modifies data. - */ -const QScatterDataItem *QScatterDataProxy::itemAt(int index) const -{ - return &dptrc()->m_dataArray->at(index); -} - -/*! - * \internal - */ -QScatterDataProxyPrivate *QScatterDataProxy::dptr() -{ - return static_cast<QScatterDataProxyPrivate *>(d_ptr.data()); -} - -/*! - * \internal - */ -const QScatterDataProxyPrivate *QScatterDataProxy::dptrc() const -{ - return static_cast<const QScatterDataProxyPrivate *>(d_ptr.data()); -} - -/*! - * \fn void QScatterDataProxy::arrayReset() - * - * Emitted when data array is reset. - */ - -/*! - * \fn void QScatterDataProxy::itemsAdded(int startIndex, int count) - * - * Emitted when items have been added. Provides \a startIndex and \a count of items added. - */ - -/*! - * \fn void QScatterDataProxy::itemsChanged(int startIndex, int count) - * - * Emitted when items have changed. Provides \a startIndex and \a count of changed items. - */ - -/*! - * \fn void QScatterDataProxy::itemsRemoved(int startIndex, int count) - * - * Emitted when items have been removed. Provides \a startIndex and \a count of items removed. - * Index may be over current array size if removed from end. - */ - -/*! - * \fn void QScatterDataProxy::itemsInserted(int startIndex, int count) - * - * Emitted when items have been inserted. Provides \a startIndex and \a count of inserted items. - */ - -// QScatterDataProxyPrivate - -QScatterDataProxyPrivate::QScatterDataProxyPrivate(QScatterDataProxy *q) - : QAbstractDataProxyPrivate(q, QAbstractDataProxy::DataTypeScatter), - m_dataArray(new QScatterDataArray) -{ - m_itemLabelFormat = QStringLiteral("(@xLabel, @yLabel, @zLabel)"); -} - -QScatterDataProxyPrivate::~QScatterDataProxyPrivate() -{ - m_dataArray->clear(); - delete m_dataArray; -} - -bool QScatterDataProxyPrivate::resetArray(QScatterDataArray *newArray) -{ - if (!m_dataArray->size() && (!newArray || !newArray->size())) - return false; - - m_dataArray->clear(); - delete m_dataArray; - - if (newArray) - m_dataArray = newArray; - else - m_dataArray = new QScatterDataArray; - - return true; -} - -void QScatterDataProxyPrivate::setItem(int index, const QScatterDataItem &item) -{ - Q_ASSERT(index >= 0 && index < m_dataArray->size()); - (*m_dataArray)[index] = item; -} - -void QScatterDataProxyPrivate::setItems(int index, const QScatterDataArray &items) -{ - Q_ASSERT(index >= 0 && (index + items.size()) <= m_dataArray->size()); - for (int i = 0; i < items.size(); i++) - (*m_dataArray)[index++] = items[i]; -} - -int QScatterDataProxyPrivate::addItem(const QScatterDataItem &item) -{ - int currentSize = m_dataArray->size(); - m_dataArray->append(item); - return currentSize; -} - -int QScatterDataProxyPrivate::addItems(const QScatterDataArray &items) -{ - int currentSize = m_dataArray->size(); - (*m_dataArray) += items; - return currentSize; -} - -void QScatterDataProxyPrivate::insertItem(int index, const QScatterDataItem &item) -{ - Q_ASSERT(index >= 0 && index <= m_dataArray->size()); - m_dataArray->insert(index, item); -} - -void QScatterDataProxyPrivate::insertItems(int index, const QScatterDataArray &items) -{ - Q_ASSERT(index >= 0 && index <= m_dataArray->size()); - for (int i = 0; i < items.size(); i++) - m_dataArray->insert(index++, items.at(i)); -} - -void QScatterDataProxyPrivate::removeItems(int index, int removeCount) -{ - Q_ASSERT(index >= 0); - int maxRemoveCount = m_dataArray->size() - index; - removeCount = qMin(removeCount, maxRemoveCount); - m_dataArray->remove(index, removeCount); -} - -QVector3D QScatterDataProxyPrivate::limitValues() -{ - QVector3D limits; - for (int i = 0; i < m_dataArray->size(); i++) { - const QScatterDataItem &item = m_dataArray->at(i); - float xValue = qAbs(item.position().x()); - if (limits.x() < xValue) - limits.setX(xValue); - float yValue = qAbs(item.position().y()); - if (limits.y() < yValue) - limits.setY(yValue); - float zValue = qAbs(item.position().z()); - if (limits.z() < zValue) - limits.setZ(zValue); - } - return limits; -} - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/qscatterdataproxy.h b/src/datavis3d/data/qscatterdataproxy.h deleted file mode 100644 index d5897631..00000000 --- a/src/datavis3d/data/qscatterdataproxy.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#ifndef QSCATTERDATAPROXY_H -#define QSCATTERDATAPROXY_H - -#include <QtDataVis3D/qabstractdataproxy.h> -#include <QtDataVis3D/qscatterdataitem.h> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -typedef QVector<QScatterDataItem> QScatterDataArray; - -class QScatterDataProxyPrivate; - -class QT_DATAVIS3D_EXPORT QScatterDataProxy : public QAbstractDataProxy -{ - Q_OBJECT - - Q_PROPERTY(int itemCount READ itemCount) -public: - explicit QScatterDataProxy(QObject *parent = 0); - virtual ~QScatterDataProxy(); - - // TODO: Replace first part of class description in docs with this once all TODOs are done: - /* - * QScatterDataProxy handles adding, inserting, changing and removing data items. - * QScatterDataProxy is optimized to use cases where the only defining characteristics of an - * individual scatter item are it's position and size. Modifying other data that might be - * added in the future such as color requires allocating additional data object for the bar. - */ - - int itemCount() const; - const QScatterDataArray *array() const; - const QScatterDataItem *itemAt(int index) const; - - void resetArray(QScatterDataArray *newArray); - - void setItem(int index, const QScatterDataItem &item); - void setItems(int index, const QScatterDataArray &items); - - int addItem(const QScatterDataItem &item); - int addItems(const QScatterDataArray &items); - - void insertItem(int index, const QScatterDataItem &item); - void insertItems(int index, const QScatterDataArray &items); - - void removeItems(int index, int removeCount); - -signals: - void arrayReset(); - void itemsAdded(int startIndex, int count); - void itemsChanged(int startIndex, int count); - void itemsRemoved(int startIndex, int count); - void itemsInserted(int startIndex, int count); - -protected: - explicit QScatterDataProxy(QScatterDataProxyPrivate *d, QObject *parent = 0); - QScatterDataProxyPrivate *dptr(); - const QScatterDataProxyPrivate *dptrc() const; - -private: - Q_DISABLE_COPY(QScatterDataProxy) - - friend class Scatter3DController; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/qscatterdataproxy_p.h b/src/datavis3d/data/qscatterdataproxy_p.h deleted file mode 100644 index 23a2fc6a..00000000 --- a/src/datavis3d/data/qscatterdataproxy_p.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef QSCATTERDATAPROXY_P_H -#define QSCATTERDATAPROXY_P_H - -#include "qscatterdataproxy.h" -#include "qabstractdataproxy_p.h" -#include "qscatterdataitem.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QScatterDataProxyPrivate : public QAbstractDataProxyPrivate -{ - Q_OBJECT -public: - QScatterDataProxyPrivate(QScatterDataProxy *q); - virtual ~QScatterDataProxyPrivate(); - - bool resetArray(QScatterDataArray *newArray); - void setItem(int index, const QScatterDataItem &item); - void setItems(int index, const QScatterDataArray &items); - int addItem(const QScatterDataItem &item); - int addItems(const QScatterDataArray &items); - void insertItem(int index, const QScatterDataItem &item); - void insertItems(int index, const QScatterDataArray &items); - void removeItems(int index, int removeCount); - - QVector3D limitValues(); - -private: - QScatterDataArray *m_dataArray; - - friend class QScatterDataProxy; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif // QBARDATAPROXY_P_H diff --git a/src/datavis3d/data/qsurfacedataproxy.cpp b/src/datavis3d/data/qsurfacedataproxy.cpp deleted file mode 100644 index 4d2d2176..00000000 --- a/src/datavis3d/data/qsurfacedataproxy.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "qsurfacedataproxy.h" -#include "qsurfacedataproxy_p.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -/*! - * Constructs QSurfaceDataProxy with the given \a parent. - */ -QSurfaceDataProxy::QSurfaceDataProxy(QObject *parent) : - QAbstractDataProxy(new QSurfaceDataProxyPrivate(this), parent) -{ -} - -/*! - * \internal - */ -QSurfaceDataProxy::QSurfaceDataProxy(QSurfaceDataProxyPrivate *d, QObject *parent) : - QAbstractDataProxy(d, parent) -{ -} - -/*! - * Destroys QSurfaceDataProxy. - */ -QSurfaceDataProxy::~QSurfaceDataProxy() -{ -} - -void QSurfaceDataProxy::resetArray(QSurfaceDataArray *newArray) -{ - if (dptr()->resetArray(newArray)) - emit arrayReset(); -} - -const QSurfaceDataArray *QSurfaceDataProxy::array() const -{ - return dptrc()->m_dataArray; -} - -const QSurfaceDataItem *QSurfaceDataProxy::itemAt(int index) const -{ - return &dptrc()->m_dataArray->at(index)->at(2); -} - -QSurfaceDataProxyPrivate *QSurfaceDataProxy::dptr() -{ - return static_cast<QSurfaceDataProxyPrivate *>(d_ptr.data()); -} - -const QSurfaceDataProxyPrivate *QSurfaceDataProxy::dptrc() const -{ - return static_cast<const QSurfaceDataProxyPrivate *>(d_ptr.data()); -} - -// -// QSurfaceDataProxyPrivate -// - -QSurfaceDataProxyPrivate::QSurfaceDataProxyPrivate(QSurfaceDataProxy *q) - : QAbstractDataProxyPrivate(q, QAbstractDataProxy::DataTypeSurface), - m_dataArray(new QSurfaceDataArray) -{ - m_itemLabelFormat = QStringLiteral("(@yLabel)"); -} - -QSurfaceDataProxyPrivate::~QSurfaceDataProxyPrivate() -{ - m_dataArray->clear(); - delete m_dataArray; -} - -bool QSurfaceDataProxyPrivate::resetArray(QSurfaceDataArray *newArray) -{ - if (!m_dataArray->size() && (!newArray || !newArray->size())) - return false; - - m_dataArray->clear(); - delete m_dataArray; - - if (newArray) - m_dataArray = newArray; - else - m_dataArray = new QSurfaceDataArray; - - return true; -} - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/qsurfacedataproxy.h b/src/datavis3d/data/qsurfacedataproxy.h deleted file mode 100644 index 70481ee2..00000000 --- a/src/datavis3d/data/qsurfacedataproxy.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#ifndef QSURFACEDATAPROXY_H -#define QSURFACEDATAPROXY_H - -#include <QtDataVis3D/qdatavis3dglobal.h> -#include <QtDataVis3D/qabstractdataproxy.h> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -typedef qreal QSurfaceDataItem; // Let's stick to this for now, expand if needed -typedef QVector<QSurfaceDataItem> QSurfaceDataRow; -typedef QList<QSurfaceDataRow *> QSurfaceDataArray; - -class QSurfaceDataProxyPrivate; - -class QT_DATAVIS3D_EXPORT QSurfaceDataProxy : public QAbstractDataProxy -{ - Q_OBJECT - -public: - explicit QSurfaceDataProxy(QObject *parent = 0); - virtual ~QSurfaceDataProxy(); - - int itemCount() const; - const QSurfaceDataArray *array() const; - const QSurfaceDataItem *itemAt(int index) const; - - void resetArray(QSurfaceDataArray *newArray); - -signals: - void arrayReset(); - -protected: - explicit QSurfaceDataProxy(QSurfaceDataProxyPrivate *d, QObject *parent = 0); - QSurfaceDataProxyPrivate *dptr(); - const QSurfaceDataProxyPrivate *dptrc() const; - -private: - Q_DISABLE_COPY(QSurfaceDataProxy) - - friend class Surface3DController; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif // QSURFACEDATAPROXY_H diff --git a/src/datavis3d/data/qsurfacedataproxy_p.h b/src/datavis3d/data/qsurfacedataproxy_p.h deleted file mode 100644 index f6a13818..00000000 --- a/src/datavis3d/data/qsurfacedataproxy_p.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef QSURFACEDATAPROXY_P_H -#define QSURFACEDATAPROXY_P_H - -#include "qsurfacedataproxy.h" -#include "qabstractdataproxy_p.h" - -#include <QSize> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class QSurfaceDataProxyPrivate : public QAbstractDataProxyPrivate -{ - Q_OBJECT -public: - QSurfaceDataProxyPrivate(QSurfaceDataProxy *q); - virtual ~QSurfaceDataProxyPrivate(); - - bool resetArray(QSurfaceDataArray *newArray); - -private: - QSurfaceDataArray *m_dataArray; - - friend class QSurfaceDataProxy; -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif // QSURFACEDATAPROXY_P_H diff --git a/src/datavis3d/data/scatteritemmodelhandler.cpp b/src/datavis3d/data/scatteritemmodelhandler.cpp deleted file mode 100644 index 57b83f94..00000000 --- a/src/datavis3d/data/scatteritemmodelhandler.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "scatteritemmodelhandler_p.h" -#include <QTimer> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -ScatterItemModelHandler::ScatterItemModelHandler(QItemModelScatterDataProxy *proxy, QObject *parent) - : AbstractItemModelHandler(parent), - m_proxy(proxy) -{ -} - -ScatterItemModelHandler::~ScatterItemModelHandler() -{ -} - -// Resolve entire item model into QScatterDataArray. -void ScatterItemModelHandler::resolveModel() -{ - QItemModelScatterDataMapping *mapping = static_cast<QItemModelScatterDataMapping *>(m_activeMapping); - if (m_itemModel.isNull() || !mapping) { - m_proxy->resetArray(0); - return; - } - - static const int noRoleIndex = -1; - - QHash<int, QByteArray> roleHash = m_itemModel->roleNames(); - //const int labelRole = roleHash.key(mapping->labelRole().toLatin1(), noRoleIndex); - const int xPosRole = roleHash.key(mapping->xPosRole().toLatin1(), noRoleIndex); - const int yPosRole = roleHash.key(mapping->yPosRole().toLatin1(), noRoleIndex); - const int zPosRole = roleHash.key(mapping->zPosRole().toLatin1(), noRoleIndex); - // Default valueRole to display role if no mapping - //const int valueRole = roleHash.key(mapping->valueRole().toLatin1(), Qt::DisplayRole); - const int columnCount = m_itemModel->columnCount(); - const int rowCount = m_itemModel->rowCount(); - const int totalCount = rowCount * columnCount; - int runningCount = 0; - - // Parse data into newProxyArray - QScatterDataArray *newProxyArray = new QScatterDataArray(totalCount); - for (int i = 0; i < rowCount; i++) { - for (int j = 0; j < columnCount; j++) { - QModelIndex index = m_itemModel->index(i, j); - //if (labelRole != noRoleIndex) - // (*newProxyArray)[runningCount].setLabel(index.data(labelRole).toString()); - float xPos(0.0f); - float yPos(0.0f); - float zPos(0.0f); - if (xPosRole != noRoleIndex) - xPos = index.data(xPosRole).toFloat(); - if (yPosRole != noRoleIndex) - yPos = index.data(yPosRole).toFloat(); - if (zPosRole != noRoleIndex) - zPos = index.data(zPosRole).toFloat(); - (*newProxyArray)[runningCount].setPosition(QVector3D(xPos, yPos, zPos)); - //(*newProxyArray)[runningCount].setValue(index.data(valueRole).toReal()); - runningCount++; - } - } - - m_proxy->resetArray(newProxyArray); -} - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/scatteritemmodelhandler_p.h b/src/datavis3d/data/scatteritemmodelhandler_p.h deleted file mode 100644 index f5b01994..00000000 --- a/src/datavis3d/data/scatteritemmodelhandler_p.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef SCATTERITEMMODELHANDLER_P_H -#define SCATTERITEMMODELHANDLER_P_H - -#include "abstractitemmodelhandler_p.h" -#include "qitemmodelscatterdataproxy.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class ScatterItemModelHandler : public AbstractItemModelHandler -{ - Q_OBJECT -public: - ScatterItemModelHandler(QItemModelScatterDataProxy *proxy, QObject *parent = 0); - virtual ~ScatterItemModelHandler(); - -protected: - void virtual resolveModel(); - - QItemModelScatterDataProxy *m_proxy; // Not owned -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/scatterrenderitem.cpp b/src/datavis3d/data/scatterrenderitem.cpp deleted file mode 100644 index 4a6fdfd7..00000000 --- a/src/datavis3d/data/scatterrenderitem.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "scatterrenderitem_p.h" -#include "scatter3drenderer_p.h" -#include "qscatterdataproxy.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -ScatterRenderItem::ScatterRenderItem() - : AbstractRenderItem() -{ -} - -ScatterRenderItem::ScatterRenderItem(const ScatterRenderItem &other) - : AbstractRenderItem(other) -{ - m_position = other.m_position; -} - -ScatterRenderItem::~ScatterRenderItem() -{ -} - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/scatterrenderitem_p.h b/src/datavis3d/data/scatterrenderitem_p.h deleted file mode 100644 index dd708f59..00000000 --- a/src/datavis3d/data/scatterrenderitem_p.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef SCATTERRENDERITEM_P_H -#define SCATTERRENDERITEM_P_H - -#include "abstractrenderitem_p.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class Scatter3DRenderer; - -class ScatterRenderItem : public AbstractRenderItem -{ -public: - ScatterRenderItem(); - ScatterRenderItem(const ScatterRenderItem &other); - virtual ~ScatterRenderItem(); - - inline const QVector3D &position() const { return m_position; } - inline void setPosition(const QVector3D &pos); - - //inline void setSize(qreal size); - //inline qreal size() const { return m_size; } - -protected: - QVector3D m_position; - //qreal m_size; // TODO in case we need a fourth variable that adjusts scatter item size - - friend class QScatterDataItem; -}; - -void ScatterRenderItem::setPosition(const QVector3D &pos) -{ - if (m_position != pos) { - m_position = pos; - // Force reformatting on next access by setting label string to null string - if (!m_selectionLabel.isNull()) - setSelectionLabel(QString()); - } -} - -typedef QVector<ScatterRenderItem> ScatterRenderItemArray; - -QT_DATAVIS3D_END_NAMESPACE - -#endif diff --git a/src/datavis3d/data/surfaceitemmodelhandler.cpp b/src/datavis3d/data/surfaceitemmodelhandler.cpp deleted file mode 100644 index cdd04ae7..00000000 --- a/src/datavis3d/data/surfaceitemmodelhandler.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -#include "surfaceitemmodelhandler_p.h" -#include <QTimer> - -QT_DATAVIS3D_BEGIN_NAMESPACE - -SurfaceItemModelHandler::SurfaceItemModelHandler(QItemModelSurfaceDataProxy *proxy, QObject *parent) - : AbstractItemModelHandler(parent), - m_proxy(proxy) -{ -} - -SurfaceItemModelHandler::~SurfaceItemModelHandler() -{ -} - -// Resolve entire item model into QSurfaceDataArray. -void SurfaceItemModelHandler::resolveModel() -{ - QItemModelSurfaceDataMapping *mapping = static_cast<QItemModelSurfaceDataMapping *>(m_activeMapping); - if (m_itemModel.isNull() || !mapping) { - m_proxy->resetArray(0); - return; - } - - bool useModelRows(false); - if (!mapping->rowCategories().size() || !mapping->columnCategories().size()) { - useModelRows = true; - } else if (mapping->rowRole().isEmpty() || mapping->columnRole().isEmpty()) { - m_proxy->resetArray(0); - return; - } - - QSurfaceDataArray *newProxyArray = new QSurfaceDataArray; - QHash<int, QByteArray> roleHash = m_itemModel->roleNames(); - // Default to display role if no mapping - int valueRole = roleHash.key(mapping->valueRole().toLatin1(), Qt::DisplayRole); - int rowCount = m_itemModel->rowCount(); - int columnCount = m_itemModel->columnCount(); - - if (useModelRows) { - for (int i = 0; i < rowCount; i++) { - QSurfaceDataRow *newProxyRow = new QSurfaceDataRow(columnCount); - for (int j = 0; j < columnCount; j++) - (*newProxyRow)[j] = m_itemModel->index(i, j).data(valueRole).toReal(); - newProxyArray->append(newProxyRow); - } - } else { - int rowRole = roleHash.key(mapping->rowRole().toLatin1()); - int columnRole = roleHash.key(mapping->columnRole().toLatin1()); - const QStringList &rowList = mapping->rowCategories(); - const QStringList &columnList = mapping->columnCategories(); - - // Sort values into rows and columns - typedef QHash<QString, qreal> ColumnValueMap; - QHash <QString, ColumnValueMap> itemValueMap; - for (int i = 0; i < rowCount; i++) { - for (int j = 0; j < columnCount; j++) { - QModelIndex index = m_itemModel->index(i, j); - itemValueMap[index.data(rowRole).toString()][index.data(columnRole).toString()] - = index.data(valueRole).toReal(); - } - } - - // Create new data array from itemValueMap - foreach (QString rowKey, rowList) { - QSurfaceDataRow *newProxyRow = new QSurfaceDataRow(columnList.size()); - for (int i = 0; i < columnList.size(); i++) - (*newProxyRow)[i] = itemValueMap[rowKey][columnList.at(i)]; - newProxyArray->append(newProxyRow); - } - } - - m_proxy->resetArray(newProxyArray); -} - -QT_DATAVIS3D_END_NAMESPACE diff --git a/src/datavis3d/data/surfaceitemmodelhandler_p.h b/src/datavis3d/data/surfaceitemmodelhandler_p.h deleted file mode 100644 index 2cdf5b47..00000000 --- a/src/datavis3d/data/surfaceitemmodelhandler_p.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the QtDataVis3D module. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the QtDataVis3D API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. - -#ifndef SURFACEITEMMODELHANDLER_P_H -#define SURFACEITEMMODELHANDLER_P_H - -#include "abstractitemmodelhandler_p.h" -#include "qitemmodelsurfacedataproxy.h" - -QT_DATAVIS3D_BEGIN_NAMESPACE - -class SurfaceItemModelHandler : public AbstractItemModelHandler -{ - Q_OBJECT -public: - SurfaceItemModelHandler(QItemModelSurfaceDataProxy *proxy, QObject *parent = 0); - virtual ~SurfaceItemModelHandler(); - -protected: - void virtual resolveModel(); - - QItemModelSurfaceDataProxy *m_proxy; // Not owned -}; - -QT_DATAVIS3D_END_NAMESPACE - -#endif |