diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-11-11 13:22:54 +0200 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-11-15 08:24:15 +0200 |
commit | 999ffa01d20f75a457da62d41c0fabfc32e5e1bb (patch) | |
tree | c5267f6831d5ff61444f85b2110f7150e20d3451 /src/datavisualization/engine/q3dsurface.cpp | |
parent | bbb874d0591215164b2030db60dc9d6a95f4c8fe (diff) |
Basic multiseries support
Task-number: QTRD-2548
Change-Id: Iba324c0e8be56f2b3f8f6c6a992883c134a51a9d
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Diffstat (limited to 'src/datavisualization/engine/q3dsurface.cpp')
-rw-r--r-- | src/datavisualization/engine/q3dsurface.cpp | 113 |
1 files changed, 30 insertions, 83 deletions
diff --git a/src/datavisualization/engine/q3dsurface.cpp b/src/datavisualization/engine/q3dsurface.cpp index ac451ad2..26f82611 100644 --- a/src/datavisualization/engine/q3dsurface.cpp +++ b/src/datavisualization/engine/q3dsurface.cpp @@ -21,6 +21,7 @@ #include "q3dvalueaxis.h" #include "qsurfacedataproxy.h" #include "q3dcamera.h" +#include "qsurface3dseries_p.h" #include <QMouseEvent> @@ -42,8 +43,6 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE * a label which in default case shows the value of the data point and the coordinates of the point. * * The value range and the label format shown on the axis can be controlled through Q3DValueAxis. - * The Q3DSurface supports only a grid with fixed steps, so when setting ranges set a value that matches - * the grid step. To calculate the steps divide the whole data range with the number of segments. * * To rotate the graph, hold down the right mouse button and move the mouse. Zooming is done using mouse * wheel. Both assume the default input handler is in use. @@ -52,9 +51,7 @@ QT_DATAVISUALIZATION_BEGIN_NAMESPACE * These default axes can be modified via axis accessors, but as soon any axis is set explicitly * for the orientation, the default axis for that orientation is destroyed. * - * Data proxies work similarly: if no data proxy is set explicitly, Q3DSurface creates a default - * proxy. If any other proxy is set as active data proxy later, the default proxy and all data - * added to it is destroyed. + * Q3DSurface supports only single series at a time. * * \section1 How to construct a minimal Q3DSurface graph * @@ -135,6 +132,34 @@ Q3DSurface::~Q3DSurface() } /*! + * Adds the \a series to the graph. + * + * \note The surface graph currently supports only a single series at a time. + */ +void Q3DSurface::addSeries(QSurface3DSeries *series) +{ + d_ptr->m_shared->addSeries(series); +} + +/*! + * Removes the \a series from the graph. + */ +void Q3DSurface::removeSeries(QSurface3DSeries *series) +{ + d_ptr->m_shared->removeSeries(series); +} + +/*! + * \return list of series added to this graph. + * + * \note The surface graph currently supports only a single series at a time. + */ +QList<QSurface3DSeries *> Q3DSurface::seriesList() +{ + return d_ptr->m_shared->surfaceSeriesList(); +} + +/*! * \internal */ void Q3DSurface::mouseDoubleClickEvent(QMouseEvent *event) @@ -297,21 +322,6 @@ QDataVis::SelectionFlags Q3DSurface::selectionMode() const } /*! - * \property Q3DSurface::surfaceVisible - * - * Sets surface to \a visible. It is preset to \c true by default. - */ -void Q3DSurface::setSurfaceVisible(bool visible) -{ - d_ptr->m_shared->setSurfaceVisible(visible); -} - -bool Q3DSurface::isSurfaceVisible() const -{ - return d_ptr->m_shared->surfaceVisible(); -} - -/*! * \property Q3DSurface::surfaceGridEnabled * * Sets surface grid to \a enabled. It is preset to \c true by default. @@ -511,69 +521,6 @@ QList<Q3DValueAxis *> Q3DSurface::axes() const } /*! - * Sets the active data \a proxy. Implicitly calls addDataProxy() to transfer ownership of - * the \a proxy to this graph. - * - * If the \a proxy is null, a temporary default proxy is created and activated. - * This temporary proxy is destroyed if another \a proxy is set explicitly active via this method. - * - * \sa addDataProxy(), releaseDataProxy() - */ -void Q3DSurface::setActiveDataProxy(QSurfaceDataProxy *proxy) -{ - d_ptr->m_shared->setActiveDataProxy(proxy); -} - -/*! - * \return active data proxy. - */ -QSurfaceDataProxy *Q3DSurface::activeDataProxy() const -{ - return static_cast<QSurfaceDataProxy *>(d_ptr->m_shared->activeDataProxy()); -} - -/*! - * Adds data \a proxy to the graph. The proxies added via addDataProxy are not yet taken to use, - * addDataProxy is simply used to give the ownership of the data \a proxy to the graph. - * The \a proxy must not be null or added to another graph. - * - * \sa releaseDataProxy(), setActiveDataProxy() - */ -void Q3DSurface::addDataProxy(QSurfaceDataProxy *proxy) -{ - d_ptr->m_shared->addDataProxy(proxy); -} - -/*! - * Releases the ownership of the data \a proxy back to the caller, if it is added to this graph. - * If the released \a proxy is in use, a new empty default proxy is created and taken to use. - * - * If the default \a proxy is released and added back later, it behaves as any other proxy would. - * - * \sa addDataProxy(), setActiveDataProxy() - */ -void Q3DSurface::releaseDataProxy(QSurfaceDataProxy *proxy) -{ - d_ptr->m_shared->releaseDataProxy(proxy); -} - -/*! - * \return list of all added data proxies. - * - * \sa addDataProxy() - */ -QList<QSurfaceDataProxy *> Q3DSurface::dataProxies() const -{ - QList<QSurfaceDataProxy *> retList; - QList<QAbstractDataProxy *> abstractList = d_ptr->m_shared->dataProxies(); - foreach (QAbstractDataProxy *proxy, abstractList) - retList.append(static_cast<QSurfaceDataProxy *>(proxy)); - - return retList; -} - - -/*! * Modifies the current surface gradient. Sets gradient color to \a color at \a pos. */ void Q3DSurface::setGradientColorAt(qreal pos, const QColor &color) |