6 changed files with 86 additions and 0 deletions
@ -0,0 +1,31 @@ |
|||
#include "MoveSurfaceCommand.h" |
|||
|
|||
namespace ofx{ |
|||
namespace piMapper{ |
|||
|
|||
MoveSurfaceCommand::MoveSurfaceCommand( |
|||
BaseSurface * surface, |
|||
ProjectionEditor * projectionEditor){ |
|||
|
|||
_surface = surface; |
|||
_projectionEditor = projectionEditor; |
|||
} |
|||
|
|||
void MoveSurfaceCommand::exec(){ |
|||
// Store surface location by copying vertices
|
|||
_previousVertices = _surface->getVertices(); |
|||
} |
|||
|
|||
void MoveSurfaceCommand::undo(){ |
|||
//for (auto i = 0; i < _previousVertices.size(); i++) {
|
|||
//_surface->setVertex(i, _previousVertices[i]);
|
|||
//}
|
|||
_surface->moveBy(_previousVertices[0] - _surface->getVertices()[0]); |
|||
_projectionEditor->updateJoints(); |
|||
_previousVertices.clear(); |
|||
_surface = 0; |
|||
} |
|||
|
|||
} // namespace piMapper
|
|||
} // namespace ofx
|
|||
|
@ -0,0 +1,31 @@ |
|||
// MoveSurfaceCommand
|
|||
// Provides with option to undo move surface operation.
|
|||
// Created by Krisjanis Rijnieks 2015-05-14
|
|||
|
|||
#pragma once |
|||
|
|||
#include "BaseCommand.h" |
|||
#include "BaseSurface.h" |
|||
#include "ProjectionEditor.h" |
|||
|
|||
namespace ofx{ |
|||
namespace piMapper{ |
|||
|
|||
class MoveSurfaceCommand : public BaseUndoableCommand{ |
|||
|
|||
public: |
|||
MoveSurfaceCommand( |
|||
BaseSurface * surface, |
|||
ProjectionEditor * projectionEditor); |
|||
void exec(); |
|||
void undo(); |
|||
|
|||
private: |
|||
BaseSurface * _surface; |
|||
ProjectionEditor * _projectionEditor; |
|||
vector<ofVec3f> _previousVertices; |
|||
}; |
|||
|
|||
} // namespace piMapper
|
|||
} // namespace ofx
|
|||
|
Loading…
Reference in new issue