3
* Copyright (C) 2002 Fabien Ch�eau
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.
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.
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.
20
#ifndef _CONSTELLATION_MGR_H_
21
#define _CONSTELLATION_MGR_H_
26
#include "loadingbar.h"
27
#include "translator.h"
35
class ConstellationMgr
38
ConstellationMgr(HipStarMgr *_hip_stars);
41
//! Draw constellation lines, art, names and boundaries if activated
42
void draw(Projector* prj, Navigator* nav) const;
45
void update(int delta_time);
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);
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);
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);
58
//! Set constellation art fade duration
59
void setArtFadeDuration(float duration);
60
//! Get constellation art fade duration
61
float getArtFadeDuration() const {return artFadeDuration;}
63
//! Set constellation maximum art intensity
64
void setArtIntensity(float f);
65
//! Set constellation maximum art intensity
66
float getArtIntensity() const {return artMaxIntensity;}
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;}
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;}
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;}
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;}
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;}
93
//! Define wehther lable are print with gravity effect
94
void setFlagGravityLabel(bool g);
97
void setLineColor(const Vec3f& c);
99
Vec3f getLineColor() const;
101
//! Define boundary color
102
void setBoundaryColor(const Vec3f& c);
103
//! Get current boundary color
104
Vec3f getBoundaryColor() const;
106
//! Set label color for names
107
void setLabelColor(const Vec3f& c);
108
//! Get label color for names
109
Vec3f getLabelColor() const;
111
//! Define font file name and size to use for constellation names display
112
void setFont(float font_size, const string& font_name);
114
//! Define which constellation is selected from its abbreviation
115
void setSelected(const string& abbreviation) {setSelectedConst(findFromAbbreviation(abbreviation));}
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));}
120
unsigned int getFirstSelectedHP(void); //Tony
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;
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;
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);
139
Constellation* is_star_in(const HipStar *) const;
140
Constellation* findFromAbbreviation(const string& abbreviation) const;
141
vector<Constellation*> asterisms;
143
HipStarMgr *hipStarMgr;
144
Constellation* selected;
145
bool isolateSelected;
146
vector<vector<Vec3f> *> allBoundarySegments;
148
// These are THE master settings - individual constellation settings can vary based on selection status
153
float artFadeDuration;
154
float artMaxIntensity;
157
#endif // _CONSTELLATION_MGR_H_