3
* Copyright (C) 2002 Fabien Chereau
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 _STEL_OBJECT_H_
21
#define _STEL_OBJECT_H_
25
#include "StelObjectType.hpp"
26
#include "GridObject.hpp"
34
// Declare the 2 functions needed by boost intrusive pointers
36
void intrusive_ptr_add_ref(StelObject* p);
37
void intrusive_ptr_release(StelObject* p);
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
45
virtual ~StelObject(void) {}
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);}
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) {;}
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) {;}
59
//! Write I18n information about the object in wstring.
60
virtual wstring getInfoString(const Navigator *nav) const = 0;
62
//! The returned wstring can typically be used for object labeling in the sky
63
virtual wstring getShortInfoString(const Navigator *nav) const = 0;
65
//! Return object's type. It should be the name of the class.
66
virtual std::string getType(void) const = 0;
68
//! Return object's name in english
69
virtual string getEnglishName(void) const = 0;
71
//! Return translated object's name
72
virtual wstring getNameI18n(void) const = 0;
74
//! Get position in earth equatorial frame
75
virtual Vec3d getEarthEquatorialPos(const Navigator *nav) const = 0;
77
//! observer centered J2000 coordinates
78
virtual Vec3d getObsJ2000Pos(const Navigator *nav) const = 0;
80
//! Return object's magnitude
81
virtual float getMagnitude(const Navigator *nav) const {return 99;}
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;}
87
//! Get a color used to display info about the object
88
virtual Vec3f getInfoColor(void) const {return Vec3f(1,1,1);}
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.;}
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.;}
97
virtual float getOnScreenSize(const Projector *prj, const Navigator *nav = NULL) const {return 0;}