summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/datavisualization/engine/surface3drenderer.cpp109
-rw-r--r--src/datavisualization/engine/surface3drenderer_p.h1
-rw-r--r--src/datavisualization/utils/surfaceobject.cpp7
-rw-r--r--src/datavisualization/utils/surfaceobject_p.h1
-rw-r--r--tests/surfacetest/main.cpp8
5 files changed, 78 insertions, 48 deletions
diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp
index f9f4a45a..194509f8 100644
--- a/src/datavisualization/engine/surface3drenderer.cpp
+++ b/src/datavisualization/engine/surface3drenderer.cpp
@@ -395,59 +395,72 @@ void Surface3DRenderer::updateItem(const QVector<Surface3DController::ChangeItem
void Surface3DRenderer::updateSliceDataModel(const QPoint &point)
{
- int column = point.y();
- int row = point.x();
-
- foreach (SurfaceSeriesRenderCache *cache, m_renderCacheList) {
- QSurfaceDataArray &sliceDataArray = cache->sliceDataArray();
- for (int i = 0; i < sliceDataArray.size(); i++)
- delete sliceDataArray.at(i);
- sliceDataArray.clear();
- sliceDataArray.reserve(2);
-
- QSurfaceDataRow *sliceRow;
- QSurfaceDataArray &dataArray = cache->dataArray();
- float adjust = (0.025f * m_heightNormalizer) / 2.0f;
- float stepDown = 2.0f * adjust;
- if (m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionRow)) {
- QSurfaceDataRow *src = dataArray.at(row);
- sliceRow = new QSurfaceDataRow(src->size());
- for (int i = 0; i < sliceRow->size(); i++)
- (*sliceRow)[i].setPosition(QVector3D(src->at(i).x(), src->at(i).y() + adjust, -1.0f));
- } else {
- QRect sampleSpace = cache->sampleSpace();
- sliceRow = new QSurfaceDataRow(sampleSpace.height());
- for (int i = 0; i < sampleSpace.height(); i++) {
- (*sliceRow)[i].setPosition(QVector3D(dataArray.at(i)->at(column).z(),
- dataArray.at(i)->at(column).y() + adjust,
- -1.0f));
- }
- }
-
- sliceDataArray << sliceRow;
+ foreach (SurfaceSeriesRenderCache *cache, m_renderCacheList)
+ cache->sliceSurfaceObject()->clear();
- // Make a duplicate, so that we get a little bit depth
- QSurfaceDataRow *duplicateRow = new QSurfaceDataRow(*sliceRow);
- for (int i = 0; i < sliceRow->size(); i++) {
- (*sliceRow)[i].setPosition(QVector3D(sliceRow->at(i).x(),
- sliceRow->at(i).y() - stepDown,
- 1.0f));
+ if (m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionMultiSeries)) {
+ foreach (SurfaceSeriesRenderCache *cache, m_renderCacheList)
+ updateSliceObject(cache, point);
+ } else {
+ if (m_selectedSeries) {
+ SurfaceSeriesRenderCache *cache =
+ m_renderCacheList.value(const_cast<QSurface3DSeries *>(m_selectedSeries));
+ if (cache)
+ updateSliceObject(cache, point);
}
+ }
+}
- sliceDataArray << duplicateRow;
+void Surface3DRenderer::updateSliceObject(SurfaceSeriesRenderCache *cache, const QPoint &point)
+{
+ int column = point.y();
+ int row = point.x();
- QRect sliceRect(0, 0, sliceRow->size(), 2);
+ QSurfaceDataArray &sliceDataArray = cache->sliceDataArray();
+ for (int i = 0; i < sliceDataArray.size(); i++)
+ delete sliceDataArray.at(i);
+ sliceDataArray.clear();
+ sliceDataArray.reserve(2);
- if (sliceRow->size() > 0) {
- if (cache->isFlatShadingEnabled()) {
- cache->sliceSurfaceObject()->setUpData(sliceDataArray, sliceRect,
- m_heightNormalizer,
- m_axisCacheY.min(), true);
- } else {
- cache->sliceSurfaceObject()->setUpSmoothData(sliceDataArray, sliceRect,
- m_heightNormalizer,
- m_axisCacheY.min(), true);
- }
+ QSurfaceDataRow *sliceRow;
+ QSurfaceDataArray &dataArray = cache->dataArray();
+ float adjust = (0.025f * m_heightNormalizer) / 2.0f;
+ float stepDown = 2.0f * adjust;
+ if (m_cachedSelectionMode.testFlag(QAbstract3DGraph::SelectionRow)) {
+ QSurfaceDataRow *src = dataArray.at(row);
+ sliceRow = new QSurfaceDataRow(src->size());
+ for (int i = 0; i < sliceRow->size(); i++)
+ (*sliceRow)[i].setPosition(QVector3D(src->at(i).x(), src->at(i).y() + adjust, -1.0f));
+ } else {
+ QRect sampleSpace = cache->sampleSpace();
+ sliceRow = new QSurfaceDataRow(sampleSpace.height());
+ for (int i = 0; i < sampleSpace.height(); i++) {
+ (*sliceRow)[i].setPosition(QVector3D(dataArray.at(i)->at(column).z(),
+ dataArray.at(i)->at(column).y() + adjust,
+ -1.0f));
+ }
+ }
+ sliceDataArray << sliceRow;
+
+ // Make a duplicate, so that we get a little bit depth
+ QSurfaceDataRow *duplicateRow = new QSurfaceDataRow(*sliceRow);
+ for (int i = 0; i < sliceRow->size(); i++) {
+ (*sliceRow)[i].setPosition(QVector3D(sliceRow->at(i).x(),
+ sliceRow->at(i).y() - stepDown,
+ 1.0f));
+ }
+ sliceDataArray << duplicateRow;
+
+ QRect sliceRect(0, 0, sliceRow->size(), 2);
+ if (sliceRow->size() > 0) {
+ if (cache->isFlatShadingEnabled()) {
+ cache->sliceSurfaceObject()->setUpData(sliceDataArray, sliceRect,
+ m_heightNormalizer,
+ m_axisCacheY.min(), true);
+ } else {
+ cache->sliceSurfaceObject()->setUpSmoothData(sliceDataArray, sliceRect,
+ m_heightNormalizer,
+ m_axisCacheY.min(), true);
}
}
}
diff --git a/src/datavisualization/engine/surface3drenderer_p.h b/src/datavisualization/engine/surface3drenderer_p.h
index e8d8bf35..4649fd72 100644
--- a/src/datavisualization/engine/surface3drenderer_p.h
+++ b/src/datavisualization/engine/surface3drenderer_p.h
@@ -131,6 +131,7 @@ private:
void checkFlatSupport(SurfaceSeriesRenderCache *cache);
void updateObjects(SurfaceSeriesRenderCache *cache, bool dimensionChanged);
void updateSliceDataModel(const QPoint &point);
+ void updateSliceObject(SurfaceSeriesRenderCache *cache, const QPoint &point);
void updateShadowQuality(QAbstract3DGraph::ShadowQuality quality);
void updateTextures();
void initShaders(const QString &vertexShader, const QString &fragmentShader);
diff --git a/src/datavisualization/utils/surfaceobject.cpp b/src/datavisualization/utils/surfaceobject.cpp
index cfaab09c..1cb576c4 100644
--- a/src/datavisualization/utils/surfaceobject.cpp
+++ b/src/datavisualization/utils/surfaceobject.cpp
@@ -682,6 +682,13 @@ QVector3D SurfaceObject::vertexAt(int column, int row)
return m_vertices.at(pos);
}
+void SurfaceObject::clear()
+{
+ m_gridIndexCount = 0;
+ m_indexCount = 0;
+ m_surfaceType = Undefined;
+}
+
QVector3D SurfaceObject::normal(const QVector3D &a, const QVector3D &b, const QVector3D &c)
{
QVector3D v1 = b - a;
diff --git a/src/datavisualization/utils/surfaceobject_p.h b/src/datavisualization/utils/surfaceobject_p.h
index f51c2909..ebae1149 100644
--- a/src/datavisualization/utils/surfaceobject_p.h
+++ b/src/datavisualization/utils/surfaceobject_p.h
@@ -70,6 +70,7 @@ public:
GLuint gridElementBuf();
GLuint gridIndexCount();
QVector3D vertexAt(int column, int row);
+ void clear();
private:
QVector3D normal(const QVector3D &a, const QVector3D &b, const QVector3D &c);
diff --git a/tests/surfacetest/main.cpp b/tests/surfacetest/main.cpp
index 408486f5..de69b48f 100644
--- a/tests/surfacetest/main.cpp
+++ b/tests/surfacetest/main.cpp
@@ -267,14 +267,22 @@ int main(int argc, char *argv[])
int(QAbstract3DGraph::SelectionRowAndColumn));
selectionMode->addItem(QStringLiteral("Item, Row and Column"),
int(QAbstract3DGraph::SelectionItemRowAndColumn));
+ selectionMode->addItem(QStringLiteral("Multi: Item, Row and Column"),
+ int(QAbstract3DGraph::SelectionItemRowAndColumn | QAbstract3DGraph::SelectionMultiSeries));
selectionMode->addItem(QStringLiteral("Slice into Row"),
int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionRow));
selectionMode->addItem(QStringLiteral("Slice into Row and Item"),
int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndRow));
+ selectionMode->addItem(QStringLiteral("Multi: Slice, Row & Item"),
+ int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndRow
+ | QAbstract3DGraph::SelectionMultiSeries));
selectionMode->addItem(QStringLiteral("Slice into Column"),
int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionColumn));
selectionMode->addItem(QStringLiteral("Slice into Column and Item"),
int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndColumn));
+ selectionMode->addItem(QStringLiteral("Multi: Slice, Column & Item"),
+ int(QAbstract3DGraph::SelectionSlice | QAbstract3DGraph::SelectionItemAndColumn
+ | QAbstract3DGraph::SelectionMultiSeries));
selectionMode->setCurrentIndex(1);
#ifndef MULTI_SERIES