TelescopeClient.hpp   TelescopeClient.hpp 
skipping to change at line 57 skipping to change at line 57
}; };
//! An abstract base class that should never be used directly, only inherit ed. //! An abstract base class that should never be used directly, only inherit ed.
//! This class used to be called Telescope, but it has been renamed //! This class used to be called Telescope, but it has been renamed
//! to TelescopeClient in order to resolve a compiler/linker conflict //! to TelescopeClient in order to resolve a compiler/linker conflict
//! with the identically named Telescope class in Stellarium's main code. //! with the identically named Telescope class in Stellarium's main code.
class TelescopeClient : public QObject, public StelObject class TelescopeClient : public QObject, public StelObject
{ {
Q_OBJECT Q_OBJECT
public: public:
static const QString TELESCOPECLIENT_TYPE;
static TelescopeClient *create(const QString &url); static TelescopeClient *create(const QString &url);
virtual ~TelescopeClient(void) {} virtual ~TelescopeClient(void) {}
// Method inherited from StelObject // Method inherited from StelObject
QString getEnglishName(void) const {return name;} QString getEnglishName(void) const {return name;}
QString getNameI18n(void) const {return nameI18n;} QString getNameI18n(void) const {return nameI18n;}
Vec3f getInfoColor(void) const Vec3f getInfoColor(void) const
{ {
return Vec3f(1, 1, 1); return Vec3f(1, 1, 1);
} }
//! TelescopeClient supports the following InfoStringGroup flags: //! TelescopeClient supports the following InfoStringGroup flags:
//! - Name //! - Name
//! - RaDecJ2000 //! - RaDecJ2000
//! - RaDec //! - RaDec
//! - PlainText //! - PlainText
//! @param core the StelCore object //! @param core the StelCore object
//! @param flags a set of InfoStringGroup items to include in the re turn value. //! @param flags a set of InfoStringGroup items to include in the re turn value.
//! @return a QString containing an HMTL encoded description of the Telescope. //! @return a QString containing an HMTL encoded description of the Telescope.
QString getInfoString(const StelCore* core, const InfoStringGroup& f lags) const; QString getInfoString(const StelCore* core, const InfoStringGroup& f lags) const;
QString getType(void) const {return "Telescope";} QString getType(void) const {return TELESCOPECLIENT_TYPE;}
QString getID() const {return name;}
virtual double getAngularSize(const StelCore*) const {Q_ASSERT(0); r eturn 0;} // TODO virtual double getAngularSize(const StelCore*) const {Q_ASSERT(0); r eturn 0;} // TODO
// Methods specific to telescope // Methods specific to telescope
virtual void telescopeGoto(const Vec3d &j2000Pos) = 0; virtual void telescopeGoto(const Vec3d &j2000Pos, StelObjectP select Object) = 0;
virtual bool isConnected(void) const = 0; virtual bool isConnected(void) const = 0;
virtual bool hasKnownPosition(void) const = 0; virtual bool hasKnownPosition(void) const = 0;
void addOcular(double fov) {if (fov>=0.0) oculars.push_back(fov);} void addOcular(double fov) {if (fov>=0.0) oculars.push_back(fov);}
const QList<double> &getOculars(void) const {return oculars;} const QList<double> &getOculars(void) const {return oculars;}
virtual bool prepareCommunication() {return false;} virtual bool prepareCommunication() {return false;}
virtual void performCommunication() {} virtual void performCommunication() {}
protected: protected:
TelescopeClient(const QString &name); TelescopeClient(const QString &name);
QString nameI18n; QString nameI18n;
const QString name; const QString name;
virtual QString getTelescopeInfoString(const StelCore* core, const I
nfoStringGroup& flags) const
{
Q_UNUSED(core);
Q_UNUSED(flags);
return QString();
}
private: private:
virtual bool isInitialized(void) const {return true;} virtual bool isInitialized(void) const {return true;}
float getSelectPriority(const StelCore* core) const {Q_UNUSED(core); return -10.f;} float getSelectPriority(const StelCore* core) const {Q_UNUSED(core); return -10.f;}
private: private:
QList<double> oculars; // fov of the oculars QList<double> oculars; // fov of the oculars
}; };
//! Example Telescope class. A physical telescope does not exist. //! Example Telescope class. A physical telescope does not exist.
//! This can be used as a starting point for implementing a derived //! This can be used as a starting point for implementing a derived
//! Telescope class. //! Telescope class.
skipping to change at line 130 skipping to change at line 139
bool prepareCommunication(void) bool prepareCommunication(void)
{ {
XYZ = XYZ * 31.0 + desired_pos; XYZ = XYZ * 31.0 + desired_pos;
const double lq = XYZ.lengthSquared(); const double lq = XYZ.lengthSquared();
if (lq > 0.0) if (lq > 0.0)
XYZ *= (1.0/std::sqrt(lq)); XYZ *= (1.0/std::sqrt(lq));
else else
XYZ = desired_pos; XYZ = desired_pos;
return true; return true;
} }
void telescopeGoto(const Vec3d &j2000Pos) void telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject)
{ {
desired_pos = j2000Pos; desired_pos = j2000Pos;
desired_pos.normalize(); desired_pos.normalize();
} }
bool hasKnownPosition(void) const bool hasKnownPosition(void) const
{ {
return true; return true;
} }
Vec3d getJ2000EquatorialPos(const StelCore*) const Vec3d getJ2000EquatorialPos(const StelCore*) const
{ {
skipping to change at line 170 skipping to change at line 179
{ {
hangup(); hangup();
} }
bool isConnected(void) const bool isConnected(void) const
{ {
//return (tcpSocket->isValid() && !wait_for_connection_estab lishment); //return (tcpSocket->isValid() && !wait_for_connection_estab lishment);
return (tcpSocket->state() == QAbstractSocket::ConnectedStat e); return (tcpSocket->state() == QAbstractSocket::ConnectedStat e);
} }
private: private:
Vec3d getJ2000EquatorialPos(const StelCore* core=0) const; Vec3d getJ2000EquatorialPos(const StelCore* core=Q_NULLPTR) const;
bool prepareCommunication(); bool prepareCommunication();
void performCommunication(); void performCommunication();
void telescopeGoto(const Vec3d &j2000Pos); void telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject);
bool isInitialized(void) const bool isInitialized(void) const
{ {
return (!address.isNull()); return (!address.isNull());
} }
void performReading(void); void performReading(void);
void performWriting(void); void performWriting(void);
private: private:
void hangup(void); void hangup(void);
QHostAddress address; QHostAddress address;
 End of changes. 7 change blocks. 
5 lines changed or deleted 15 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/