From 5bd1fec462466d605f974fa27c3b00826a1bab57 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Fri, 12 Feb 2016 19:03:51 -0200 Subject: Refactoring of Projection{Observer,History} & ManipulationHandler. ProjectionObserver class has been removed, all of its functionality is now inside class ProjectionHistory, thus dealing with the design problem mentioned in the previous commit. ProjectionHistory is now also responsible for all rewinding functionality, which makes more sense. --- main.h | 51 +++++++++++++++++++++------------------------------ 1 file changed, 21 insertions(+), 30 deletions(-) (limited to 'main.h') diff --git a/main.h b/main.h index e1964e7..de3a7f4 100644 --- a/main.h +++ b/main.h @@ -6,7 +6,6 @@ #include "colorscale.h" #include "continuouscolorscale.h" -#include "projectionobserver.h" #include "projectionhistory.h" #include "numericrange.h" #include "barchart.h" @@ -76,25 +75,6 @@ public: cpPlot->setAcceptHoverEvents(true); } - enum ObserverType { - ObserverCurrent = ProjectionObserver::ObserverCurrent, - ObserverDiffPrevious = ProjectionObserver::ObserverDiffPrevious, - ObserverDiffFirst = ProjectionObserver::ObserverDiffFirst - }; - - Q_INVOKABLE bool setObserverType(ObserverType observerType) { - switch (observerType) { - case ObserverCurrent: - return projectionObserver->setType(ProjectionObserver::ObserverCurrent); - case ObserverDiffPrevious: - return projectionObserver->setType(ProjectionObserver::ObserverDiffPrevious); - case ObserverDiffFirst: - return projectionObserver->setType(ProjectionObserver::ObserverDiffFirst); - } - - return false; - } - enum ColorScaleType { ColorScaleCategorical, ColorScaleContinuous, @@ -139,17 +119,29 @@ public: Scatterplot *cpPlot, *rpPlot; VoronoiSplat *splat; - // Shared object that controls manipulation history + // Object that controls manipulation history ProjectionHistory *projectionHistory; - ProjectionObserver *projectionObserver; - Q_INVOKABLE void undoManipulation() { - projectionHistory->undo(); - projectionObserver->undo(); - } - Q_INVOKABLE void resetManipulation() { - projectionHistory->reset(); - projectionObserver->reset(); + Q_INVOKABLE void undoManipulation() { projectionHistory->undo(); } + Q_INVOKABLE void resetManipulation() { projectionHistory->reset(); } + + enum ObserverType { + ObserverCurrent = ProjectionHistory::ObserverCurrent, + ObserverDiffPrevious = ProjectionHistory::ObserverDiffPrevious, + ObserverDiffFirst = ProjectionHistory::ObserverDiffFirst + }; + + Q_INVOKABLE bool setObserverType(ObserverType observerType) { + switch (observerType) { + case ObserverCurrent: + return projectionHistory->setType(ProjectionHistory::ObserverCurrent); + case ObserverDiffPrevious: + return projectionHistory->setType(ProjectionHistory::ObserverDiffPrevious); + case ObserverDiffFirst: + return projectionHistory->setType(ProjectionHistory::ObserverDiffFirst); + } + + return false; } public slots: @@ -195,7 +187,6 @@ private: , cpPlot(0) , rpPlot(0) , splat(0) - , projectionObserver(0) , projectionHistory(0) { } -- cgit v1.2.3