1 #include "CmdAddPointAxis.h"
2 #include "CmdMediator.h"
3 #include "CursorFactory.h"
4 #include "DigitizeStateAxis.h"
5 #include "DigitizeStateContext.h"
6 #include "DlgEditPoint.h"
8 #include "GraphicsScene.h"
9 #include "GraphicsView.h"
11 #include "MainWindow.h"
12 #include "PointStyle.h"
15 #include <QMessageBox>
23 DigitizeStateAxis::~DigitizeStateAxis ()
29 return AXIS_CURVE_NAME;
34 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::begin";
41 void DigitizeStateAxis::createTemporaryPoint (
const QPointF &posScreen)
43 LOG4CPP_DEBUG_S ((*mainCat)) <<
"DigitizeStateAxis::createTemporaryPoint";
58 LOG4CPP_DEBUG_S ((*mainCat)) <<
"DigitizeStateAxis::cursor";
68 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::end";
73 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::handleCurveChange";
79 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::handleKeyPress"
80 <<
" key=" << QKeySequence (key).toString ().toLatin1 ().data ();
90 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::handleMousePress";
95 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::handleMouseRelease";
97 if (
context().mainWindow().transformIsDefined()) {
99 QMessageBox::warning (0,
101 "Three axis points have been defined, and no more are needed or allowed.");
105 createTemporaryPoint (posScreen);
110 context().cmdMediator().document().modelCoords(),
112 context().mainWindow().transformation());
113 int rtn = dlg->exec ();
114 QPointF posGraph = dlg->
posGraph ();
120 if (rtn == QDialog::Accepted) {
125 QString errorMessage;
135 QMessageBox::warning (0,
156 return "DigitizeStateAxis";
161 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::updateModelDigitizeCurve";
168 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::updateModelSegments";
virtual void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
virtual void handleMouseMove(QPointF posScreen)
Handle a mouse move. This is part of an experiment to see if augmenting the cursor in Point Match mod...
CmdMediator & cmdMediator()
Provide CmdMediator for indirect access to the Document.
void removePoint(const QString &identifier)
Remove specified point. This aborts if the point does not exist.
void setDragMode(QGraphicsView::DragMode dragMode)
Set QGraphicsView drag mode (in m_view). Called from DigitizeStateAbstractBase subclasses.
virtual void handleMousePress(QPointF posScreen)
Handle a mouse press that was intercepted earlier.
Create standard cross cursor, or custom cursor, according to settings.
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...
PointStyle pointStyle() const
Get method for PointStyle.
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses...
virtual QString activeCurve() const
Name of the active Curve. This can include AXIS_CURVE_NAME.
MainWindow & mainWindow()
Reference to the MainWindow, without const.
static QString temporaryPointIdentifier()
Point identifier for temporary point that is used by DigitzeStateAxis.
QPointF posGraph() const
Return the graph coordinates position specified by the user. Only applies if dialog was accepted...
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Details for a specific Point.
GraphicsScene & scene()
Scene container for the QImage and QGraphicsItems.
virtual QString state() const
State name for debugging.
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
void setCursor()
Update the cursor according to the current state.
Command for adding one axis point.
virtual void handleCurveChange()
Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Se...
Storage of one imported image and the data attached to that image.
Container for one set of digitized Points.
Graphics item for drawing a circular or polygonal Point.
virtual void updateModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
Dialog box for editing the information of one axis point.
void appendNewCmd(QUndoCommand *cmd)
Append just-created QUndoCommand to command stack. This is called from DigitizeStateAbstractBase subc...
int nextOrdinalForCurve(const QString &curveName) const
Default next ordinal value for specified curve.
virtual void handleKeyPress(Qt::Key key, bool atLeastOneSelectedItem)
Handle a key press that was intercepted earlier.
virtual void handleMouseRelease(QPointF posScreen)
Handle a mouse release that was intercepted earlier.
void addTemporaryPoint(const QString &identifier, GraphicsPoint *point)
Add one temporary point to m_graphicsLinesForCurves. Non-temporary points are handled by the updateLi...
Model for DlgSettingsSegments and CmdSettingsSegments.
CurveStyle curveStyle() const
Return the curve style.
GraphicsPoint * createPoint(const QString &identifier, const PointStyle &pointStyle, const QPointF &posScreen)
Create one QGraphicsItem-based object that represents one Point. It is NOT added to m_graphicsLinesFo...
virtual QCursor cursor() const
Returns the state-specific cursor shape.
Base class for all digitizing states. This serves as an interface to DigitizeStateContext.
DigitizeStateAxis(DigitizeStateContext &context)
Single constructor.
virtual void begin(DigitizeState previousState)
Method that is called at the exact moment a state is entered.
QCursor generate(const DocumentModelDigitizeCurve &modelDigitizeCurve) const
Factory method to generate standard or custom cursor.
void checkAddPointAxis(const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage)
Check before calling addPointAxis. Also returns the next available ordinal number (to prevent clashes...
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before begin for t...