From 07c470d8eed4bd0b96f829c7dc9f63cc5d714869 Mon Sep 17 00:00:00 2001 From: Diego Caceres Date: Mon, 26 Sep 2011 16:53:46 +0000 Subject: [PATCH] DFCH: Undo/Redo 60% :) :) --- lib/maracasVisuLib/CMakeLists.txt | 1 + .../widgets/manualPaint/image3DDequeUR.cxx | 40 +++++++++++++++ .../widgets/manualPaint/image3DDequeUR.h | 34 +++++++++++++ .../widgets/manualPaint/imageDequeUR.cxx | 41 +++++++++++++++ .../widgets/manualPaint/imageDequeUR.h | 35 +++++++++++++ .../widgets/manualPaint/imageInfoUR.cxx | 50 +++++++++++++++++++ .../widgets/manualPaint/imageInfoUR.h | 36 +++++++++++++ .../widgets/manualPaint/imageUndoRedo.cxx | 48 ++++++++++++++++++ .../widgets/manualPaint/imageUndoRedo.h | 35 +++++++++++++ .../widgets/manualPaint/managerUR.cxx | 46 +++++++++++++++++ .../wxWindows/widgets/manualPaint/managerUR.h | 34 +++++++++++++ .../widgets/manualPaint/regionStructUR.h | 23 +++++++++ 12 files changed, 423 insertions(+) create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageDequeUR.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageDequeUR.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageInfoUR.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageInfoUR.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/managerUR.cxx create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/managerUR.h create mode 100644 lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/regionStructUR.h diff --git a/lib/maracasVisuLib/CMakeLists.txt b/lib/maracasVisuLib/CMakeLists.txt index 6135b61..83d09b1 100644 --- a/lib/maracasVisuLib/CMakeLists.txt +++ b/lib/maracasVisuLib/CMakeLists.txt @@ -66,6 +66,7 @@ IF ( BUILD_${LIBRARY_NAME} ) FILE(GLOB ${LIBRARY_NAME}_HEADERS_MANUAL_PAINT "src/interface/wxWindows/widgets/manualPaint/*.h") FILE(GLOB ${LIBRARY_NAME}_SOURCES_MANUAL_PAINT src/interface/wxWindows/widgets/manualPaint/*.cpp ) + FILE(GLOB ${LIBRARY_NAME}_SOURCES_MANUAL_PAINT src/interface/wxWindows/widgets/manualPaint/*.cxx ) FILE(GLOB ${LIBRARY_NAME}_HEADERS_KERNEL "src/kernel/*.h") FILE(GLOB ${LIBRARY_NAME}_SOURCES_KERNEL src/kernel/*.cxx src/kernel/*.cpp src/kernel/*.cc) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.cxx new file mode 100644 index 0000000..38b6fa2 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.cxx @@ -0,0 +1,40 @@ +#include "image3DDequeUR.h" + +Image3DDequeUR::Image3DDequeUR() { + this->m_currentPos = 0; +} +//virtual +Image3DDequeUR::~Image3DDequeUR() { + +} +//virtual +void Image3DDequeUR::addImageToContainer(ImageType* img, + const RegionS& region) { +} +//virtual +void Image3DDequeUR::loadImageToPMemory() { +} +//virtual +void Image3DDequeUR::removeImageFromPMemory() { + +} +ImageType* Image3DDequeUR::undo() { + return NULL; +} +ImageType* Image3DDequeUR::redo() { + return NULL; +} +void Image3DDequeUR::removeFirstImageFromContainer() { + this->m_ImgDeque.pop_front(); +} +void Image3DDequeUR::removeLastImageFromContainer() { + this->m_ImgDeque.pop_back(); +} +void Image3DDequeUR::cleanContainer() { + this->m_ImgDeque.clear(); +} +void Image3DDequeUR::cleanContainerFromIndex(const unsigned int& index) { + for (int i = this->m_ImgDeque.size(); i >= index; i--) { + this->m_ImgDeque.pop_back(); + } +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.h new file mode 100644 index 0000000..f62aaca --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.h @@ -0,0 +1,34 @@ +/* + * image3DDequeUR.h + * + * Created on: Sep 26, 2011 + * Author: caceres + */ + +#ifndef IMAGE3DDEQUEUR_H_ +#define IMAGE3DDEQUEUR_H_ + +#include "imageDequeUR.h" + +class Image3DDequeUR : public ImageDequeUR +{ +private: + ImageInfoDeque m_ImgDeque; + unsigned int m_currentPos; +public: + Image3DDequeUR(); + virtual ~ImageDequeUR(); + virtual void addImageToContainer(ImageType* img, const RegionS& region); + virtual void loadImageToPMemory(); + virtual void removeImageFromPMemory(); + virtual ImageType* undo(); + virtual ImageType* redo(); + void removeFirstImageFromContainer(); + void removeLastImageFromContainer(); + void cleanContainer(); +private: + void cleanContainerFromIndex(const unsigned int& index); +}; + + +#endif /* IMAGE3DDEQUEUR_H_ */ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageDequeUR.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageDequeUR.cxx new file mode 100644 index 0000000..5ac8965 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageDequeUR.cxx @@ -0,0 +1,41 @@ +/* +#include "imageDequeUR.h" + +ImageDequeUR::ImageDequeUR() { + this->m_currentPos = 0; +} +//virtual +ImageDequeUR::~ImageDequeUR() { + +} +//virtual +void ImageDequeUR::addImageToContainer(ImageType* img, const RegionS& region) { +} +//virtual +void ImageDequeUR::loadImageToPMemory() { +} +//virtual +void ImageDequeUR::removeImageFromPMemory() { + +} +ImageType* ImageDequeUR::undo() { + return NULL; +} +ImageType* ImageDequeUR::redo() { + return NULL; +} +void ImageDequeUR::removeFirstImageFromContainer() { + this->m_ImgDeque.pop_front(); +} +void ImageDequeUR::removeLastImageFromContainer() { + this->m_ImgDeque.pop_back(); +} +void ImageDequeUR::cleanContainer() { + this->m_ImgDeque.clear(); +} +void ImageDequeUR::cleanContainerFromIndex(const unsigned int& index) { + for (int i = this->m_ImgDeque.size(); i >= index; i--) { + this->m_ImgDeque.pop_back(); + } +} +*/ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageDequeUR.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageDequeUR.h new file mode 100644 index 0000000..3da0311 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageDequeUR.h @@ -0,0 +1,35 @@ +/* + * ImageDeque.h + * + * Created on: Sep 22, 2011 + * Author: caceres + */ + +#ifndef IMAGEDEQUE_H_ +#define IMAGEDEQUE_H_ + +#include +#include +#include +#include +#include "imageInfoUR.h" +#include "regionStructUR.h" + +typedef std::deque ImageInfoDeque; +typedef vtkImageData ImageType; +typedef RegionStructUR RegionS; + +class ImageDequeUR { +public: + ImageDequeUR(); + virtual ~ImageDequeUR(); + virtual void addImageToContainer(ImageType* img, const RegionS& region); + virtual void loadImageToPMemory(); + virtual void removeImageFromPMemory(); + virtual ImageType* undo(); + virtual ImageType* redo(); +private: + void cleanContainerFromIndex(const unsigned int& index); +}; + +#endif /* IMAGEDEQUE_H_ */ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageInfoUR.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageInfoUR.cxx new file mode 100644 index 0000000..9f0db9c --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageInfoUR.cxx @@ -0,0 +1,50 @@ +/* + * ImageInfo.cxx + * + * Created on: Sep 22, 2011 + * Author: caceres + */ +#include "imageInfoUR.h" + +ImageInfoUR::ImageInfoUR() +{ + this->m_Image = NULL; +} + +ImageInfoUR::~ImageInfoUR() +{ + this->deleteImage(); +} + +void ImageInfoUR::setImageName(const std::string &imgName) +{ + this->m_ImageName = imgName; +} +void ImageInfoUR::setRegion(const RegionStructUR ®ion) +{ + this->m_Region = region; +} +void ImageInfoUR::setStatus(bool onDisk) +{ + this->m_OnDisk = onDisk; +} +void ImageInfoUR::setImage(vtkImageData* img) +{ + this->m_Image = img; +} +std::string ImageInfoUR::getImageName() +{ + return( this->m_ImageName ); +} +RegionStructUR ImageInfoUR::getRegion() +{ + return( this->m_Region ); +} +bool ImageInfoUR::getStatus() +{ + return( this->m_OnDisk ); +} +void ImageInfoUR::deleteImage() +{ + this->m_Image->Delete(); +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageInfoUR.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageInfoUR.h new file mode 100644 index 0000000..7a59b54 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageInfoUR.h @@ -0,0 +1,36 @@ +/* + * ImageInfo.h + * + * Created on: Sep 22, 2011 + * Author: caceres + */ + +#ifndef IMAGEINFO_H_ +#define IMAGEINFO_H_ + +#include +#include +#include +#include "regionStructUR.h" + +class ImageInfoUR{ +private: + vtkImageData* m_Image; + std::string m_ImageName; + RegionStructUR m_Region; + bool m_OnDisk; +public: + ImageInfoUR(); + virtual ~ImageInfoUR(); + void setImageName( const std::string &imgName ); + void setRegion( const RegionStructUR ®ion ); + void setStatus( bool onDisk ); + void setImage( vtkImageData* img ); + std::string getImageName( ); + RegionStructUR getRegion( ); + bool getStatus( ); + void deleteImage(); +}; + + +#endif /* IMAGEINFO_H_ */ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.cxx new file mode 100644 index 0000000..be1ce69 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.cxx @@ -0,0 +1,48 @@ +/* + * imageUndoRedo.cxx + * + * Created on: Sep 26, 2011 + * Author: caceres + */ + + +#include "imageUndoRedo.h" + +ImageUndoRedo::ImageUndoRedo(ImageType* current) { + + this->m_CurrentImage = current; + this->m_CurrentImage->Update(); + this->m_OriginalImage = ImageType::New(); + this->m_OriginalImage->ShallowCopy(m_CurrentImage); +} +//virtual +ImageUndoRedo::~ImageUndoRedo() { + +} +//virtual +void ImageUndoRedo::undo() { + +} +//virtual +void ImageUndoRedo::redo() { + +} +//virtual +void ImageUndoRedo::setUndoImage(const RegionSType& region) { + +} +//virtual +void ImageUndoRedo::setRedoImage( ) { + +} +void ImageUndoRedo::setOriginalImage(ImageType* img) { + this->m_OriginalImage = img; +} +void ImageUndoRedo::setCurrentImage(ImageType* img) { + this->m_CurrentImage = img; +} +//virtual +void ImageUndoRedo::drawUR(ImageType* urImage, const RegionSType& region){ + +} + diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.h new file mode 100644 index 0000000..2b935fa --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.h @@ -0,0 +1,35 @@ +/* + * imageUndoRedo.h + * + * Created on: Sep 26, 2011 + * Author: caceres + */ + +#ifndef IMAGEUNDOREDO_H_ +#define IMAGEUNDOREDO_H_ + +#include "managerUR.h" + +class ImageUndoRedo: public ManagerUR { + +private: + + IDequeType* m_ImagesDeque; + ImageType* m_OriginalImage; + ImageType* m_CurrentImage; + +public: + ImageUndoRedo(ImageType* current); + virtual ~ImageUndoRedo(); + virtual void undo(); + virtual void redo(); + virtual void setUndoImage(const RegionSType& region); + virtual void setRedoImage(); + void setOriginalImage(ImageType* img); + void setCurrentImage(ImageType* img); +private: + virtual void drawUR(ImageType* urImage, const RegionSType& region); + +}; + +#endif /* IMAGEUNDOREDO_H_ */ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/managerUR.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/managerUR.cxx new file mode 100644 index 0000000..126fee0 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/managerUR.cxx @@ -0,0 +1,46 @@ +/* + * managerUR.cxx + * + * Created on: Sep 26, 2011 + * Author: caceres + */ + +/*#include "managerUR.h" + +ManagerUR::ManagerUR(ImageType* current) { + + this->m_CurrentImage = current; + this->m_CurrentImage->Update(); + this->m_OriginalImage = ImageType::New(); + this->m_OriginalImage->ShallowCopy(m_CurrentImage); +} +//virtual +ManagerUR::~ManagerUR() { + +} +//virtual +void ManagerUR::undo() { + +} +//virtual +void ManagerUR::redo() { + +} +//virtual +void ManagerUR::setUndoImage(const RegionSType& region) { + +} +//virtual +void ManagerUR::setRedoImage( ) { + +} +void ManagerUR::setOriginalImage(ImageType* img) { + this->m_OriginalImage = img; +} +void ManagerUR::setCurrentImage(ImageType* img) { + this->m_CurrentImage = img; +} +//virtual +void ManagerUR::drawUR(ImageType* urImage, const RegionSType& region){ + +}*/ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/managerUR.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/managerUR.h new file mode 100644 index 0000000..e570092 --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/managerUR.h @@ -0,0 +1,34 @@ +/* + * managerUR.h + * + * Created on: Sep 26, 2011 + * Author: caceres + */ + +#ifndef MANAGERUR_H_ +#define MANAGERUR_H_ + +#include +#include +#include + +#include "imageDequeUR.h" + +typedef ImageDequeUR IDequeType; +typedef RegionStructUR RegionSType; +typedef vtkImageData ImageType; + +class ManagerUR { +public: + ManagerUR(); + virtual ~ManagerUR(); + virtual void undo(); + virtual void redo(); + virtual void setUndoImage( const RegionSType& region ); + virtual void setRedoImage( ); +private: + virtual void drawUR(ImageType* urImage, const RegionSType& region); + +}; + +#endif /* MANAGERUR_H_ */ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/regionStructUR.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/regionStructUR.h new file mode 100644 index 0000000..7cd244b --- /dev/null +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/regionStructUR.h @@ -0,0 +1,23 @@ +/* + * RegionStruct.h + * + * Created on: Sep 22, 2011 + * Author: caceres + */ + +#ifndef REGIONSTRUCT_H_ +#define REGIONSTRUCT_H_ + +#include + +struct RegionStructUR{ + int minX; + int maxX; + int minY; + int maxY; + int minZ; + int maxZ; +}; + + +#endif /* REGIONSTRUCT_H_ */ -- 2.47.1