Fraxinus  16.5.0-fx-rc4
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
34 #include "cxImage.h"
35 #include "cxActiveData.h"
36 
37 namespace cx
38 {
40  mActiveData(activeData)
41 {
43  connect(mActiveImageProxy.get(), &ActiveImageProxy::activeImageChanged, this, &DoublePropertyShadingBase::activeImageChanged);
45  this->activeImageChanged();
46 }
47 
48 void DoublePropertyShadingBase::activeImageChanged()
49 {
50  mImage = mActiveData->getActive<Image>();
51  emit changed();
52 }
53 
55  DoublePropertyShadingBase(activeData)
56 {
57 }
58 
60 {
61  if (!mImage)
62  return 0.0;
63  return mImage->getShadingAmbient();
64 }
65 
67 {
68  if (!mImage)
69  return false;
70  if (similar(val, mImage->getShadingAmbient()))
71  return false;
72  mImage->setShadingAmbient(val);
73  return true;
74 }
75 
76 
78  DoublePropertyShadingBase(activeData)
79 {
80 
81 }
82 
84 {
85  if (!mImage)
86  return 0.0;
87  return mImage->getShadingDiffuse();
88 }
90 {
91  if (!mImage)
92  return false;
93  if (similar(val, mImage->getShadingDiffuse()))
94  return false;
95  mImage->setShadingDiffuse(val);
96  return true;
97 }
98 
99 
101  DoublePropertyShadingBase(activeData)
102 {
103 }
104 
106 {
107  if (!mImage)
108  return 0.0;
109  return mImage->getShadingSpecular();
110 }
112 {
113  if (!mImage)
114  return false;
115  if (similar(val, mImage->getShadingSpecular()))
116  return false;
117  mImage->setShadingSpecular(val);
118  return true;
119 }
120 
121 
123  DoublePropertyShadingBase(activeData)
124 {
125 }
126 
128 {
129  if (!mImage)
130  return 0.0;
131  return mImage->getShadingSpecularPower();
132 }
134 {
135  if (!mImage)
136  return false;
137  if (similar(val, mImage->getShadingSpecularPower()))
138  return false;
139  mImage->setShadingSpecularPower(val);
140  return true;
141 }
142 
143 
144 }// namespace cx
145 
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:42
virtual bool setValue(double val)
set the data value.
virtual double getValue() const
get the data value.
DoublePropertyShadingSpecular(ActiveDataPtr activeData)
void transferFunctionsChanged()
bool similar(const DoubleBoundingBox3D &a, const DoubleBoundingBox3D &b, double tol)
DoublePropertyShadingBase(ActiveDataPtr activeData)
static ActiveImageProxyPtr New(ActiveDataPtr activeData)
A volumetric data set.
Definition: cxImage.h:66
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.
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)