19 #include <QVTKInteractor.h>
21 #include <vtkEventQtSlotConnect.h>
22 #include <vtkGenericOpenGLRenderWindow.h>
23 #include <vtkTextProperty.h>
36 #include <QQuickWindow>
51 static QMap<vtkRenderWindow*, QmlMitkRenderWindowItem*> s_Instances;
69 if (m_DataStorage.IsNotNull())
90 planeNode->SetProperty(
"layer", layer);
96 planeNode->SetColor(0.88, 0.35, 0.27);
99 planeNode->SetColor(0.25, 0.7, 0.35);
102 planeNode->SetColor(0.01, 0.31, 0.67);
105 planeNode->SetColor(1.0, 1.0, 0.0);
119 this->m_annotation->SetText(0, text.c_str());
120 this->m_annotation->SetMaximumFontSize(12);
121 this->m_annotation->GetTextProperty()->SetColor( color[0],color[1],color[2] );
124 if(!this->
GetRenderer()->GetVtkRenderer()->HasViewProp(this->m_annotation))
129 this->m_rectangle->SetColor(color[0],color[1],color[2]);
131 if(!this->
GetRenderer()->GetVtkRenderer()->HasViewProp(this->m_rectangle))
139 switch (this->m_viewType)
164 if(this->m_multiItem == multiItem)
173 return this->m_multiItem;
183 qreal ratio = this->window()->effectiveDevicePixelRatio();
185 point[0] = me->x()*ratio;
186 point[1] = me->y()*ratio;
192 qreal ratio = this->window()->effectiveDevicePixelRatio();
194 point[0] = we->x()*ratio;
195 point[1] = we->y()*ratio;
202 switch (me->button())
207 case Qt::RightButton:
224 if (me->buttons() & Qt::LeftButton)
228 if (me->buttons() & Qt::RightButton)
232 if (me->buttons() & Qt::MidButton)
243 if (me->modifiers() & Qt::ALT)
247 if (me->modifiers() & Qt::CTRL)
251 if (me->modifiers() & Qt::SHIFT)
262 if (we->buttons() & Qt::LeftButton)
266 if (we->buttons() & Qt::RightButton)
270 if (we->buttons() & Qt::MidButton)
280 return this->m_viewType;
virtual bool InitializeViews(const BaseGeometry *geometry, RequestType type=REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace=false)
virtual bool HandleEvent(InteractionEvent *interactionEvent)
virtual DataNode * GetCurrentWorldPlaneGeometryNode()
Get a DataNode pointing to a data object containing the current 2D-worldgeometry. ...
void setMultiItem(QmlMitkStdMultiItem *multiItem)
mitk::InteractionEvent::MouseButtons GetButtonState(QMouseEvent *me) const
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd, MouseButtons _arge)
mitk::Point2D GetMousePosition(QMouseEvent *me) const
static BaseRenderer * GetInstance(vtkRenderWindow *renWin)
mitk::InteractionEvent::MouseButtons GetEventButton(QMouseEvent *me) const
mitk::InteractionEvent::ModifierKeys GetModifiers(QInputEvent *me) const
void setViewType(int type)
virtual void SetDataStorage(mitk::DataStorage *storage) override
set the datastorage that will be used for rendering
~QmlMitkRenderWindowItem()
virtual void mouseMoveEvent(QMouseEvent *e)
void ForceImmediateUpdate()
virtual void mouseMoveEvent(QMouseEvent *e)
virtual vtkRenderWindowInteractor * GetVtkRenderWindowInteractor()
QVTKInteractor * GetInteractor() const
virtual bool prepareForRender()
void SetDataStorage(mitk::DataStorage::Pointer storage)
virtual DataStorage::Pointer GetDataStorage() const
virtual void wheelEvent(QWheelEvent *e)
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd, int _arge)
virtual void mouseReleaseEvent(QMouseEvent *e)
mitk::DataStorage::Pointer m_DataStorage
Manager for coordinating the rendering process.
static RenderingManager * GetInstance()
static QmlMitkRenderWindowItem * instance
static QmlMitkRenderWindowItem * GetInstanceForVTKRenderWindow(vtkRenderWindow *rw)
virtual CameraController * GetCameraController()
virtual void mousePressEvent(QMouseEvent *e)
virtual void mousePressEvent(QMouseEvent *e)
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd)
QmlMitkStdMultiItem multiItem
virtual mitk::VtkPropRenderer * GetRenderer()
virtual void wheelEvent(QWheelEvent *e)
void setDecorationProperties(std::string text, mitk::Color color)
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
virtual void PrepareRender()
This methods contains all method neceassary before a VTK Render() call.
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd, MouseButtons _arge)
static QMap< vtkRenderWindow *, QmlMitkRenderWindowItem * > & GetInstances()
virtual void cleanupAfterRender()
virtual vtkRenderWindow * GetVtkRenderWindow()
void Initialize(mitk::RenderingManager *renderingManager=NULL, const char *name="unnamed renderer", mitk::BaseRenderer::RenderingMode::Type renderingMode=mitk::BaseRenderer::RenderingMode::Standard)
void registerViewerItem(QmlMitkRenderWindowItem *viewerItem)
virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
virtual void SetMapperID(const MapperSlotId mapperId) override
Set the MapperSlotId to use.
virtual SliceNavigationController * GetSliceNavigationController()
virtual mitk::SliceNavigationController * GetSliceNavigationController()
virtual void mouseReleaseEvent(QMouseEvent *e)
QmlMitkStdMultiItem * getMultiItem()
vtkRenderer * GetVtkRenderer() const
void Fit()
Fit Adjust the camera, so that the world bounding box is fully visible.
QmlMitkRenderWindowItem(QQuickItem *parent=0, const QString &name="QML render window", mitk::VtkPropRenderer *renderer=NULL, mitk::RenderingManager *renderingManager=NULL)
vtkOpenGLRenderWindow * GetRenderWindow() const
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.