15 #include "boost/bind.hpp" 18 #include <vtkPolyDataMapper.h> 19 #include <vtkProperty.h> 20 #include <vtkRenderer.h> 21 #include <vtkSectorSource.h> 37 mDataManager(dataManager),
47 this->
getView()->getRenderer()->RemoveActor(mCircleActor);
57 mCircleSource = vtkSectorSource::New();
59 mCircleSource->SetInnerRadius(0);
60 mCircleSource->SetStartAngle(0);
61 mCircleSource->SetEndAngle(360);
62 mCircleSource->SetCircumferentialResolution(60);
64 mapper->SetInputConnection(mCircleSource->GetOutputPort());
65 mapper->ScalarVisibilityOff();
66 mCircleActor = vtkActor::New();
67 mCircleActor->SetMapper(mapper);
68 mCircleActor->GetProperty()->LightingOff();
75 if (!mSliceProxy->getTool())
80 double toolOffset = mSliceProxy->getTool()->getTooltipOffset();
81 Transform3D rMt = mDataManager->get_rMpr()*mSliceProxy->getTool()->get_prMt();
86 Vector3D position = mSliceProxy->get_sMr() * centerRef;
87 mCircleActor->SetPosition(position[0], position[1], 0);
89 const double margin = 10;
90 double offsetDistance = (
mMetric->getRefCoord() - toolOffsetPosRef).
length();
91 double distance = (
mMetric->getRefCoord() - toolPosRef).
length();
92 double radius = 0.5 * offsetDistance + margin;
93 mCircleSource->SetOuterRadius(radius);
94 mCircleSource->SetInnerRadius(radius - mOutlineWidth);
96 if (distance < mRequestedAccuracy)
98 mCircleActor->GetProperty()->SetColor(0, 1, 1);
100 else if (offsetDistance < mRequestedAccuracy && toolOffset >= 0 && distance < 4*mRequestedAccuracy)
102 mCircleActor->GetProperty()->SetColor(0, 1, 1.0 - (distance-mRequestedAccuracy)/(3*mRequestedAccuracy));
104 else if (offsetDistance < mRequestedAccuracy && toolOffset >= 0)
106 mCircleActor->GetProperty()->SetColor(0, 1, 0);
110 mCircleActor->GetProperty()->SetColor(1, 0, 0);
119 mSliceProxy = sliceProxy;
127 mOutlineWidth = width;
133 mRequestedAccuracy = accuracy;
vtkRendererPtr getRenderer()
static GuideRep2DPtr New(PatientModelServicePtr dataManager, const QString &uid="")
void setOutlineWidth(double width)
vtkSmartPointer< class vtkPolyDataMapper > vtkPolyDataMapperPtr
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
static boost::shared_ptr< REP > wrap_new(REP *object, QString uid)
void setRequestedAccuracy(double accuracy)
boost::shared_ptr< class GuideRep2D > GuideRep2DPtr
virtual void onModifiedStartRender()
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
RealScalar length() const
void setSliceProxy(SliceProxyPtr slicer)
Namespace for all CustusX production code.