NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxTool.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 "cxTool.h"
13 
14 #include <vtkConeSource.h>
15 #include "cxToolNull.h"
16 #include "cxNullDeleter.h"
17 
18 namespace cx
19 {
21 {
22  vtkConeSourcePtr coneSource = vtkConeSourcePtr::New();
23  coneSource->SetResolution(25);
24  coneSource->SetRadius(10);
25  coneSource->SetHeight(100);
26 
27  coneSource->SetDirection(0, 0, 1);
28  double newCenter[3];
29  coneSource->GetCenter(newCenter);
30  newCenter[2] = newCenter[2] - coneSource->GetHeight() / 2;
31  coneSource->SetCenter(newCenter);
32 
33  coneSource->Update();
34  return coneSource->GetOutput();
35 }
36 
37 Tool::Tool(const QString &uid, const QString &name) :
38  mUid(uid), mName(name)
39 {
40  if (name.isEmpty())
41  mName = uid;
42 }
43 
45 {
46  static ToolPtr mNull;
47  if (!mNull)
48  mNull.reset(new ToolNull, null_deleter());
49  return mNull;
50 }
51 
53 {
54  return mData.trimmed();
55  // return mData.toElement().ownerDocument().toString();
56 }
57 
58 } //cx
59 
cx::null_deleter
Definition: cxNullDeleter.h:8
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::ToolNull
Definition: cxToolNull.h:23
cxNullDeleter.h
cx::Tool::getNullObject
static ToolPtr getNullObject()
Definition: cxTool.cpp:44
vtkConeSourcePtr
vtkSmartPointer< class vtkConeSource > vtkConeSourcePtr
Definition: vtkForwardDeclarations.h:45
cxTool.h
cxToolNull.h
cx::vtkPolyDataPtr
vtkSmartPointer< vtkPolyData > vtkPolyDataPtr
Definition: cxCenterlineRegistration.h:42
cx::Tool::Tool
Tool(const QString &uid="", const QString &name="")
Definition: cxTool.cpp:37
cx::ToolPtr
boost::shared_ptr< class Tool > ToolPtr
Definition: cxVideoConnectionWidget.h:43
cx::Tool::createDefaultPolyDataCone
static vtkPolyDataPtr createDefaultPolyDataCone()
Definition: cxTool.cpp:20
cx::Tool::mName
QString mName
Definition: cxTool.h:150
cx::ToolPositionMetadata::toString
QString toString() const
Definition: cxTool.cpp:52
cx::ToolPositionMetadata::mData
QString mData
Definition: cxTool.h:45