OpenIndy-Core  0.2.0.43
station.h
Go to the documentation of this file.
1 #ifndef STATION_H
2 #define STATION_H
3 
4 #include <QObject>
5 #include <QList>
6 #include <QPointer>
7 
8 #include "sensorcontrol.h"
9 #include "feature.h"
10 #include "point.h"
11 
12 class ProjectExchanger;
13 
14 namespace oi{
15 
16 class Reading;
17 class CoordinateSystem;
18 class Sensor;
19 
24 {
25  friend class OiJob;
26  friend class ProjectExchanger;
27  friend class Observation;
28  Q_OBJECT
29 
30 public:
31  explicit Station(QObject *parent = 0);
32  explicit Station(const QString &name, QObject *parent = 0);
33 
34  Station(const Station &copy, QObject *parent = 0);
35 
36  Station &operator=(const Station &copy);
37 
38  ~Station();
39 
40  //#############################
41  //get or set station attributes
42  //#############################
43 
44  const bool &getIsActiveStation() const;
45  void setActiveStationState(const bool &isActiveStation);
46 
47  const QPointer<Point> &getPosition() const;
48 
49  const QPointer<CoordinateSystem> &getCoordinateSystem() const;
50 
51  //get information about the currently connected sensor
52  bool getIsSensorSet();
53  bool getIsSensorConnected();
54  bool getIsReadyForMeasurement();
55  bool getIsBusy();
56  QMap<QString, QString> getSensorStatus();
57 
58  SensorConfiguration getSensorConfiguration();
59  void setSensorConfiguration(const SensorConfiguration &sConfig);
60 
61  void setSensor(const QPointer<Sensor> &sensor);
62  void resetSensor();
63 
64  const QPointer<SensorListener> getSensorListener() const;
65 
66  //####################################################
67  //get information about the currently connected sensor
68  //####################################################
69 
70  SensorTypes getActiveSensorType() const;
71 
72  QList<ReadingTypes> getSupportedReadingTypes() const;
73  QList<ConnectionTypes> getSupportedConnectionTypes() const;
74 
75  QList<SensorFunctions> getSupportedSensorActions() const;
76  QStringList getSelfDefinedActions() const;
77 
78  //###########################
79  //reexecute the function list
80  //###########################
81 
82  void recalc();
83 
84  //#################
85  //save and load XML
86  //#################
87 
88  QDomElement toOpenIndyXML(QDomDocument &xmlDoc);
89  bool fromOpenIndyXML(QDomElement &xmlElem);
90 
91  //###############
92  //display methods
93  //###############
94 
95  QString getDisplayX(const UnitType &type, const int &digits, const bool &showDiff = false) const;
96  QString getDisplayY(const UnitType &type, const int &digits, const bool &showDiff = false) const;
97  QString getDisplayZ(const UnitType &type, const int &digits, const bool &showDiff = false) const;
98 
99 signals:
100 
101  //#######################################
102  //signals to inform about station changes
103  //#######################################
104 
105  void activeStationChanged(const int &stationId);
106  void sensorChanged(const int &featureId);
107 
108  //###############################
109  //signals to start sensor actions
110  //###############################
111 
112  void connectSensor();
113  void disconnectSensor();
114 
115  void measure(const int &geomId, const MeasurementConfig &mConfig);
116 
117  void setStreamFormat(ReadingTypes streamFormat);
118 
119  void move(const double &azimuth, const double &zenith, const double &distance, const bool &isRelative,
120  const bool &measure, const int &geomId = -1, const MeasurementConfig &mConfig = MeasurementConfig());
121  void move(const double &x, const double &y, const double &z,
122  const bool &measure, const int &geomId = -1, const MeasurementConfig &mConfig = MeasurementConfig());
123  void initialize();
124  void motorState();
125  void home();
126  void toggleSight();
127  void compensation();
128  void selfDefinedAction(const QString &action);
129 
130  //#################################################
131  //signals emitted when a sensor action was finished
132  //#################################################
133 
134  void commandFinished(const bool &success, const QString &msg);
135  void measurementFinished(const int &geomId, const QList<QPointer<Reading> > &readings);
136 
137 protected:
138 
139  //######################################
140  //update feature id when the job was set
141  //######################################
142 
143  void setUpFeatureId();
144 
145 private:
146 
147  //##########################
148  //general station attributes
149  //##########################
150 
151  bool isActiveStation;
152 
153  QPointer<Point> position; //the position of the station
154 
155  QPointer<SensorControl> sensorControl; //sensor communication
156  QThread stationThread; //thread the sensor control runs on
157 
158  QPointer<CoordinateSystem> stationSystem; //the corresponding coordinate system
159 
160  //#############################
161  //readings made by this station
162  //#############################
163 
164  QList<QPointer<Reading> > cartesianReadings;
165  QList<QPointer<Reading> > directionReadings;
166  QList<QPointer<Reading> > distanceReadings;
167  QList<QPointer<Reading> > polarReadings;
168  QList<QPointer<Reading> > levelReadings;
169  QList<QPointer<Reading> > temperatureRadings;
170  QList<QPointer<Reading> > undefinedReadings;
171 
172 private slots:
173 
174  //##############
175  //helper methods
176  //##############
177 
178  void stationNameChanged(const int &featureId, const QString &oldName);
179  void connectSensorControl();
180  void disconnectSensorControl();
181 
182  void addReadings(const int &geomId, const QList<QPointer<Reading> > &readings);
183  void removeReading(const QPointer<Reading> &reading);
184 
185 protected:
186 
187  //#############################################
188  //pointer to OiJob that this feature belongs to
189  //#############################################
190 
191  void setJob(const QPointer<OiJob> &job);
192 
193 };
194 
195 }
196 
197 #endif // STATION_H
The Feature class.
Definition: feature.h:20
ReadingTypes
Definition: types.h:203
The Observation class.
Definition: observation.h:27
Definition: coordinatesystem.h:15
The MeasurementConfig class Contains all the configuration parameters needed to start a measurement...
Definition: measurementconfig.h:15
The SensorConfiguration class.
Definition: sensorconfiguration.h:70
The Station class.
Definition: station.h:23
SensorTypes
Definition: types.h:390
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