Stellarium  0.90.0
CustomObject.hpp
1 /*
2  * Copyright (C) 2016 Alexander Wolf
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
17  */
18 
19 #ifndef _CUSTOMOBJECT_HPP_
20 #define _CUSTOMOBJECT_HPP_ 1
21 
22 #include <QVariant>
23 #include <QString>
24 #include <QStringList>
25 #include <QFont>
26 #include <QList>
27 
28 #include "StelObject.hpp"
29 #include "StelTextureTypes.hpp"
30 #include "StelFader.hpp"
31 
32 class StelPainter;
33 
34 class CustomObject : public StelObject
35 {
36  friend class CustomObjectMgr;
37 public:
38  static const QString CUSTOMOBJECT_TYPE;
39 
40  CustomObject(const QString& codesignation, const Vec3d& coordinates, const bool isVisible);
41  ~CustomObject();
42 
44  virtual QString getType(void) const
45  {
46  return CUSTOMOBJECT_TYPE;
47  }
48 
49  virtual QString getID(void) const
50  {
51  return designation;
52  }
53 
54  virtual float getSelectPriority(const StelCore* core) const;
55 
59  virtual QString getInfoString(const StelCore* core, const InfoStringGroup& flags) const;
60  virtual Vec3f getInfoColor(void) const;
61  virtual Vec3d getJ2000EquatorialPos(const StelCore*) const
62  {
63  return XYZ;
64  }
66  virtual float getVMagnitude(const StelCore* core) const;
68  virtual double getAngularSize(const StelCore* core) const;
70  virtual QString getNameI18n(void) const;
72  virtual QString getEnglishName(void) const
73  {
74  return designation;
75  }
76 
77  void update(double deltaTime);
78 
79 private:
80  bool initialized;
81 
82  Vec3d XYZ; // holds J2000 position
83 
84  StelTextureSP markerTexture;
85  static Vec3f markerColor;
86  static float markerSize;
87 
88  void draw(StelCore* core, StelPainter *painter);
89 
90  QString designation;
91  bool isMarker;
92 
93  LinearFader labelsFader;
94 };
95 
96 #endif // _CUSTOMOBJECT_HPP_
virtual Vec3f getInfoColor(void) const
Get a color used to display info about the object.
virtual double getAngularSize(const StelCore *core) const
Get the angular size of pulsar.
Implementation of StelFader which implements a linear transition.
Definition: StelFader.hpp:77
The base abstract class for sky objects used in Stellarium like Stars, Planets, Constellations etc...
Definition: StelObject.hpp:36
virtual Vec3d getJ2000EquatorialPos(const StelCore *) const
Get observer-centered equatorial coordinates at equinox J2000.
Define the StelTextureSP type.
virtual float getSelectPriority(const StelCore *core) const
Return a priority value which is used to discriminate objects by priority As for magnitudes, the lower is the higher priority.
Main class for Stellarium core processing.
Definition: StelCore.hpp:48
virtual QString getInfoString(const StelCore *core, const InfoStringGroup &flags) const
Get an HTML string to describe the object.
virtual float getVMagnitude(const StelCore *core) const
Get the visual magnitude of pulsar.
virtual QString getID(void) const
Returns a unique identifier for this object.
virtual QString getType(void) const
Get the type of object.
Provides functions for performing openGL drawing operations.
Definition: StelPainter.hpp:40
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
virtual QString getEnglishName(void) const
Get the english name of pulsar.
virtual void update(double)
Update the module with respect to the time.
virtual void draw(StelCore *core)
Execute all the drawing functions for this module.
virtual QString getNameI18n(void) const
Get the localized name of pulsar.