コード例 #1
0
void DigitizeStateSegment::handleCurveChange(CmdMediator *cmdMediator)
{
    LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSegment::handleCurveChange";

    QImage img = context().mainWindow().imageFiltered();

    GraphicsScene &scene = context().mainWindow().scene();
    SegmentFactory segmentFactory ((QGraphicsScene &) scene,
                                   context().isGnuplot());

    segmentFactory.clearSegments (m_segments);

    // Create new segments
    segmentFactory.makeSegments (img,
                                 cmdMediator->document().modelSegments(),
                                 m_segments);

    // Connect signals of the new segments
    QList<Segment*>::iterator itr;
    for (itr = m_segments.begin(); itr != m_segments.end(); itr++) {
        Segment *segment = *itr;

        LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSegment::handleCurveChange"
                                    << " lines=" << segment->lineCount();

        connect (segment, SIGNAL (signalMouseClickOnSegment (QPointF)), this, SLOT (slotMouseClickOnSegment (QPointF)));
    }
}
コード例 #2
0
void DigitizeStateSegment::end ()
{
    LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStateSegment::end";

    GraphicsScene &scene = context().mainWindow().scene();
    SegmentFactory segmentFactory ((QGraphicsScene &) scene,
                                   context().isGnuplot());

    segmentFactory.clearSegments(m_segments);
}
コード例 #3
0
void DlgSettingsSegments::updatePreview()
{
  LOG4CPP_INFO_S ((*mainCat)) << "DlgSettingsSegments::updatePreview"
                              << " loading=" << (m_loading ? "true" : "false");

  const QString ARBITRARY_IDENTIFIER ("");
  const QColor COLOR (Qt::blue);
  const int RADIUS = 5;

  if (!m_loading) {

    SegmentFactory segmentFactory (*m_scenePreview,
                                   mainWindow().isGnuplot());

    clearPoints();
    segmentFactory.clearSegments (m_segments);

    // Create new segments
    segmentFactory.makeSegments (createPreviewImage(),
                                 *m_modelSegmentsAfter,
                                 m_segments);

    // Make the segment visible
    QList<Segment*>::iterator itrS;
    for (itrS = m_segments.begin(); itrS != m_segments.end(); itrS++) {
      Segment *segment = *itrS;
      segment->slotHover (true);
    }

    // Create some points
    PointStyle pointStyle (POINT_SHAPE_CROSS,
                           RADIUS,
                           BRUSH_WIDTH,
                           COLOR_PALETTE_BLUE);
    QPolygonF polygon = pointStyle.polygon();
    QList<QPoint> points = segmentFactory.fillPoints (*m_modelSegmentsAfter,
                                                      m_segments);
    QList<QPoint>::iterator itrP;
    for (itrP = points.begin(); itrP != points.end(); itrP++) {
      QPoint pos = *itrP;
      GraphicsPoint *graphicsPoint = new GraphicsPoint (*m_scenePreview,
                                                        ARBITRARY_IDENTIFIER,
                                                        pos,
                                                        COLOR,
                                                        polygon,
                                                        BRUSH_WIDTH);
      m_points.push_back (graphicsPoint);
    }
  }
}