]> Creatis software - creaMaracasVisu.git/commitdiff
DFCH: Undo/Redo 60% :) :)
authorDiego Caceres <Diego.Caceres@creatis.insa-lyon.fr>
Mon, 26 Sep 2011 16:53:46 +0000 (16:53 +0000)
committerDiego Caceres <Diego.Caceres@creatis.insa-lyon.fr>
Mon, 26 Sep 2011 16:53:46 +0000 (16:53 +0000)
12 files changed:
lib/maracasVisuLib/CMakeLists.txt
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.cxx [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/image3DDequeUR.h [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageDequeUR.cxx [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageDequeUR.h [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageInfoUR.cxx [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageInfoUR.h [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.cxx [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/imageUndoRedo.h [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/managerUR.cxx [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/managerUR.h [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/regionStructUR.h [new file with mode: 0644]

index 6135b61799b7723536b99bbb2a504cd0f985ba6c..83d09b1e2979edda9e241ebb016dc28dcf07cc44 100644 (file)
@@ -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 (file)
index 0000000..38b6fa2
--- /dev/null
@@ -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 (file)
index 0000000..f62aaca
--- /dev/null
@@ -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 (file)
index 0000000..5ac8965
--- /dev/null
@@ -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 (file)
index 0000000..3da0311
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * ImageDeque.h
+ *
+ *  Created on: Sep 22, 2011
+ *      Author: caceres
+ */
+
+#ifndef IMAGEDEQUE_H_
+#define IMAGEDEQUE_H_
+
+#include <iostream>
+#include <string>
+#include <deque>
+#include <vtkImageData.h>
+#include "imageInfoUR.h"
+#include "regionStructUR.h"
+
+typedef std::deque<ImageInfoUR> 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 (file)
index 0000000..9f0db9c
--- /dev/null
@@ -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 &region)
+{
+       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 (file)
index 0000000..7a59b54
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * ImageInfo.h
+ *
+ *  Created on: Sep 22, 2011
+ *      Author: caceres
+ */
+
+#ifndef IMAGEINFO_H_
+#define IMAGEINFO_H_
+
+#include <iostream>
+#include <string>
+#include <vtkImageData.h>
+#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 &region );
+       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 (file)
index 0000000..be1ce69
--- /dev/null
@@ -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 (file)
index 0000000..2b935fa
--- /dev/null
@@ -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 (file)
index 0000000..126fee0
--- /dev/null
@@ -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 (file)
index 0000000..e570092
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * managerUR.h
+ *
+ *  Created on: Sep 26, 2011
+ *      Author: caceres
+ */
+
+#ifndef MANAGERUR_H_
+#define MANAGERUR_H_
+
+#include <iostream>
+#include <string>
+#include <vtkImageData.h>
+
+#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 (file)
index 0000000..7cd244b
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * RegionStruct.h
+ *
+ *  Created on: Sep 22, 2011
+ *      Author: caceres
+ */
+
+#ifndef REGIONSTRUCT_H_
+#define REGIONSTRUCT_H_
+
+#include <iostream>
+
+struct RegionStructUR{
+       int minX;
+       int maxX;
+       int minY;
+       int maxY;
+       int minZ;
+       int maxZ;
+};
+
+
+#endif /* REGIONSTRUCT_H_ */