39 return m_PointSetSeries[t];
44 return m_PointSetSeries[t];
50 m_PointSetSeries[t] = mesh;
55 return m_PointSetSeries[t]->GetNumberOfCells();
67 while (cellIt != cellEnd)
69 if (cellIt.Value()->GetNumberOfPoints() > 1)
78 int currentLineId = 0;
79 while (inAIt != inEnd)
82 if (m_PointSetSeries[t]->GetPoint((*inAIt), &pointA) && m_PointSetSeries[t]->GetPoint((*inBIt), &pointB))
85 line->SetPoints(pointA, pointB);
86 double thisDistance =
line->Distance(point);
87 if (thisDistance < bestDist)
89 cellId = cellIt->Index();
90 lineId = currentLineId;
91 bestDist = thisDistance;
103 bool dataOk = m_PointSetSeries[t]->GetCellData(cellIt->Index(), &cellData);
112 if (m_PointSetSeries[t]->GetPoint((*inAIt), &pointA) && m_PointSetSeries[t]->GetPoint((*inBIt), &pointB))
115 line->SetPoints(pointA, pointB);
116 double thisDistance =
line->Distance(point);
117 if (thisDistance < bestDist)
119 cellId = cellIt->Index();
120 lineId = currentLineId;
121 bestDist = thisDistance;
129 return (bestDist < distance);
139 PointIdIterator position = std::find(it->Value()->PointIdsBegin(), it->Value()->PointIdsEnd(), pointId);
141 if (position != it->Value()->PointIdsEnd())
156 int pointId = this->SearchPoint(point, precision, t);
160 cellId = this->SearchFirstCell(pointId, t);
163 unsigned long lineId = 0;
164 if (this->SearchLine(point, precision, lineId, cellId, t))
174 long nextCellId = -1;
180 nextCellId = it.Index();
190 cellDataEnd = m_PointSetSeries[t]->GetCellData()->End();
191 for (cellDataIt = m_PointSetSeries[t]->GetCellData()->Begin(); cellDataIt != cellDataEnd; cellDataIt++)
194 if (cellDataIt->Value().selected)
196 return cellDataIt->Index();
210 ok = m_PointSetSeries[t]->GetCell(cellId, cellAutoPointer);
213 CellType *cell = cellAutoPointer.GetPointer();
217 m_PointSetSeries[t]->GetCellData(cellId, &cellData);
218 bool closed = cellData.
closed;
222 unsigned int counter = 0;
223 while (pointIdIt != pointIdEnd)
225 if (counter == lineId)
238 if (pointIdIt != pointIdEnd)
246 pointIdIt = cell->PointIdsBegin();
269 if (lineOp ==
nullptr)
271 Superclass::ExecuteOperation(operation);
277 ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
283 m_PointSetSeries[0]->SetCell(cellId, cellAutoPointer);
288 m_PointSetSeries[0]->SetCellData(cellId, cellData);
296 if (lineOp ==
nullptr)
298 Superclass::ExecuteOperation(operation);
300 m_PointSetSeries[0]->GetCells()->DeleteIndex((
unsigned)lineOp->
GetCellId());
301 m_PointSetSeries[0]->GetCellData()->DeleteIndex((
unsigned)lineOp->
GetCellId());
309 if (lineOp ==
nullptr)
312 Superclass::ExecuteOperation(operation);
318 cellId = this->SearchSelectedCell(0);
325 ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
329 m_PointSetSeries[0]->GetCellData(cellId, &cellData);
331 m_PointSetSeries[0]->SetCellData(cellId, cellData);
339 if (lineOp ==
nullptr)
341 Superclass::ExecuteOperation(operation);
346 ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
350 m_PointSetSeries[0]->GetCellData(cellId, &cellData);
353 m_PointSetSeries[0]->SetCellData(cellId, cellData);
367 if (lineOp ==
nullptr)
369 cellId = this->SearchSelectedCell(0);
373 pId = this->SearchSelectedPoint(0);
389 ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
392 CellType *cell = cellAutoPointer.GetPointer();
393 if (cell->GetType() == CellType::POLYGON_CELL)
400 polygon->AddPointId(pId);
405 ok = m_PointSetSeries[0]->GetCellData(cellId, &cellData);
410 if (polygon->GetNumberOfPoints() > 1)
411 cellData.
selectedLines.push_back(polygon->GetNumberOfPoints() - 2);
413 m_PointSetSeries[0]->SetCellData(cellId, cellData);
414 m_PointSetSeries[0]->SetCell(cellId, cellAutoPointer);
428 if (lineOp ==
nullptr)
430 cellId = this->SearchSelectedCell(0);
433 pId = this->SearchSelectedPoint(0);
445 ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
448 CellType *cell = cellAutoPointer.GetPointer();
449 if (cell->GetType() == CellType::POLYGON_CELL)
455 newCell.TakeOwnership(newPolygonCell);
458 oldend = oldPolygon->PointIdsEnd();
461 for (it = oldPolygon->PointIdsBegin(); it != oldend; ++it)
463 if ((*it) != (MeshType::PointIdentifier)pId)
465 newPolygonCell->AddPointId(*it);
472 for (it = oldPolygon->PointIdsBegin(); it != oldend; ++it)
473 newPolygonCell->AddPointId(*it);
475 oldPolygon->SetPointIds(0, newPolygonCell->GetNumberOfPoints(), newPolygonCell->PointIdsBegin());
486 if (lineOp ==
nullptr)
488 Superclass::ExecuteOperation(operation);
494 ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
498 CellType *cell = cellAutoPointer.GetPointer();
505 int pointId = lineOp->
GetPIdA();
511 if ((*it) == (
unsigned int)pointId)
517 newPolygon->AddPointId(*it);
523 newPolygon->AddPointId(*it);
526 m_PointSetSeries[0]->SetCell(cellId, newCellAutoPointer);
606 if (lineOp ==
nullptr)
609 "Message from mitkMesh: Recieved wrong type of operation! See mitkMeshInteractor.cpp", 10000);
620 m_PointSetSeries[0]->GetPoint(lineOp->
GetPIdA(), &pointA);
621 m_PointSetSeries[0]->GetPoint(lineOp->
GetPIdB(), &pointB);
633 Superclass::ExecuteOperation(operationA);
634 Superclass::ExecuteOperation(operationB);
641 if (lineOp ==
nullptr)
643 Superclass::ExecuteOperation(operation);
647 bool ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
651 m_PointSetSeries[0]->GetCellData(cellId, &cellData);
653 auto position = std::find(selectedLines->begin(), selectedLines->end(), (
unsigned int)lineOp->
GetId());
655 if (position == selectedLines->end())
659 m_PointSetSeries[0]->SetCellData(lineOp->
GetCellId(), cellData);
667 if (lineOp ==
nullptr)
669 Superclass::ExecuteOperation(operation);
673 bool ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
677 m_PointSetSeries[0]->GetCellData(cellId, &cellData);
679 auto position = std::find(selectedLines->begin(), selectedLines->end(), (
unsigned int)lineOp->
GetId());
681 if (position != selectedLines->end())
683 selectedLines->erase(position);
685 m_PointSetSeries[0]->SetCellData(cellId, cellData);
693 if (lineOp ==
nullptr)
695 Superclass::ExecuteOperation(operation);
702 bool ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
706 m_PointSetSeries[0]->GetCellData(cellId, &cellData);
708 m_PointSetSeries[0]->SetCellData(cellId, cellData);
716 if (lineOp ==
nullptr)
718 Superclass::ExecuteOperation(operation);
722 bool ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
726 m_PointSetSeries[0]->GetCellData(cellId, &cellData);
728 m_PointSetSeries[0]->SetCellData(cellId, cellData);
737 if (lineOp ==
nullptr)
739 Superclass::ExecuteOperation(operation);
747 bool ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
752 m_PointSetSeries[0]->GetCellData(cellId, &cellData);
759 unsigned int position = (*it);
762 m_PointSetSeries[0]->GetPoint(position, &point);
763 point = point + vector;
764 m_PointSetSeries[0]->SetPoint(position, point);
772 Superclass::ExecuteOperation(operation);
779 ((
const itk::Object *)
this)->InvokeEvent(endevent);
792 if (m_PointSetSeries[t]->GetCell(cellId, cellAutoPointer))
797 while (bbIt != bbEnd)
800 bool pointOk = m_PointSetSeries[t]->GetPoint((*bbIt), &point);
802 pointsContainer->SetElement((*bbIt), point);
806 bBoxPointer->SetPoints(pointsContainer);
807 bBoxPointer->ComputeBoundingBox();
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...
DataType::CellDataContainerIterator CellDataIterator
Base class of all Operation-classes.
CellTraits::PointIdConstIterator PointIdConstIterator
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.
virtual const DataType * GetMesh(int t=0) const
returns the mesh
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 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
virtual 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...
unsigned long GetNewCellId(int t=0)
searches for the next new cellId and returns that id
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
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.