Engauge Digitizer 2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CmdFactory Class Reference

Factory for CmdAbstractBase objects from xml. See also GuidelineDragCommandFactory. More...

#include <CmdFactory.h>

Collaboration diagram for CmdFactory:
Collaboration graph

Public Member Functions

 CmdFactory ()
 Single constructor.
 
CmdAbstractcreateCmd (MainWindow &mainWindow, Document &document, QXmlStreamReader &reader)
 Factory method. Input is the xml node from an error report file.
 

Detailed Description

Factory for CmdAbstractBase objects from xml. See also GuidelineDragCommandFactory.

Definition at line 16 of file CmdFactory.h.

Constructor & Destructor Documentation

◆ CmdFactory()

CmdFactory::CmdFactory ( )

Single constructor.

Definition at line 47 of file CmdFactory.cpp.

48{
49}

Member Function Documentation

◆ createCmd()

CmdAbstract * CmdFactory::createCmd ( MainWindow & mainWindow,
Document & document,
QXmlStreamReader & reader )

Factory method. Input is the xml node from an error report file.

Definition at line 51 of file CmdFactory.cpp.

54{
55 CmdAbstract *cmd = nullptr;
56
58 if (!attributes.hasAttribute(DOCUMENT_SERIALIZE_CMD_TYPE) ||
60
61 // Invalid xml
62 LOG4CPP_ERROR_S ((*mainCat)) << "CmdFactory::createCmd missing " << DOCUMENT_SERIALIZE_CMD_TYPE.toLatin1().data()
63 << " or " << DOCUMENT_SERIALIZE_CMD_DESCRIPTION.toLatin1().data();
64 ENGAUGE_ASSERT(false);
65
66 }
67
68 // Get common attributes
70 QString cmdDescription = attributes.value(DOCUMENT_SERIALIZE_CMD_DESCRIPTION).toString();
71
73 cmd = new CmdAddPointAxis (mainWindow,
74 document,
75 cmdDescription,
76 reader);
78 cmd = new CmdAddPointGraph (mainWindow,
79 document,
80 cmdDescription,
81 reader);
83 cmd = new CmdAddPointsGraph (mainWindow,
84 document,
85 cmdDescription,
86 reader);
88 cmd = new CmdCopy (mainWindow,
89 document,
90 cmdDescription,
91 reader);
92 } else if (cmdType == DOCUMENT_SERIALIZE_CMD_CUT) {
93 cmd = new CmdCut (mainWindow,
94 document,
95 cmdDescription,
96 reader);
98 cmd = new CmdDelete (mainWindow,
99 document,
100 cmdDescription,
101 reader);
103 cmd = new CmdEditPointAxis (mainWindow,
104 document,
105 cmdDescription,
106 reader);
108 cmd = new CmdEditPointGraph (mainWindow,
109 document,
110 cmdDescription,
111 reader);
112 } else if (cmdType == DOCUMENT_SERIALIZE_CMD_GONG) {
113 cmd = new CmdGong (mainWindow,
114 document,
115 cmdDescription,
116 reader);
118 cmd = new CmdGuidelineAddXT (mainWindow,
119 document,
120 cmdDescription,
121 reader);
123 cmd = new CmdGuidelineAddYR (mainWindow,
124 document,
125 cmdDescription,
126 reader);
128 cmd = new CmdGuidelineMoveXT (mainWindow,
129 document,
130 cmdDescription,
131 reader);
133 cmd = new CmdGuidelineMoveYR (mainWindow,
134 document,
135 cmdDescription,
136 reader);
138 cmd = new CmdGuidelineRemoveXT (mainWindow,
139 document,
140 cmdDescription,
141 reader);
143 cmd = new CmdGuidelineRemoveYR (mainWindow,
144 document,
145 cmdDescription,
146 reader);
148 cmd = new CmdGuidelineViewState (mainWindow,
149 document,
150 cmdDescription,
151 reader);
153 cmd = new CmdMoveBy (mainWindow,
154 document,
155 cmdDescription,
156 reader);
158 cmd = new CmdRedoForTest (mainWindow,
159 document,
160 cmdDescription,
161 reader);
163 cmd = new CmdSelectCoordSystem (mainWindow,
164 document,
165 cmdDescription,
166 reader);
168 cmd = new CmdSettingsAxesChecker (mainWindow,
169 document,
170 cmdDescription,
171 reader);
173 cmd = new CmdSettingsColorFilter (mainWindow,
174 document,
175 cmdDescription,
176 reader);
178 cmd = new CmdSettingsCoords (mainWindow,
179 document,
180 cmdDescription,
181 reader);
183 cmd = new CmdSettingsCurveList (mainWindow,
184 document,
185 cmdDescription,
186 reader);
188 cmd = new CmdSettingsCurveProperties (mainWindow,
189 document,
190 cmdDescription,
191 reader);
193 cmd = new CmdSettingsDigitizeCurve (mainWindow,
194 document,
195 cmdDescription,
196 reader);
198 cmd = new CmdSettingsExportFormat (mainWindow,
199 document,
200 cmdDescription,
201 reader);
203 cmd = new CmdSettingsGeneral (mainWindow,
204 document,
205 cmdDescription,
206 reader);
208 cmd = new CmdSettingsGridRemoval (mainWindow,
209 document,
210 cmdDescription,
211 reader);
213 cmd = new CmdSettingsPointMatch (mainWindow,
214 document,
215 cmdDescription,
216 reader);
218 cmd = new CmdSettingsSegments (mainWindow,
219 document,
220 cmdDescription,
221 reader);
223 cmd = new CmdUndoForTest (mainWindow,
224 document,
225 cmdDescription,
226 reader);
227 } else {
228
229 // Invalid xml
230 LOG4CPP_ERROR_S ((*mainCat)) << "CmdFactory::createCmd invalid command type " << cmdType.toLatin1().data();
231 ENGAUGE_ASSERT (false);
232
233 }
234
235 return cmd;
236}
const int INNER_RADIUS_MIN
const QString DOCUMENT_SERIALIZE_CMD_ADD_POINT_AXIS
const QString DOCUMENT_SERIALIZE_CMD_MOVE_BY
const QString DOCUMENT_SERIALIZE_CMD_REDO_FOR_TEST
const QString DOCUMENT_SERIALIZE_CMD_SETTINGS_CURVE_LIST
const QString DOCUMENT_SERIALIZE_CMD_SETTINGS_CURVE_PROPERTIES
const QString DOCUMENT_SERIALIZE_CMD_SETTINGS_GRID_REMOVAL
const QString DOCUMENT_SERIALIZE_CMD_ADD_POINTS_GRAPH
const QString DOCUMENT_SERIALIZE_CMD_GUIDELINE_VIEW_STATE
const QString DOCUMENT_SERIALIZE_CMD_ADD_POINT_GRAPH
const QString DOCUMENT_SERIALIZE_CMD_GUIDELINE_REMOVE_Y_R
const QString DOCUMENT_SERIALIZE_CMD_GONG
const QString DOCUMENT_SERIALIZE_CMD_GUIDELINE_MOVE_Y_R
const QString DOCUMENT_SERIALIZE_CMD_SETTINGS_SEGMENTS
const QString DOCUMENT_SERIALIZE_CMD_SETTINGS_POINT_MATCH
const QString DOCUMENT_SERIALIZE_CMD_GUIDELINE_MOVE_X_T
const QString DOCUMENT_SERIALIZE_CMD_GUIDELINE_ADD_X_T
const QString DOCUMENT_SERIALIZE_CMD_GUIDELINE_ADD_Y_R
const QString DOCUMENT_SERIALIZE_CMD_SETTINGS_COLOR_FILTER
const QString DOCUMENT_SERIALIZE_CMD_UNDO_FOR_TEST
const QString DOCUMENT_SERIALIZE_CMD_TYPE
const QString DOCUMENT_SERIALIZE_CMD_SETTINGS_GENERAL
const QString DOCUMENT_SERIALIZE_CMD_CUT
const QString DOCUMENT_SERIALIZE_CMD_SETTINGS_DIGITIZE_CURVE
const QString DOCUMENT_SERIALIZE_CMD_DELETE
const QString DOCUMENT_SERIALIZE_CMD_GUIDELINE_REMOVE_X_T
const QString DOCUMENT_SERIALIZE_CMD_EDIT_POINT_AXIS
const QString DOCUMENT_SERIALIZE_CMD_EDIT_POINT_GRAPH
const QString DOCUMENT_SERIALIZE_CMD_SETTINGS_COORDS
const QString DOCUMENT_SERIALIZE_CMD_SETTINGS_AXES_CHECKER
const QString DOCUMENT_SERIALIZE_CMD_DESCRIPTION
const QString DOCUMENT_SERIALIZE_CMD_SETTINGS_EXPORT
const QString DOCUMENT_SERIALIZE_CMD_COPY
const QString DOCUMENT_SERIALIZE_CMD_SELECT_COORD_SYSTEM
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.
log4cpp::Category * mainCat
Definition Logger.cpp:14
Wrapper around QUndoCommand. This simplifies the more complicated feature set of QUndoCommand.
Definition CmdAbstract.h:20
Command for adding one axis point.
Command for adding one graph point.
Command for adding one or more graph points. This is for Segment Fill mode.
Command for copying all selected Points to the clipboard.
Definition CmdCopy.h:19
Command for cutting all selected Points.
Definition CmdCut.h:19
Command for deleting all selected Points.
Definition CmdDelete.h:19
Command for editing the graph coordinates one axis point.
Command for editing the graph coordinates of one or more graph points.
Command for sending a satisfying signal to the unit test framework to indicate completion of queued c...
Definition CmdGong.h:16
Command for adding one X/T Guideline value.
Command for adding one Y/R Guideline value.
Command for moving one X/T Guideline value.
Command for moving one Y/R Guideline value.
Command for removing one X/T Guideline value.
Command for removing one Y/R Guideline value.
Command for changing the View / Guidelines state.
Command for moving all selected Points by a specified translation.
Definition CmdMoveBy.h:19
Command for performing Redo during testing.
Command for changing the currently selected CoordSystem.
Command for DlgSettingsAxesChecker.
Command for DlgSettingsColorFilter.
Command for DlgSettingsCoords.
Command for DlgSettingsCurveList.
Command for DlgSettingsCurveProperties.
Command for DlgSettingsDigitizeCurve.
Command for DlgSettingsExportFormat.
Command for DlgSettingsGeneral.
Command for DlgSettingsGridRemoval.
Command for DlgSettingsPointMatch.
Command for DlgSettingsSegments.
Command for performing Undo during testing.
#define LOG4CPP_ERROR_S(logger)
Definition convenience.h:12

The documentation for this class was generated from the following files: