void DigitizeStatePointMatch::findPointsAndShowFirstCandidate (CmdMediator *cmdMediator, const QPointF &posScreen) { LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStatePointMatch::findPointsAndShowFirstCandidate"; const DocumentModelPointMatch &modelPointMatch = cmdMediator->document().modelPointMatch(); const QImage &img = context().mainWindow().imageFiltered(); QList<PointMatchPixel> samplePointPixels = extractSamplePointPixels (img, modelPointMatch, posScreen); QString curveName = activeCurve(); const Document &doc = cmdMediator->document(); const Curve *curve = doc.curveForCurveName (curveName); // The point match algorithm takes a few seconds, so set the cursor so user knows we are processing QApplication::setOverrideCursor(Qt::WaitCursor); PointMatchAlgorithm pointMatchAlgorithm (context().isGnuplot()); m_candidatePoints = pointMatchAlgorithm.findPoints (samplePointPixels, img, modelPointMatch, curve->points()); QApplication::restoreOverrideCursor(); // Heavy duty processing has finished context().mainWindow().showTemporaryMessage ("Right arrow adds next matched point"); popCandidatePoint (cmdMediator); }
void DigitizeStatePointMatch::createTemporaryPoint (CmdMediator *cmdMediator, const QPoint &posScreen) { LOG4CPP_DEBUG_S ((*mainCat)) << "DigitizeStatePointMatch::createTemporaryPoint"; GeometryWindow *NULL_GEOMETRY_WINDOW = nullptr; const DocumentModelPointMatch &modelPointMatch = cmdMediator->document().modelPointMatch(); // Get point style for current graph, and then override with candidate color const CurveStyles &curveStyles = cmdMediator->document().modelCurveStyles(); PointStyle pointStyle = curveStyles.pointStyle (activeCurve()); pointStyle.setPaletteColor (modelPointMatch.paletteColorCandidate()); // Temporary point that user can see while DlgEditPoint is active GraphicsPoint *point = context().mainWindow().scene().createPoint(Point::temporaryPointIdentifier (), pointStyle, posScreen, NULL_GEOMETRY_WINDOW); context().mainWindow().scene().removeTemporaryPointIfExists(); // Only one temporary point at a time is allowed context().mainWindow().scene().addTemporaryPoint (Point::temporaryPointIdentifier(), point); m_posCandidatePoint = posScreen; }
void DigitizeStateAxis::begin (DigitizeState /* previousState */) { LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateAxis::begin"; setCursor(); context().setDragMode(QGraphicsView::NoDrag); context().mainWindow().updateViewsOfSettings(activeCurve ()); }
void DigitizeStateEmpty::begin (CmdMediator *cmdMediator, DigitizeState /* previousState */) { LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateEmpty::begin"; setCursor(cmdMediator); context().mainWindow().updateViewsOfSettings(activeCurve ()); }
void DigitizeStateSelect::begin (DigitizeState /* previousState */) { LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::begin"; setCursor(); context().setDragMode(QGraphicsView::RubberBandDrag); setCursorForPoints (); context().mainWindow().updateViewsOfSettings(activeCurve ()); }
void DigitizeStateSelect::begin (CmdMediator *cmdMediator, DigitizeState /* previousState */) { LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSelect::begin"; setCursor(cmdMediator); context().setDragMode(QGraphicsView::RubberBandDrag); addHoverHighlighting(); context().mainWindow().updateViewsOfSettings(activeCurve ()); }
void DigitizeStateSegment::begin (CmdMediator *cmdMediator, DigitizeState /* previousState */) { LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSegment::begin"; m_cmdMediator = cmdMediator; // Save for slotMouseClickOnSegment setCursor(cmdMediator); context().setDragMode(QGraphicsView::NoDrag); context().mainWindow().updateViewsOfSettings(activeCurve ()); handleCurveChange(cmdMediator); }
void DigitizeStatePointMatch::begin (CmdMediator *cmdMediator, DigitizeState /* previousState */) { LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStatePointMatch::begin"; setCursor(cmdMediator); context().setDragMode(QGraphicsView::NoDrag); context().mainWindow().updateViewsOfSettings(activeCurve ()); // Add outline that will move with the cursor m_outline = new QGraphicsEllipseItem (); context().mainWindow().scene().addItem (m_outline); m_outline->setPen (QPen (Qt::black)); m_outline->setVisible (true); m_outline->setZValue (Z_VALUE); }
void DigitizeStateSegment::slotMouseClickOnSegment(QPointF posSegmentStart) { LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSegment::slotMouseClickOnSegment"; Segment *segment = segmentFromSegmentStart (posSegmentStart); // Create single-entry list that is expected by SegmentFactory QList<Segment*> segments; segments.push_back (segment); // Generate point coordinates. Nothing is created in the GraphicsScene at this point GraphicsScene &scene = context().mainWindow().scene(); SegmentFactory segmentFactory ((QGraphicsScene &) scene, context().isGnuplot()); QList<QPoint> points = segmentFactory.fillPoints (m_cmdMediator->document().modelSegments(), segments); // Create one ordinal for each point OrdinalGenerator ordinalGenerator; Document &document = m_cmdMediator->document (); const Transformation &transformation = context ().mainWindow ().transformation(); QList<double> ordinals; QList<QPoint>::iterator itr; for (itr = points.begin(); itr != points.end(); itr++) { QPoint point = *itr; ordinals << ordinalGenerator.generateCurvePointOrdinal(document, transformation, point, activeCurve ()); } // Create command to add points QUndoCommand *cmd = new CmdAddPointsGraph (context ().mainWindow(), document, context ().mainWindow().selectedGraphCurve(), points, ordinals); context().appendNewCmd(m_cmdMediator, cmd); }
void DigitizeStatePointMatch::createPermanentPoint (CmdMediator *cmdMediator, const QPointF &posScreen) { // Create command to add point OrdinalGenerator ordinalGenerator; Document &document = cmdMediator->document (); const Transformation &transformation = context ().mainWindow ().transformation(); QUndoCommand *cmd = new CmdAddPointGraph (context ().mainWindow(), document, context ().mainWindow().selectedGraphCurve(), posScreen, ordinalGenerator.generateCurvePointOrdinal(document, transformation, posScreen, activeCurve ())); context().appendNewCmd(cmdMediator, cmd); }