diff options
author | Samuel Fadel <samuelfadel@gmail.com> | 2016-01-28 15:52:39 +0100 |
---|---|---|
committer | Samuel Fadel <samuelfadel@gmail.com> | 2016-01-28 15:55:07 +0100 |
commit | ff10df2f8bfc71afe8637eec67d11d6ce87b673b (patch) | |
tree | 3e7ba65d7c2cff27a2d13511f25857a4e5326e1d /scatterplot.cpp | |
parent | 5404374a510b4c09bd4d38331a1255583abb28d4 (diff) |
ProjectionObsever now responds to selection changes.
* Scatterplot: small fix to selection updates
* ProjectionObserver: whenever CP selection changes, compute
influence of CPs over all RPs. Whenever RP selection changes,
compute influence of RPs by all CPs.
* ProjectionObserver: with empty selections, go back to normal mode
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 260825c..97f2f41 100644 --- a/scatterplot.cpp +++ b/scatterplot.cpp @@ -195,7 +195,7 @@ void QuadTree::query(const QRectF &rect, std::vector<int> &result) const m_ne->query(rect, result); m_sw->query(rect, result); m_se->query(rect, result); - } else if (rect.contains(m_x, m_y)) { + } else if (rect.contains(m_x, m_y) && m_value != -1) { result.push_back(m_value); } } @@ -278,14 +278,18 @@ void Scatterplot::setXY(const arma::mat &xy) void Scatterplot::setColorData(const arma::vec &colorData, bool updateView) { - if (m_xy.n_rows > 0 && colorData.n_elem != m_xy.n_rows) { + if (m_xy.n_rows > 0 + && (colorData.n_elem > 0 && colorData.n_elem != m_xy.n_rows)) { return; } m_colorData = colorData; emit colorDataChanged(m_colorData); - m_colorScale.setExtents(m_colorData.min(), m_colorData.max()); + if (m_colorData.n_elem > 0) { + m_colorScale.setExtents(m_colorData.min(), m_colorData.max()); + } + m_shouldUpdateMaterials = true; if (updateView) { update(); @@ -623,8 +627,6 @@ void Scatterplot::mouseReleaseEvent(QMouseEvent *event) if (m_brushedItem < 0 || event->button() == Qt::RightButton) { // Mouse clicked with no brush target; clear selection, if any m_selection.assign(m_selection.size(), false); - m_shouldUpdateMaterials = true; - update(); } else { // Mouse clicked with brush target; set new selection or append to // current @@ -633,11 +635,11 @@ void Scatterplot::mouseReleaseEvent(QMouseEvent *event) m_selection.assign(m_selection.size(), false); } m_selection[m_brushedItem] = true; - emit selectionInteractivelyChanged(m_selection); - - m_shouldUpdateMaterials = true; - update(); } + emit selectionInteractivelyChanged(m_selection); + + m_shouldUpdateMaterials = true; + update(); break; case INTERACTION_SELECTING: { |