Image3DDequeUR::Image3DDequeUR() {
this->m_globalPath = "/tmp/";
- this->m_currentPos = -1;
+ this->m_currentUndoPos = -1;
}
//virtual
Image3DDequeUR::~Image3DDequeUR() {
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) {
//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;
std::string Image3DDequeUR::getGlobalPath() {
return (this->m_globalPath);
}
+void Image3DDequeUR::setUndoPointerOnTop() {
+ this->m_currentUndoPos = this->m_ImgDeque.size() - 1;
+}
{
private:
ImageInfoDeque m_ImgDeque;
- unsigned int m_currentPos;
+ int m_currentUndoPos;
std::string m_globalPath;
public:
Image3DDequeUR();
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);
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);
};
void ImageInfoUR::setImage(vtkImageData* img)
{
this->m_Image = img;
+ this->setStatus(true);
}
std::string ImageInfoUR::getImageName()
{
void ImageInfoUR::removeImageFromMemory()
{
this->m_Image->Delete();
+ this->setStatus(false);
}
}
//virtual
-void ImageUndoRedo::setRedoImage( ) {
+void ImageUndoRedo::setRedoImage( const RegionSType& region ) {
}
void ImageUndoRedo::setOriginalImage(ImageType* img) {
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:
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);