aboutsummaryrefslogtreecommitdiff
path: root/main.h
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-02-12 19:03:51 -0200
committerSamuel Fadel <samuelfadel@gmail.com>2016-02-12 19:03:51 -0200
commit5bd1fec462466d605f974fa27c3b00826a1bab57 (patch)
tree6cfefd8bd5c81644755c3be197f7ab2d60cd268b /main.h
parent95a77b04a6855b26d340aaca5e3030a7d1a7cb3c (diff)
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.
Diffstat (limited to 'main.h')
-rw-r--r--main.h51
1 files changed, 21 insertions, 30 deletions
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)
{
}