GlobeEngine
System.h
Go to the documentation of this file.
1 #ifndef ExoViewer_System_h
2 #define ExoViewer_System_h
3 
4 #include "OpenGL_Includes.h"
5 #include <math.h>
6 #include <vector>
7 #include <vmmlib/vmmlib.hpp>
8 #include "GlobeComponent.h"
9 #include "AstroCommon.h"
10 #include "HabitableZone.h"
11 #include "Star.h"
12 #include "Planet.h"
13 #include "Moon.h"
14 #include "SmallBody.h"
15 #include "SmallBodyPointCloud.h"
16 
17 
18 namespace geAstro{
19 
20  class System : public ge::GlobeComponent
21  {
22  public:
23  enum BodyType{
25  };
26 
27  System();
28  ~System();
29  void clear();
30  void update();
31  void create(std::string _name, std::string _rightascensionString, std::string _declinationString,
32  double _rightascension, double _declination, double _distance,
33  double _epoch);
34  void createSmallBodyPointCloud(std::shared_ptr<ge::Shader> _programForPoints);
35 
36  bool isSolarSystem() const;
37 
38  void setHabitableZone();
39  //void setStandardTextureForPlanetsInHabitalZone(std::shared_ptr<ge::TextureHandle> _earthLikeTex);
40  const std::shared_ptr<HabitableZone>& getHabitableZone() const;
41 
42  //no const & as vector is modified elsewhere
43  std::vector< std::shared_ptr<Body> >& getBodiesInSystem();
44  std::vector< std::shared_ptr<Star> >& getStarsInSystem();
45  std::vector< std::shared_ptr<Moon> >& getMoonsInSystem();
46  std::vector< std::shared_ptr<Planet> >& getPlanetsInSystem();
47  std::vector< std::shared_ptr<SmallBody> >& getSmallBodiesInSystem();
48 
49  void addStar(std::shared_ptr<Star> _star);
50  void addPlanet(std::shared_ptr<Planet> _planet);
51  void addMoon(std::shared_ptr<Moon> _moon);
52  void addSmallBody(std::shared_ptr<SmallBody> _smallBody);
53 
54  int getNumberOfBodies();
55 
56  void setHabitableZone(std::shared_ptr<ge::Shader> _ringShader,
57  std::shared_ptr<HabitableZoneClassification> _hzClass,
58  std::shared_ptr<ge::TextureHandle> _earthLikeTexHandle);
59 
60  void updateOrbits(double _currentDate);
61 
62  //void rescale(double _scaleFactor, bool _isScaled);
63 
65 
66  void drawObjectsOfType(System::BodyType _type, std::shared_ptr<ge::Camera> _cam);
67  void drawOrbitsOfType(System::BodyType _type, std::shared_ptr<ge::Camera> _cam);
68 
69  //std::shared_ptr<SmallBodyPointCloud> getSmallBodyPointCloud() const;
70 
71  double getEpoch() const;
72  double getMeanInclination() const;
73  double getMeanOmega() const;
74  double getMeanW() const;
75  std::string getRightAscension() const;
76  std::string getDeclination() const;
77  double getDistance() const;
78 
79  const vmml::Matrix4d& getTranslationMatrix();
80  const vmml::Matrix4d& getInverseTranslationMatrix();
81  const vmml::Matrix4d& getRotationMatrix();
82  const vmml::Matrix4d& getInverseRotationMatrix();
83  const vmml::Vector3d& getWorldPosition();
84 
86 
87  private:
88  void create() {};
89 
90  bool solarSystem;
91  double distance;
92 
93  std::string rightAscensionString; //in string format "hh mm ss" for display in UI
94  std::string declinationString; //in string format "°° mm ss" for display in UI
95 
96  double rightAscension; //in degrees
97  double declination; //in degrees
98  double epoch;
99  float meanInclination;
100  float meanOmega;
101  float meanW;
102 
103  std::vector<std::shared_ptr<Body>> bodiesInSystem;
104  std::vector<std::shared_ptr<Star>> stars;
105  std::vector<std::shared_ptr<Planet>> planets;
106  std::vector<std::shared_ptr<Moon>> moons;
107  std::vector<std::shared_ptr<SmallBody>> smallBodies;
108 
109  std::shared_ptr<HabitableZone> habitableZone;
110 
111  std::shared_ptr<SmallBodyPointCloud> sbPointCloud;
112 
113  vmml::Matrix4d translationMatrix;
114  vmml::Matrix4d inverseTranslationMatrix;
115  vmml::Matrix4d rotationMatrix;
116  vmml::Matrix4d inverseRotationMatrix;
117  vmml::Vector3d worldPosition;
118 
119  };
120 }
121 #endif
Definition: DrawableComponent.h:25
const ge::DrawableComponent & getDrawableForSelection(UniverseSelection _selection) const
int getNumberOfBodies()
Definition: System.cpp:466
void addSmallBody(std::shared_ptr< SmallBody > _smallBody)
Definition: System.cpp:485
void updateOrbits(double _currentDate)
Definition: System.cpp:331
void createSmallBodyPointCloud(std::shared_ptr< ge::Shader > _programForPoints)
Definition: System.cpp:249
std::vector< std::shared_ptr< Star > > & getStarsInSystem()
Definition: System.cpp:450
bool isSolarSystem() const
Definition: System.cpp:438
void update()
Definition: System.cpp:346
System()
Definition: System.cpp:5
const vmml::Matrix4d & getRotationMatrix()
Definition: System.cpp:524
Definition: AstroCommon.h:50
std::string getDeclination() const
Definition: System.cpp:494
const vmml::Matrix4d & getTranslationMatrix()
Definition: System.cpp:516
void setHabitableZone()
const std::shared_ptr< HabitableZone > & getHabitableZone() const
Definition: System.cpp:442
const vmml::Matrix4d & getInverseRotationMatrix()
Definition: System.cpp:528
Definition: AstroCommon.h:18
void calculateMeanOrbitalParameters()
Definition: System.cpp:254
std::vector< std::shared_ptr< SmallBody > > & getSmallBodiesInSystem()
Definition: System.cpp:462
double getMeanOmega() const
Definition: System.cpp:505
Definition: System.h:24
Definition: System.h:24
BodyType
Definition: System.h:23
Definition: System.h:24
void drawOrbitsOfType(System::BodyType _type, std::shared_ptr< ge::Camera > _cam)
Definition: System.cpp:409
double getEpoch() const
Definition: System.cpp:512
std::vector< std::shared_ptr< Body > > & getBodiesInSystem()
Definition: System.cpp:446
double getMeanInclination() const
Definition: System.cpp:502
Definition: GlobeComponent.h:15
Definition: System.h:20
std::vector< std::shared_ptr< Moon > > & getMoonsInSystem()
Definition: System.cpp:454
double getDistance() const
Definition: System.cpp:498
void clear()
Definition: System.cpp:15
~System()
Definition: System.cpp:10
std::vector< std::shared_ptr< Planet > > & getPlanetsInSystem()
Definition: System.cpp:458
void drawObjectsOfType(System::BodyType _type, std::shared_ptr< ge::Camera > _cam)
Definition: System.cpp:371
void addMoon(std::shared_ptr< Moon > _moon)
Definition: System.cpp:480
const vmml::Matrix4d & getInverseTranslationMatrix()
Definition: System.cpp:520
void addStar(std::shared_ptr< Star > _star)
Definition: System.cpp:470
void addPlanet(std::shared_ptr< Planet > _planet)
Definition: System.cpp:475
Definition: System.h:24
std::string getRightAscension() const
Definition: System.cpp:490
Definition: System.h:24
double getMeanW() const
Definition: System.cpp:508
const vmml::Vector3d & getWorldPosition()
Definition: System.cpp:532