~ubuntu-branches/debian/squeeze/stellarium/squeeze

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
 * Author and Copyright of this file and of the stellarium telescope feature:
 * Johannes Gajdosik, 2006
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

#ifndef _TELESCOPE_MGR_H_
#define _TELESCOPE_MGR_H_

#include "StelObjectModule.hpp"
#include "Fader.hpp"
#include "vecmath.h"
#include "STextureTypes.hpp"

#include <vector>
#include <map>
#include <string>

using namespace std;

class InitParser;
class Projector;
class Navigator;
class SFont;
class StelObject;
class Telescope;

class TelescopeMgr : public StelObjectModule {
public:
  TelescopeMgr(void);
  virtual ~TelescopeMgr(void);
  
	///////////////////////////////////////////////////////////////////////////
	// Methods defined in the StelModule class
	virtual void init(const InitParser& conf);
	virtual double draw(StelCore *core);
	virtual void update(double deltaTime);
	virtual void setColorScheme(const InitParser& conf, const QString& section);
	virtual double getCallOrder(StelModuleActionName actionName) const;
	
	///////////////////////////////////////////////////////////////////////////
	// Methods defined in the StelObjectModule class
	virtual vector<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const;
	virtual StelObjectP searchByNameI18n(const wstring& nameI18n) const;
	virtual StelObjectP searchByName(const string& name) const;

	virtual vector<wstring> listMatchingObjectsI18n(const wstring& objPrefix, unsigned int maxNbItem=5) const;


  void communicate(void);
   
  void set_names_fade_duration(float duration)
    {name_fader.set_duration((int) (duration * 1000.f));}
  
  void set_label_color(const Vec3f &c) {label_color = c;}
  const Vec3f &getLabelColor(void) const {return label_color;}

  void set_circle_color(const Vec3f &c) {circle_color = c;}
  const Vec3f &getCircleColor(void) const {return circle_color;}
  
  //! Set display flag for Telescopes
  void setFlagTelescopes(bool b) {telescope_fader=b;}
  //! Get display flag for Telescopes
  bool getFlagTelescopes(void) const {return (bool)telescope_fader;}  
  
  //! Set display flag for Telescope names
  void setFlagTelescopeName(bool b) {name_fader=b;}
  //! Get display flag for Telescope names
  bool getFlagTelescopeName(void) const {return name_fader==true;}
  
  //! Define font size to use for telescope names display
  void setFontSize(float font_size);

  //! send a J2000-goto-command to the specified telescope
  void telescopeGoto(int telescope_nr,const Vec3d &j2000_pos);
private:
#ifdef WIN32
  bool wsa_ok;
#endif
	//! Draw a nice animated pointer around the object
	void drawPointer(const Projector* prj, const Navigator * nav);

  LinearFader name_fader;
  LinearFader telescope_fader;
  Vec3f circle_color;
  Vec3f label_color;
  SFont *telescope_font;
  STextureSP telescope_texture;

  class TelescopeMap : public std::map<int,Telescope*> {
  public:
    ~TelescopeMap(void) {clear();}
    void clear(void);
  };
  TelescopeMap telescope_map;
  STextureSP texPointer;			// The selection pointer texture
};


#endif