aboutsummaryrefslogtreecommitdiff
path: root/scatterplot.cpp
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-01-15 22:35:13 +0100
committerSamuel Fadel <samuelfadel@gmail.com>2016-01-15 22:35:13 +0100
commit7ad4b526899f8bc764192e88e65306c788a9ed32 (patch)
treeb2e7dae9ceb06b12709ab3b76fc749304c7a2a92 /scatterplot.cpp
parente3a4e5827ada7836468d785b12a57e0022b653e6 (diff)
VoronoiSplat & Scatterplot: splatting is now a separate component.
The change was due to future functionality requirements, this separation provides grater flexibility. As a nice side effect, the cropping bug when first rendering the splat is now gone.
Diffstat (limited to 'scatterplot.cpp')
-rw-r--r--scatterplot.cpp71
1 files changed, 0 insertions, 71 deletions
diff --git a/scatterplot.cpp b/scatterplot.cpp
index de96e6f..04a50cd 100644
--- a/scatterplot.cpp
+++ b/scatterplot.cpp
@@ -1,6 +1,5 @@
#include "scatterplot.h"
-#include "voronoisplat.h"
#include "geometry.h"
#include <cmath>
@@ -23,7 +22,6 @@ Scatterplot::Scatterplot(QQuickItem *parent)
, m_currentInteractionState(INTERACTION_NONE)
, m_shouldUpdateGeometry(false)
, m_shouldUpdateMaterials(false)
- , m_displaySplat(true)
{
setClip(true);
setFlag(QQuickItem::ItemHasContents);
@@ -164,26 +162,6 @@ void Scatterplot::autoScale()
emit scaleChanged(m_sx, m_sy);
}
-QSGNode *Scatterplot::newSplatNode()
-{
- if (m_xy.n_rows < 1) {
- return 0;
- }
-
- QSGSimpleTextureNode *node = new QSGSimpleTextureNode;
- VoronoiSplatTexture *tex = new VoronoiSplatTexture(QSize(width(), height()));
-
- tex->setSites(m_xy);
- tex->setValues(m_colorData);
- tex->setColormap(m_colorScale);
-
- node->setTexture(tex);
- node->setOwnsTexture(true);
- node->setSourceRect(0, 0, width(), height());
-
- return node;
-}
-
QSGNode *Scatterplot::newGlyphTree()
{
// NOTE:
@@ -235,10 +213,6 @@ QSGNode *Scatterplot::newSceneGraph()
// The hierarchy in the scene graph is as follows:
// root [[splatNode] [glyphsRoot [glyph [...]]] [selectionNode]]
QSGNode *root = new QSGNode;
- QSGNode *splatNode = newSplatNode();
- if (splatNode) {
- root->appendChildNode(splatNode);
- }
QSGNode *glyphTreeRoot = newGlyphTree();
if (glyphTreeRoot) {
root->appendChildNode(glyphTreeRoot);
@@ -262,9 +236,6 @@ QSGNode *Scatterplot::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
// This keeps track of where we are in the scene when updating
QSGNode *node = root->firstChild();
- updateSplat(node);
- node = node->nextSibling();
-
updateGlyphs(node);
node = node->nextSibling();
@@ -290,36 +261,6 @@ QSGNode *Scatterplot::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
return root;
}
-void Scatterplot::updateSplat(QSGNode *node)
-{
- QSGSimpleTextureNode *texNode = static_cast<QSGSimpleTextureNode *>(node);
-
- if (!m_displaySplat) {
- // Hide the splat and return, ignoring update requests
- texNode->setRect(0, 0, 0, 0);
- return;
- }
-
- texNode->setRect(x(), y(), width(), height());
-
- VoronoiSplatTexture *tex =
- static_cast<VoronoiSplatTexture *>(texNode->texture());
- if (m_shouldUpdateGeometry) {
- tex->setSites(m_xy);
- }
-
- if (m_shouldUpdateMaterials) {
- tex->setValues(m_colorData);
- tex->setColormap(m_colorScale);
- }
-
- bool updated = tex->updateTexture();
- if (updated) {
- texNode->markDirty(QSGNode::DirtyMaterial);
- window()->resetOpenGLState();
- }
-}
-
void Scatterplot::updateGlyphs(QSGNode *glyphsNode)
{
qreal x, y, tx, ty, moveTranslationF;
@@ -487,18 +428,6 @@ void Scatterplot::setSelection(const QSet<int> &selection)
emit selectionChanged(selection);
}
-void Scatterplot::setDisplaySplat(bool displaySplat)
-{
- if (m_displaySplat != displaySplat) {
- m_displaySplat = displaySplat;
- m_shouldUpdateGeometry = true;
- m_shouldUpdateMaterials = true;
- update();
-
- emit displaySplatChanged(displaySplat);
- }
-}
-
void Scatterplot::applyManipulation()
{
m_sx.inverse();