Ejemplo n.º 1
0
void Model::insertSegment(SegmentModel* m)
{
  m->setParent(this);
  m_segments.insert(m);

  // TODO have indexes on the points with the start and end
  // curve segments
  connect(m, &SegmentModel::startChanged, this, [=]() {
    for (PointModel* pt : m_points)
    {
      if (pt->following() == m->id())
      {
        pt->setPos(m->start());
        break;
      }
    }
  });
  connect(m, &SegmentModel::endChanged, this, [=]() {
    for (PointModel* pt : m_points)
    {
      if (pt->previous() == m->id())
      {
        pt->setPos(m->end());
        break;
      }
    }
  });

  segmentAdded(*m);
}
Ejemplo n.º 2
0
void SegmentManager::addSegment(int i, const Segment &pts)
{
    segments.insert(i, pts);
    emit segmentAdded(i, calcSegmentArea(segments[i]), segments[i]);
    selectSegment(i);
}