Home · All Namespaces · All Classes · Functions · Coding Style · Plugins · File Structure

core/StelObject.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2002 Fabien Chereau
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 #ifndef _STELOBJECT_HPP_
00021 #define _STELOBJECT_HPP_
00022 
00023 #include <QString>
00024 #include "VecMath.hpp"
00025 #include "StelObjectType.hpp"
00026 #include "StelGridObject.hpp"
00027 
00028 class StelNavigator;
00029 class StelCore;
00030 
00031 // Declare the 2 functions needed by boost intrusive pointers
00032 class StelObject;
00033 void intrusive_ptr_add_ref(StelObject* p);
00034 void intrusive_ptr_release(StelObject* p);
00035 
00040 class StelObject : public StelGridObject
00041 {
00042 public:
00047     enum InfoStringGroup
00048     {
00049         Name          = 0x00000001, 
00050         CatalogNumber = 0x00000002, 
00051         Magnitude     = 0x00000004, 
00052         RaDecJ2000    = 0x00000008, 
00053         RaDecOfDate   = 0x00000010, 
00054         AltAzi        = 0x00000020, 
00055         Distance      = 0x00000040, 
00056         Size          = 0x00000080, 
00057         Extra1        = 0x00000100, 
00058         Extra2        = 0x00000200, 
00059         Extra3        = 0x00000400, 
00060         PlainText     = 0x00000800, 
00061         HourAngle     = 0x00001000,  
00062         AbsoluteMagnitude = 0x00002000  
00063     };
00064 
00066     static const InfoStringGroup AllInfo = (InfoStringGroup)(Name|CatalogNumber|Magnitude|RaDecJ2000|RaDecOfDate|AltAzi|Distance|Size|Extra1|Extra2|Extra3|HourAngle|AbsoluteMagnitude);
00068     static const InfoStringGroup ShortInfo = (InfoStringGroup)(Name|CatalogNumber|Magnitude|RaDecJ2000);
00069 
00070     virtual ~StelObject(void) {}
00071 
00074     virtual Vec3d getPositionForGrid() const {return getJ2000EquatorialPos(NULL);}
00075     
00082     virtual QString getInfoString(const StelCore *core, const InfoStringGroup& flags=StelObject::AllInfo) const = 0;
00083     
00085     virtual QString getType(void) const = 0;
00086     
00088     virtual QString getEnglishName(void) const = 0;
00089     
00091     virtual QString getNameI18n(void) const = 0;
00092     
00094     virtual Vec3d getJ2000EquatorialPos(const StelNavigator *nav) const = 0;
00095     
00099     Vec3d getEquinoxEquatorialPos(const StelNavigator* nav) const;
00100     
00103     Vec3d getSideralPos(const StelCore* core) const;
00104     
00107     Vec3d getAltAzPos(const StelNavigator* nav) const;
00108     
00110     virtual float getVMagnitude(const StelNavigator *nav) const {return 99;}
00111     
00114     virtual float getSelectPriority(const StelNavigator *nav) const {return 99;}
00115     
00117     virtual Vec3f getInfoColor(void) const {return Vec3f(1,1,1);}
00118     
00120     virtual double getCloseViewFov(const StelNavigator *nav) const {return 10.;}
00121     
00123     virtual double getSatellitesFov(const StelNavigator *nav) const {return -1.;}
00124     virtual double getParentSatellitesFov(const StelNavigator *nav) const {return -1.;}
00125     
00129     virtual double getAngularSize(const StelCore* core) const = 0;
00130 
00131 protected:
00132     friend void intrusive_ptr_add_ref(StelObject* p);
00133     friend void intrusive_ptr_release(StelObject* p);
00134     
00136     QString getPositionInfoString(const StelCore *core, const InfoStringGroup& flags) const;
00137     
00139     void postProcessInfoString(QString& str, const InfoStringGroup& flags) const;
00140     
00143     virtual void retain(void) {;}
00144     
00147     virtual void release(void) {;}
00148 };
00149 
00150 #endif // _STELOBJECT_HPP_

Generated on Mon Feb 2 17:23:47 2009 for Stellarium by  doxygen 1.5.5