CustusX  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 
static ToolPtr getNullObject()
Definition: cxTool.cpp:44
QString mUid
Definition: cxTool.h:149
QString mName
Definition: cxTool.h:150
Tool(const QString &uid="", const QString &name="")
Definition: cxTool.cpp:37
vtkSmartPointer< vtkPolyData > vtkPolyDataPtr
vtkSmartPointer< class vtkConeSource > vtkConeSourcePtr
static vtkPolyDataPtr createDefaultPolyDataCone()
Definition: cxTool.cpp:20
QString toString() const
Definition: cxTool.cpp:52
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr