63 while (cellIt != cellEnd)
65 if (cellIt.Value()->GetNumberOfPoints() > 1)
74 int currentLineId = 0;
75 while (inAIt != inEnd)
81 line->SetPoints(pointA, pointB);
82 double thisDistance =
line->Distance(point);
83 if (thisDistance < bestDist)
85 cellId = cellIt->Index();
86 lineId = currentLineId;
87 bestDist = thisDistance;
111 line->SetPoints(pointA, pointB);
112 double thisDistance =
line->Distance(point);
113 if (thisDistance < bestDist)
115 cellId = cellIt->Index();
116 lineId = currentLineId;
117 bestDist = thisDistance;
125 return (bestDist < distance);
135 PointIdIterator position = std::find(it->Value()->PointIdsBegin(), it->Value()->PointIdsEnd(), pointId);
137 if (position != it->Value()->PointIdsEnd())
152 int pointId = this->
SearchPoint(point, precision, t);
159 unsigned long lineId = 0;
160 if (this->
SearchLine(point, precision, lineId, cellId, t))
170 long nextCellId = -1;
176 nextCellId = it.Index();
187 for (cellDataIt =
m_PointSetSeries[t]->GetCellData()->
Begin(); cellDataIt != cellDataEnd; cellDataIt++)
190 if (cellDataIt->Value().selected)
192 return cellDataIt->Index();
207 CellType *cell = cellAutoPointer.GetPointer();
212 bool closed = cellData.
closed;
216 unsigned int counter = 0;
218 while (pointIdIt != pointIdEnd)
220 if (counter == lineId)
233 if (pointIdIt != pointIdEnd)
241 pointIdIt = cell->PointIdsBegin();
264 if (lineOp ==
nullptr)
266 Superclass::ExecuteOperation(operation);
270 int cellId = lineOp->GetCellId();
291 if (lineOp ==
nullptr)
293 Superclass::ExecuteOperation(operation);
295 m_PointSetSeries[0]->GetCells()->DeleteIndex((
unsigned)lineOp->GetCellId());
296 m_PointSetSeries[0]->GetCellData()->DeleteIndex((
unsigned)lineOp->GetCellId());
304 if (lineOp ==
nullptr)
307 Superclass::ExecuteOperation(operation);
310 int cellId = lineOp->GetCellId();
334 if (lineOp ==
nullptr)
336 Superclass::ExecuteOperation(operation);
339 int cellId = lineOp->GetCellId();
362 if (lineOp ==
nullptr)
374 cellId = lineOp->GetCellId();
377 pId = lineOp->GetPIdA();
387 CellType *cell = cellAutoPointer.GetPointer();
388 if (cell->GetType() == CellType::POLYGON_CELL)
395 polygon->AddPointId(pId);
405 if (polygon->GetNumberOfPoints() > 1)
406 cellData.
selectedLines.push_back(polygon->GetNumberOfPoints() - 2);
423 if (lineOp ==
nullptr)
432 cellId = lineOp->GetCellId();
435 pId = lineOp->GetPIdA();
443 CellType *cell = cellAutoPointer.GetPointer();
444 if (cell->GetType() == CellType::POLYGON_CELL)
446 auto *oldPolygon =
static_cast<PolygonType *
>(cell);
450 newCell.TakeOwnership(newPolygonCell);
453 oldend = oldPolygon->PointIdsEnd();
456 for (it = oldPolygon->PointIdsBegin(); it != oldend; ++it)
458 if ((*it) != (MeshType::PointIdentifier)pId)
460 newPolygonCell->AddPointId(*it);
467 for (it = oldPolygon->PointIdsBegin(); it != oldend; ++it)
468 newPolygonCell->AddPointId(*it);
470 oldPolygon->SetPointIds(0, newPolygonCell->GetNumberOfPoints(), newPolygonCell->PointIdsBegin());
481 if (lineOp ==
nullptr)
483 Superclass::ExecuteOperation(operation);
488 int cellId = lineOp->GetCellId();
493 CellType *cell = cellAutoPointer.GetPointer();
496 auto *newPolygon =
static_cast<PolygonType *
>(cell);
500 int pointId = lineOp->GetPIdA();
506 if ((*it) == (
unsigned int)pointId)
512 newPolygon->AddPointId(*it);
518 newPolygon->AddPointId(*it);
601 if (lineOp ==
nullptr)
604 "Message from mitkMesh: Recieved wrong type of operation! See mitkMeshInteractor.cpp", 10000);
618 pointA[0] += lineOp->GetVector()[0];
619 pointA[1] += lineOp->GetVector()[1];
620 pointA[2] += lineOp->GetVector()[2];
621 pointB[0] += lineOp->GetVector()[0];
622 pointB[1] += lineOp->GetVector()[1];
623 pointB[2] += lineOp->GetVector()[2];
628 Superclass::ExecuteOperation(operationA);
629 Superclass::ExecuteOperation(operationB);
636 if (lineOp ==
nullptr)
638 Superclass::ExecuteOperation(operation);
640 int cellId = lineOp->GetCellId();
648 auto position = std::find(selectedLines->begin(), selectedLines->end(), (
unsigned int)lineOp->GetId());
650 if (position == selectedLines->end())
662 if (lineOp ==
nullptr)
664 Superclass::ExecuteOperation(operation);
666 int cellId = lineOp->GetCellId();
674 auto position = std::find(selectedLines->begin(), selectedLines->end(), (
unsigned int)lineOp->GetId());
676 if (position != selectedLines->end())
678 selectedLines->erase(position);
688 if (lineOp ==
nullptr)
690 Superclass::ExecuteOperation(operation);
693 int cellId = lineOp->GetCellId();
711 if (lineOp ==
nullptr)
713 Superclass::ExecuteOperation(operation);
715 int cellId = lineOp->GetCellId();
732 if (lineOp ==
nullptr)
734 Superclass::ExecuteOperation(operation);
737 int cellId = lineOp->GetCellId();
738 Vector3D vector = lineOp->GetVector();
754 unsigned int position = (*it);
758 point = point + vector;
767 Superclass::ExecuteOperation(operation);
774 ((
const itk::Object *)
this)->InvokeEvent(endevent);
789 DataType::PointsContainerPointer pointsContainer = DataType::PointsContainer::New();
792 while (bbIt != bbEnd)
797 pointsContainer->SetElement((*bbIt), point);
800 bBoxPointer = DataType::BoundingBoxType::New();
801 bBoxPointer->SetPoints(pointsContainer);
802 bBoxPointer->ComputeBoundingBox();
void Expand(unsigned int timeSteps) override
Expands the TimeGeometry to a number of TimeSteps.
virtual bool GetPointIds(unsigned long cellId, unsigned long lineId, int &idA, int &idB, int t=0)
searches a line according to the cellId and lineId and returns the PointIds, that assign the line; if...
int SearchPoint(Point3D point, ScalarType distance, int t=0) const
searches a point in the list == point +/- distance
DataType::CellDataContainerIterator CellDataIterator
Base class of all Operation-classes.
CellTraits::PointIdConstIterator PointIdConstIterator
virtual int SearchSelectedPoint(int t=0) const
searches a selected point and returns the id of that point. If no point is found, then -1 is returned...
Operation, that holds everything necessary for an operation on a line.
void SetMesh(DataType *mesh, int t=0)
Constants for most interaction classes, due to the generic StateMachines.
PointSetSeries m_PointSetSeries
CellType::CellAutoPointer CellAutoPointer
virtual unsigned long GetNumberOfCells(int t=0)
returns the current number of cells in the mesh
std::vector< unsigned int > SelectedLinesType
cellDataType, that stores all indexes of the lines, that are selected e.g.: points A...
virtual const DataType * GetMesh(int t=0) const
returns the mesh
virtual DataType::BoundingBoxPointer GetBoundingBoxFromCell(unsigned long cellId, int t=0)
creates a BoundingBox and computes it with the given points of the cell.
void DisplayText(const char *t)
Send a string to the applications StatusBar.
Operation that handles all actions on one Point.
SelectedLinesType selectedLines
void ExecuteOperation(Operation *operation) override
executes the given Operation
itk::PolygonCell< CellType > PolygonType
Operation, that holds everything necessary for an operation on a cell.
static StatusBar * GetInstance()
static method to get the GUI dependent StatusBar-instance so the methods DisplayText, etc. can be called No reference counting, cause of decentral static use!
virtual bool SearchLine(Point3D point, float distance, unsigned long &lineId, unsigned long &cellId, int t=0)
searches for a line, that is hit by the given point. Then returns the lineId and the cellId ...
Superclass::DataType::CellsContainer::ConstIterator ConstCellIterator
virtual int SearchSelectedCell(int t=0)
searches a selected cell and returns the id of that cell. If no cell is found, then -1 is returned ...
virtual bool EvaluatePosition(Point3D point, unsigned long &cellId, float precision, int t=0)
checks if the given point is in a cell and returns that cellId. Basicaly it searches lines and points...
PointsIterator Begin(int t=0)
unsigned long GetNewCellId(int t=0)
searches for the next new cellId and returns that id
PointType GetPoint(PointIdentifier id, int t=0) const
Get the point with ID id in world coordinates.
virtual int SearchFirstCell(unsigned long pointId, int t=0)
returns the first cell that includes the given pointId
OperationType GetOperationType()
CellTraits::PointIdIterator PointIdIterator
BoundingBoxType::Pointer BoundingBoxPointer
Superclass::DataType::CellType CellType