]> Creatis software - creaMaracasVisu.git/commitdiff
DFCH: Manual paint changes :)
authorDiego Caceres <Diego.Caceres@creatis.insa-lyon.fr>
Tue, 4 Oct 2011 09:35:12 +0000 (09:35 +0000)
committerDiego Caceres <Diego.Caceres@creatis.insa-lyon.fr>
Tue, 4 Oct 2011 09:35:12 +0000 (09:35 +0000)
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageDequeUR.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageInfoUR.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/managerUR.h

index c5c4e221a6e15509d9402a538c9c0dc84d4e1c8c..36dd0168350133c9c83991c0e0684269833b3a1b 100644 (file)
@@ -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;
+}
index db9a2232246fb554df8145ce1a2f3085fd310ec9..a8ef891b0f6da3539ad73b292ba54c3e909bbb0f 100644 (file)
@@ -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);
index a12887ed3bb3a3cfda9a03fe627b0f7f29d6ebb5..9d475d8643f43aaa07f7d5554d7fdb51e3d644f2 100644 (file)
@@ -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);
 };
index d91a428ed72ad1da309a5bafce49b44783daad06..f2275ea6e3ee7f5b144aa190e60255107c259321 100644 (file)
@@ -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);
 }
index be1ce6989b314132a9aaa59a61cc8c06877bf631..5c7e3009aa990a8012beb6002a5be0c14c564da7 100644 (file)
@@ -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) {
index 2b935fa8fbf49dbe6cf3a01c9546b57fdfc1edb1..3a9dd2030a450ce3705d7b67204211cf3328780f 100644 (file)
@@ -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:
index e570092e1b8724b2bcc063dbf8ce283ae66a0df2..5a2932e620d5edbb48753553ea7d80ae83e52b39 100644 (file)
@@ -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);