Fraxinus  16.5.0-fx-rc3
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 
34 #ifndef CXTOOLREP3D_H_
35 #define CXTOOLREP3D_H_
36 
37 #include "cxResourceVisualizationExport.h"
38 
39 #include "cxRepImpl.h"
40 #include "cxTransform3D.h"
41 
42 #include "vtkForwardDeclarations.h"
43 #include "cxForwardDeclarations.h"
44 #include "cxVtkHelperClasses.h"
45 #include "cxViewportListener.h"
46 
47 namespace cx
48 {
49 
50 typedef boost::shared_ptr<class VideoSourceGraphics> VideoSourceGraphicsPtr;
51 typedef boost::shared_ptr<class ToolTracer> ToolTracerPtr;
52 typedef boost::shared_ptr<class SpaceProvider> SpaceProviderPtr;
53 
54 
72 class cxResourceVisualization_EXPORT ToolRep3D : public RepImpl
73 {
74  Q_OBJECT
75 public:
76  static ToolRep3DPtr New(SpaceProviderPtr spaceProvider, const QString& uid="");
77  virtual ~ToolRep3D();
78  virtual QString getType() const;
79 
80  virtual void setTool(ToolPtr tool);
81  virtual bool hasTool(ToolPtr tool) const;
82  virtual ToolPtr getTool();
83  ToolTracerPtr getTracer();
84  void setSphereRadius(double radius);
85 
86  void setTooltipPointColor(QColor c);
87  void setOffsetPointColor(QColor c);
88  void setOffsetLineColor(QColor c);
89  void setOffsetStipplePattern(int pattern);
90 
91  void setStayHiddenAfterVisible(bool val);
92  void setStayVisibleAfterHide(bool val);
93  void setOffsetPointVisibleAtZeroOffset(bool val);
94  void setSphereRadiusInNormalizedViewport(bool on);
95 
96 protected:
97  ToolRep3D(SpaceProviderPtr spaceProvider);
98  virtual void addRepActorsToViewRenderer(ViewPtr view);
99  virtual void removeRepActorsFromViewRenderer(ViewPtr view);
100  bool showProbe();
101  virtual void onModifiedStartRender();
102 
103 private slots:
104  void probeSectorChanged();
109  void receiveVisible(bool visible);
110  void tooltipOffsetSlot(double val);
111  void updateToolActor();
112 
113 private:
114  void update();
115  void updateOffsetGraphics();
116  void scaleSpheres();
117 
118  double mSphereRadius;
119  ToolPtr mTool;
120  vtkActorPtr mToolActor;
121  vtkPolyDataMapperPtr mPolyDataMapper;
122  GraphicalPoint3DPtr mTooltipPoint;
123  GraphicalPoint3DPtr mOffsetPoint;
124  GraphicalLine3DPtr mOffsetLine;
125  bool mStayHiddenAfterVisible;
126  bool mStayVisibleAfterHide;
127  bool mOffsetPointVisibleAtZeroOffset;
128  bool mSphereRadiusInNormalizedViewport;
129  ToolTracerPtr mTracer;
130  ViewportListenerPtr mViewportListener;
131  SpaceProviderPtr mSpaceProvider;
132 
133  //US Probe sector
134  ProbeSectorPtr mProbeSector;
135  vtkPolyDataMapperPtr mProbeSectorPolyDataMapper;
136  vtkActorPtr mProbeSectorActor;
137  QColor mTooltipPointColor;
138  QColor mOffsetPointColor;
139  QColor mOffsetLineColor;
140  int mStipplePattern;
141 };
142 } // namespace cx
143 
144 #endif /*CXTOOLREP3D_H_*/
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
vtkSmartPointer< class vtkActor > vtkActorPtr
boost::shared_ptr< class GraphicalPoint3D > GraphicalPoint3DPtr
vtkSmartPointer< class vtkPolyDataMapper > vtkPolyDataMapperPtr
boost::shared_ptr< class ViewportListener > ViewportListenerPtr
boost::shared_ptr< class ToolTracer > ToolTracerPtr
boost::shared_ptr< class View > ViewPtr
Display a Tool in 3D.
Definition: cxToolRep3D.h:72
boost::shared_ptr< class VideoSourceGraphics > VideoSourceGraphicsPtr
Default implementation of Rep.
Definition: cxRepImpl.h:63
cxLogicManager_EXPORT SpaceProviderPtr spaceProvider()
boost::shared_ptr< class ProbeSector > ProbeSectorPtr
boost::shared_ptr< class GraphicalLine3D > GraphicalLine3DPtr
boost::shared_ptr< class ToolRep3D > ToolRep3DPtr
boost::shared_ptr< class Tool > ToolPtr