diff options
-rw-r--r-- | lineplot.cpp | 10 | ||||
-rw-r--r-- | lineplot.h | 9 |
2 files changed, 9 insertions, 10 deletions
diff --git a/lineplot.cpp b/lineplot.cpp index 0e9e001..35654be 100644 --- a/lineplot.cpp +++ b/lineplot.cpp @@ -60,20 +60,18 @@ void LinePlot::setColorScale(const ColorScale *scale) void LinePlot::relax() { - m_gdFinalPtr.reset(new GraphDrawing); - *m_gdFinalPtr.get() = *m_gdBundlePtr.get(); - m_gdFinalPtr.get()->interpolate(*m_gdPtr.get(), m_relaxation); + m_gdFinal = m_gdBundle; + m_gdFinal.interpolate(*m_gdPtr.get(), m_relaxation); setLinesChanged(true); } void LinePlot::bundle() { - m_gdBundlePtr.reset(new GraphDrawing); - *m_gdBundlePtr.get() = *m_gdPtr.get(); + m_gdBundle = *m_gdPtr.get(); CPUBundling bundling(std::min(width(), height())); - bundling.setInput(m_gdBundlePtr.get()); + bundling.setInput(&m_gdBundle); bundling.niter = m_iterations; bundling.h = m_kernelSize; @@ -44,9 +44,9 @@ public: void setColorScale(const ColorScale *scale); - const GraphDrawing *graphDrawing() const { return m_gdFinalPtr.get(); } - const std::vector<float> &values() const { return m_values; } - const std::vector<float> &colorScale() const { return m_cmap; } + const GraphDrawing *graphDrawing() const { return &m_gdFinal; } + const std::vector<float> &values() const { return m_values; } + const std::vector<float> &colorScale() const { return m_cmap; } LinearScale<float> scaleX() const { return m_sx; } LinearScale<float> scaleY() const { return m_sy; } @@ -140,7 +140,8 @@ private: // Visuals std::vector<float> m_cmap; LinearScale<float> m_sx, m_sy; - std::unique_ptr<GraphDrawing> m_gdPtr, m_gdBundlePtr, m_gdFinalPtr; + std::unique_ptr<GraphDrawing> m_gdPtr; + GraphDrawing m_gdBundle, m_gdFinal; // Internal state bool m_linesChanged, m_valuesChanged, m_colorScaleChanged; |