NorMIT-nav  22.09
An IGT application
cxMeshInView.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 #include "cxMeshInView.h"
12 
13 #include "cxMesh.h"
14 #include "cxGeometricRep.h"
15 #include "cxViewService.h"
16 #include "cxView.h"
17 #include "cxLogger.h"
18 
19 namespace cx
20 {
21 
22 MeshInView::MeshInView(ViewServicePtr viewService) : mViewService(viewService)
23 {
24 
25 }
27 {
28  this->hide();
29 }
30 
32 {
33  if (!mRep)
34  {
35  MeshPtr mesh(new Mesh("mesh", "mesh"));
36  mesh->setColor(QColor("cornflowerblue"));
37 
38  mRep = GeometricRep::New();
39  mRep->setMesh(mesh);
40 
41  ViewPtr view = mViewService->get3DView();
42  if (view)
43  view->addRep(mRep);
44  }
45 
46  mRep->getMesh()->setVtkPolyData(polyData);
47 }
48 
50 {
51  ViewPtr view = mViewService->get3DView();
52  if (view)
53  view->removeRep(mRep);
54  mRep.reset();
55 }
56 
57 } // namespace cx
cxLogger.h
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::MeshInView::hide
void hide()
Definition: cxMeshInView.cpp:49
cx::MeshInView::show
void show(vtkPolyDataPtr polyData)
Definition: cxMeshInView.cpp:31
cx::MeshInView::MeshInView
MeshInView(ViewServicePtr viewService)
Definition: cxMeshInView.cpp:22
cxGeometricRep.h
cxMeshInView.h
cx::MeshInView::~MeshInView
~MeshInView()
Definition: cxMeshInView.cpp:26
cx::MeshPtr
boost::shared_ptr< class Mesh > MeshPtr
Definition: cxForwardDeclarations.h:48
cxViewService.h
cx::ViewServicePtr
boost::shared_ptr< class ViewService > ViewServicePtr
Definition: cxLogicManager.h:28
cxView.h
cx::vtkPolyDataPtr
vtkSmartPointer< vtkPolyData > vtkPolyDataPtr
Definition: cxCenterlineRegistration.h:42
cx::ViewPtr
boost::shared_ptr< class View > ViewPtr
Definition: cxForwardDeclarations.h:110
cx::Mesh
A mesh data set.
Definition: cxMesh.h:45
cx::GeometricRep::New
static GeometricRepPtr New(const QString &uid="")
Definition: cxGeometricRep.cpp:184
cxMesh.h