28 #ifndef _TELESCOPE_CONTROL_HPP_
29 #define _TELESCOPE_CONTROL_HPP_
31 #include "StelFader.hpp"
32 #include "StelGui.hpp"
33 #include "StelJsonParser.hpp"
34 #include "StelObjectModule.hpp"
37 #include "TelescopeControlGlobals.hpp"
38 #include "VecMath.hpp"
47 #include <QStringList>
48 #include <QTextStream>
61 typedef QSharedPointer<TelescopeClient> TelescopeClientP;
81 virtual void deinit();
82 virtual void update(
double deltaTime);
84 virtual double getCallOrder(StelModuleActionName actionName)
const;
88 virtual QList<StelObjectP> searchAround(
const Vec3d& v,
double limitFov,
const StelCore* core)
const;
89 virtual StelObjectP searchByNameI18n(
const QString& nameI18n)
const;
90 virtual StelObjectP searchByName(
const QString& name)
const;
96 virtual QStringList listMatchingObjectsI18n(
const QString& objPrefix,
int maxNbItem=5,
bool useStartOfWords=
false)
const;
102 virtual QStringList listMatchingObjects(
const QString& objPrefix,
int maxNbItem=5,
bool useStartOfWords=
false)
const;
104 virtual QStringList listAllObjects(
bool inEnglish)
const { Q_UNUSED(inEnglish)
return QStringList(); }
105 virtual QStringList listAllObjectsByType(
const QString& objType,
bool inEnglish)
const { Q_UNUSED(objType) Q_UNUSED(inEnglish)
return QStringList(); }
106 virtual QString getName()
const {
return "Telescope Control"; }
107 virtual bool configureGui(
bool show =
true);
114 void telescopeGoto(
int telescopeNr,
const Vec3d &j2000Pos);
117 void deleteAllTelescopes();
120 const QHash<QString, DeviceModel>& getDeviceModels();
123 void loadConfiguration();
125 void saveConfiguration();
128 void saveTelescopes();
130 void loadTelescopes();
135 bool addTelescopeAtSlot(
int slot, ConnectionType connectionType, QString name, QString equinox, QString host = QString(
"localhost"),
int portTCP = DEFAULT_TCP_PORT,
int delay = DEFAULT_DELAY,
bool connectAtStartup =
false, QList<double> circles = QList<double>(), QString serverName = QString(), QString portSerial = QString());
137 bool getTelescopeAtSlot(
int slot, ConnectionType& connectionType, QString& name, QString& equinox, QString& host,
int& portTCP,
int& delay,
bool& connectAtStartup, QList<double>& circles, QString& serverName, QString& portSerial);
139 bool removeTelescopeAtSlot(
int slot);
142 bool startTelescopeAtSlot(
int slot);
144 bool stopTelescopeAtSlot(
int slot);
146 bool stopAllTelescopes();
149 bool isExistingClientAtSlot(
int slot);
151 bool isConnectedClientAtSlot(
int slot);
154 QHash<int, QString> getConnectedClientsNames();
156 bool getFlagUseServerExecutables() {
return useServerExecutables;}
158 void setFlagUseServerExecutables(
bool b);
159 const QString& getServerExecutablesDirectoryPath();
161 bool setServerExecutablesDirectoryPath(
const QString& newPath);
163 bool getFlagUseTelescopeServerLogs () {
return useTelescopeServerLogs;}
197 void setFontSize(
int fontSize);
202 void slewTelescopeToSelectedObject();
208 void slewTelescopeToViewDirection();
214 void clientConnected(
int slot, QString name);
215 void clientDisconnected(
int slot);
218 void setStelStyle(
const QString& section);
220 void translateActionDescriptions();
227 void communicate(
void);
239 Vec3f reticleNormalColor;
241 Vec3f reticleNightColor;
243 Vec3f labelNormalColor;
245 Vec3f labelNightColor;
247 Vec3f circleNormalColor;
249 Vec3f circleNightColor;
263 QMap<int, TelescopeClientP> telescopeClients;
265 QHash<int, QProcess*> telescopeServerProcess;
266 QStringList telescopeServers;
267 QVariantMap telescopeDescriptions;
268 QHash<QString, DeviceModel> deviceModels;
270 QHash<ConnectionType, QString> connectionTypeNames;
272 bool useTelescopeServerLogs;
273 QHash<int, QFile*> telescopeServerLogFiles;
274 QHash<int, QTextStream*> telescopeServerLogStreams;
276 bool useServerExecutables;
277 QString serverExecutablesDirectoryPath;
284 bool isValidSlotNumber(
int slot);
285 bool isValidPort(uint port);
286 bool isValidDelay(
int delay);
292 bool startServerAtSlot(
int slot, QString serverName,
int tcpPort, QString serialPort);
294 bool stopServerAtSlot(
int slot);
297 bool startClientAtSlot(
int slot, ConnectionType connectionType, QString name, QString equinox, QString host,
int portTCP,
int delay, QList<double> circles, QString serverName = QString(), QString portSerial = QString());
300 bool stopClientAtSlot(
int slot);
303 void loadTelescopeServerExecutables();
306 void loadDeviceModels();
310 bool restoreDeviceModelsListTo(QString deviceModelsListPath);
312 void addLogAtSlot(
int slot);
313 void logAtSlot(
int slot);
314 void removeLogAtSlot(
int slot);
316 QString actionGroupId;
317 QString moveToSelectedActionId;
318 QString moveToCenterActionId;
324 #include "StelPluginInterface.hpp"
330 Q_PLUGIN_METADATA(IID StelPluginInterface_iid)
const Vec3f & getLabelColor() const
Get the telescope labels color.
void setLabelColor(const Vec3f &c)
Set the telescope labels color.
void setFlagTelescopeReticles(bool b)
Set display flag for telescope reticles.
void setFlagTelescopeCircles(bool b)
Set display flag for telescope field of view circles.
bool getFlagTelescopeCircles() const
Get display flag for telescope field of view circles.
An abstract base class that should never be used directly, only inherited.
This class manages the controlling of one or more telescopes by one instance of the stellarium progra...
bool getFlagTelescopeReticles() const
Get display flag for telescope reticles.
This class is used by Qt to manage a plug-in interface.
void setCircleColor(const Vec3f &c)
Set the field of view circles color.
QSharedPointer< StelProjector > StelProjectorP
bool getFlagTelescopeLabels() const
Get display flag for telescope name labels.
void setFlagTelescopeLabels(bool b)
Set display flag for telescope name labels.
const Vec3f & getReticleColor() const
Get the telescope reticle color.
void setFlagUseTelescopeServerLogs(bool b)
Used in the GUI.
void setReticleColor(const Vec3f &c)
Set the telescope reticle color.
QSharedPointer< StelTexture > StelTextureSP
const Vec3f & getCircleColor() const
Get the field of view circles color.