aboutsummaryrefslogtreecommitdiff
path: root/voronoisplat.h
diff options
context:
space:
mode:
Diffstat (limited to 'voronoisplat.h')
-rw-r--r--voronoisplat.h32
1 files changed, 11 insertions, 21 deletions
diff --git a/voronoisplat.h b/voronoisplat.h
index 962389e..894b6ca 100644
--- a/voronoisplat.h
+++ b/voronoisplat.h
@@ -1,23 +1,21 @@
#ifndef VORONOISPLAT_H
#define VORONOISPLAT_H
-#include <QQuickFramebufferObject>
+#include <memory>
#include <armadillo>
+#include <nod.hpp>
#include "colorscale.h"
#include "scale.h"
class VoronoiSplat
- : public QQuickFramebufferObject
{
- Q_OBJECT
- Q_PROPERTY(float alpha READ alpha WRITE setAlpha NOTIFY alphaChanged)
- Q_PROPERTY(float beta READ beta WRITE setBeta NOTIFY betaChanged)
public:
- VoronoiSplat(QQuickItem *parent = 0);
+ VoronoiSplat();
- Renderer *createRenderer() const;
+ // Renderer *createRenderer() const;
+ void update();
const std::vector<float> &sites() const { return m_sites; }
const std::vector<float> &values() const { return m_values; }
@@ -27,10 +25,6 @@ public:
float alpha() const { return m_alpha; }
float beta() const { return m_beta; }
- bool sitesChanged() const { return m_sitesChanged; }
- bool valuesChanged() const { return m_valuesChanged; }
- bool colorScaleChanged() const { return m_colorScaleChanged; }
-
void setSitesChanged(bool sitesChanged) {
m_sitesChanged = sitesChanged;
}
@@ -41,16 +35,12 @@ public:
m_colorScaleChanged = colorScaleChanged;
}
-signals:
- void sitesChanged(const arma::mat &sites) const;
- void valuesChanged(const arma::vec &values) const;
- void colorScaleChanged(const ColorScale *scale) const;
- void scaleChanged(const LinearScale<float> &sx,
- const LinearScale<float> &sy) const;
- void alphaChanged(float alpha) const;
- void betaChanged(float alpha) const;
+ nod::signal<void(const arma::mat &)> sitesChanged;
+ nod::signal<void(const arma::vec &)> valuesChanged;
+ nod::signal<void(std::shared_ptr<const ColorScale>)> colorScaleChanged;
+ nod::signal<void(const LinearScale<float> &, const LinearScale<float> &)> scaleChanged;
+ nod::signal<void(float)> alphaChanged, betaChanged;
-public slots:
// 'points' should be a 2D points matrix (each point in a row)
void setSites(const arma::mat &points);
@@ -58,7 +48,7 @@ public slots:
void setValues(const arma::vec &values);
// Set colorScale data based on the given color scale
- void setColorScale(const ColorScale *scale);
+ void setColorScale(std::shared_ptr<const ColorScale> scale);
void setScale(const LinearScale<float> &sx,
const LinearScale<float> &sy);