OpenIndy-Core  0.2.0.43
coordinatesystem.h
Go to the documentation of this file.
1 #ifndef COORDINATESYSTEM_H
2 #define COORDINATESYSTEM_H
3 
4 #include <QObject>
5 #include <QList>
6 #include <QPointer>
7 
8 #include "feature.h"
9 #include "position.h"
10 #include "direction.h"
11 
12 class TrafoController;
13 class ProjectExchanger;
14 
15 namespace oi{
16 
17 class Observation;
18 class TrafoParam;
19 class Geometry;
20 class Station;
21 
26 {
27  friend class Station;
28  friend class OiJob;
29  friend class TrafoController;
30  friend class ProjectExchanger;
31  friend class Observation;
32  Q_OBJECT
33 
34 public:
35  explicit CoordinateSystem(QObject *parent = 0);
36  explicit CoordinateSystem(const QPointer<Station> &station, QObject *parent = 0);
37 
38  CoordinateSystem(const CoordinateSystem &copy, QObject *parent = 0);
39 
40  CoordinateSystem &operator=(const CoordinateSystem &copy);
41 
43 
44  //#######################################
45  //get or set coordinate system attributes
46  //#######################################
47 
48  const bool &getIsActiveCoordinateSystem() const;
49  void setActiveCoordinateSystemState(const bool &isActiveCoordinateSystem);
50 
51  const bool &getIsStationSystem() const;
52  const QPointer<Station> &getStation() const;
53 
54  const Position &getOrigin() const;
55  const Direction &getXAxis() const;
56  const Direction &getYAxis() const;
57  const Direction &getZAxis() const;
58 
59  void setCoordinateSystem(const Position &origin, const Direction &xAxis, const Direction &yAxis, const Direction &zAxis);
60 
61  const Position &getExpansionOrigin() const;
62  void setExpansionOrigin(const Position &expansionOrigin);
63 
64  //##################################################
65  //get or set observations, trafo params and nominals
66  //##################################################
67 
68  const QList<QPointer<Observation> > &getObservations() const;
69  QPointer<Observation> getObservation(const int &observationId) const;
70  bool addObservation(const QPointer<Observation> &observation);
71 
72  const QList<QPointer<TrafoParam> > &getTransformationParameters() const;
73  const QList<QPointer<TrafoParam> > getTransformationParameters(const QPointer<CoordinateSystem> &to) const;
74  bool addTransformationParameter(const QPointer<TrafoParam> &trafoParam);
75  bool removeTransformationParameter(const QPointer<TrafoParam> &trafoParam);
76 
77  const QList<QPointer<FeatureWrapper> > &getNominals() const;
78  bool addNominal(const QPointer<FeatureWrapper> &nominal);
79  bool addNominals(const QList< QPointer<FeatureWrapper> > &nominals);
80  bool removeNominal(const QPointer<FeatureWrapper> &nominal);
81  bool removeNominal(const int &featureId);
82 
83  //###########################
84  //reexecute the function list
85  //###########################
86 
87  void recalc();
88 
89  //#################
90  //save and load XML
91  //#################
92 
93  QDomElement toOpenIndyXML(QDomDocument &xmlDoc);
94  bool fromOpenIndyXML(QDomElement &xmlElem);
95 
96  //###############
97  //display methods
98  //###############
99 
100  QString getDisplayX(const UnitType &type, const int &digits, const bool &showDiff = false) const;
101  QString getDisplayY(const UnitType &type, const int &digits, const bool &showDiff = false) const;
102  QString getDisplayZ(const UnitType &type, const int &digits, const bool &showDiff = false) const;
103 
104  QString getDisplayExpansionOriginX(const UnitType &type, const int &digits) const;
105  QString getDisplayExpansionOriginY(const UnitType &type, const int &digits) const;
106  QString getDisplayExpansionOriginZ(const UnitType &type, const int &digits) const;
107  QString getDisplayXAxisI(const int &digits) const;
108  QString getDisplayXAxisJ(const int &digits) const;
109  QString getDisplayXAxisK(const int &digits) const;
110  QString getDisplayYAxisI(const int &digits) const;
111  QString getDisplayYAxisJ(const int &digits) const;
112  QString getDisplayYAxisK(const int &digits) const;
113  QString getDisplayZAxisI(const int &digits) const;
114  QString getDisplayZAxisJ(const int &digits) const;
115  QString getDisplayZAxisK(const int &digits) const;
116 
117 signals:
118 
119  //#################################################
120  //signals to inform about coordinate system changes
121  //#################################################
122 
123  void observationsChanged(const int &coordId, const int &obsId);
124  void transformationParametersChanged(const int &coordId);
125  void nominalsChanged(const int &coordId);
126  void activeCoordinateSystemChanged(const int &coordId);
127 
128 protected:
129 
130  //######################################
131  //update feature id when the job was set
132  //######################################
133 
134  void setUpFeatureId();
135 
136 private slots:
137 
138  //##############
139  //helper methods
140  //##############
141 
142  void removeObservation(const QPointer<Observation> &obs);
143 
144 private:
145 
146  //####################################
147  //general coordinate system attributes
148  //####################################
149 
150  Position origin; //origin of the coordinate system in the current display coordinate system
151 
152  Direction xAxis; //x axis of the coordinate system in the current display coordinate system
153  Direction yAxis; //y axis of the coordinate system in the current display coordinate system
154  Direction zAxis; //z axis of the coordinate system in the current display coordinate system
155 
156  bool isStationSystem; //true if the coordinate system is a station system
157 
158  bool isActiveCoordinateSystem;
159 
160  Position expansionOrigin; //represents the point from which the Part object expands with temperature
161 
162  QPointer<Station> station; //holds the station object (only if this is a station system)
163 
164  //#######################################
165  //observations, trafo params and nominals
166  //#######################################
167 
168  QList< QPointer<Observation> > observationsList;
169  QMap< int, QPointer<Observation> > observationsMap; //same observations but id as key
170 
171  QList< QPointer<TrafoParam> > trafoParams;
172 
173  QList< QPointer<FeatureWrapper> > nominalsList;
174  QMap< int, QPointer<FeatureWrapper> > nominalsMap; //same geometries but id as key
175 
176 };
177 
178 }
179 
180 #endif // COORDINATESYSTEM_H
The Feature class.
Definition: feature.h:20
The Position class.
Definition: position.h:16
The TrafoParam class.
Definition: trafoparam.h:23
The Observation class.
Definition: observation.h:27
Definition: coordinatesystem.h:15
The Station class.
Definition: station.h:23
The Geometry class.
Definition: geometry.h:26
The CoordinateSystem class.
Definition: coordinatesystem.h:25
UnitType
Definition: types.h:354
Definition: direction.h:13
#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