7 changed files with 108 additions and 20 deletions
@ -0,0 +1,33 @@ |
|||||
|
#include "SelectSurfaceCommand.h" |
||||
|
|
||||
|
namespace ofx{ |
||||
|
namespace piMapper{ |
||||
|
|
||||
|
SelectSurfaceCommand::SelectSurfaceCommand( |
||||
|
SurfaceManager * surfaceManager, |
||||
|
BaseSurface * surfaceToSelect, |
||||
|
ProjectionEditor * projectionEditor){ |
||||
|
|
||||
|
_surfaceManager = surfaceManager; |
||||
|
_surfaceToSelect = surfaceToSelect; |
||||
|
_projectionEditor = projectionEditor; |
||||
|
} |
||||
|
|
||||
|
void SelectSurfaceCommand::exec(){ |
||||
|
_prevSelectedSurface = _surfaceManager->getSelectedSurface(); |
||||
|
_projectionEditor->clearJoints(); |
||||
|
_surfaceManager->selectSurface(_surfaceToSelect); |
||||
|
_projectionEditor->createJoints(); |
||||
|
} |
||||
|
|
||||
|
void SelectSurfaceCommand::undo(){ |
||||
|
_projectionEditor->clearJoints(); |
||||
|
_surfaceManager->selectSurface(_prevSelectedSurface); |
||||
|
_projectionEditor->createJoints(); |
||||
|
_surfaceToSelect = 0; |
||||
|
_prevSelectedSurface = 0; |
||||
|
} |
||||
|
|
||||
|
} // namespace piMapper
|
||||
|
} // namespace ofx
|
||||
|
|
@ -0,0 +1,34 @@ |
|||||
|
// SelectSurfaceCommand
|
||||
|
// Provides with option to undo select surface operation.
|
||||
|
// Created by Krisjanis Rijnieks 2015-05-14
|
||||
|
|
||||
|
#pragma once |
||||
|
|
||||
|
#include "BaseCommand.h" |
||||
|
#include "BaseSurface.h" |
||||
|
#include "SurfaceManager.h" |
||||
|
#include "ProjectionEditor.h" |
||||
|
|
||||
|
namespace ofx{ |
||||
|
namespace piMapper{ |
||||
|
|
||||
|
class SelectSurfaceCommand : public BaseUndoableCommand{ |
||||
|
|
||||
|
public: |
||||
|
SelectSurfaceCommand( |
||||
|
SurfaceManager * surfaceManager, |
||||
|
BaseSurface * surfaceToSelect, |
||||
|
ProjectionEditor * projectionEditor); |
||||
|
void exec(); |
||||
|
void undo(); |
||||
|
|
||||
|
private: |
||||
|
BaseSurface * _surfaceToSelect; |
||||
|
SurfaceManager * _surfaceManager; |
||||
|
BaseSurface * _prevSelectedSurface; |
||||
|
ProjectionEditor * _projectionEditor; |
||||
|
}; |
||||
|
|
||||
|
} // namespace piMapper
|
||||
|
} // namespace ofx
|
||||
|
|
Loading…
Reference in new issue