DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
setnodevaluecommand.h
Go to the documentation of this file.
1 #ifndef SETNODEVALUECOMMAND_H
2 #define SETNODEVALUECOMMAND_H
3 
4 #include <commands/command.h>
5 #include <memory>
6 #include <dtree/dtnode.h>
7 #include <QList>
8 
9 class QGraphicsItem;
10 class GraphNodeItem;
11 
13 {
14 public:
15  SetNodeValueCommand(QList<QGraphicsItem *> items, double new_value);
16  virtual ~SetNodeValueCommand();
17 
18  virtual bool execute();
19  virtual bool undo();
20  virtual bool redo();
21 
22 private:
23  struct Data {
24  std::shared_ptr<dtree::Node> node;
25  GraphNodeItem *item;
26  double old_value;
27  };
28 
29  QList<Data> mData;
30  double mNewValue;
31 };
32 
33 #endif // SETNODEVALUECOMMAND_H
An abstract class that implements an interface for commands that can be undone and redone.
Definition: command.h:9
virtual bool execute()
Execute the command.
Definition: setnodevaluecommand.cpp:33
virtual bool redo()
Redo the command.
Definition: setnodevaluecommand.cpp:51
virtual ~SetNodeValueCommand()
Definition: setnodevaluecommand.cpp:27
virtual bool undo()
Undo the command.
Definition: setnodevaluecommand.cpp:42
Definition: setnodevaluecommand.h:12
SetNodeValueCommand(QList< QGraphicsItem * > items, double new_value)
Definition: setnodevaluecommand.cpp:6
Definition: graphnodeitem.h:36