21 #include <itkCommand.h>
27 : QAbstractListModel(parent),
29 m_PointSetModifiedObserverTag(0),
30 m_PointSetDeletedObserverTag(0),
39 return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
50 QAbstractListModel::beginResetModel();
51 QAbstractListModel::endResetModel();
63 QAbstractListModel::beginResetModel();
64 QAbstractListModel::endResetModel();
82 if (oldPointSet.IsNotNull())
88 catch (std::exception &e)
90 MITK_ERROR <<
"Exception while removing observer from old point set node: " << e.what();
99 if (pointSet.IsNotNull())
122 QAbstractListModel::beginResetModel();
123 QAbstractListModel::endResetModel();
138 QAbstractListModel::beginResetModel();
139 QAbstractListModel::endResetModel();
145 if (pointSet.IsNotNull())
159 if (pointSet.IsNull())
164 if (!index.isValid())
169 if (index.row() >= pointSet->GetSize(
m_TimeStep))
174 if (role == Qt::DisplayRole)
176 mitk::PointSet::PointsContainer::ElementIdentifier id;
179 if (pointFound ==
false)
182 QString s = QString(
"%0: (%1, %2, %3)").arg(
id, 3).arg(p[0], 0,
'f', 3).arg(p[1], 0,
'f', 3).arg(p[2], 0,
'f', 3);
193 if (role != Qt::DisplayRole)
198 if (orientation == Qt::Horizontal)
200 return QString(
"Coordinates").arg(section);
204 return QString(
"Row %1").arg(section);
213 if (pointSet.IsNull())
216 if ((index.row() < 0) || (index.row() >= (int)pointSet->GetPointSet(
m_TimeStep)->GetPoints()->Size()))
223 mitk::PointSet::PointsContainer::Iterator it = pointSet->GetPointSet(
m_TimeStep)->GetPoints()->Begin();
224 for (
int i = 0; i < index.row(); ++i)
228 if (it == pointSet->GetPointSet(
m_TimeStep)->GetPoints()->End())
232 if (it != pointSet->GetPointSet(
m_TimeStep)->GetPoints()->End())
245 if (pointSet.IsNull())
250 if (points->IndexExists(
id) ==
false)
253 unsigned int idx = 0;
254 for (mitk::PointSet::PointsContainer::Iterator it = points->Begin(); it != points->End(); ++it)
256 if (it->Index() == id)
258 index = this->index(idx);
271 if (pointSet.IsNull())
275 selectedID = pointSet->SearchSelectedPoint(
m_TimeStep);
279 pointSet->ExecuteOperation(doOp);
286 if (pointSet.IsNull())
290 selectedID = pointSet->SearchSelectedPoint(
m_TimeStep);
294 pointSet->ExecuteOperation(doOp);
301 if (pointSet.IsNull())
305 selectedID = pointSet->SearchSelectedPoint(
m_TimeStep);
309 pointSet->ExecuteOperation(doOp);
318 if (pointSet.IsNotNull())
itk::SmartPointer< Self > Pointer
void RemoveSelectedPoint()
QVariant data(const QModelIndex &index, int role) const override
interface of QAbstractListModel
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
interface of QAbstractListModel
QmitkPointListModel(mitk::DataNode *=NULL, int t=0, QObject *parent=0)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
interface of QAbstractListModel
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
void MoveSelectedPointUp()
Constants for most interaction classes, due to the generic StateMachines.
void SetTimeStep(int t)
which time step to display/model
unsigned int m_PointSetDeletedObserverTag
void SetPointSetNode(mitk::DataNode *pointSetNode)
which point set to work on
void ObserveNewPointSet(mitk::DataNode *pointSetNode)
internally observe different point set
DataType::PointIdentifier PointIdentifier
void OnPointSetChanged(const itk::EventObject &e)
itk observer for point set "modified" events
bool GetPointForModelIndex(const QModelIndex &index, mitk::PointSet::PointType &p, mitk::PointSet::PointIdentifier &id) const
get point and point ID that correspond to a given QModelIndex
int GetTimeStep() const
which time step to display/model
Data structure which stores a set of points. Superclass of mitk::Mesh.
static RenderingManager * GetInstance()
Operation that handles all actions on one Point.
void MoveSelectedPointDown()
Qt::ItemFlags flags(const QModelIndex &) const override
unsigned int m_PointSetModifiedObserverTag
mitk::PointSet * CheckForPointSetInNode(mitk::DataNode *node) const
mitk::DataNode * m_PointSetNode
void OnPointSetDeleted(const itk::EventObject &e)
itk observer for point set "delete" events
void SignalUpdateSelection()
bool GetModelIndexForPointID(mitk::PointSet::PointIdentifier id, QModelIndex &index) const
returns a QModelIndex for a given point ID
mitk::PointSet * GetPointSet() const
which point set to work on
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
Class for nodes of the DataTree.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.