7 #include "CmdAbstract.h"
10 #include "GraphicsItemType.h"
11 #include "GraphicsScene.h"
12 #include "GraphicsView.h"
14 #include "MainWindow.h"
16 #include <QGraphicsItem>
20 const QString &cmdDescription) :
21 QUndoCommand (cmdDescription),
22 m_mainWindow (mainWindow),
23 m_document (document),
26 LOG4CPP_INFO_S ((*mainCat)) <<
"CmdAbstract::CmdAbstract";
29 CmdAbstract::~CmdAbstract()
48 void CmdAbstract::redo ()
51 LOG4CPP_INFO_S ((*mainCat)) <<
"CmdAbstract::redo";
70 m_isFirstRedo =
false;
75 LOG4CPP_INFO_S ((*mainCat)) <<
"CmdAbstract::redo identifierIndex=" << m_identifierIndexBeforeRedo <<
"->"
76 << m_identifierIndexAfterRedo;
81 LOG4CPP_INFO_S ((*mainCat)) <<
"CmdAbstract::resetSelection";
84 QList<QGraphicsItem *>::iterator itrS;
85 for (itrS = items.begin (); itrS != items.end (); itrS++) {
87 QGraphicsItem *item = *itrS;
88 bool selected =
false;
89 if (item->data (DATA_KEY_GRAPHICS_ITEM_TYPE).toInt () == GRAPHICS_ITEM_TYPE_POINT) {
91 QString pointIdentifier = item->data (DATA_KEY_IDENTIFIER).toString ();
93 selected = pointIdentifiersToSelect.
contains (pointIdentifier);
96 item->setSelected (selected);
100 void CmdAbstract::undo ()
102 LOG4CPP_INFO_S ((*mainCat)) <<
"CmdAbstract::undo identifierIndex=" << m_identifierIndexAfterRedo <<
"->"
103 << m_identifierIndexBeforeRedo;
Hash table class that tracks point identifiers as the key, with a corresponding boolean value...
static void setIdentifierIndex(unsigned int identifierIndex)
Reset the current index while performing a Redo.
static unsigned int identifierIndex()
Return the current index for storage in case we need to reset it later while performing a Redo...
bool contains(const QString &pointIdentifier) const
True if specified entry exists in the table.
virtual void cmdRedo()=0
Redo method that is called when QUndoStack is moved one command forward.
GraphicsView & view()
View for the QImage and QGraphicsItems, without const.
CmdAbstract(MainWindow &mainWindow, Document &document, const QString &cmdDescription)
Single constructor.
MainWindow & mainWindow()
Return the MainWindow so it can be updated by this command as a last step.
Storage of one imported image and the data attached to that image.
virtual void cmdUndo()=0
Undo method that is called when QUndoStack is moved one command backward.
Document & document()
Return the Document that this command will modify during redo and undo.
void resetSelection(const PointIdentifiers &pointIdentifiersToSelect)
Since the set of selected points has probably changed, changed that set back to the specified set...
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...