CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxFrameMetricRep.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 "cxFrameMetricRep.h"
13 
14 #include "cxView.h"
15 #include "boost/bind.hpp"
16 #include "cxGraphicalAxes3D.h"
17 
18 namespace cx
19 {
20 
22 {
23  return wrap_new(new FrameMetricRep(), uid);
24 }
25 
26 FrameMetricRep::FrameMetricRep()
27 {
28 }
29 
31 {
32  mAxes.reset();
34 }
35 
36 FrameMetricPtr FrameMetricRep::getFrameMetric()
37 {
38  return boost::dynamic_pointer_cast<FrameMetric>(mMetric);
39 }
40 
42 {
43  FrameMetricPtr metric = this->getFrameMetric();
44 
45  if (!metric || !metric->isValid() || !this->getView())
46  return;
47 
48  if (!mAxes)
49  {
50  mAxes.reset(new GraphicalAxes3D());
51  mAxes->setFontSize(0.04);
52  mAxes->setAxisLength(0.05);
53  mAxes->setShowAxesLabels(false);
54  mAxes->setRenderer(this->getRenderer());
55  }
56 
57  mAxes->setTransform(metric->getRefFrame());
58  this->drawText();
59 }
60 
61 } // namespace cx
ViewPtr getView() const
Definition: cxRepImpl.cpp:83
vtkRendererPtr getRenderer()
Definition: cxRepImpl.cpp:88
boost::shared_ptr< class FrameMetric > FrameMetricPtr
Definition: cxFrameMetric.h:23
Visualization for one 3D coordinate axis triplet.
virtual void clear()
static boost::shared_ptr< REP > wrap_new(REP *object, QString uid)
Definition: cxRepImpl.h:62
Data class that represents a single frame (transform).
Definition: cxFrameMetric.h:33
static FrameMetricRepPtr New(const QString &uid="")
virtual void clear()
boost::shared_ptr< class FrameMetricRep > FrameMetricRepPtr
virtual void onModifiedStartRender()
DataMetricPtr mMetric
Namespace for all CustusX production code.