CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxMeshTextureWidget.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 "cxMeshTextureWidget.h"
12 #include "cxMesh.h"
13 
14 
15 namespace cx
16 {
17 
18 MeshTextureWidget::MeshTextureWidget(SelectDataStringPropertyBasePtr meshSelector, PatientModelServicePtr patientModelService, ViewServicePtr viewService, QWidget* parent)
19  : BaseWidget(parent, "mesh_texture_widget", "Texture"),
20  mPatientModelService(patientModelService),
21  mViewService(viewService),
22  mMeshSelector(meshSelector)
23 {
24  QVBoxLayout* toptopLayout = new QVBoxLayout(this);
25  QGridLayout* gridLayout = new QGridLayout;
26  gridLayout->setMargin(0);
27  toptopLayout->addLayout(gridLayout);
28  mOptionsWidget = new OptionsWidget(mViewService, mPatientModelService,this);
29  toptopLayout->addWidget(mOptionsWidget);
30  toptopLayout->addStretch();
31 
32  this->clearUI();
33  connect(mMeshSelector.get(), &Property::changed, this, &MeshTextureWidget::meshSelectedSlot);
34  this->setModified();
35 }
36 
38 {
39 
40 }
41 
43 {
44  this->setupUI();
45 }
46 
48 {
49  if (mMesh == mMeshSelector->getData())
50  return;
51 
52  mMesh = boost::dynamic_pointer_cast<Mesh>(mMeshSelector->getData());
53 
54  this->setupUI();
55  mOptionsWidget->rebuild();
56 }
57 
58 void MeshTextureWidget::clearUI()
59 {
60  this->setModified();
61 }
62 
64 {
65  if (!mMesh)
66  return;
67 
68  std::vector<PropertyPtr> properties = mMesh->getTextureData().getProperties();
69  mOptionsWidget->setOptions(mMesh->getUid(), properties, true);
70 
71 }
72 
73 }//end namespace cx
A mesh data set.
Definition: cxMesh.h:45
boost::shared_ptr< class ViewService > ViewServicePtr
boost::shared_ptr< class SelectDataStringPropertyBase > SelectDataStringPropertyBasePtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
void changed()
emit when the underlying data value is changed: The user interface will be updated.
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
void setOptions(QString uid, std::vector< PropertyPtr > options, bool showAdvanced)
Namespace for all CustusX production code.