From 94d76d786ee1e9ee0aa739d6ae50ad222255120a Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Mon, 15 Feb 2016 17:05:11 +0100 Subject: [PATCH] Rename `MvSurfaceCmd` to `StartDragSurfaceCmd` Also optimize - remove the need to pass projection editor as an argument --- src/Commands/MvSurfaceCmd.cpp | 29 -------------------------- src/Commands/MvSurfaceCmd.h | 31 ---------------------------- src/Commands/StartDragSurfaceCmd.cpp | 23 +++++++++++++++++++++ src/Commands/StartDragSurfaceCmd.h | 24 +++++++++++++++++++++ 4 files changed, 47 insertions(+), 60 deletions(-) delete mode 100644 src/Commands/MvSurfaceCmd.cpp delete mode 100644 src/Commands/MvSurfaceCmd.h create mode 100644 src/Commands/StartDragSurfaceCmd.cpp create mode 100644 src/Commands/StartDragSurfaceCmd.h diff --git a/src/Commands/MvSurfaceCmd.cpp b/src/Commands/MvSurfaceCmd.cpp deleted file mode 100644 index 91456fc..0000000 --- a/src/Commands/MvSurfaceCmd.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "MvSurfaceCmd.h" - -namespace ofx { -namespace piMapper { - -MvSurfaceCmd::MvSurfaceCmd(BaseSurface * surface, - ProjectionEditor * projectionEditor){ - - _surface = surface; - _projectionEditor = projectionEditor; -} - -void MvSurfaceCmd::exec(){ - ofLogNotice("MvSurfaceCmd", "exec"); - _previousVertices = _surface->getVertices(); - _surface->setMoved(false); -} - -void MvSurfaceCmd::undo(){ - ofLogNotice("MvSurfaceCmd", "undo"); - _surface->moveBy(_previousVertices[0] - _surface->getVertices()[0]); - _projectionEditor->updateJoints(); - _previousVertices.clear(); - _surface = 0; -} - -} // namespace piMapper -} // namespace ofx - diff --git a/src/Commands/MvSurfaceCmd.h b/src/Commands/MvSurfaceCmd.h deleted file mode 100644 index c5bb388..0000000 --- a/src/Commands/MvSurfaceCmd.h +++ /dev/null @@ -1,31 +0,0 @@ -// MvSurfaceCmd -// Provides with option to undo move surface operation. -// Created by Krisjanis Rijnieks 2015-05-14 - -#pragma once - -#include "BaseCmd.h" -#include "BaseSurface.h" -#include "ProjectionEditor.h" - -namespace ofx { -namespace piMapper { - -class MvSurfaceCmd : public BaseUndoCmd { - - public: - MvSurfaceCmd(BaseSurface * surface, - ProjectionEditor * projectionEditor); - void exec(); - void undo(); - - private: - BaseSurface * _surface; - ProjectionEditor * _projectionEditor; - vector _previousVertices; - -}; - -} // namespace piMapper -} // namespace ofx - diff --git a/src/Commands/StartDragSurfaceCmd.cpp b/src/Commands/StartDragSurfaceCmd.cpp new file mode 100644 index 0000000..8adb2ed --- /dev/null +++ b/src/Commands/StartDragSurfaceCmd.cpp @@ -0,0 +1,23 @@ +#include "StartDragSurfaceCmd.h" + +namespace ofx { +namespace piMapper { + +StartDragSurfaceCmd::StartDragSurfaceCmd(BaseSurface * surface){ + _surface = surface; +} + +void StartDragSurfaceCmd::exec(){ + ofLogNotice("StartDragSurfaceCmd", "exec"); + _previousVertices = _surface->getVertices(); + _surface->setMoved(false); +} + +void StartDragSurfaceCmd::undo(){ + ofLogNotice("StartDragSurfaceCmd", "undo"); + _surface->moveBy(_previousVertices[0] - _surface->getVertices()[0]); +} + +} // namespace piMapper +} // namespace ofx + diff --git a/src/Commands/StartDragSurfaceCmd.h b/src/Commands/StartDragSurfaceCmd.h new file mode 100644 index 0000000..7bee80d --- /dev/null +++ b/src/Commands/StartDragSurfaceCmd.h @@ -0,0 +1,24 @@ +#pragma once + +#include "BaseCmd.h" +#include "BaseSurface.h" + +namespace ofx { +namespace piMapper { + +class StartDragSurfaceCmd : public BaseUndoCmd { + + public: + StartDragSurfaceCmd(BaseSurface * surface); + void exec(); + void undo(); + + private: + BaseSurface * _surface; + vector _previousVertices; + +}; + +} // namespace piMapper +} // namespace ofx +