CustusX  22.04-rc5
An IGT application
cxShadingParamsInterfaces.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 
13 #include "cxImage.h"
14 #include "cxActiveData.h"
15 
16 namespace cx
17 {
19  mActiveData(activeData)
20 {
22  connect(mActiveImageProxy.get(), &ActiveImageProxy::activeImageChanged, this, &DoublePropertyShadingBase::activeImageChanged);
24  this->activeImageChanged();
25 }
26 
27 void DoublePropertyShadingBase::activeImageChanged()
28 {
29  mImage = mActiveData->getActive<Image>();
30  emit changed();
31 }
32 
34  DoublePropertyShadingBase(activeData)
35 {
36 }
37 
39 {
40  if (!mImage)
41  return 0.0;
42  return mImage->getShadingAmbient();
43 }
44 
46 {
47  if (!mImage)
48  return false;
49  if (similar(val, mImage->getShadingAmbient()))
50  return false;
51  mImage->setShadingAmbient(val);
52  return true;
53 }
54 
55 
57  DoublePropertyShadingBase(activeData)
58 {
59 
60 }
61 
63 {
64  if (!mImage)
65  return 0.0;
66  return mImage->getShadingDiffuse();
67 }
69 {
70  if (!mImage)
71  return false;
72  if (similar(val, mImage->getShadingDiffuse()))
73  return false;
74  mImage->setShadingDiffuse(val);
75  return true;
76 }
77 
78 
80  DoublePropertyShadingBase(activeData)
81 {
82 }
83 
85 {
86  if (!mImage)
87  return 0.0;
88  return mImage->getShadingSpecular();
89 }
91 {
92  if (!mImage)
93  return false;
94  if (similar(val, mImage->getShadingSpecular()))
95  return false;
96  mImage->setShadingSpecular(val);
97  return true;
98 }
99 
100 
102  DoublePropertyShadingBase(activeData)
103 {
104 }
105 
107 {
108  if (!mImage)
109  return 0.0;
110  return mImage->getShadingSpecularPower();
111 }
113 {
114  if (!mImage)
115  return false;
116  if (similar(val, mImage->getShadingSpecularPower()))
117  return false;
118  mImage->setShadingSpecularPower(val);
119  return true;
120 }
121 
122 
123 }// namespace cx
124 
virtual double getValue() const
get the data value.
virtual bool setValue(double val)
set the data value.
virtual bool setValue(double val)
set the data value.
DoublePropertyShadingDiffuse(ActiveDataPtr activeData)
boost::shared_ptr< class ActiveData > ActiveDataPtr
Definition: cxColorWidget.h:21
virtual bool setValue(double val)
set the data value.
virtual double getValue() const
get the data value.
DoublePropertyShadingSpecular(ActiveDataPtr activeData)
void transferFunctionsChanged()
DoublePropertyShadingBase(ActiveDataPtr activeData)
static ActiveImageProxyPtr New(ActiveDataPtr activeData)
A volumetric data set.
Definition: cxImage.h:45
virtual bool setValue(double val)
set the data value.
void changed()
emit when the underlying data value is changed: The user interface will be updated.
virtual double getValue() const
get the data value.
bool similar(const CameraInfo &lhs, const CameraInfo &rhs, double tol)
virtual double getValue() const
get the data value.
DoublePropertyShadingAmbient(ActiveDataPtr activeData)
void activeImageChanged(const QString &uid)
The original image changed signal from DataManager.
DoublePropertyShadingSpecularPower(ActiveDataPtr activeData)
Namespace for all CustusX production code.