🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
SolarSystem.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "AstCore/CelestialBody.hpp"
25#include "AstCore/Object.hpp"
26#include <unordered_map>
27#include <vector>
28
29AST_NAMESPACE_BEGIN
30
31
44class CelestialBody;
45class SolarSystem;
46
47
48
52class AST_CORE_API SolarSystem: public Object
53{
54public:
55 SolarSystem() = default;
56 ~SolarSystem() = default;
57
59 void init();
60
65 errc_t load(StringView dirpath);
66
71 errc_t loadPCK(StringView filepath);
72
74 errc_t loadDefault();
75
77 static std::string defaultSolarSystemDir();
78
80 const std::string& getDirpath() const { return dirpath_; }
81
83 CelestialBody* getSolarSystemBarycenter() const { return solarSystemBarycenter_.get(); }
84
86 CelestialBody* getEarthMoonBarycenter() const { return earthMoonBarycenter_.get(); }
87
89 CelestialBody* getMercury() const { return mercury_.get(); }
90
92 CelestialBody* getVenus() const { return venus_.get(); }
93
95 CelestialBody* getEarth() const { return earth_.get(); }
96
98 CelestialBody* getMars() const { return mars_.get(); }
99
101 CelestialBody* getJupiter() const { return jupiter_.get(); }
102
104 CelestialBody* getSaturn() const { return saturn_.get(); }
105
107 CelestialBody* getUranus() const { return uranus_.get(); }
108
110 CelestialBody* getNeptune() const { return neptune_.get(); }
111
113 CelestialBody* getPluto() const { return pluto_.get(); }
114
116 CelestialBody* getMoon() const { return moon_.get(); }
117
119 CelestialBody* getSun() const { return sun_.get(); }
120
124 CelestialBody* getBody(StringView name) const;
125
126
130 CelestialBody* getBodyByJplIndex(int index) const;
131
135 CelestialBody* getBodyBySpiceId(int id) const;
136
140 CelestialBody* addBody(StringView name);
141
145 CelestialBody* addBody(HCelestialBody body);
146
150 CelestialBody* getOrAddBody(StringView name);
151
152protected:
153 using BodyNameMap = std::unordered_map<std::string, CelestialBody*>;
154 using BodyIndexMap = std::unordered_map<int, CelestialBody*>;
155 using BodyVector = std::vector<SharedPtr<CelestialBody>>;
156
157
160
172
173 BodyVector bodies_;
174 mutable BodyNameMap nameMap_;
175 mutable BodyIndexMap jplIndexMap_;
176 mutable BodyIndexMap spiceIdMap_;
177 bool isInit_{false};
178 std::string dirpath_;
179};
180
181
182
185AST_NAMESPACE_END
186
187AST_DECL_TYPE_ALIAS(SolarSystem)
天体
定义 CelestialBody.hpp:52
对象基类,继承自该类的对象可以使用运行时类型信息相关功能,实现强弱引用计数、运行时元信息(属性访问、序列化等)等基础功能
定义 Object.hpp:81
太阳系
定义 SolarSystem.hpp:53
std::string dirpath_
太阳系数据目录路径
定义 SolarSystem.hpp:178
SharedPtr< CelestialBody > earth_
地球
定义 SolarSystem.hpp:163
BodyIndexMap jplIndexMap_
太阳系天体映射表,根据JPL索引映射
定义 SolarSystem.hpp:175
CelestialBody * getEarthMoonBarycenter() const
获取地月质心
定义 SolarSystem.hpp:86
SharedPtr< CelestialBody > jupiter_
木星
定义 SolarSystem.hpp:165
SharedPtr< CelestialBody > neptune_
海王星
定义 SolarSystem.hpp:168
CelestialBody * getMars() const
获取火星
定义 SolarSystem.hpp:98
SharedPtr< CelestialBody > earthMoonBarycenter_
地月质心
定义 SolarSystem.hpp:159
SharedPtr< CelestialBody > mars_
火星
定义 SolarSystem.hpp:164
SharedPtr< CelestialBody > mercury_
水星
定义 SolarSystem.hpp:161
BodyNameMap nameMap_
太阳系天体映射表,可能存在别名映射
定义 SolarSystem.hpp:174
SharedPtr< CelestialBody > pluto_
冥王星
定义 SolarSystem.hpp:169
CelestialBody * getJupiter() const
获取木星
定义 SolarSystem.hpp:101
CelestialBody * getSaturn() const
获取土星
定义 SolarSystem.hpp:104
CelestialBody * getNeptune() const
获取海王星
定义 SolarSystem.hpp:110
CelestialBody * getMoon() const
获取月球
定义 SolarSystem.hpp:116
CelestialBody * getSolarSystemBarycenter() const
获取太阳系质心
定义 SolarSystem.hpp:83
SharedPtr< CelestialBody > moon_
月球
定义 SolarSystem.hpp:170
CelestialBody * getVenus() const
获取金星
定义 SolarSystem.hpp:92
CelestialBody * getPluto() const
获取冥王星
定义 SolarSystem.hpp:113
BodyVector bodies_
太阳系天体集合
定义 SolarSystem.hpp:173
CelestialBody * getMercury() const
获取水星
定义 SolarSystem.hpp:89
SharedPtr< CelestialBody > venus_
金星
定义 SolarSystem.hpp:162
BodyIndexMap spiceIdMap_
太阳系天体映射表,根据SPICE ID映射
定义 SolarSystem.hpp:176
SharedPtr< CelestialBody > uranus_
天王星
定义 SolarSystem.hpp:167
const std::string & getDirpath() const
获取太阳系数据目录路径
定义 SolarSystem.hpp:80
CelestialBody * getEarth() const
获取地球
定义 SolarSystem.hpp:95
SharedPtr< CelestialBody > solarSystemBarycenter_
太阳系质心
定义 SolarSystem.hpp:158
SharedPtr< CelestialBody > sun_
太阳
定义 SolarSystem.hpp:171
SharedPtr< CelestialBody > saturn_
土星
定义 SolarSystem.hpp:166
CelestialBody * getUranus() const
获取天王星
定义 SolarSystem.hpp:107
CelestialBody * getSun() const
获取火星
定义 SolarSystem.hpp:119