CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxSpaceProperty.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 #ifndef CXSPACEPROPERTY_H_
12 #define CXSPACEPROPERTY_H_
13 
14 
15 #include "cxResourceExport.h"
16 
17 #include <QDomElement>
18 #include <QStringList>
19 #include "cxSpacePropertyBase.h"
20 #include "cxXmlOptionItem.h"
21 
22 namespace cx
23 {
24 
25 typedef boost::shared_ptr<class SpaceProperty> SpacePropertyPtr;
26 
30 class cxResource_EXPORT SpaceProperty: public SpacePropertyBase
31 {
32 Q_OBJECT
33 public:
37  static SpacePropertyPtr initialize(const QString& uid, QString name, QString help, Space value=Space(),
38  std::vector<Space> range=std::vector<Space>(), QDomNode root = QDomNode());
39  void setSpaceProvider(SpaceProviderPtr provider);
40 
41 public:
42  // inherited interface
43  virtual QString getDisplayName() const;
44  virtual QString getUid() const;
45  virtual bool setValue(const Space& value);
46  virtual Space getValue() const;
47  virtual QString getHelp() const;
48  virtual void setHelp(QString val);
49  virtual std::vector<Space> getValueRange() const;
50  virtual void setValueRange(std::vector<Space> range);
51  virtual QString convertRefObjectInternal2Display(QString internal);
52  virtual void setRefObjectDisplayNames(std::map<QString, QString> names);
53 
54  virtual bool isReadOnly() const { return mIsReadOnly; }
55  virtual bool getAllowOnlyValuesInRange() const { return mAllowOnlyValuesInRange; }
56  void setReadOnly(bool val);
57 
58 
59 signals:
60  void valueWasSet();
61 
62 private slots:
63  void providerChangedSlot();
64 private:
65  SpaceProperty();
66  QString mName;
67  QString mUid;
68  QString mHelp;
69  Space mValue;
70  std::vector<Space> mRange;
71  XmlOptionItem mStore;
72  std::map<QString, QString> mDisplayNames;
73  bool mIsReadOnly;
74  bool mAllowOnlyValuesInRange;
75 
76  SpaceProviderPtr mProvider;
77 };
78 
79 // --------------------------------------------------------
80 // --------------------------------------------------------
81 
82 
83 } // namespace cx
84 
85 #endif // CXSPACEPROPERTY_H_
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
boost::shared_ptr< class SpaceProperty > SpacePropertyPtr
Helper class for storing one string value in an xml document.
CoordinateSystem Space
Identification of a Coordinate system.
virtual bool isReadOnly() const
virtual bool getAllowOnlyValuesInRange() const
Namespace for all CustusX production code.