Engauge Digitizer  2
DigitizeStateSelect.cpp
Go to the documentation of this file.
1 /******************************************************************************************************
2  * (C) 2014 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 "CallbackScaleBar.h"
8 #include "CmdEditPointAxis.h"
9 #include "CmdEditPointGraph.h"
10 #include "CmdMediator.h"
11 #include "CmdMoveBy.h"
12 #include "DataKey.h"
13 #include "DigitizeStateContext.h"
14 #include "DigitizeStateSelect.h"
15 #include "DlgEditPointAxis.h"
16 #include "DlgEditPointGraph.h"
17 #include "DlgEditScale.h"
18 #include "EngaugeAssert.h"
19 #include "GraphicsItemsExtractor.h"
20 #include "GraphicsItemType.h"
21 #include "GraphicsScene.h"
22 #include "GraphicsView.h"
23 #include "Logger.h"
24 #include "MainWindow.h"
25 #include <QCursor>
26 #include <QGraphicsItem>
27 #include <QImage>
28 #include <QMessageBox>
29 #include <QObject>
30 #include <QSize>
31 #include <QtToString.h>
32 #include "Transformation.h"
33 #include "Version.h"
34 
35 const QString MOVE_TEXT_DOWN (QObject::tr ("Move down"));
36 const QString MOVE_TEXT_LEFT (QObject::tr ("Move left"));
37 const QString MOVE_TEXT_RIGHT (QObject::tr ("Move right"));
38 const QString MOVE_TEXT_UP (QObject::tr ("Move up"));
39 
42 {
43 }
44 
46 {
47 }
48 
49 QString DigitizeStateSelect::activeCurve () const
50 {
52 }
53 
54 void DigitizeStateSelect::addHoverHighlighting()
55 {
56  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::addHoverHighlighting";
57 
58  QList<QGraphicsItem*> items = context().mainWindow().scene().items();
59  QList<QGraphicsItem*>::iterator itr;
60  for (itr = items.begin (); itr != items.end (); itr++) {
61 
62  QGraphicsItem *item = *itr;
64  item->setAcceptHoverEvents(true);
65  }
66  }
67 }
68 
69 void DigitizeStateSelect::begin (CmdMediator *cmdMediator,
70  DigitizeState /* previousState */)
71 {
72  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::begin";
73 
74  setCursor(cmdMediator);
75  context().setDragMode(QGraphicsView::RubberBandDrag);
76 
77  addHoverHighlighting();
79 }
80 
81 bool DigitizeStateSelect::canPaste (const Transformation & /* transformation */,
82  const QSize & /* viewSize */) const
83 {
84  return false;
85 }
86 
87 QCursor DigitizeStateSelect::cursor(CmdMediator * /* cmdMediator */) const
88 {
89  LOG4CPP_DEBUG_S ((*mainCat)) << "DigitizeStateSelect::cursor";
90 
91  return QCursor (Qt::ArrowCursor);
92 }
93 
95 {
96  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::end";
97 
98  removeHoverHighlighting();
99 }
100 
102  const QString &pointIdentifier)
103 {
104  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::handleContextMenuEventAxis "
105  << " point=" << pointIdentifier.toLatin1 ().data ();
106 
108  handleContextMenuEventAxis2 (cmdMediator);
109  } else {
110  handleContextMenuEventAxis34 (cmdMediator,
111  pointIdentifier);
112  }
113 }
114 
115 void DigitizeStateSelect::handleContextMenuEventAxis2 (CmdMediator *cmdMediator)
116 {
117  LOG4CPP_DEBUG_S ((*mainCat)) << "DigitizeStateSelect::handleContextMenuEventAxis2";
118 
119  const bool IS_NOT_X_ONLY = false;
120 
121  // The point identifier we want is not necessarily the one edited but is the one with the
122  // nonzero x or y (but not both) coordinate
123  QString pointIdentifier = scaleBarPointIdentifier (cmdMediator);
124 
125  QPointF posScreen = cmdMediator->document().positionScreen (pointIdentifier);
126  QPointF posGraphBefore = cmdMediator->document().positionGraph (pointIdentifier);
127 
128  // Ask user for scale length
129  double scaleLength = scaleBarLength (cmdMediator);
130  DlgEditScale *dlg = new DlgEditScale (context().mainWindow(),
131  cmdMediator->document().modelCoords(),
132  cmdMediator->document().modelGeneral(),
134  &scaleLength);
135  int rtn = dlg->exec ();
136 
137  scaleLength = dlg->scaleLength (); // This call returns new value for scale length
138  delete dlg;
139 
140  if (rtn == QDialog::Accepted) {
141 
142  // User wants to edit the scale length, which is effectively editing this axis point, but let's perform sanity checks first
143 
144  bool isError;
145  QString errorMessage;
146 
147  bool isXNonzero = (qAbs (posGraphBefore.x()) > 0); // Identify which coordinate is to be edited
148  QPointF posGraphAfter (isXNonzero ? scaleLength : 0,
149  isXNonzero ? 0 : scaleLength);
150  context().mainWindow().cmdMediator()->document().checkEditPointAxis(pointIdentifier,
151  posScreen,
152  posGraphAfter,
153  isError,
154  errorMessage);
155 
156  if (isError) {
157 
158  QMessageBox::warning (nullptr,
160  errorMessage);
161 
162  } else {
163 
164  // Create a command to change the scale length
165  CmdEditPointAxis *cmd = new CmdEditPointAxis (context().mainWindow(),
166  cmdMediator->document(),
167  pointIdentifier,
168  posGraphBefore,
169  posGraphAfter,
170  IS_NOT_X_ONLY);
171  context().appendNewCmd(cmdMediator,
172  cmd);
173  }
174  }
175 }
176 
177 void DigitizeStateSelect::handleContextMenuEventAxis34 (CmdMediator *cmdMediator,
178  const QString &pointIdentifier)
179 {
180  LOG4CPP_DEBUG_S ((*mainCat)) << "DigitizeStateSelect::handleContextMenuEventAxis34";
181 
182  QPointF posScreen = cmdMediator->document().positionScreen (pointIdentifier);
183  QPointF posGraphBefore = cmdMediator->document().positionGraph (pointIdentifier);
184  bool isXOnly = cmdMediator->document().isXOnly (pointIdentifier);
185 
186  // Ask user for coordinates
187  double x = posGraphBefore.x();
188  double y = posGraphBefore.y();
189 
190  DlgEditPointAxis *dlg = new DlgEditPointAxis (context().mainWindow(),
191  cmdMediator->document().modelCoords(),
192  cmdMediator->document().modelGeneral(),
195  cmdMediator->document().documentAxesPointsRequired(),
196  isXOnly,
197  &x,
198  &y);
199  int rtn = dlg->exec ();
200 
201  QPointF posGraphAfter = dlg->posGraph (isXOnly); // This call returns new values for isXOnly and the graph position
202  delete dlg;
203 
204  if (rtn == QDialog::Accepted) {
205 
206  // User wants to edit this axis point, but let's perform sanity checks first
207 
208  bool isError;
209  QString errorMessage;
210 
211  context().mainWindow().cmdMediator()->document().checkEditPointAxis(pointIdentifier,
212  posScreen,
213  posGraphAfter,
214  isError,
215  errorMessage);
216 
217  if (isError) {
218 
219  QMessageBox::warning (nullptr,
221  errorMessage);
222 
223  } else {
224 
225  // Create a command to edit the point
226  CmdEditPointAxis *cmd = new CmdEditPointAxis (context().mainWindow(),
227  cmdMediator->document(),
228  pointIdentifier,
229  posGraphBefore,
230  posGraphAfter,
231  isXOnly);
232  context().appendNewCmd(cmdMediator,
233  cmd);
234  }
235  }
236 }
237 
239  const QStringList &pointIdentifiers)
240 {
241  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::handleContextMenuEventGraph "
242  << "points=" << pointIdentifiers.join(",").toLatin1 ().data ();
243 
244  // Editing graph coordinates before the axes are defined is not useful because:
245  // 1) That functionality is for fine tuning point placement based on defined axes
246  // 2) The transformation from screen to graph coordinates below will crash
247  if (context().mainWindow().transformation().transformIsDefined()) {
248 
249  double *x = nullptr, *y = nullptr;
250 
251  if (pointIdentifiers.count() == 1) {
252 
253  // There is exactly one point so pass its coordinates to the dialog
254  x = new double;
255  y = new double;
256 
257  QPointF posScreenBefore = cmdMediator->document().positionScreen (pointIdentifiers.first());
258  QPointF posGraphBefore;
260  posGraphBefore);
261 
262  // Ask user for coordinates
263  *x = posGraphBefore.x();
264  *y = posGraphBefore.y();
265  }
266 
267  DlgEditPointGraph *dlg = new DlgEditPointGraph (context().mainWindow(),
268  cmdMediator->document().modelCoords(),
269  cmdMediator->document().modelGeneral(),
272  x,
273  y);
274  delete x;
275  delete y;
276 
277  x = nullptr;
278  y = nullptr;
279 
280  int rtn = dlg->exec ();
281 
282  bool isXGiven, isYGiven;
283  double xGiven, yGiven;
284  dlg->posGraph (isXGiven, xGiven, isYGiven, yGiven); // One or both coordinates are returned
285  delete dlg;
286 
287  if (rtn == QDialog::Accepted) {
288 
289  // Create a command to edit the point
290  CmdEditPointGraph *cmd = new CmdEditPointGraph (context().mainWindow(),
291  cmdMediator->document(),
292  pointIdentifiers,
293  isXGiven,
294  isYGiven,
295  xGiven,
296  yGiven);
297  context().appendNewCmd(cmdMediator,
298  cmd);
299  }
300  }
301 }
302 
303 void DigitizeStateSelect::handleCurveChange(CmdMediator * /* cmdMediator */)
304 {
305  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::handleCurveChange";
306 }
307 
309  Qt::Key key,
310  bool atLeastOneSelectedItem)
311 {
312  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::handleKeyPress"
313  << " key=" << QKeySequence (key).toString ().toLatin1 ().data ();
314 
315  if (atLeastOneSelectedItem) {
316 
317  if (key == Qt::Key_Down ||
318  key == Qt::Key_Up ||
319  key == Qt::Key_Left ||
320  key == Qt::Key_Right) {
321 
322  keyPressArrow (cmdMediator,
323  key);
324 
325  }
326  }
327 }
328 
329 void DigitizeStateSelect::handleMouseMove (CmdMediator * /* cmdMediator */,
330  QPointF /* posScreen */)
331 {
332 // LOG4CPP_DEBUG_S ((*mainCat)) << "DigitizeStateSelect::handleMouseMove";
333 }
334 
335 void DigitizeStateSelect::handleMousePress (CmdMediator * /* cmdMediator */,
336  QPointF posScreen)
337 {
338  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::handleMousePress"
339  << " posScreen=" << QPointFToString (posScreen).toLatin1 ().data ();
340 
341  // Note that GraphicsView has already called GraphicsPointAbstract::resetPositionHasChanged on all items
342 
343  m_movingStart = posScreen;
344 }
345 
347  QPointF posScreen)
348 {
349  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::handleMouseRelease"
350  << " posScreen=" << QPointFToString (posScreen).toLatin1 ().data ();
351 
352  QPointF deltaScreen = posScreen - m_movingStart;
353  QStringList positionHasChangedIdentifers = context().mainWindow().scene().positionHasChangedPointIdentifiers();
354 
355  bool positionHasChanged = (positionHasChangedIdentifers.count () > 0);
356 
357  if (positionHasChanged && (
358  qAbs (deltaScreen.x ()) > 0 ||
359  qAbs (deltaScreen.y ()) > 0)) {
360 
361  QString moveText = moveTextFromDeltaScreen (deltaScreen);
362 
363  // Create command to move points
364  CmdMoveBy *cmd = new CmdMoveBy (context().mainWindow(),
365  cmdMediator->document(),
366  deltaScreen,
367  moveText,
368  positionHasChangedIdentifers);
369  context().appendNewCmd (cmdMediator,
370  cmd);
371 
372  } else {
373 
374  // Selection probably changed so update the MainWindow controls (especially Cut)
376 
377  showCoordinatesIfSinglePointIsSelected ();
378  }
379 }
380 
381 void DigitizeStateSelect::keyPressArrow (CmdMediator *cmdMediator,
382  Qt::Key key)
383 {
384  QPointF deltaScreen;
385  QString moveText;
386  switch (key) {
387  case Qt::Key_Down:
388  deltaScreen = QPointF (0, zoomedToUnzoomedScreenY ());
389  moveText = MOVE_TEXT_DOWN;
390  break;
391 
392  case Qt::Key_Left:
393  deltaScreen = QPointF (-1 * zoomedToUnzoomedScreenX (), 0);
394  moveText = MOVE_TEXT_LEFT;
395  break;
396 
397  case Qt::Key_Right:
398  deltaScreen = QPointF (zoomedToUnzoomedScreenX (), 0);
399  moveText = MOVE_TEXT_RIGHT;
400  break;
401 
402  case Qt::Key_Up:
403  deltaScreen = QPointF (0, -1 * zoomedToUnzoomedScreenY ());
404  moveText = MOVE_TEXT_UP;
405  break;
406 
407  default:
408  ENGAUGE_ASSERT (false);
409  }
410 
411  // Create command to move points
412  GraphicsItemsExtractor graphicsItemsExtractor;
413  const QList<QGraphicsItem*> &items = context().mainWindow().scene ().selectedItems();
414  CmdMoveBy *cmd = new CmdMoveBy (context().mainWindow(),
415  cmdMediator->document(),
416  deltaScreen,
417  moveText,
418  graphicsItemsExtractor.selectedPointIdentifiers (items));
419  context().appendNewCmd (cmdMediator,
420  cmd);
421 }
422 
423 QString DigitizeStateSelect::moveTextFromDeltaScreen (const QPointF &deltaScreen)
424 {
425  QString moveText;
426 
427  // x UP x -----> +x
428  // x x |
429  // LEFT x RIGHT |
430  // x x v
431  // x DOWN x +y
432  bool downOrRight = (deltaScreen.y () > -1.0 * deltaScreen.x ());
433  bool upOrRight = (deltaScreen.y () < deltaScreen.x ());
434  if (downOrRight && upOrRight) {
435  moveText = MOVE_TEXT_RIGHT;
436  } else if (downOrRight && !upOrRight) {
437  moveText = MOVE_TEXT_DOWN;
438  } else if (!downOrRight && upOrRight) {
439  moveText = MOVE_TEXT_UP;
440  } else {
441  moveText = MOVE_TEXT_LEFT;
442  }
443 
444  return moveText;
445 }
446 
447 void DigitizeStateSelect::removeHoverHighlighting()
448 {
449  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::removeHoverHighlighting";
450 
451  QList<QGraphicsItem*> items = context().mainWindow().scene().items();
452  QList<QGraphicsItem*>::iterator itr;
453  for (itr = items.begin (); itr != items.end (); itr++) {
454 
455  QGraphicsItem *item = *itr;
457  item->setAcceptHoverEvents(false);
458  }
459  }
460 }
461 
462 double DigitizeStateSelect::scaleBarLength (CmdMediator *cmdMediator) const
463 {
464  CallbackScaleBar ftor;
465 
466  Functor2wRet<const QString &, const Point&, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
468  cmdMediator->iterateThroughCurvePointsAxes (ftorWithCallback);
469 
470  return ftor.scaleBarLength ();
471 }
472 
473 QString DigitizeStateSelect::scaleBarPointIdentifier (CmdMediator *cmdMediator) const
474 {
475  CallbackScaleBar ftor;
476 
477  Functor2wRet<const QString &, const Point&, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
479  cmdMediator->iterateThroughCurvePointsAxes (ftorWithCallback);
480 
481  return ftor.scaleBarPointIdentifier();
482 }
483 
484 void DigitizeStateSelect::setHoverHighlighting(const MainWindowModel &modelMainWindow)
485 {
486  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::addHoverHighlighting";
487 
488  // Set the opacity for all points. It should be already set for pre-existing points
489  QList<QGraphicsItem*> items = context().mainWindow().scene().items();
490  QList<QGraphicsItem*>::iterator itr;
491  for (itr = items.begin (); itr != items.end (); itr++) {
492 
493  QGraphicsItem *item = *itr;
495  item->setOpacity (modelMainWindow.highlightOpacity());
496  }
497  }
498 }
499 
500 void DigitizeStateSelect::showCoordinatesIfSinglePointIsSelected ()
501 {
502  // See if there is a single point selected
503  QList<QGraphicsItem*> items = context().mainWindow().scene().selectedItems();
504  if (items.size () == 1) {
505 
506  // There is a single item selected but we must see if it is a point
507  QGraphicsItem *item = * (items.begin ());
508 
510 
511  // Show the coordinates of the point in the status bar
512  QString coordsScreen, coordsGraph, resolutionGraph;
514  coordsScreen,
515  coordsGraph,
516  resolutionGraph,
517  context().mainWindow().modeMap());
518 
519  context().mainWindow().showTemporaryMessage(coordsGraph);
520  }
521  }
522 }
523 
524 QString DigitizeStateSelect::state() const
525 {
526  return "DigitizeStateSelect";
527 }
528 
530 {
531  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::updateAfterPointAddition";
532 
533  addHoverHighlighting ();
534 }
535 
537  const DocumentModelDigitizeCurve & /*modelDigitizeCurve */)
538 {
539  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::updateModelDigitizeCurve";
540 }
541 
542 void DigitizeStateSelect::updateModelSegments(const DocumentModelSegments & /* modelSegments */)
543 {
544  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::updateModelSegments";
545 }
546 
547 double DigitizeStateSelect::zoomedToUnzoomedScreenX () const
548 {
549  double m11 = context().mainWindow ().view ().transform().m11 ();
550  return 1.0 / m11;
551 }
552 
553 double DigitizeStateSelect::zoomedToUnzoomedScreenY () const
554 {
555  double m22 = context().mainWindow ().view ().transform().m22 ();
556  return 1.0 / m22;
557 }
Document::documentAxesPointsRequired
DocumentAxesPointsRequired documentAxesPointsRequired() const
Get method for DocumentAxesPointsRequired.
Definition: Document.cpp:363
CmdMoveBy.h
MainWindow::updateAfterMouseRelease
void updateAfterMouseRelease()
Call MainWindow::updateControls (which is private) after the very specific case - a mouse press/relea...
Definition: MainWindow.cpp:3320
DigitizeStateSelect::~DigitizeStateSelect
virtual ~DigitizeStateSelect()
Definition: DigitizeStateSelect.cpp:44
CmdEditPointGraph.h
MainWindow::cmdMediator
CmdMediator * cmdMediator()
Accessor for commands to process the Document.
Definition: MainWindow.cpp:349
DigitizeStateContext::setDragMode
void setDragMode(QGraphicsView::DragMode dragMode)
Set QGraphicsView drag mode (in m_view). Called from DigitizeStateAbstractBase subclasses.
Definition: DigitizeStateContext.cpp:211
MOVE_TEXT_DOWN
const QString MOVE_TEXT_DOWN(QObject::tr("Move down"))
DigitizeStateContext
Container for all DigitizeStateAbstractBase subclasses. This functions as the context class in a stan...
Definition: DigitizeStateContext.h:26
CmdMoveBy
Command for moving all selected Points by a specified translation.
Definition: CmdMoveBy.h:17
DigitizeStateAbstractBase::context
DigitizeStateContext & context()
Reference to the DigitizeStateContext that contains all the DigitizeStateAbstractBase subclasses,...
Definition: DigitizeStateAbstractBase.cpp:41
CmdEditPointAxis
Command for editing the graph coordinates one axis point.
Definition: CmdEditPointAxis.h:17
Document::modelGeneral
DocumentModelGeneral modelGeneral() const
Get method for DocumentModelGeneral.
Definition: Document.cpp:723
DATA_KEY_GRAPHICS_ITEM_TYPE
Unique identifier for QGraphicsItem object
Definition: DataKey.h:17
DigitizeStateSelect::end
virtual void end()
Method that is called at the exact moment a state is exited. Typically called just before begin for t...
Definition: DigitizeStateSelect.cpp:93
DigitizeStateSelect::DigitizeStateSelect
DigitizeStateSelect(DigitizeStateContext &context)
Single constructor.
Definition: DigitizeStateSelect.cpp:39
DigitizeStateSelect.h
GraphicsItemType.h
DlgEditScale::scaleLength
double scaleLength() const
Return the scale bar length specified by the user. Only applies if dialog was accepted.
Definition: DlgEditScale.cpp:134
DlgEditScale
Dialog box for editing the information of the map scale.
Definition: DlgEditScale.h:21
DigitizeStateSelect::handleMouseRelease
virtual void handleMouseRelease(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse release that was intercepted earlier.
Definition: DigitizeStateSelect.cpp:345
MainWindowModel::highlightOpacity
double highlightOpacity() const
Get method for highlight opacity.
Definition: MainWindowModel.cpp:85
CallbackScaleBar::callback
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
Definition: CallbackScaleBar.cpp:27
DigitizeStateContext::mainWindow
MainWindow & mainWindow()
Reference to the MainWindow, without const.
Definition: DigitizeStateContext.cpp:168
DigitizeStateSelect::begin
virtual void begin(CmdMediator *cmdMediator, DigitizeState previousState)
Method that is called at the exact moment a state is entered.
Definition: DigitizeStateSelect.cpp:68
CmdMediator.h
MainWindow::selectedGraphCurve
QString selectedGraphCurve() const
Curve name that is currently selected in m_cmbCurve.
Definition: MainWindow.cpp:1478
MainWindow::modeMap
bool modeMap() const
True if document scale is set using a scale bar, otherwise using axis points.
Definition: MainWindow.cpp:1171
DigitizeStateSelect::handleContextMenuEventGraph
virtual void handleContextMenuEventGraph(CmdMediator *cmdMediator, const QStringList &pointIdentifiers)
Handle a right click, on a graph point, that was intercepted earlier.
Definition: DigitizeStateSelect.cpp:237
Transformation
Affine transformation between screen and graph coordinates, based on digitized axis points.
Definition: Transformation.h:30
EngaugeAssert.h
DlgEditPointGraph
Dialog box for editing the information of one or more points.
Definition: DlgEditPointGraph.h:24
DigitizeStateContext.h
DigitizeStateSelect::handleContextMenuEventAxis
virtual void handleContextMenuEventAxis(CmdMediator *cmdMediator, const QString &pointIdentifier)
Handle a right click, on an axis point, that was intercepted earlier.
Definition: DigitizeStateSelect.cpp:100
DOCUMENT_AXES_POINTS_REQUIRED_2
Definition: DocumentAxesPointsRequired.h:15
DigitizeStateSelect::handleMousePress
virtual void handleMousePress(CmdMediator *cmdMediator, QPointF posScreen)
Handle a mouse press that was intercepted earlier.
Definition: DigitizeStateSelect.cpp:334
DigitizeStateSelect::handleCurveChange
virtual void handleCurveChange(CmdMediator *cmdMediator)
Handle the selection of a new curve. At a minimum, DigitizeStateSegment will generate a new set of Se...
Definition: DigitizeStateSelect.cpp:302
MainWindow::modelMainWindow
MainWindowModel modelMainWindow() const
Get method for main window model.
Definition: MainWindow.cpp:1231
DigitizeStateSelect::updateAfterPointAddition
virtual void updateAfterPointAddition()
Update graphics attributes after possible new points. This is useful for highlight opacity.
Definition: DigitizeStateSelect.cpp:528
MOVE_TEXT_LEFT
const QString MOVE_TEXT_LEFT(QObject::tr("Move left"))
Document::checkEditPointAxis
void checkEditPointAxis(const QString &pointIdentifier, const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage)
Check before calling editPointAxis.
Definition: Document.cpp:284
CallbackScaleBar
Callback for identifying, for the scale bar of a map, various quantities.
Definition: CallbackScaleBar.h:16
Version.h
MainWindowModel
Model for DlgSettingsMainWindow.
Definition: MainWindowModel.h:29
Transformation::coordTextForStatusBar
void coordTextForStatusBar(QPointF cursorScreen, QString &coordsScreen, QString &coordsGraph, QString &resolutionGraph, bool usingScaleBar)
Return string descriptions of cursor coordinates for status bar.
Definition: Transformation.cpp:167
DlgEditPointAxis.h
GRAPHICS_ITEM_TYPE_POINT
Definition: GraphicsItemType.h:16
DigitizeStateSelect::cursor
virtual QCursor cursor(CmdMediator *cmdMediator) const
Returns the state-specific cursor shape.
Definition: DigitizeStateSelect.cpp:86
DigitizeStateContext::appendNewCmd
void appendNewCmd(CmdMediator *cmdMediator, QUndoCommand *cmd)
Append just-created QUndoCommand to command stack. This is called from DigitizeStateAbstractBase subc...
Definition: DigitizeStateContext.cpp:64
Transformation.h
DlgEditPointAxis
Dialog box for editing the information of one axis point, in a graph with two axes.
Definition: DlgEditPointAxis.h:23
DigitizeStateSelect::canPaste
virtual bool canPaste(const Transformation &transformation, const QSize &viewSize) const
Return true if there is good data in the clipboard for pasting, and that is compatible with the curre...
Definition: DigitizeStateSelect.cpp:80
DigitizeStateSelect::state
virtual QString state() const
State name for debugging.
Definition: DigitizeStateSelect.cpp:523
Logger.h
MOVE_TEXT_RIGHT
const QString MOVE_TEXT_RIGHT(QObject::tr("Move right"))
CmdMediator::document
Document & document()
Provide the Document to commands, primarily for undo/redo processing.
Definition: CmdMediator.cpp:72
DigitizeState
DigitizeState
Set of possible states of Digitize toolbar.
Definition: DigitizeStateAbstractBase.h:23
LOG4CPP_INFO_S
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
MainWindow::transformation
Transformation transformation() const
Return read-only copy of transformation.
Definition: MainWindow.cpp:3230
GraphicsItemsExtractor
This class consolidates utility routines that deal with graphics items that are getting extracted fro...
Definition: GraphicsItemsExtractor.h:19
DataKey.h
DigitizeStateSelect::handleKeyPress
virtual void handleKeyPress(CmdMediator *cmdMediator, Qt::Key key, bool atLeastOneSelectedItem)
Handle a key press that was intercepted earlier.
Definition: DigitizeStateSelect.cpp:307
CallbackScaleBar::scaleBarLength
double scaleBarLength() const
Length of scale bar.
Definition: CallbackScaleBar.cpp:53
DigitizeStateSelect::updateModelSegments
virtual void updateModelSegments(const DocumentModelSegments &modelSegments)
Update the segments given the new settings.
Definition: DigitizeStateSelect.cpp:541
DocumentModelSegments
Model for DlgSettingsSegments and CmdSettingsSegments.
Definition: DocumentModelSegments.h:16
MainWindow::view
GraphicsView & view()
View for the QImage and QGraphicsItems, without const.
Definition: MainWindow.cpp:3856
DigitizeStateAbstractBase::setCursor
void setCursor(CmdMediator *cmdMediator)
Update the cursor according to the current state.
Definition: DigitizeStateAbstractBase.cpp:51
engaugeWindowTitle
QString engaugeWindowTitle()
Text for title bars of dialogs.
Definition: Version.cpp:14
CmdMediator::iterateThroughCurvePointsAxes
void iterateThroughCurvePointsAxes(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for the single axes curve.
Definition: CmdMediator.cpp:87
CallbackScaleBar.h
CmdEditPointAxis.h
mainCat
log4cpp::Category * mainCat
Definition: Logger.cpp:14
MainWindow.h
GraphicsScene.h
Document::positionScreen
QPointF positionScreen(const QString &pointIdentifier) const
See Curve::positionScreen.
Definition: Document.cpp:827
Document::isXOnly
bool isXOnly(const QString &pointIdentifier) const
See Curve::isXOnly.
Definition: Document.cpp:444
GraphicsItemsExtractor.h
Transformation::transformScreenToRawGraph
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
Definition: Transformation.cpp:453
DocumentModelDigitizeCurve
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Definition: DocumentModelDigitizeCurve.h:17
DigitizeStateSelect::updateModelDigitizeCurve
virtual void updateModelDigitizeCurve(CmdMediator *cmdMediator, const DocumentModelDigitizeCurve &modelDigitizeCurve)
Update the digitize curve settings.
Definition: DigitizeStateSelect.cpp:535
GraphicsItemsExtractor::selectedPointIdentifiers
QStringList selectedPointIdentifiers(const QList< QGraphicsItem * > &items) const
Return list of selected point identifiers.
Definition: GraphicsItemsExtractor.cpp:59
CmdMediator
Command queue stack.
Definition: CmdMediator.h:22
DlgEditScale.h
MainWindow::scene
GraphicsScene & scene()
Scene container for the QImage and QGraphicsItems.
Definition: MainWindow.cpp:1458
Document::modelCoords
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
Definition: Document.cpp:695
DlgEditPointGraph.h
LOG4CPP_DEBUG_S
#define LOG4CPP_DEBUG_S(logger)
Definition: convenience.h:20
GraphicsScene::positionHasChangedPointIdentifiers
QStringList positionHasChangedPointIdentifiers() const
Return a list of identifiers for the points that have moved since the last call to resetPositionHasCh...
Definition: GraphicsScene.cpp:143
DigitizeStateSelect::activeCurve
virtual QString activeCurve() const
Name of the active Curve. This can include AXIS_CURVE_NAME.
Definition: DigitizeStateSelect.cpp:48
QtToString.h
MainWindow::showTemporaryMessage
void showTemporaryMessage(const QString &temporaryMessage)
Show temporary message in status bar.
Definition: MainWindow.cpp:1910
QPointFToString
QString QPointFToString(const QPointF &pos)
Definition: QtToString.cpp:17
MOVE_TEXT_UP
const QString MOVE_TEXT_UP(QObject::tr("Move up"))
DigitizeStateSelect::handleMouseMove
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...
Definition: DigitizeStateSelect.cpp:328
DigitizeStateAbstractBase
Base class for all digitizing states. This serves as an interface to DigitizeStateContext.
Definition: DigitizeStateAbstractBase.h:36
DlgEditPointGraph::posGraph
void posGraph(bool &isX, double &x, bool &isY, double &y) const
Return one or both coordinates. Only applies if dialog was accepted.
Definition: DlgEditPointGraph.cpp:219
ENGAUGE_ASSERT
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
Definition: EngaugeAssert.h:19
GraphicsView.h
Document::positionGraph
QPointF positionGraph(const QString &pointIdentifier) const
See Curve::positionGraph.
Definition: Document.cpp:822
DlgEditPointAxis::posGraph
QPointF posGraph(bool &isXOnly) const
Return the graph coordinates position specified by the user. Only applies if dialog was accepted.
Definition: DlgEditPointAxis.cpp:273
CallbackScaleBar::scaleBarPointIdentifier
QString scaleBarPointIdentifier() const
Identified axis point.
Definition: CallbackScaleBar.cpp:58
CmdEditPointGraph
Command for editing the graph coordinates of one or more graph points.
Definition: CmdEditPointGraph.h:17
MainWindow::updateViewsOfSettings
void updateViewsOfSettings(const QString &activeCurve)
Update curve-specific view of settings. Private version gets active curve name from DigitizeStateCont...
Definition: MainWindow.cpp:3797