Home · All Namespaces · All Classes · Functions · Coding Style · Plugins · File Structure

modules/Telescope.hpp

00001 /*
00002  * Author and Copyright of this file and of the stellarium telescope feature:
00003  * Johannes Gajdosik, 2006
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  * 
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 #ifndef _TELESCOPE_HPP_
00021 #define _TELESCOPE_HPP_
00022 
00023 #include <QList>
00024 #include <QString>
00025 
00026 #if defined (_MSC_VER)
00027 #include <winsock2.h>
00028 #endif
00029 
00030 #include "StelObject.hpp"
00031 #include "StelNavigator.hpp"
00032 
00033 long long int GetNow(void);
00034 
00035 #ifdef __MINGW32__
00036 struct fd_set;
00037 #endif
00038 
00039 class Telescope : public StelObject
00040 {
00041 public:
00042     static Telescope *create(const QString &url);
00043     virtual ~Telescope(void) {}
00044     
00045     // Method inherited from StelObject
00046     QString getEnglishName(void) const {return name;}
00047     QString getNameI18n(void) const {return nameI18n;}
00056     QString getInfoString(const StelCore* core, const InfoStringGroup& flags) const;
00057     QString getType(void) const {return "Telescope";}
00058     virtual double getAngularSize(const StelCore* core) const {Q_ASSERT(0); return 0;}  // TODO
00059         
00060     // Methods specific to telescope
00061     virtual void telescopeGoto(const Vec3d &j2000Pos) = 0;
00062     virtual bool isConnected(void) const = 0;
00063     virtual bool hasKnownPosition(void) const = 0;
00064     void addOcular(double fov) {if (fov>=0.0) oculars.push_back(fov);}
00065     const QList<double> &getOculars(void) const {return oculars;}
00066     
00067     // all TCP (and all possible other style) communication shall be done in these functions:
00068     virtual void prepareSelectFds(fd_set &read_fds,fd_set &write_fds, int &fdmax) = 0;
00069     virtual void handleSelectFds(const fd_set &read_fds, const fd_set &write_fds) {}
00070 
00071 protected:
00072     Telescope(const QString &name);
00073     QString nameI18n;
00074     const QString name;
00075 private:
00076     bool isInitialized(void) const {return true;}
00077     float getSelectPriority(const StelNavigator *nav) const {return -10.f;}
00078 private:
00079     QList<double> oculars; // fov of the oculars
00080 };
00081 
00082 #endif // _TELESCOPE_HPP_

Generated on Mon Mar 9 16:16:16 2009 for Stellarium by  doxygen 1.5.5