29 #include <QInputDialog>
30 #include <QPushButton>
31 #include <QStringList>
41 m_lastSelectedItem(NULL),
42 m_lastAffineObserver(0),
44 m_BoundingObjectCounter(1)
46 QBoxLayout *mainLayout =
new QVBoxLayout(
this);
48 QHBoxLayout *buttonLayout =
new QHBoxLayout();
51 boList << tr(
"add") << tr(
"cube") << tr(
"cone") << tr(
"ellipse") << tr(
"cylinder");
54 m_addComboBox->setItemIcon(1, QIcon(
":/QmitkWidgetsExt/btnCube.xpm"));
55 m_addComboBox->setItemIcon(2, QIcon(
":/QmitkWidgetsExt/btnPyramid.xpm"));
56 m_addComboBox->setItemIcon(3, QIcon(
":/QmitkWidgetsExt/btnEllipsoid.xpm"));
57 m_addComboBox->setItemIcon(4, QIcon(
":/QmitkWidgetsExt/btnCylinder.xpm"));
75 sList << tr(
"name") << tr(
"inverted") << tr(
"visible");
81 m_TreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
84 mainLayout->addLayout(buttonLayout);
91 SIGNAL(itemDoubleClicked(QTreeWidgetItem *,
int)),
108 QTreeWidgetItem *item = it->first;
117 QWidget::setEnabled(flag);
123 QList<QTreeWidgetItem *> selectedItems =
m_TreeWidget->selectedItems();
124 if (selectedItems.size() < 1)
127 QTreeWidgetItem *selectedItem = selectedItems.first();
148 ItemNodeMapType::iterator it =
m_ItemNodeMap.find(selectedItem);
157 affineDataInteractor->SetDataNode(new_node);
180 QTreeWidgetItem *item =
new QTreeWidgetItem();
181 item->setData(0, Qt::EditRole, QString::fromLocal8Bit(name.c_str()));
182 item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
185 item->setData(1, Qt::CheckStateRole, tr(
""));
186 item->setCheckState(1, Qt::Unchecked);
189 item->setData(2, Qt::CheckStateRole, tr(
""));
190 item->setCheckState(2, Qt::Checked);
197 QList<QTreeWidgetItem *> items =
m_TreeWidget->selectedItems();
198 for (
int i = 0; i < items.size(); i++)
206 MITK_ERROR << name <<
" is not a bounding object or does not exist in data storage" << endl;
232 node->
SetName(item->text(0).toLocal8Bit().data());
239 boundingObject->
SetPositive(!(item->checkState(1)));
254 QList<QTreeWidgetItem *> selectedItems =
m_TreeWidget->selectedItems();
255 QTreeWidgetItem *item = selectedItems.first();
256 QString str = item->text(0);
303 return boundingObject;
339 if ((plane1 != NULL) && (plane2 != NULL) && (plane1->
IntersectionLine(plane2, line)))
357 name.prepend(
"Cube_");
361 name.prepend(
"Cone_");
365 name.prepend(
"Ellipse_");
369 name.prepend(
"Cylinder_");
381 boundingObject->GetGeometry()->SetSpacing(size);
383 boundingObject->GetGeometry()->Translate(pos.GetVectorFromOrigin());
384 boundingObject->GetTimeGeometry()->Update();
388 node->SetData(boundingObject);
415 for (mitk::DataStorage::SetOfObjects::const_iterator it = allBO->begin(); it != allBO->end(); ++it)
420 boundingObjectGroup->AddBoundingObject(boundingObject);
423 boundingObjectGroupNode->SetData(boundingObjectGroup);
425 if (boundingObjectGroup->GetCount() > 0)
426 return boundingObjectGroupNode;
433 QList<QTreeWidgetItem *> selectedItems =
m_TreeWidget->selectedItems();
434 if (selectedItems.size() < 1)
437 QTreeWidgetItem *item = selectedItems.first();
virtual void Add(mitk::DataNode *node, const mitk::DataStorage::SetOfObjects *parents=nullptr)=0
Adds a DataNode containing a data object to its internal storage.
Data management class that handles 'was created by' relations.
itk::SmartPointer< Self > Pointer
bool IntersectionPoint(const Line3D &line, Point3D &intersectionPoint) const
Calculate intersection point between the plane and a line.
void SetVisibility(bool visible, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="visible")
Convenience method for setting visibility properties (instances of BoolProperty)
static BaseRenderer * GetInstance(vtkRenderWindow *renWin)
static Module * GetModule(long id)
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
itk::SmartPointer< const Self > ConstPointer
bool GetStringProperty(const char *propertyKey, std::string &string, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for string properties (instances of StringProperty)
superclass of all bounding objects (cylinder, cuboid,...)
virtual void SetPositive(bool _arg)
mitk::DataStorage::Pointer m_DataStorage
SetOfObjects::ConstPointer GetSubset(const NodePredicateBase *condition) const
returns a set of data objects that meet the given condition(s)
static RenderingManager * GetInstance()
virtual void SetName(const char *name)
Extra convenience access method to set the name of an object.
std::vector< vtkRenderWindow * > RenderWindowVector
static Pointer New(const char *_arg)
void SetBoolProperty(const char *propertyKey, bool boolValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting boolean properties (instances of BoolProperty)
bool IntersectionLine(const PlaneGeometry *plane, Line3D &crossline) const
Calculate the intersecting line of two planes.
Describes a two-dimensional, rectangular plane.
virtual void SetDataInteractor(const DataInteractor::Pointer interactor)
Set the Interactor.
virtual void Remove(const mitk::DataNode *node)=0
Removes node from the DataStorage.
const RenderWindowVector & GetAllRegisteredRenderWindows()
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.