Hugin trunk 0.1
Loading...
Searching...
No Matches
Command.cpp
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
24#include "Command.h"
25
26namespace PanoCommand
27{
28
30{
31 if (m_memento != NULL)
32 {
33 delete m_memento;
34 };
35 if (m_redoMemento != NULL)
36 {
37 delete m_redoMemento;
38 };
39}
40
42{
43 saveMemento();
44 bool success = processPanorama(m_pano);
45 setSuccessful(success);
46 if (success)
47 {
48 // notify all observers about changes
49 m_pano.changeFinished();
50 if (m_clearDirty)
51 {
52 m_pano.clearDirty();
53 };
54 }
55 else
56 {
57 // [TODO] warning!
58 m_pano.setMementoToCopyOf(m_memento);
59 };
60}
61
63{
64 DEBUG_ASSERT(m_memento != NULL);
65 saveRedoMemento();
66 m_pano.setMementoToCopyOf(m_memento);
67 m_pano.changeFinished();
68}
69
71{
72 if (m_redoMemento == NULL)
73 {
74 execute();
75 }
76 else
77 {
78 m_pano.setMementoToCopyOf(m_redoMemento);
79 m_pano.changeFinished();
80 };
81}
82
83std::string PanoCommand::getName() const
84{
85 return m_name;
86}
87
88void PanoCommand::setName(const std::string& newName)
89{
90 m_name = newName;
91}
92
94{
95 return m_successful;
96}
97
99{
100 m_successful = success;
101}
102
104{
105 if (m_memento != NULL)
106 {
107 delete m_memento;
108 };
109 m_memento = m_pano.getNewMemento();
110};
111
113{
114 if (m_redoMemento != NULL)
115 {
116 delete m_redoMemento;
117 };
118 m_redoMemento = m_pano.getNewMemento();
119}
120
125
126} // namespace
Model for a panorama.
Definition Panorama.h:153
virtual void execute()
execute the command.
Definition Command.cpp:41
virtual void undo()
undo execute() [virtual]
Definition Command.cpp:62
virtual void saveRedoMemento()
saves the state for redo
Definition Command.cpp:112
virtual bool processPanorama(HuginBase::Panorama &pano)
Called by execute().
Definition Command.cpp:121
virtual void setSuccessful(bool success=true)
Definition Command.cpp:98
virtual void setName(const std::string &newName)
sets the name for the command
Definition Command.cpp:88
virtual ~PanoCommand()
destructor
Definition Command.cpp:29
virtual void redo()
redo execute() [virtual]
Definition Command.cpp:70
virtual std::string getName() const
returns the name of the command
Definition Command.cpp:83
virtual bool wasSuccessful() const
Definition Command.cpp:93
virtual void saveMemento()
saves the state for undo
Definition Command.cpp:103
#define DEBUG_ASSERT(cond)
Definition utils.h:80
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41