NorMIT-nav  2023.01.05-dev+develop.0da12
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_ */
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxDoubleRange.h
cxDoublePropertyBase.h
cxXmlOptionItem.h
cx::DoubleProperty
Definition: cxDoubleProperty.h:48
cx::DoublePropertyPtr
boost::shared_ptr< class DoubleProperty > DoublePropertyPtr
Definition: cxReconstructionMethodService.h:33
cx::XmlOptionItem
Helper class for storing one string value in an xml document.
Definition: cxXmlOptionItem.h:38
cx::DoublePropertyBase
Definition: cxDoublePropertyBase.h:70
cx::DoubleRange
Utility class for describing a bounded numeric range.
Definition: cxDoubleRange.h:32