CustusX  22.04-rc5
An IGT application
cxDoublePairProperty.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 #ifndef CXDOUBLEPAIRPROPERTY_H_
13 #define CXDOUBLEPAIRPROPERTY_H_
14 
15 #include "cxResourceExport.h"
16 
18 #include "cxXmlOptionItem.h"
19 
20 namespace cx
21 {
22 typedef boost::shared_ptr<class DoublePairProperty> DoublePairPropertyPtr;
23 
40 class cxResource_EXPORT DoublePairProperty : public DoublePairPropertyBase
41 {
42 Q_OBJECT
43 public:
47  static DoublePairPropertyPtr initialize(const QString& uid, QString name, QString help,
48  DoubleRange range, int decimals, QDomNode root = QDomNode());
49  void setInternal2Display(double factor);
50 
51 public:
52  // inherited interface
53  virtual QString getDisplayName() const;
54  virtual QString getUid() const;
55  virtual bool setValue(const Eigen::Vector2d& value);
56  virtual Eigen::Vector2d getValue() const;
57  virtual QString getHelp() const;
58  virtual DoubleRange getValueRange() const;
59  virtual void setValueRange(DoubleRange range);
60  virtual int getValueDecimals() const;
61  virtual double convertInternal2Display(double internal)
62  {
63  return mFactor * internal;
64  }
65  virtual double convertDisplay2Internal(double display)
66  {
67  return display / mFactor;
68  }
69 
70 
71 signals:
72  void valueWasSet();
73 
74 private:
76  QString mName;
77  QString mUid;
78  QString mHelp;
79  Eigen::Vector2d mValue;
80  double mDecimals;
81  DoubleRange mRange;
82  XmlOptionItem mStore;
83  double mFactor;
84 };
85 
86 } // namespace cx
87 #endif // CXDOUBLEPAIRPROPERTY_H_
Utility class for describing a bounded numeric range.
Definition: cxDoubleRange.h:32
virtual double convertDisplay2Internal(double display)
conversion from internal value to display value
Helper class for storing one string value in an xml document.
Implementation of DoublePairPropertyBase.
boost::shared_ptr< class DoublePairProperty > DoublePairPropertyPtr
Abstract interface for interaction with internal data structure: A pair of doubles.
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.