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

« back to all changes in this revision

Viewing changes to src/constellation_mgr.h

  • Committer: Bazaar Package Importer
  • Author(s): Cédric Delfosse
  • Date: 2008-05-19 21:28:23 UTC
  • mfrom: (3.1.5 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080519212823-m5nfiuntxstxzxj7
Tags: 0.9.1-4
Add libxcursor-dev, libxfixes-dev, libxinerama-dev, libqt4-opengl-dev to
build-deps (Closes: #479906)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Stellarium
3
 
 * Copyright (C) 2002 Fabien Ch�eau
4
 
 * 
5
 
 * This program is free software; you can redistribute it and/or
6
 
 * modify it under the terms of the GNU General Public License
7
 
 * as published by the Free Software Foundation; either version 2
8
 
 * of the License, or (at your option) any later version.
9
 
 * 
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 * 
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
 
 */
19
 
 
20
 
#ifndef _CONSTELLATION_MGR_H_
21
 
#define _CONSTELLATION_MGR_H_
22
 
 
23
 
#include <vector>
24
 
 
25
 
#include "fader.h"
26
 
#include "loadingbar.h"
27
 
#include "translator.h"
28
 
 
29
 
class HipStarMgr;
30
 
class HipStar;
31
 
class Constellation;
32
 
class Projector;
33
 
class Navigator;
34
 
 
35
 
class ConstellationMgr  
36
 
{
37
 
public:
38
 
    ConstellationMgr(HipStarMgr *_hip_stars);
39
 
    ~ConstellationMgr();
40
 
    
41
 
    //! Draw constellation lines, art, names and boundaries if activated
42
 
    void draw(Projector* prj, Navigator* nav) const;
43
 
    
44
 
    //! Update faders
45
 
        void update(int delta_time);
46
 
        
47
 
        //! @brief Read constellation names from the given file
48
 
        //! @param namesFile Name of the file containing the constellation names in english
49
 
        void loadNames(const string& names_file);
50
 
        
51
 
        //! @brief Update i18 names from english names according to current locale
52
 
        //! The translation is done using gettext with translated strings defined in translations.h
53
 
        void translateNames(Translator& trans);
54
 
                   
55
 
        //! @brief Load constellation line shapes, art textures and boundaries shapes from data files*/
56
 
        void loadLinesAndArt(const string& lines_file, const string& art_file, const string &boundaryfileName, LoadingBar& lb);
57
 
        
58
 
        //! Set constellation art fade duration
59
 
        void setArtFadeDuration(float duration);
60
 
        //! Get constellation art fade duration
61
 
        float getArtFadeDuration() const {return artFadeDuration;}
62
 
                
63
 
        //! Set constellation maximum art intensity
64
 
        void setArtIntensity(float f);
65
 
        //! Set constellation maximum art intensity
66
 
        float getArtIntensity() const {return artMaxIntensity;}
67
 
        
68
 
        //! Set whether constellation art will be displayed
69
 
        void setFlagArt(bool b);
70
 
        //! Get whether constellation art is displayed
71
 
        bool getFlagArt(void) const {return flagArt;}
72
 
        
73
 
        //! Set whether constellation path lines will be displayed
74
 
        void setFlagLines(bool b);
75
 
        //! Get whether constellation path lines are displayed
76
 
        bool getFlagLines(void) const {return flagLines;}
77
 
        
78
 
        //! Set whether constellation boundaries lines will be displayed
79
 
        void setFlagBoundaries(bool b);
80
 
        //! Get whether constellation boundaries lines are displayed
81
 
        bool getFlagBoundaries(void) const {return flagBoundaries;}
82
 
        
83
 
        //! Set whether constellation names will be displayed
84
 
        void setFlagNames(bool b);
85
 
        //! Set whether constellation names are displayed
86
 
        bool getFlagNames(void) const {return flagNames;}
87
 
        
88
 
        //! Set whether selected constellation must be displayed alone
89
 
        void setFlagIsolateSelected(bool s) { isolateSelected = s; setSelectedConst(selected);}
90
 
        //! Get whether selected constellation is displayed alone
91
 
        bool getFlagIsolateSelected(void) const { return isolateSelected;}
92
 
        
93
 
        //! Define wehther lable are print with gravity effect
94
 
        void setFlagGravityLabel(bool g);
95
 
        
96
 
        //! Define line color
97
 
        void setLineColor(const Vec3f& c);
98
 
        //! Get line color
99
 
        Vec3f getLineColor() const;
100
 
        
101
 
        //! Define boundary color
102
 
        void setBoundaryColor(const Vec3f& c);
103
 
        //! Get current boundary color
104
 
        Vec3f getBoundaryColor() const;
105
 
                
106
 
        //! Set label color for names
107
 
        void setLabelColor(const Vec3f& c);
108
 
        //! Get label color for names
109
 
        Vec3f getLabelColor() const;
110
 
        
111
 
        //! Define font file name and size to use for constellation names display
112
 
        void setFont(float font_size, const string& font_name);
113
 
        
114
 
        //! Define which constellation is selected from its abbreviation
115
 
        void setSelected(const string& abbreviation) {setSelectedConst(findFromAbbreviation(abbreviation));}
116
 
        
117
 
        //! Define which constellation is selected from a star number
118
 
        void setSelected(const HipStar * s) {if (!s) setSelectedConst(NULL); else setSelectedConst(is_star_in(s));}
119
 
        
120
 
        unsigned int getFirstSelectedHP(void);  //Tony
121
 
 
122
 
        //! Return the matching constellation object's pointer if exists or NULL
123
 
        //! @param nameI18n The case sensistive constellation name
124
 
        Constellation* searchByNameI18n(const wstring& nameI18n) const; 
125
 
 
126
 
        //! Find and return the list of at most maxNbItem objects auto-completing the passed object I18n name
127
 
        //! @param objPrefix the case insensitive first letters of the searched object
128
 
        //! @param maxNbItem the maximum number of returned object names
129
 
        //! @return a vector of matching object name by order of relevance, or an empty vector if nothing match
130
 
        vector<wstring> listMatchingObjectsI18n(const wstring& objPrefix, unsigned int maxNbItem=5) const;
131
 
private:
132
 
        bool loadBoundaries(const string& conCatFile);
133
 
        void draw_lines(Projector * prj) const;
134
 
        void draw_art(Projector * prj, Navigator * nav) const;
135
 
        void draw_names(Projector * prj) const;
136
 
        void drawBoundaries(Projector* prj) const;      
137
 
        void setSelectedConst(Constellation* c);
138
 
 
139
 
    Constellation* is_star_in(const HipStar *) const;
140
 
    Constellation* findFromAbbreviation(const string& abbreviation) const;              
141
 
    vector<Constellation*> asterisms;
142
 
    s_font *asterFont;
143
 
    HipStarMgr *hipStarMgr;
144
 
        Constellation* selected;
145
 
        bool isolateSelected;
146
 
        vector<vector<Vec3f> *> allBoundarySegments;
147
 
 
148
 
        // These are THE master settings - individual constellation settings can vary based on selection status
149
 
        bool flagNames;
150
 
        bool flagLines;
151
 
        bool flagArt;
152
 
        bool flagBoundaries;
153
 
        float artFadeDuration;
154
 
        float artMaxIntensity;
155
 
};
156
 
 
157
 
#endif // _CONSTELLATION_MGR_H_