CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxGraphicalDisk.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 #ifndef CXGRAPHICALDISK_H
12 #define CXGRAPHICALDISK_H
13 
14 #include "cxResourceVisualizationExport.h"
15 
16 #include <boost/shared_ptr.hpp>
17 #include "vtkForwardDeclarations.h"
18 #include "cxVector3D.h"
19 #include <QColor>
20 typedef vtkSmartPointer<class vtkLinearExtrusionFilter> vtkLinearExtrusionFilterPtr;
21 
22 namespace cx
23 {
24 
32 class cxResourceVisualization_EXPORT GraphicalDisk
33 {
34 public:
35  GraphicalDisk();
36  void setRenderer(vtkRendererPtr renderer = vtkRendererPtr());
37  ~GraphicalDisk();
38  void setRadius(double radius);
39  void setOutlineColor(QColor color);
40  void setOutlineWidth(double width);
41  void setColor(QColor color);
42  void setFillVisible(bool val);
43  void setLighting(bool on);
44  void setHeight(double height);
45 
46  void setPosition(Vector3D pos);
47  void setDirection(Vector3D direction);
48 
49  void update();
50 
51  void setRadiusBySlicingSphere(double sphereRadius, double sliceHeight);
52 
53 private:
54  void createActors();
55  void addActors();
56  void removeActors();
57  void updateOrientation();
58  double getRadiusOfCircleSlicedFromSphere(double sphereRadius, double sliceHeight) const;
59 
60  vtkRendererPtr mRenderer;
61 
62  double mRadius;
63  double mHeight;
64  Vector3D mPosition;
65  Vector3D mDirection;
66 
67  vtkActorPtr mCircleActor;
68  vtkLinearExtrusionFilterPtr mCircleExtruder;
69  vtkSectorSourcePtr mCircleSource;
70  vtkActorPtr mOutlineActor;
71  vtkLinearExtrusionFilterPtr mOutlineExtruder;
72  vtkSectorSourcePtr mOutlineSource;
73  double mOutlineWidth;
74  QColor mOutlineColor;
75  QColor mColor;
76  bool mFillVisible;
77  bool mUseLighting;
78 };
79 typedef boost::shared_ptr<GraphicalDisk> GraphicalDiskPtr;
80 
81 
82 
83 } // namespace cx
84 
85 
86 
87 #endif // CXGRAPHICALDISK_H
vtkSmartPointer< class vtkActor > vtkActorPtr
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
vtkSmartPointer< class vtkSectorSource > vtkSectorSourcePtr
vtkSmartPointer< class vtkLinearExtrusionFilter > vtkLinearExtrusionFilterPtr
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
boost::shared_ptr< GraphicalDisk > GraphicalDiskPtr
Namespace for all CustusX production code.