7 #include "CmdAddPointAxis.h" 8 #include "CmdMediator.h" 9 #include "CursorFactory.h" 10 #include "DigitizeStateAxis.h" 11 #include "DigitizeStateContext.h" 12 #include "DlgEditPointAxis.h" 14 #include "GraphicsScene.h" 15 #include "GraphicsView.h" 17 #include "MainWindow.h" 18 #include "PointStyle.h" 21 #include <QMessageBox> 29 DigitizeStateAxis::~DigitizeStateAxis ()
35 return AXIS_CURVE_NAME;
41 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::begin";
48 void DigitizeStateAxis::createTemporaryPoint (
CmdMediator *cmdMediator,
49 const QPointF &posScreen)
51 LOG4CPP_DEBUG_S ((*mainCat)) <<
"DigitizeStateAxis::createTemporaryPoint";
61 NULL_GEOMETRY_WINDOW);
69 LOG4CPP_DEBUG_S ((*mainCat)) <<
"DigitizeStateAxis::cursor";
79 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::end";
83 const QString &pointIdentifier)
85 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::handleContextMenuEventAxis " 86 <<
" point=" << pointIdentifier.toLatin1 ().data ();
90 const QStringList &pointIdentifiers)
92 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::handleContextMenuEventGraph " 93 <<
"points=" << pointIdentifiers.join(
",").toLatin1 ().data ();
98 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::handleCurveChange";
105 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::handleKeyPress" 106 <<
" key=" << QKeySequence (key).toString ().toLatin1 ().data ();
118 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::handleMousePress";
124 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::handleMouseRelease";
126 if (
context().mainWindow().transformIsDefined()) {
128 QMessageBox::warning (0,
129 QObject::tr (
"Engauge Digitizer"),
130 QObject::tr (
"Three axis points have been defined, and no more are needed or allowed."));
134 createTemporaryPoint (cmdMediator,
144 int rtn = dlg->exec ();
147 QPointF posGraph = dlg->
posGraph (isXOnly);
153 if (rtn == QDialog::Accepted) {
158 QString errorMessage;
169 QMessageBox::warning (0,
170 QObject::tr (
"Engauge Digitizer"),
192 return "DigitizeStateAxis";
197 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::updateAfterPointAddition";
203 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::updateModelDigitizeCurve";
210 LOG4CPP_INFO_S ((*mainCat)) <<
"DigitizeStateAxis::updateModelSegments";
Dialog box for editing the information of one axis point.
virtual void handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
Handle a right click, on a graph point, that was intercepted earlier.
virtual void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
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 QString state() const
State name for debugging.
Create standard cross cursor, or custom cursor, according to settings.
int nextOrdinalForCurve(const QString &curveName) const
Default next ordinal value for specified curve.
PointStyle pointStyle() const
Get method for PointStyle.
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...
DocumentModelGeneral modelGeneral() const
Get method for DocumentModelGeneral.
DocumentAxesPointsRequired documentAxesPointsRequired() const
Get method for DocumentAxesPointsRequired.
Window that displays the geometry information, as a table, for the current curve. ...
virtual void handleMousePress(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse press that was intercepted earlier.
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses...
void checkAddPointAxis(const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage, bool isXOnly)
Check before calling addPointAxis. Also returns the next available ordinal number (to prevent clashes...
virtual QCursor cursor(CmdMediator *cmdMediator) const
Returns the state-specific cursor shape.
MainWindow & mainWindow()
Reference to the MainWindow, without const.
static QString temporaryPointIdentifier()
Point identifier for temporary point that is used by DigitzeStateAxis.
Transformation transformation() const
Return read-only copy of transformation.
virtual void handleMouseMove(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse move. This is part of an experiment to see if augmenting the cursor in Point Match mod...
virtual void updateAfterPointAddition()
Update graphics attributes after possible new points. This is useful for highlight opacity...
GraphicsPoint * createPoint(const QString &identifier, const PointStyle &pointStyle, const QPointF &posScreen, GeometryWindow *geometryWindow)
Create one QGraphicsItem-based object that represents one Point. It is NOT added to m_graphicsLinesFo...
QPointF posGraph(bool &isXOnly) const
Return the graph coordinates position specified by the user. Only applies if dialog was accepted...
DocumentModelDigitizeCurve modelDigitizeCurve() const
Get method for DocumentModelDigitizeCurve.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Details for a specific Point.
GraphicsScene & scene()
Scene container for the QImage and QGraphicsItems.
void setCursor(CmdMediator *cmdMediator)
Update the cursor according to the current state.
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
void appendNewCmd(CmdMediator *cmdMediator, QUndoCommand *cmd)
Append just-created QUndoCommand to command stack. This is called from DigitizeStateAbstractBase subc...
Command for adding one axis point.
virtual void handleKeyPress(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
Handle a key press that was intercepted earlier.
virtual void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
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.
MainWindowModel modelMainWindow() const
Get method for main window model.
virtual QString activeCurve() const
Name of the active Curve. This can include AXIS_CURVE_NAME.
virtual void handleContextMenuEventAxis(CmdMediator *cmdMediator, const QString &pointIdentifier)
Handle a right click, on an axis point, that was intercepted earlier.
virtual void handleMouseRelease(CmdMediator *cmdMediator, 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.
Base class for all digitizing states. This serves as an interface to DigitizeStateContext.
virtual void handleCurveChange(CmdMediator *cmdMediator)
Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Se...
virtual void begin(CmdMediator *cmdMediator, DigitizeState previousState)
Method that is called at the exact moment a state is entered.
DigitizeStateAxis(DigitizeStateContext &context)
Single constructor.
QCursor generate(const DocumentModelDigitizeCurve &modelDigitizeCurve) const
Factory method to generate standard or custom cursor.
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before begin for t...