MCPcopy Create free account
hub / github.com/MITK/MITK / ExecuteOperation

Method ExecuteOperation

Modules/Core/src/DataManagement/mitkPointSet.cpp:581–767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579}
580
581void mitk::PointSet::ExecuteOperation(Operation *operation)
582{
583 int timeStep = -1;
584
585 mitkCheckOperationTypeMacro(PointOperation, operation, pointOp);
586
587 if (pointOp)
588 {
589 timeStep = this->GetTimeGeometry()->TimePointToTimeStep(pointOp->GetTimeInMS());
590 }
591
592 if (timeStep < 0)
593 {
594 MITK_ERROR << "Time step (" << timeStep << ") outside of PointSet time bounds" << std::endl;
595 return;
596 }
597
598 switch (operation->GetOperationType())
599 {
600 case OpNOTHING:
601 break;
602
603 case OpINSERT: // inserts the point at the given position and selects it.
604 {
605 int position = pointOp->GetIndex();
606
607 PointType pt;
608 pt.CastFrom(pointOp->GetPoint());
609
610 if (timeStep >= (int)this->GetTimeSteps())
611 this->Expand(timeStep + 1);
612
613 // transfer from world to index coordinates
614 mitk::BaseGeometry *geometry = this->GetGeometry(timeStep);
615 if (geometry == nullptr)
616 {
617 MITK_INFO << "GetGeometry returned nullptr!\n";
618 return;
619 }
620 geometry->WorldToIndex(pt, pt);
621
622 m_PointSetSeries[timeStep]->GetPoints()->InsertElement(position, pt);
623
624 PointDataType pointData = {
625 static_cast<unsigned int>(pointOp->GetIndex()), pointOp->GetSelected(), pointOp->GetPointType()};
626
627 m_PointSetSeries[timeStep]->GetPointData()->InsertElement(position, pointData);
628
629 this->Modified();
630
631 // boundingbox has to be computed
632 m_CalculateBoundingBox = true;
633
634 this->InvokeEvent(PointSetAddEvent());
635 this->OnPointSetChange();
636 }
637 break;
638

Callers 1

SetSelectInfoMethod · 0.95

Calls 15

ExpandMethod · 0.95
SwapPointContentsMethod · 0.95
GetTimeInMSMethod · 0.80
GetOperationTypeMethod · 0.80
GetTimeStepsMethod · 0.80
GetGeometryMethod · 0.80
GetPointTypeMethod · 0.80
TimePointToTimeStepMethod · 0.45
GetIndexMethod · 0.45
GetPointMethod · 0.45
WorldToIndexMethod · 0.45
GetSelectedMethod · 0.45

Tested by

no test coverage detected