CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxSphereMetricRep.cpp
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 #include "cxSphereMetricRep.h"
13 
14 #include "cxView.h"
15 
16 #include <vtkVectorText.h>
17 #include <vtkFollower.h>
18 #include <vtkPolyDataMapper.h>
19 #include <vtkProperty.h>
20 #include <vtkRenderer.h>
21 #include <vtkCamera.h>
22 #include <vtkRenderWindow.h>
23 #include "cxTypeConversions.h"
24 #include "vtkTextActor.h"
25 #include "cxGraphicalPrimitives.h"
26 #include "cxSphereMetric.h"
27 #include "cxGraphicalPrimitives.h"
28 
29 namespace cx
30 {
31 
33 {
34  return wrap_new(new SphereMetricRep(), uid);
35 }
36 
37 SphereMetricRep::SphereMetricRep()
38 {
39 }
40 
42 {
44  mGraphicalPoint.reset();
45 }
46 
47 SphereMetricPtr SphereMetricRep::getSphereMetric()
48 {
49  return boost::dynamic_pointer_cast<SphereMetric>(mMetric);
50 }
51 
53 {
54  if (!mMetric)
55  return;
56 
57  if (!mGraphicalPoint && this->getView() && mMetric)
58  mGraphicalPoint.reset(new GraphicalPoint3D(this->getRenderer()));
59 
60  if (!mGraphicalPoint)
61  return;
62 
63  mGraphicalPoint->setValue(mMetric->getRefCoord());
64  mGraphicalPoint->setRadius(this->getSphereMetric()->getRadius());
65  mGraphicalPoint->setColor(mMetric->getColor());
66 
67  this->drawText();
68 }
69 
70 }
ViewPtr getView() const
Definition: cxRepImpl.cpp:83
vtkRendererPtr getRenderer()
Definition: cxRepImpl.cpp:88
virtual void clear()
static boost::shared_ptr< REP > wrap_new(REP *object, QString uid)
Definition: cxRepImpl.h:62
boost::shared_ptr< class SphereMetric > SphereMetricPtr
virtual void onModifiedStartRender()
Helper for rendering a point in 3D.
Data class that represents a donut.
boost::shared_ptr< class SphereMetricRep > SphereMetricRepPtr
DataMetricPtr mMetric
static SphereMetricRepPtr New(const QString &uid="")
Namespace for all CustusX production code.