Engauge Digitizer
2
Toggle main menu visibility
Loading...
Searching...
No Matches
Centipede
CentipedeStateBuildCartesian.cpp
Go to the documentation of this file.
1
/******************************************************************************************************
2
* (C) 2020 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3
* under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4
* LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5
******************************************************************************************************/
6
7
#include "
CentipedePairCartesian.h
"
8
#include "
CentipedeStateBuildCartesian.h
"
9
#include "
CentipedeStateContext.h
"
10
#include "
DocumentModelCoords.h
"
11
#include "
DocumentModelGuideline.h
"
12
#include "
GraphicsScene.h
"
13
#include "
Logger.h
"
14
#include "
Transformation.h
"
15
16
CentipedeStateBuildCartesian::CentipedeStateBuildCartesian
(
CentipedeStateContext
&
context
) :
17
CentipedeStateAbstractBase
(
context
),
18
m_centipedePair (0)
19
{
20
}
21
22
CentipedeStateBuildCartesian::~CentipedeStateBuildCartesian
()
23
{
24
delete
m_centipedePair;
25
}
26
27
void
CentipedeStateBuildCartesian::begin
()
28
{
29
qCDebug(ENGAUGE_LOG) <<
"CentipedeStateBuildCartesian::begin"
;
30
31
// Start showing CentipedePair
32
m_centipedePair =
new
CentipedePairCartesian
(
context
().scene(),
33
context
().transformation (),
34
context
().modelGuideline (),
35
context
().modelCoords (),
36
context
().posClickScreen ());
37
}
38
39
void
CentipedeStateBuildCartesian::end
()
40
{
41
qCDebug(ENGAUGE_LOG) <<
"CentipedeStateBuildCartesian::end"
;
42
43
delete
m_centipedePair;
44
m_centipedePair =
nullptr
;
45
}
46
47
void
CentipedeStateBuildCartesian::handleKeyPress
(Qt::Key
/* key */
,
48
bool
/* atLeastOneSelectedItem */
)
49
{
50
// Stop
51
context
().
requestDelayedStateTransition
(
CENTIPEDE_STATE_PREBUILD
);
52
}
53
54
void
CentipedeStateBuildCartesian::handleMouseMove
(QPointF posScreen)
55
{
56
if
(m_centipedePair-> done (posScreen)) {
57
58
// Done so make a command and exit this state
59
context
().
createGuidelineCommand
(m_centipedePair->selectedXTFinal (),
60
m_centipedePair->valueFinal ());
61
context
().
requestDelayedStateTransition
(
CENTIPEDE_STATE_PREBUILD
);
62
63
}
else
{
64
65
m_centipedePair->move (posScreen);
66
67
}
68
}
69
70
void
CentipedeStateBuildCartesian::handleMousePress
(QPointF
/* posScreen */
)
71
{
72
// Noop
73
}
74
75
void
CentipedeStateBuildCartesian::handleMouseRelease
(QPointF
/* posScreen */
)
76
{
77
context
().
requestDelayedStateTransition
(
CENTIPEDE_STATE_PREBUILD
);
78
}
CentipedePairCartesian.h
CentipedeStateBuildCartesian.h
CentipedeStateContext.h
CENTIPEDE_STATE_PREBUILD
@ CENTIPEDE_STATE_PREBUILD
Definition
CentipedeState.h:16
DocumentModelCoords.h
DocumentModelGuideline.h
GraphicsScene.h
Logger.h
Transformation.h
CentipedePairCartesian
Show two cartesian Centipede graphics items that the user interacts with by moving the cursor.
Definition
CentipedePairCartesian.h:65
CentipedeStateAbstractBase::CentipedeStateAbstractBase
CentipedeStateAbstractBase(CentipedeStateContext &context)
Single constructor.
Definition
CentipedeStateAbstractBase.cpp:10
CentipedeStateAbstractBase::context
CentipedeStateContext & context()
Reference to the CentipedeStateContext that contains all the CentipedeStateAbstractBase subclasses.
Definition
CentipedeStateAbstractBase.cpp:19
CentipedeStateBuildCartesian::end
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before start of th...
Definition
CentipedeStateBuildCartesian.cpp:39
CentipedeStateBuildCartesian::handleMousePress
virtual void handleMousePress(QPointF posScreen)
Handle mouse press event.
Definition
CentipedeStateBuildCartesian.cpp:70
CentipedeStateBuildCartesian::CentipedeStateBuildCartesian
CentipedeStateBuildCartesian(CentipedeStateContext &context)
Single constructor.
Definition
CentipedeStateBuildCartesian.cpp:16
CentipedeStateBuildCartesian::handleKeyPress
virtual void handleKeyPress(Qt::Key key, bool atLeastOneSelectedItem)
Handle key press event.
Definition
CentipedeStateBuildCartesian.cpp:47
CentipedeStateBuildCartesian::handleMouseRelease
virtual void handleMouseRelease(QPointF posScreen)
Handle mouse release event.
Definition
CentipedeStateBuildCartesian.cpp:75
CentipedeStateBuildCartesian::handleMouseMove
virtual void handleMouseMove(QPointF posScreen)
Handle mouse move event.
Definition
CentipedeStateBuildCartesian.cpp:54
CentipedeStateBuildCartesian::~CentipedeStateBuildCartesian
virtual ~CentipedeStateBuildCartesian()
Definition
CentipedeStateBuildCartesian.cpp:22
CentipedeStateBuildCartesian::begin
virtual void begin()
Method that is called at the exact moment a state is entered. Typically called just after end for the...
Definition
CentipedeStateBuildCartesian.cpp:27
CentipedeStateContext
State context class for tracking the steps involved in creating centipedes in preparation for creatin...
Definition
CentipedeStateContext.h:26
CentipedeStateContext::requestDelayedStateTransition
void requestDelayedStateTransition(CentipedeState centipedeState)
Initiate state transition to be performed later, when CentipedeState is off the stack.
Definition
CentipedeStateContext.cpp:141
CentipedeStateContext::createGuidelineCommand
void createGuidelineCommand(bool selectedXTFinal, double valueFinal)
Create a command for creating a Guideline.
Definition
CentipedeStateContext.cpp:70
Generated on
for Engauge Digitizer by
1.17.0