NorMIT-nav  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
cx::MeshTextureWidget::~MeshTextureWidget
virtual ~MeshTextureWidget()
Definition: cxMeshTextureWidget.cpp:37
cx::OptimizedUpdateWidget::setModified
virtual void setModified()
Definition: cxOptimizedUpdateWidget.cpp:36
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::MeshTextureWidget::setupUI
void setupUI()
Definition: cxMeshTextureWidget.cpp:63
cx::BaseWidget
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
cx::Property::changed
void changed()
emit when the underlying data value is changed: The user interface will be updated.
cx::PatientModelServicePtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Definition: cxLogicManager.h:25
cx::ViewServicePtr
boost::shared_ptr< class ViewService > ViewServicePtr
Definition: cxLogicManager.h:28
cx::MeshTextureWidget::prePaintEvent
virtual void prePaintEvent()
Definition: cxMeshTextureWidget.cpp:42
cxMeshTextureWidget.h
cx::OptionsWidget::setOptions
void setOptions(QString uid, std::vector< PropertyPtr > options, bool showAdvanced)
Definition: cxOptionsWidget.cpp:37
cx::OptionsWidget::rebuild
void rebuild()
Definition: cxOptionsWidget.cpp:60
cx::MeshTextureWidget::meshSelectedSlot
void meshSelectedSlot()
Definition: cxMeshTextureWidget.cpp:47
cxMesh.h
cx::OptionsWidget
Definition: cxOptionsWidget.h:31
cx::SelectDataStringPropertyBasePtr
boost::shared_ptr< class SelectDataStringPropertyBase > SelectDataStringPropertyBasePtr
Definition: cxMeshGlyphsWidget.h:26