void DigitizeStateAxis::handleMouseRelease (QPointF posScreen)
{
  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateAxis::handleMouseRelease";

  if (context().mainWindow().transformIsDefined()) {

    QMessageBox::warning (0,
                          "Application",
                          "Three axis points have been defined, and no more are needed or allowed.");

  } else {

    createTemporaryPoint (posScreen);

    // Ask user for coordinates
    DlgEditPoint *dlg = new DlgEditPoint (context ().mainWindow (),
                                          *this,
                                          context().cmdMediator().document().modelCoords(),
                                          cursor (),
                                          context().mainWindow().transformation());
    int rtn = dlg->exec ();
    QPointF posGraph = dlg->posGraph ();
    delete dlg;

    // Remove temporary point
    context().mainWindow().scene().removePoint(Point::temporaryPointIdentifier ());

    if (rtn == QDialog::Accepted) {

      // User wants to add this axis point, but let's perform sanity checks first

      bool isError;
      QString errorMessage;
      int nextOrdinal = context().cmdMediator().document().nextOrdinalForCurve(AXIS_CURVE_NAME);

      context().cmdMediator().document().checkAddPointAxis(posScreen,
                                                           posGraph,
                                                           isError,
                                                           errorMessage);

      if (isError) {

        QMessageBox::warning (0,
                              "Application",
                              errorMessage);

      } else {

        // Create command to add point
        Document &document = context ().cmdMediator ().document ();
        QUndoCommand *cmd = new CmdAddPointAxis (context ().mainWindow(),
                                                 document,
                                                 posScreen,
                                                 posGraph,
                                                 nextOrdinal);
        context().appendNewCmd(cmd);
      }
    }
  }
}
void DigitizeStatePointMatch::popCandidatePoint (CmdMediator *cmdMediator)
{
  LOG4CPP_DEBUG_S ((*mainCat)) << "DigitizeStatePointMatch::popCandidatePoint";

  if (m_candidatePoints.count() > 0) {

    // Pop next point from list onto screen
    QPoint posScreen = m_candidatePoints.first();
    m_candidatePoints.pop_front ();

    createTemporaryPoint(cmdMediator,
                         posScreen);

  } else {

    // No more points. Inform user
    QMessageBox::information (nullptr,
                              QObject::tr ("Point Match"),
                              QObject::tr ("There are no more matching points"));

  }
}