NorMIT-nav  22.09
An IGT application
cxToolRep3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 
13 #ifndef CXTOOLREP3D_H_
14 #define CXTOOLREP3D_H_
15 
16 #include "cxResourceVisualizationExport.h"
17 
18 #include "cxRepImpl.h"
19 #include "cxTransform3D.h"
20 
21 #include "vtkForwardDeclarations.h"
22 #include "cxForwardDeclarations.h"
23 #include "cxVtkHelperClasses.h"
24 #include "cxViewportListener.h"
25 
26 namespace cx
27 {
28 
29 typedef boost::shared_ptr<class VideoSourceGraphics> VideoSourceGraphicsPtr;
30 typedef boost::shared_ptr<class ToolTracer> ToolTracerPtr;
31 typedef boost::shared_ptr<class SpaceProvider> SpaceProviderPtr;
32 
33 
51 class cxResourceVisualization_EXPORT ToolRep3D : public RepImpl
52 {
53  Q_OBJECT
54 public:
55  static ToolRep3DPtr New(SpaceProviderPtr spaceProvider, const QString& uid="");
56  virtual ~ToolRep3D();
57  virtual QString getType() const;
58 
59  virtual void setTool(ToolPtr tool);
60  virtual bool hasTool(ToolPtr tool) const;
61  virtual ToolPtr getTool();
62  ToolTracerPtr getTracer();
63  void setSphereRadius(double radius);
64 
65  void setStayHiddenAfterVisible(bool val);
66  void setStayVisibleAfterHide(bool val);
67  void setOffsetPointVisibleAtZeroOffset(bool val);
68  void setSphereRadiusInNormalizedViewport(bool on);
69  void setTooltipPointColor(const QColor& color);
70  void setToolOffsetPointColor(const QColor& color);
71  void setToolOffsetLineColor(const QColor& color);
72 
73 protected:
74  ToolRep3D(SpaceProviderPtr spaceProvider);
75  virtual void addRepActorsToViewRenderer(ViewPtr view);
76  virtual void removeRepActorsFromViewRenderer(ViewPtr view);
77  bool showProbe();
78  virtual void onModifiedStartRender();
79 
80 private slots:
81  void probeSectorChanged();
86  void receiveVisible(bool visible);
87  void tooltipOffsetSlot(double val);
88  void updateToolActor();
89 
90 private:
91  void update();
92  void updateOffsetGraphics();
93  void scaleSpheres();
94 
95  double mSphereRadius;
96  ToolPtr mTool;
97  vtkActorPtr mToolActor;
98  vtkPolyDataMapperPtr mPolyDataMapper;
99  GraphicalPoint3DPtr mTooltipPoint;
100  GraphicalPoint3DPtr mOffsetPoint;
101  GraphicalLine3DPtr mOffsetLine;
102  bool mStayHiddenAfterVisible;
103  bool mStayVisibleAfterHide;
104  bool mOffsetPointVisibleAtZeroOffset;
105  bool mSphereRadiusInNormalizedViewport;
106  ToolTracerPtr mTracer;
107  ViewportListenerPtr mViewportListener;
108  SpaceProviderPtr mSpaceProvider;
109 
110  //US Probe sector
111  ProbeSectorPtr mProbeSector;
112  vtkPolyDataMapperPtr mProbeSectorPolyDataMapper;
113  vtkActorPtr mProbeSectorActor;
114  QColor mTooltipPointColor;
115  QColor mOffsetPointColor;
116  QColor mOffsetLineColor;
117  int mStipplePattern;
118 };
119 } // namespace cx
120 
121 #endif /*CXTOOLREP3D_H_*/
cx::GraphicalPoint3DPtr
boost::shared_ptr< class GraphicalPoint3D > GraphicalPoint3DPtr
Definition: cxForwardDeclarations.h:74
cxRepImpl.h
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxForwardDeclarations.h
vtkPolyDataMapperPtr
vtkSmartPointer< class vtkPolyDataMapper > vtkPolyDataMapperPtr
Definition: vtkForwardDeclarations.h:112
cx::ToolRep3DPtr
boost::shared_ptr< class ToolRep3D > ToolRep3DPtr
Definition: cxRecordSessionSelector.h:27
cx::ViewportListenerPtr
boost::shared_ptr< class ViewportListener > ViewportListenerPtr
Definition: cxForwardDeclarations.h:170
cx::ProbeSectorPtr
boost::shared_ptr< class ProbeSector > ProbeSectorPtr
Definition: cxForwardDeclarations.h:57
cx::VideoSourceGraphicsPtr
boost::shared_ptr< class VideoSourceGraphics > VideoSourceGraphicsPtr
Definition: cxVideoGraphics.h:28
cxViewportListener.h
vtkForwardDeclarations.h
cx::ToolRep3D
Display a Tool in 3D.
Definition: cxToolRep3D.h:51
cx::ViewPtr
boost::shared_ptr< class View > ViewPtr
Definition: cxForwardDeclarations.h:110
cx::RepImpl
Default implementation of Rep.
Definition: cxRepImpl.h:42
vtkActorPtr
vtkSmartPointer< class vtkActor > vtkActorPtr
Definition: vtkForwardDeclarations.h:31
cx::ToolPtr
boost::shared_ptr< class Tool > ToolPtr
Definition: cxVideoConnectionWidget.h:43
cxVtkHelperClasses.h
cx::GraphicalLine3DPtr
boost::shared_ptr< class GraphicalLine3D > GraphicalLine3DPtr
Definition: cxForwardDeclarations.h:73
cxTransform3D.h
cx::ToolTracerPtr
boost::shared_ptr< class ToolTracer > ToolTracerPtr
Definition: cxForwardDeclarations.h:106
cx::SpaceProviderPtr
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
Definition: cxLogicManager.h:23