Engauge Digitizer 2
Loading...
Searching...
No Matches
GuidelineDragCommandFactory Class Reference

Determine if inputs that were collected after a Guideline drag should result in a Cmd to move or Cmd to delete, and then generate the appropriate Cmd. More...

#include <GuidelineDragCommandFactory.h>

Collaboration diagram for GuidelineDragCommandFactory:
Collaboration graph

Public Member Functions

 GuidelineDragCommandFactory ()
 Single constructor.
CmdAbstractcreateAfterDrag (MainWindow &mainWindow, Document &document, double newValue, const DocumentModelGuideline &modelGuidelineDocument, const QString &identifier, bool draggedOffscreen)
 Create delete or move Cmd.

Detailed Description

Determine if inputs that were collected after a Guideline drag should result in a Cmd to move or Cmd to delete, and then generate the appropriate Cmd.

Definition at line 21 of file GuidelineDragCommandFactory.h.

Constructor & Destructor Documentation

◆ GuidelineDragCommandFactory()

GuidelineDragCommandFactory::GuidelineDragCommandFactory ( )

Single constructor.

Definition at line 19 of file GuidelineDragCommandFactory.cpp.

20{
21}

Member Function Documentation

◆ createAfterDrag()

CmdAbstract * GuidelineDragCommandFactory::createAfterDrag ( MainWindow & mainWindow,
Document & document,
double newValue,
const DocumentModelGuideline & modelGuidelineDocument,
const QString & identifier,
bool draggedOffscreen )

Create delete or move Cmd.

The selected Cmd will act on the document Guidelines to make that set consistent with the displayed Guidelines (which includes the just-moved Guideline)

Definition at line 23 of file GuidelineDragCommandFactory.cpp.

29{
30 LOG4CPP_INFO_S ((*mainCat)) << "GuidelineDragCommandFactory::GuidelineDragCommandFactory";
31
32 GuidelineValues valuesXDocument = modelGuidelineDocument.valuesX ();
33 GuidelineValues valuesYDocument = modelGuidelineDocument.valuesY ();
34
35 // So which Guideline moved?
36 double valueBefore = valueForIdentifier (modelGuidelineDocument,
37 identifier);
38
39 // What type was the Guideline?
40 bool isXT = isXTForIdentifier (modelGuidelineDocument,
41 identifier);
42
43 CmdAbstract *cmd = nullptr;
44
45 if (draggedOffscreen) {
46
47 // Delete
48 if (isXT) {
49 cmd = new CmdGuidelineRemoveXT(mainWindow,
50 document,
51 identifier,
52 valueBefore);
53 } else {
54 cmd = new CmdGuidelineRemoveYR(mainWindow,
55 document,
56 identifier,
57 valueBefore);
58 }
59 } else {
60
61 // Move
62 if (isXT) {
63 cmd = new CmdGuidelineMoveXT(mainWindow,
64 document,
65 identifier,
66 valueBefore,
67 valueAfter);
68 } else {
69 cmd = new CmdGuidelineMoveYR(mainWindow,
70 document,
71 identifier,
72 valueBefore,
73 valueAfter);
74 }
75 }
76
77 return cmd;
78}
QMap< QString, double > GuidelineValues
log4cpp::Category * mainCat
Definition Logger.cpp:14
GuidelineValues valuesY() const
Get method for y/r values.
GuidelineValues valuesX() const
Get method for x/t values.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

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