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

« back to all changes in this revision

Viewing changes to src/StelObject.hpp

  • 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 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 _STEL_OBJECT_H_
 
21
#define _STEL_OBJECT_H_
 
22
 
 
23
#include <string>
 
24
#include "vecmath.h"
 
25
#include "StelObjectType.hpp"
 
26
#include "GridObject.hpp"
 
27
 
 
28
using namespace std;
 
29
 
 
30
class Navigator;
 
31
class Projector;
 
32
class STexture;
 
33
 
 
34
// Declare the 2 functions needed by boost intrusive pointers
 
35
class StelObject;
 
36
void intrusive_ptr_add_ref(StelObject* p);
 
37
void intrusive_ptr_release(StelObject* p);
 
38
 
 
39
//! The base abstract class for sky objects used in Stellarium like Stars, Planets, Constellations etc...
 
40
//! Normally you should use StelObjectP instead of StelObject* which have by default the same behaviour,
 
41
//! but which can be added reference counting if needed.
 
42
class StelObject : public GridObject
 
43
{
 
44
public:
 
45
        virtual ~StelObject(void) {}
 
46
 
 
47
        //! Default implementation of the GridObject method
 
48
        //! Calling this method on some object will cause an error if they need a valid Navigator instance to compute their position
 
49
        virtual Vec3d getPositionForGrid() const {return getObsJ2000Pos(NULL);}
 
50
        
 
51
        //! Increment the reference counts if needed.
 
52
        //! The default behaviour is to do nothing, thus making StelObjectP behave like normal pointers.
 
53
        virtual void retain(void) {;}
 
54
        
 
55
        //! Decrement the reference counts if needed.
 
56
        //! The default behaviour is to do nothing, thus making StelObjectP behave like normal pointers.
 
57
        virtual void release(void) {;}
 
58
        
 
59
        //! Write I18n information about the object in wstring. 
 
60
        virtual wstring getInfoString(const Navigator *nav) const = 0;
 
61
        
 
62
        //! The returned wstring can typically be used for object labeling in the sky
 
63
        virtual wstring getShortInfoString(const Navigator *nav) const = 0;
 
64
        
 
65
        //! Return object's type. It should be the name of the class.
 
66
        virtual std::string getType(void) const = 0;
 
67
        
 
68
        //! Return object's name in english
 
69
        virtual string getEnglishName(void) const = 0;
 
70
        
 
71
        //! Return translated object's name
 
72
        virtual wstring getNameI18n(void) const = 0;
 
73
        
 
74
        //! Get position in earth equatorial frame
 
75
        virtual Vec3d getEarthEquatorialPos(const Navigator *nav) const = 0;
 
76
        
 
77
        //! observer centered J2000 coordinates
 
78
        virtual Vec3d getObsJ2000Pos(const Navigator *nav) const = 0;
 
79
        
 
80
        //! Return object's magnitude
 
81
        virtual float getMagnitude(const Navigator *nav) const {return 99;}
 
82
        
 
83
        //! Return a priority value which is used to discriminate objects by priority
 
84
        //! As for magnitudes, the lower is the higher priority 
 
85
        virtual float getSelectPriority(const Navigator *nav) const {return 99;}
 
86
        
 
87
        //! Get a color used to display info about the object
 
88
        virtual Vec3f getInfoColor(void) const {return Vec3f(1,1,1);}
 
89
        
 
90
        //! Return the best FOV in degree to use for a close view of the object
 
91
        virtual double getCloseViewFov(const Navigator *nav) const {return 10.;}
 
92
        
 
93
        //! Return the best FOV in degree to use for a global view of the object satellite system (if there are satellites)
 
94
        virtual double get_satellites_fov(const Navigator *nav) const {return -1.;}
 
95
        virtual double get_parent_satellites_fov(const Navigator *nav) const {return -1.;}
 
96
        
 
97
        virtual float getOnScreenSize(const Projector *prj, const Navigator *nav = NULL) const {return 0;}
 
98
};
 
99
 
 
100
#endif