OpenIndy-Core  0.2.0.43
feature.h
Go to the documentation of this file.
1 #ifndef FEATURE_H
2 #define FEATURE_H
3 
4 #include <QObject>
5 #include <QPointer>
6 #include <QList>
7 #include <QString>
8 #include <QtXml>
9 
10 #include "element.h"
11 
12 namespace oi{
13 
14 class FeatureWrapper;
15 class Function;
16 
21 {
22  friend class OiJob;
23  friend class Feature;
24  Q_OBJECT
25 
26 public:
27  explicit Feature(QObject *parent = 0);
28 
29  Feature(const Feature &copy, QObject *parent = 0);
30 
31  Feature &operator=(const Feature &copy);
32 
33  virtual ~Feature();
34 
35  //############################################
36  //get the feature wrapped by a feature wrapper
37  //############################################
38 
39  const QPointer<FeatureWrapper> &getFeatureWrapper() const;
40 
41  //#############################
42  //get or set feature attributes
43  //#############################
44 
45  const QString &getFeatureName() const;
46  void setFeatureName(const QString &name);
47 
48  const QString &getGroupName() const;
49  void setGroupName(const QString &group);
50 
51  const QString &getComment() const;
52  void setComment(const QString &comment);
53 
54  const bool &getIsUpdated() const;
55  void setIsUpdated(const bool &isUpdated);
56 
57  const bool &getIsSolved() const;
58  void setIsSolved(const bool &isSolved);
59 
60  const QList<QPointer<Function> > &getFunctions() const;
61  void addFunction(const QPointer<Function> &function);
62  void removeFunction(const int &index);
63 
64  const bool &getIsActiveFeature() const;
65  void setActiveFeatureState(const bool &isActiveFeature);
66 
67  const QList<QPointer<FeatureWrapper> > &getUsedFor() const;
68  bool addUsedFor(const QPointer<FeatureWrapper> &feature);
69  bool removeUsedFor(const QPointer<FeatureWrapper> &feature);
70 
71  const QList<QPointer<FeatureWrapper> > &getPreviouslyNeeded() const;
72  bool addPreviouslyNeeded(const QPointer<FeatureWrapper> &feature);
73  bool removePreviouslyNeeded(const QPointer<FeatureWrapper> &feature);
74 
75  //###########################
76  //reexecute the function list
77  //###########################
78 
79  virtual void recalc();
80 
81  //#################
82  //save and load XML
83  //#################
84 
85  virtual QDomElement toOpenIndyXML(QDomDocument &xmlDoc) const;
86  virtual bool fromOpenIndyXML(QDomElement &xmlElem);
87 
88  //###############
89  //display methods
90  //###############
91 
92  //general attributes
93  virtual QString getDisplayType() const;
94  virtual QString getDisplayIsSolved() const;
95  virtual QString getDisplayIsUpdated() const;
96  virtual QString getDisplayFunctions() const;
97  virtual QString getDisplayUsedFor() const;
98  virtual QString getDisplayPreviouslyNeeded() const;
99  virtual QString getDisplayStDev(const UnitType &type, const int &digits) const;
100 
101  //geometry specific attributes
102  virtual QString getDisplayMeasurementConfig() const;
103  virtual QString getDisplayObservations() const;
104 
105  //unknown geometry parameters
106  virtual QString getDisplayX(const UnitType &type, const int &digits, const bool &showDiff = false) const;
107  virtual QString getDisplayY(const UnitType &type, const int &digits, const bool &showDiff = false) const;
108  virtual QString getDisplayZ(const UnitType &type, const int &digits, const bool &showDiff = false) const;
109  virtual QString getDisplayPrimaryI(const int &digits, const bool &showDiff = false) const;
110  virtual QString getDisplayPrimaryJ(const int &digits, const bool &showDiff = false) const;
111  virtual QString getDisplayPrimaryK(const int &digits, const bool &showDiff = false) const;
112  virtual QString getDisplayRadiusA(const UnitType &type, const int &digits, const bool &showDiff = false) const;
113  virtual QString getDisplayRadiusB(const UnitType &type, const int &digits, const bool &showDiff = false) const;
114  virtual QString getDisplaySecondaryI(const int &digits, const bool &showDiff = false) const;
115  virtual QString getDisplaySecondaryJ(const int &digits, const bool &showDiff = false) const;
116  virtual QString getDisplaySecondaryK(const int &digits, const bool &showDiff = false) const;
117  virtual QString getDisplayAperture(const UnitType &type, const int &digits, const bool &showDiff = false) const;
118  virtual QString getDisplayA(const UnitType &type, const int &digits, const bool &showDiff = false) const;
119  virtual QString getDisplayB(const UnitType &type, const int &digits, const bool &showDiff = false) const;
120  virtual QString getDisplayC(const UnitType &type, const int &digits, const bool &showDiff = false) const;
121  virtual QString getDisplayAngle(const UnitType &type, const int &digits, const bool &showDiff = false) const;
122  virtual QString getDisplayDistance(const UnitType &type, const int &digits, const bool &showDiff = false) const;
123  virtual QString getDisplayMeasurementSeries(const UnitType &type, const int &digits, const bool &showDiff = false) const;
124  virtual QString getDisplayTemperature(const UnitType &type, const int &digits, const bool &showDiff = false) const;
125  virtual QString getDisplayLength(const UnitType &type, const int &digits, const bool &showDiff = false) const;
126 
127  //coordinate system specific
128  virtual QString getDisplayExpansionOriginX(const UnitType &type, const int &digits) const;
129  virtual QString getDisplayExpansionOriginY(const UnitType &type, const int &digits) const;
130  virtual QString getDisplayExpansionOriginZ(const UnitType &type, const int &digits) const;
131  virtual QString getDisplayXAxisI(const int &digits) const;
132  virtual QString getDisplayXAxisJ(const int &digits) const;
133  virtual QString getDisplayXAxisK(const int &digits) const;
134  virtual QString getDisplayYAxisI(const int &digits) const;
135  virtual QString getDisplayYAxisJ(const int &digits) const;
136  virtual QString getDisplayYAxisK(const int &digits) const;
137  virtual QString getDisplayZAxisI(const int &digits) const;
138  virtual QString getDisplayZAxisJ(const int &digits) const;
139  virtual QString getDisplayZAxisK(const int &digits) const;
140 
141  //trafo param specific
142  virtual QString getDisplayStartSystem() const;
143  virtual QString getDisplayDestinationSystem() const;
144  virtual QString getDisplayTranslationX(const UnitType &type, const int &digits) const;
145  virtual QString getDisplayTranslationY(const UnitType &type, const int &digits) const;
146  virtual QString getDisplayTranslationZ(const UnitType &type, const int &digits) const;
147  virtual QString getDisplayRotationX(const UnitType &type, const int &digits) const;
148  virtual QString getDisplayRotationY(const UnitType &type, const int &digits) const;
149  virtual QString getDisplayRotationZ(const UnitType &type, const int &digits) const;
150  virtual QString getDisplayScaleX(const int &digits) const;
151  virtual QString getDisplayScaleY(const int &digits) const;
152  virtual QString getDisplayScaleZ(const int &digits) const;
153  virtual QString getDisplayIsUsed() const;
154  virtual QString getDisplayValidTime() const;
155  virtual QString getDisplayIsMovement() const;
156  virtual QString getDisplayIsDatumTransformation() const;
157 
158 signals:
159 
160  //#######################################
161  //signals to inform about feature changes
162  //#######################################
163 
164  void featureNameChanged(const int &featureId, const QString &oldName);
165  void featureGroupChanged(const int &featureId, const QString &oldGroup);
166  void featureCommentChanged(const int &featureId);
167  void featureIsUpdatedChanged(const int &featureId);
168  void featureIsSolvedChanged(const int &featureId);
169  void featureFunctionListChanged(const int &featureId);
170  void featureUsedForChanged(const int &featureId);
171  void featurePreviouslyNeededChanged(const int &featureId);
172  void featureIsActiveChanged(const int &featureId);
173 
174 protected:
175 
176  //######################################
177  //update feature id when the job was set
178  //######################################
179 
180  virtual void setUpFeatureId();
181 
182  //##################
183  //feature attributes
184  //##################
185 
186  QString name;
187  QString group;
188  QString comment;
189 
190  bool isSolved; //true of the feature is solved in the current disply system
191  bool isUpdated; //helper attribute to indicate if a feature was already recalced during recalculation process
192 
194 
195  QList< QPointer<Function> > functionList;
196 
197  QList< QPointer<FeatureWrapper> > usedForList; //features which need this feature to recalc
198  QMap<int, QPointer<FeatureWrapper> > usedForMap;
199  QList< QPointer<FeatureWrapper> > previouslyNeededList; //features which are needed to recalc this feature
200  QMap<int, QPointer<FeatureWrapper> > previouslyNeededMap;
201 
202  //######################################
203  //this pointer wrapped by FeatureWrapper
204  //######################################
205 
206  QPointer<FeatureWrapper> selfFeature;
207 
208  //#############################################
209  //pointer to OiJob that this feature belongs to
210  //#############################################
211 
212  virtual void setJob(const QPointer<OiJob> &job);
213 
214  QPointer<OiJob> job;
215 
216 };
217 
218 }
219 
220 Q_DECLARE_METATYPE( oi::Feature* )
221 
222 #endif // FEATURE_H
The Feature class.
Definition: feature.h:20
QMap< int, QPointer< FeatureWrapper > > usedForMap
Definition: feature.h:198
bool isUpdated
Definition: feature.h:191
The Element class.
Definition: element.h:17
QPointer< OiJob > job
Definition: feature.h:214
QString comment
Definition: feature.h:188
Definition: coordinatesystem.h:15
QList< QPointer< FeatureWrapper > > usedForList
Definition: feature.h:197
bool isSolved
Definition: feature.h:190
QList< QPointer< Function > > functionList
Definition: feature.h:195
QMap< int, QPointer< FeatureWrapper > > previouslyNeededMap
Definition: feature.h:200
QList< QPointer< FeatureWrapper > > previouslyNeededList
Definition: feature.h:199
QString group
Definition: feature.h:187
QPointer< FeatureWrapper > selfFeature
Definition: feature.h:206
QString name
Definition: feature.h:186
bool isActiveFeature
Definition: feature.h:193
UnitType
Definition: types.h:354
#define OI_CORE_EXPORT
Definition: types.h:11
The OiJob class Represents an OpenIndy job (holds all features and active states) ...
Definition: oijob.h:30