diff options
author | Samuel Fadel <samuelfadel@gmail.com> | 2015-09-01 20:45:02 -0300 |
---|---|---|
committer | Samuel Fadel <samuelfadel@gmail.com> | 2015-09-01 20:45:02 -0300 |
commit | a1956a4ff879eb2d34c7a0ca448f48ee6e64ce99 (patch) | |
tree | b958291afa29268517633a8490920ae38dfcf2d8 /scatterplot.cpp | |
parent | f405ac30db93ed9f2adb739c3c09b2ce9369fee6 (diff) |
Improvements related to visual representation of distortions.
- New continuous color scale class;
- Improvements in signal handler for calculating distortions;
- Implementation of the NP(k) measure.
Diffstat (limited to 'scatterplot.cpp')
-rw-r--r-- | scatterplot.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/scatterplot.cpp b/scatterplot.cpp index c43b625..0a252e1 100644 --- a/scatterplot.cpp +++ b/scatterplot.cpp @@ -2,7 +2,7 @@ #include <cmath> -static const qreal GLYPH_OPACITY = 0.3; +static const qreal GLYPH_OPACITY = 0.4; static const qreal GLYPH_OPACITY_SELECTED = 1.0; static const QColor SELECTION_COLOR(QColor(128, 128, 128, 96)); static const int GLYPH_SIZE = 8; @@ -14,7 +14,8 @@ Scatterplot::Scatterplot(QQuickItem *parent) , m_currentInteractionState(INTERACTION_NONE) , m_shouldUpdateGeometry(false) , m_shouldUpdateMaterials(false) - , m_colorScale{ +{ + m_colorScale = new ColorScale{ QColor("#1f77b4"), QColor("#ff7f0e"), QColor("#2ca02c"), @@ -24,18 +25,20 @@ Scatterplot::Scatterplot(QQuickItem *parent) QColor("#e377c2"), QColor("#17becf"), QColor("#7f7f7f"), - } -{ + }; + setClip(true); setFlag(QQuickItem::ItemHasContents); } -void Scatterplot::setColorScale(const ColorScale &colorScale) +void Scatterplot::setColorScale(ColorScale *colorScale) { - m_colorScale = colorScale; + if (!colorScale) { + return; + } + m_colorScale = colorScale; if (m_colorData.n_elem > 0) { - m_colorScale.setExtents(m_colorData.min(), m_colorData.max()); updateMaterials(); } } @@ -62,7 +65,6 @@ void Scatterplot::setColorData(const arma::vec &colorData) return; m_colorData = colorData; - m_colorScale.setExtents(m_colorData.min(), m_colorData.max()); emit colorDataChanged(m_colorData); updateMaterials(); @@ -182,7 +184,7 @@ QSGNode *Scatterplot::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) } if (m_shouldUpdateMaterials) { QSGFlatColorMaterial *material = static_cast<QSGFlatColorMaterial *>(glyphNode->material()); - material->setColor(m_colorScale.color(m_colorData[i])); + material->setColor(m_colorScale->color(m_colorData[i])); glyphNode->setMaterial(material); glyphNode->markDirty(QSGNode::DirtyMaterial); } |