32 : m_tissue(tissue), m_scene(scene), m_cut(nullptr) {}
37 for (
auto slice : m_slices) {
45 m_cut->setZValue(0.5);
46 m_cut->setPen(QPen(QBrush(QColor(0,0,255,255)), 0, Qt::DashLine));
47 m_scene->addItem(m_cut);
52 QPolygonF boundaryPolygon;
53 for (
auto node : m_tissue->GetMesh()->GetMesh()->GetBoundaryPolygon()->GetNodes()) {
54 boundaryPolygon.append(QPointF((*node)[0], (*node)[1]));
58 auto item =
new SliceItem(polygon, m_cut->line(), m_tissue, m_scene);
60 connect(item, SIGNAL(Truncated()),
this, SLOT(Finish()));
61 m_slices.push_back(item);
62 m_scene->addItem(item);
68 if (m_slices.size() == 0 && point != m_cut->line().p1()) {
70 m_cut->setLine(QLineF(m_cut->line().p1(), point));
80 return m_slices.size() > 0;
83 void TissueSlicer::Finish()
85 m_scene->removeItem(m_cut);
86 for (
auto slice : m_slices) {
87 m_scene->removeItem(slice);
Represents a slice of a cell complex.
Interface for TissueSlicer.
Namespace for SimPT tissue editor package.
bool CutEnded() const
Checks whether the cut-action has ended.
Namespace for SimPT shell package.
see the online Qt documentation
bool MoveCut(const QPointF &point)
This procedure is for dynamically moving the line in the canvas (the first point is fixed)...
static std::list< QPolygonF > SlicePolygon(const QPolygonF &polygon, QLineF cut)
Slice an open, simple and valid polygon in multiple polygons with a given line.
void EndCut()
End the cut procedure by putting a second point for the cut.
void Finished()
Emitted when the slicing has finished.
virtual ~TissueSlicer()
Destructor.
void StartCut(const QPointF &point)
Start the cut procedure by putting a starting point for the cut.
TissueSlicer(std::shared_ptr< EditControlLogic > tissue, QGraphicsScene *scene)
Constructor.
Interface for PolygonUtils.