Engauge Digitizer 2
Loading...
Searching...
No Matches
GuidelineStateHandleX.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2019 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 "EngaugeAssert.h"
8#include "GraphicsScene.h"
9#include "GuidelineAbstract.h"
10#include "GuidelineFormat.h"
12#include "GuidelineState.h"
15#include "Logger.h"
16#include "Transformation.h"
17
22
26
28{
29 LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateHandleX::begin"
30 << " identifier=" << context().guideline().identifier().toLatin1().data();
31
32 beginCommon ();
33}
34
36{
37 const double ARBITRARY_Y = 1; // Value that is legal in all cases including log
38 QPointF posScreen;
41 posScreen);
42
43 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandleX::convertGraphCoordinateToScreenPoint"
44 << " pos=(" << posScreen.x() << ", " << posScreen.y() << ")";
45
46 return posScreen;
47}
48
50{
51 QPointF posGraph;
53 posGraph);
54
55 LOG4CPP_DEBUG_S ((*mainCat)) << "GuidelineStateHandleX::convertScreenPointToGraphCoordinate"
56 << " pos=(" << posGraph.x() << ", " << posGraph.y() << ")";
57
58 return posGraph.x();
59}
60
62{
63 LOG4CPP_INFO_S ((*mainCat)) << "GuidelineStateHandleX::end";
64}
65
74
76{
77 // pointToLine applies in this state
78 return EllipseParameters();
79}
80
82{
84
85 return projector.fromPosScreen (context().transformation(),
86 sceneRect (),
87 posScreen);
88}
89
const int INNER_RADIUS_MIN
QString guidelineStateAsString(GuidelineState state)
@ GUIDELINE_STATE_DISCARDED
@ GUIDELINE_STATE_HANDLE_X
@ GUIDELINE_STATE_DEPLOYED_CONSTANT_X_SELECT_EDIT
log4cpp::Category * mainCat
Definition Logger.cpp:14
Parameters that define an ellipse about the specified center, at the specified angle from alignment w...
void sacrificeHandleAndVisibleGuidelines(const QPointF &posScene, GuidelineState guidelineStateForReplacement)
Replace visible and handle Guidelines after click and drag.
virtual QString identifier() const =0
Unique identifier from QGraphicsItem.
Project a point along the vertical direction in graph coordinates to produce a line segment along the...
QLineF fromPosScreen(const Transformation &transformation, const QRectF &sceneRect, const QPointF &posScreen)
Return line through point in screen coordinates.
QRectF sceneRect() const
Scene rectangle in screen coordinates (=pixels)
GuidelineStateContext & context() const
Context in charge of the state classes.
Context class for state machine that belongs to the Guideline class.
Transformation transformation() const
Return copy of transformation owned by MainWindow.
GuidelineAbstract & guideline()
Guideline that owns this context class.
void requestStateTransition(GuidelineState guidelineState)
Request a state transition.
State for an invisible handle which was previously a deployed Guideline but morphed into an invisible...
virtual void begin()
Transition into state.
virtual QString stateName() const
Name of state as a string for debugging only.
virtual EllipseParameters pointToEllipse(const QPointF &posScreen) const
Return ellipse representing constant range, that passes through the specified point.
virtual void end()
Transition out of state.
virtual double convertScreenPointToGraphCoordinate(const QPointF &posScreen) const
Convert screen point pair into single graph coordinate.
virtual void handleMouseRelease(const QPointF &posScene)
At the end of dragging, clone the Guideline that owns the state machine where these states live.
GuidelineStateHandleX(GuidelineStateContext &context)
Single constructor.
virtual QPointF convertGraphCoordinateToScreenPoint(double valueGraph) const
Convert single graph coordinate into screen point pair.
virtual QLineF pointToLine(const QPointF &posScreen) const
Return line parallel to an axis line, that passes through the specified point.
void transformRawGraphToScreen(const QPointF &pointRaw, QPointF &pointScreen) const
Transform from raw graph coordinates to linear cartesian graph coordinates, then to screen coordinate...
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18
#define LOG4CPP_DEBUG_S(logger)
Definition convenience.h:20