diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-07-08 15:11:06 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-07-09 07:40:05 +0300 |
commit | 24275c551f0a10df022f037962d1678b7213ef09 (patch) | |
tree | 310a339c2c1582d68618881c905fd32dd64f2f5e /src/datavis3d/engine/bars3dcontroller.cpp | |
parent | d9267977b3f5bb8ab5573c29f0721a07397e5b82 (diff) |
Refactor data item
Data items do not need to know about rendering related stuff,
so separated that to render items. Renderer will maintain
array of render items equal to the sample space.
Change-Id: I61c0db96f115b7c667e37ea92aa5ae6b8583c61a
Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Diffstat (limited to 'src/datavis3d/engine/bars3dcontroller.cpp')
-rw-r--r-- | src/datavis3d/engine/bars3dcontroller.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/datavis3d/engine/bars3dcontroller.cpp b/src/datavis3d/engine/bars3dcontroller.cpp index c3f7aa5f..a633999e 100644 --- a/src/datavis3d/engine/bars3dcontroller.cpp +++ b/src/datavis3d/engine/bars3dcontroller.cpp @@ -76,7 +76,8 @@ Bars3dController::Bars3dController(QRect boundRect) m_tickStep(0), m_tickMinimum(0.0f), m_renderer(0), - m_data(0) + m_data(0), + m_valuesDirty(false) { // Default axes. Only Y axis can actually be changed by user. setAxisX(new QCategoryAxis()); @@ -113,9 +114,10 @@ void Bars3dController::render(const GLuint defaultFboHandle) return; // TODO do not give the entire data array, just the data window - QMutexLocker(m_data->mutex()); - m_renderer->render(m_data->array(), m_cameraHelper, m_axisX->d_ptr->titleItem(), + m_renderer->render(m_data, m_valuesDirty, m_cameraHelper, m_axisX->d_ptr->titleItem(), m_axisY->d_ptr->titleItem(), m_axisZ->d_ptr->titleItem(), defaultFboHandle); + + m_valuesDirty = false; } QMatrix4x4 Bars3dController::calculateViewMatrix(int zoom, int viewPortWidth, int viewPortHeight, bool showUnder) @@ -278,7 +280,7 @@ void Bars3dController::setDataProxy(QBarDataProxy *proxy) QObject::connect(m_data, &QBarDataProxy::rowsRemoved, this, &Bars3dController::handleRowsRemoved); QObject::connect(m_data, &QBarDataProxy::rowsInserted, this, &Bars3dController::handleRowsInserted); - // emit something? + // emit something? Renderer might be interested? } QBarDataProxy *Bars3dController::dataProxy() @@ -290,6 +292,7 @@ void Bars3dController::handleArrayReset() { setSlicingActive(false); handleLimitChange(); + m_valuesDirty = true; } void Bars3dController::handleRowsAdded(int startIndex, int count) @@ -300,6 +303,7 @@ void Bars3dController::handleRowsAdded(int startIndex, int count) // TODO should update slice instead of deactivating? setSlicingActive(false); handleLimitChange(); + m_valuesDirty = true; } void Bars3dController::handleRowsChanged(int startIndex, int count) @@ -310,6 +314,7 @@ void Bars3dController::handleRowsChanged(int startIndex, int count) // TODO should update slice instead of deactivating? setSlicingActive(false); handleLimitChange(); + m_valuesDirty = true; } void Bars3dController::handleRowsRemoved(int startIndex, int count) @@ -320,6 +325,7 @@ void Bars3dController::handleRowsRemoved(int startIndex, int count) // TODO should update slice instead of deactivating? setSlicingActive(false); handleLimitChange(); + m_valuesDirty = true; } void Bars3dController::handleRowsInserted(int startIndex, int count) @@ -330,6 +336,7 @@ void Bars3dController::handleRowsInserted(int startIndex, int count) // TODO should update slice instead of deactivating? setSlicingActive(false); handleLimitChange(); + m_valuesDirty = true; } void Bars3dController::setBarSpecs(QSizeF thickness, QSizeF spacing, bool relative) @@ -416,7 +423,7 @@ void Bars3dController::setupSampleSpace(int rowCount, int columnCount) m_rowCount = rowCount; m_columnCount = columnCount; - emit sampleSpaceChanged(columnCount, rowCount); + emit sampleSpaceChanged(rowCount, columnCount); } |