~ubuntu-branches/debian/jessie/stellarium/jessie

« back to all changes in this revision

Viewing changes to src/constellation.h

Tags: upstream-0.9.0
Import upstream version 0.9.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Stellarium
3
 
 * Copyright (C) 2002 Fabien Chereau
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_H_
21
 
#define _CONSTELLATION_H_
22
 
 
23
 
#include "stellarium.h"
24
 
#include "stel_object_base.h"
25
 
#include "stel_object.h"
26
 
#include "stel_utility.h"
27
 
#include "s_font.h"
28
 
#include "fader.h"
29
 
#include <vector>
30
 
 
31
 
class HipStarMgr;
32
 
 
33
 
class Constellation : public StelObjectBase
34
 
{
35
 
    friend class ConstellationMgr;
36
 
private:
37
 
    Constellation();
38
 
    ~Constellation();
39
 
    
40
 
    // StelObject method to override
41
 
        //! Write I18n information about the object in wstring. 
42
 
        wstring getInfoString(const Navigator * nav) const {return getNameI18n() + L"(" + StelUtility::stringToWstring(getShortName()) + L"°";}
43
 
        //! The returned wstring can typically be used for object labeling in the sky
44
 
        wstring getShortInfoString(const Navigator * nav) const {return getNameI18n();}
45
 
        //! Return object's type
46
 
        STEL_OBJECT_TYPE get_type(void) const {return STEL_OBJECT_CONSTELLATION;}
47
 
        //! Get position in earth equatorial frame
48
 
        Vec3d get_earth_equ_pos(const Navigator *nav) const {return XYZname;}
49
 
        //! observer centered J2000 coordinates
50
 
        Vec3d getObsJ2000Pos(const Navigator *nav) const {return XYZname;}
51
 
        //! Return object's magnitude
52
 
        float get_mag(const Navigator * nav) const {return 0.;} 
53
 
    
54
 
    bool read(const string& record, HipStarMgr * _VouteCeleste);
55
 
    void draw_name(s_font * constfont, Projector* prj) const;
56
 
    void draw_art(Projector* prj, Navigator* nav) const;
57
 
    void draw_boundary_optim(Projector* prj) const;
58
 
    const Constellation* is_star_in(const StelObject&) const;
59
 
        StelObject getBrightestStarInConstellation(void) const;
60
 
    
61
 
    wstring getNameI18n(void) const {return nameI18;}
62
 
    string getEnglishName(void) const {return abbreviation;}
63
 
    string getShortName(void) const {return abbreviation;}
64
 
 
65
 
    void draw_optim(Projector* prj) const;
66
 
    void draw_art_optim(Projector* prj, Navigator* nav) const;
67
 
        void update(int delta_time);
68
 
        
69
 
        void setFlagLines(bool b) {line_fader=b;}
70
 
        void setFlagBoundaries(bool b) {boundary_fader=b;}
71
 
        void setFlagName(bool b) {name_fader=b;}
72
 
        void setFlagArt(bool b) {art_fader=b;}
73
 
        bool getFlagLines(void) const {return line_fader;}
74
 
        bool getFlagBoundaries(void) const {return boundary_fader;}
75
 
        bool getFlagName(void) const {return name_fader;}
76
 
        bool getFlagArt(void) const {return art_fader;}
77
 
        
78
 
        /** International name (translated using gettext) */
79
 
    wstring nameI18;
80
 
    
81
 
    /** Name in english */
82
 
        string englishName;
83
 
        
84
 
        /** Abbreviation (of the latin name for western constellations) */
85
 
    string abbreviation;
86
 
    
87
 
    /** Direction vector pointing on constellation name drawing position */
88
 
    Vec3f XYZname;
89
 
        Vec3d XYname;
90
 
        
91
 
        /** Number of segments in the lines */
92
 
    unsigned int nb_segments;
93
 
    
94
 
    /** List of stars forming the segments */
95
 
    StelObject* asterism;
96
 
   
97
 
        s_texture* art_tex;
98
 
        Vec3d art_vertex[9];
99
 
        
100
 
        /** Define whether art, lines, names and boundary must be drawn */
101
 
        LinearFader art_fader, line_fader, name_fader, boundary_fader;
102
 
        
103
 
        vector<vector<Vec3f> *> isolatedBoundarySegments;
104
 
        vector<vector<Vec3f> *> sharedBoundarySegments;
105
 
        
106
 
        // Currently we only need one color for all constellations, this may change at some point
107
 
        static Vec3f lineColor;
108
 
        static Vec3f labelColor;
109
 
        static Vec3f boundaryColor;
110
 
 
111
 
    /** Whether labels are to be printed with gravity */
112
 
        static bool gravityLabel;
113
 
        static bool singleSelected;
114
 
};
115
 
 
116
 
#endif // _CONSTELLATION_H_