X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FimageUndoRedo%2FimageUndoRedo.cxx;h=2137a713e5d4fcd57277cf17a94598dfcba30bea;hb=2725f81fc97c9faa92749159bdbaf9cedeef7af4;hp=dd9bcecf4d3e6233b5a2d79d754f38d075b9b374;hpb=ada3e60bcd998550327dac4f95b65f0c113f063b;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx index dd9bcec..2137a71 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx @@ -17,16 +17,19 @@ ImageUndoRedo::~ImageUndoRedo() { //virtual void ImageUndoRedo::Undo() { ImageInfoUR* imageInfo = this->m_ImagesDeque->Undo(); - if (imageInfo != NULL) - { - //this->SetRedoImage(imageInfo->GetRegion()); - this->DrawUR(imageInfo); + if (imageInfo != NULL) { + //this->SetRedoImage(imageInfo->GetImageMManager()); + this->DrawUR(imageInfo, true); this->UpdateUndoImage(); } } //virtual void ImageUndoRedo::Redo() { - + /*ImageInfoUR* imageInfo = this->m_ImagesDeque->Redo(); + if (imageInfo != NULL) + { + this->DrawUR(imageInfo); + }*/ } void ImageUndoRedo::SetImage(VTKImageDataPointerType image) { this->m_CurrentImage = image; @@ -34,26 +37,21 @@ void ImageUndoRedo::SetImage(VTKImageDataPointerType image) { this->UpdateUndoImage(); } //virtual -void ImageUndoRedo::SetUndoImage(ImageMManagerType* imMManager) { +void ImageUndoRedo::SetURImages(ImageMManagerType* imMManager) { ImageMManagerType* newImageManager = new ImageMManagerType(imMManager); if (newImageManager->ValidateRegion()) { RegionSType region = newImageManager->GetModifiedRegion(); - VTKImageDataPointerType imgResult = this->GetImageRegion(region, + VTKImageDataPointerType imgUndo = this->GetImageRegion(region, this->m_UndoImage); - this->m_ImagesDeque->AddImageToUndoContainer(imgResult, + VTKImageDataPointerType imgRedo = this->GetImageRegion(region, + this->m_CurrentImage); + this->m_ImagesDeque->AddImagesToURContainer(imgUndo, imgRedo, newImageManager); this->UpdateUndoImage(); } else { std::cerr << "INVALID REGION" << std::endl; } } -//virtual -void ImageUndoRedo::SetRedoImage(const ImageMManagerType* imMManager) { - /*RegionSType region = imMManager.GetModifiedRegion(); - VTKImageDataPointerType imgResult = this->ImageMManagerType(region, - this->m_CurrentImage); - this->m_ImagesDeque->AddImageToRedoContainer(imgResult, imMManager);*/ -} void ImageUndoRedo::UpdateUndoImage() { this->m_CurrentImage->Update(); @@ -78,8 +76,14 @@ void ImageUndoRedo::SetCurrentImage(VTKImageDataPointerType img) { this->m_CurrentImage = img; } //virtual -void ImageUndoRedo::DrawUR(ImageInfoUR* imageInfo) { - VTKImageDataPointerType img = imageInfo->GetImage(); +void ImageUndoRedo::DrawUR(ImageInfoUR* imageInfo, const bool& undo) { + VTKImageDataPointerType img; + if (undo) { + img = imageInfo->GetUndoImage(); + } //fi + else { + img = imageInfo->GetRedoImage(); + } //else RegionSType region = imageInfo->GetImageMManager()->GetModifiedRegion(); if (img != NULL) { for (int i = region.minX, x = 0; i <= region.maxX; i++, x++) {