CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkLinearValueProxy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkLinearValueProxy_h
22 #define __ctkLinearValueProxy_h
23 
24 // CTK includes
25 #include "ctkCoreExport.h"
26 #include "ctkValueProxy.h"
27 #include "ctkPimpl.h"
28 
29 class ctkLinearValueProxyPrivate;
30 
40 class CTK_CORE_EXPORT ctkLinearValueProxy : public ctkValueProxy
41 {
42  Q_OBJECT
43  Q_PROPERTY(double coefficient READ coefficient WRITE setCoefficient)
44  Q_PROPERTY(double offset READ offset WRITE setOffset)
45 
46 public:
48  explicit ctkLinearValueProxy(QObject* parent = 0);
50 
51  virtual double proxyValueFromValue(double value) const;
52 
53  virtual double valueFromProxyValue(double proxyValue) const;
54 
55  virtual double coefficient() const;
56  virtual double offset() const;
57 
58 public Q_SLOTS:
59  virtual void setCoefficient(double newCoeff);
60  virtual void setOffset(double newOffset);
61 
62 protected:
63  QScopedPointer<ctkLinearValueProxyPrivate> d_ptr;
64 
65 private:
66  Q_DECLARE_PRIVATE(ctkLinearValueProxy);
67  Q_DISABLE_COPY(ctkLinearValueProxy);
68 };
69 
70 #endif
Implementation of an affine value proxy. The ctkLinearValueProxy takes a coefficient and an offset,...
ctkLinearValueProxy(QObject *parent=0)
virtual double coefficient() const
virtual void setCoefficient(double newCoeff)
QScopedPointer< ctkLinearValueProxyPrivate > d_ptr
virtual double valueFromProxyValue(double proxyValue) const
virtual ~ctkLinearValueProxy()
virtual double offset() const
virtual double proxyValueFromValue(double value) const
virtual void setOffset(double newOffset)
Base class for value proxies. Value proxy allows to decouple the displayed value from the values acce...
Definition: ctkValueProxy.h:47