From: Diego Caceres Date: Tue, 4 Oct 2011 09:35:12 +0000 (+0000) Subject: DFCH: Manual paint changes :) X-Git-Tag: v1.0.4~62 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=f8995d30b9e3afb874a79b199b43d40aab843d2e;p=creaMaracasVisu.git DFCH: Manual paint changes :) --- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.cxx index c5c4e22..36dd016 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.cxx @@ -2,7 +2,7 @@ Image3DDequeUR::Image3DDequeUR() { this->m_globalPath = "/tmp/"; - this->m_currentPos = -1; + this->m_currentUndoPos = -1; } //virtual Image3DDequeUR::~Image3DDequeUR() { @@ -37,8 +37,6 @@ void Image3DDequeUR::addImageToContainer(ImageType* img, this->saveImageAsMHD(img, fullpath); //Adding to deque this->m_ImgDeque.push_back(imageInfo); - this->m_currentPos = this->m_ImgDeque.size() - 1; - } //virtual void Image3DDequeUR::loadImageToPMemory(const unsigned int& index) { @@ -66,20 +64,23 @@ void Image3DDequeUR::saveImageAsMHD(ImageType* img, //ATENCIIIOOOON TIENE QUE HACER POP PARA PONER EL REDO //virtual -ImageType* Image3DDequeUR::undo() { - if (this->m_currentPos == -1) { - return NULL; +ImageInfoUR Image3DDequeUR::undo() { + if (this->m_currentUndoPos == -1) { + ImageInfoUR retAux; + return (retAux); } //fi - this->m_currentPos--; - return (NULL); + ImageInfoUR imgRet = m_ImgDeque[(unsigned int) m_currentUndoPos]; + this->m_currentUndoPos--; + return (imgRet); } //virtual -ImageType* Image3DDequeUR::redo() { - if (this->m_currentPos == ( this->m_ImgDeque.size() - 1 )) { - return NULL; +ImageInfoUR Image3DDequeUR::redo() { + if (this->m_currentUndoPos != (this->m_ImgDeque.size() - 1)) { + this->m_currentUndoPos++; + return (m_ImgDeque[(unsigned int) m_currentUndoPos]); } //fi - this->m_currentPos++; - return (NULL); + ImageInfoUR retAux; + return (retAux); } void Image3DDequeUR::setGlobalPath(const std::string& globalPath) { this->m_globalPath = globalPath; @@ -101,3 +102,6 @@ void Image3DDequeUR::cleanContainerFromIndex(const unsigned int& index) { std::string Image3DDequeUR::getGlobalPath() { return (this->m_globalPath); } +void Image3DDequeUR::setUndoPointerOnTop() { + this->m_currentUndoPos = this->m_ImgDeque.size() - 1; +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.h index db9a223..a8ef891 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.h @@ -17,7 +17,7 @@ class Image3DDequeUR : public ImageDequeUR { private: ImageInfoDeque m_ImgDeque; - unsigned int m_currentPos; + int m_currentUndoPos; std::string m_globalPath; public: Image3DDequeUR(); @@ -26,12 +26,13 @@ public: virtual void loadImageToPMemory( const unsigned int& index ); virtual void removeImageFromPMemory( const unsigned int& index ); virtual void saveImageAsMHD( ImageType* img, const std::string& filename ); - virtual ImageType* undo(); - virtual ImageType* redo(); + virtual ImageInfoUR undo(); + virtual ImageInfoUR redo(); void setGlobalPath( const std::string& globalPath ); void removeFirstImageFromContainer(); void removeLastImageFromContainer(); void cleanContainer(); + void setUndoPointerOnTop(); std::string getGlobalPath( ); private: void cleanContainerFromIndex(const unsigned int& index); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageDequeUR.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageDequeUR.h index a12887e..9d475d8 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageDequeUR.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageDequeUR.h @@ -27,8 +27,8 @@ public: virtual void loadImageToPMemory( const unsigned int& index ); virtual void removeImageFromPMemory( const unsigned int& index ); virtual void saveImageAsMHD( ImageType* img, const std::string& filename ); - virtual ImageType* undo(); - virtual ImageType* redo(); + virtual ImageInfoUR undo(); + virtual ImageInfoUR redo(); private: void cleanContainerFromIndex(const unsigned int& index); }; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageInfoUR.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageInfoUR.cxx index d91a428..f2275ea 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageInfoUR.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageInfoUR.cxx @@ -31,6 +31,7 @@ void ImageInfoUR::setStatus(const bool& onMemory) void ImageInfoUR::setImage(vtkImageData* img) { this->m_Image = img; + this->setStatus(true); } std::string ImageInfoUR::getImageName() { @@ -47,4 +48,5 @@ bool ImageInfoUR::getStatus() void ImageInfoUR::removeImageFromMemory() { this->m_Image->Delete(); + this->setStatus(false); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.cxx index be1ce69..5c7e300 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.cxx @@ -32,7 +32,7 @@ void ImageUndoRedo::setUndoImage(const RegionSType& region) { } //virtual -void ImageUndoRedo::setRedoImage( ) { +void ImageUndoRedo::setRedoImage( const RegionSType& region ) { } void ImageUndoRedo::setOriginalImage(ImageType* img) { diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.h index 2b935fa..3a9dd20 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.h @@ -24,7 +24,7 @@ public: virtual void undo(); virtual void redo(); virtual void setUndoImage(const RegionSType& region); - virtual void setRedoImage(); + virtual void setRedoImage( const RegionSType& region ); void setOriginalImage(ImageType* img); void setCurrentImage(ImageType* img); private: diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/managerUR.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/managerUR.h index e570092..5a2932e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/managerUR.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/managerUR.h @@ -25,7 +25,7 @@ public: virtual void undo(); virtual void redo(); virtual void setUndoImage( const RegionSType& region ); - virtual void setRedoImage( ); + virtual void setRedoImage( const RegionSType& region ); private: virtual void drawUR(ImageType* urImage, const RegionSType& region);