CustusX  18.04
An IGT application
cxDoubleProperty.h
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 
12 
13 /*
14  * sscDoubleProperty.h
15  *
16  * Created on: Jun 27, 2010
17  * Author: christiana
18  */
19 
20 #ifndef CXDOUBLEPROPERTY_H_
21 #define CXDOUBLEPROPERTY_H_
22 
23 #include "cxResourceExport.h"
24 
25 #include <QDomElement>
26 #include <QStringList>
27 #include "cxDoubleRange.h"
28 #include "cxDoublePropertyBase.h"
29 #include "cxXmlOptionItem.h"
30 
31 namespace cx
32 {
33 
34 typedef boost::shared_ptr<class DoubleProperty> DoublePropertyPtr;
35 
48 class cxResource_EXPORT DoubleProperty: public DoublePropertyBase
49 {
50 
51  Q_OBJECT
52 public:
56  static DoublePropertyPtr initialize(const QString& uid, QString name, QString help, double value, DoubleRange range, int decimals, QDomNode root = QDomNode());
57  void setInternal2Display(double factor);
58 
59 public:
60  // inherited interface
61  virtual QString getDisplayName() const;
62  virtual QString getUid() const;
63  virtual bool setValue(double value);
64  virtual double getValue() const;
65  virtual QString getHelp() const;
66  virtual DoubleRange getValueRange() const;
67  virtual void setValueRange(DoubleRange range);
68  virtual int getValueDecimals() const;
69  virtual double convertInternal2Display(double internal)
70  {
71  return mFactor * internal;
72  }
73  virtual double convertDisplay2Internal(double display)
74  {
75  return display / mFactor;
76  }
77 
78 
79 signals:
80  void valueWasSet();
81 
82 private:
84  QString mName;
85  QString mUid;
86  QString mHelp;
87  double mValue;
88  double mDecimals;
89  DoubleRange mRange;
90  XmlOptionItem mStore;
91  double mFactor;
92 };
93 
94 } // namespace cx
95 
96 #endif /* CXDOUBLEPROPERTY_H_ */
Utility class for describing a bounded numeric range.
Definition: cxDoubleRange.h:32
Helper class for storing one string value in an xml document.
boost::shared_ptr< class DoubleProperty > DoublePropertyPtr
virtual double convertDisplay2Internal(double display)
conversion from internal value to display value
virtual double convertInternal2Display(double internal)
conversion from internal value to display value (for example between 0..1 and percent) ...
Namespace for all CustusX production code.