🛰️航天仿真算法库 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 "AstUtil/ObjectNamed.hpp"
27#include <unordered_map>
28#include <vector>
29
30AST_NAMESPACE_BEGIN
31
32
45class CelestialBody;
46class SolarSystem;
47
48
49
53class AST_CORE_API SolarSystem: public ObjectNamed
54{
55public:
56 SolarSystem() = default;
57 ~SolarSystem() = default;
58
60 void init();
61
66 errc_t load(StringView dirpath);
67
72 errc_t loadPCK(StringView filepath);
73
75 errc_t loadDefault();
76
78 static std::string defaultSolarSystemDir();
79
81 const std::string& getDirpath() const { return dirpath_; }
82
84 CelestialBody* getSolarSystemBarycenter() const { return solarSystemBarycenter_.get(); }
85
87 CelestialBody* getEarthMoonBarycenter() const { return earthMoonBarycenter_.get(); }
88
90 CelestialBody* getMercury() const { return mercury_.get(); }
91
93 CelestialBody* getVenus() const { return venus_.get(); }
94
96 CelestialBody* getEarth() const { return earth_.get(); }
97
99 CelestialBody* getMars() const { return mars_.get(); }
100
102 CelestialBody* getJupiter() const { return jupiter_.get(); }
103
105 CelestialBody* getSaturn() const { return saturn_.get(); }
106
108 CelestialBody* getUranus() const { return uranus_.get(); }
109
111 CelestialBody* getNeptune() const { return neptune_.get(); }
112
114 CelestialBody* getPluto() const { return pluto_.get(); }
115
117 CelestialBody* getMoon() const { return moon_.get(); }
118
120 CelestialBody* getSun() const { return sun_.get(); }
121
125 CelestialBody* getBody(StringView name) const;
126
127
131 CelestialBody* getBodyByJplIndex(int index) const;
132
136 CelestialBody* getBodyBySpiceId(int id) const;
137
141 CelestialBody* addBody(StringView name);
142
146 CelestialBody* addBody(HCelestialBody body);
147
151 CelestialBody* getOrAddBody(StringView name);
152
153protected:
154 using BodyNameMap = std::unordered_map<std::string, CelestialBody*>;
155 using BodyIndexMap = std::unordered_map<int, CelestialBody*>;
156 using BodyVector = std::vector<SharedPtr<CelestialBody>>;
157
158
161
173
174 BodyVector bodies_;
175 mutable BodyNameMap nameMap_;
176 mutable BodyIndexMap jplIndexMap_;
177 mutable BodyIndexMap spiceIdMap_;
178 bool isInit_{false};
179 std::string dirpath_;
180};
181
182
183
186AST_NAMESPACE_END
187
188AST_DECL_TYPE_ALIAS(SolarSystem)
天体
定义 CelestialBody.hpp:52
命名对象
定义 ObjectNamed.hpp:36
太阳系
定义 SolarSystem.hpp:54
std::string dirpath_
太阳系数据目录路径
定义 SolarSystem.hpp:179
SharedPtr< CelestialBody > earth_
地球
定义 SolarSystem.hpp:164
BodyIndexMap jplIndexMap_
太阳系天体映射表,根据JPL索引映射
定义 SolarSystem.hpp:176
CelestialBody * getEarthMoonBarycenter() const
获取地月质心
定义 SolarSystem.hpp:87
SharedPtr< CelestialBody > jupiter_
木星
定义 SolarSystem.hpp:166
SharedPtr< CelestialBody > neptune_
海王星
定义 SolarSystem.hpp:169
CelestialBody * getMars() const
获取火星
定义 SolarSystem.hpp:99
SharedPtr< CelestialBody > earthMoonBarycenter_
地月质心
定义 SolarSystem.hpp:160
SharedPtr< CelestialBody > mars_
火星
定义 SolarSystem.hpp:165
SharedPtr< CelestialBody > mercury_
水星
定义 SolarSystem.hpp:162
BodyNameMap nameMap_
太阳系天体映射表,可能存在别名映射
定义 SolarSystem.hpp:175
SharedPtr< CelestialBody > pluto_
冥王星
定义 SolarSystem.hpp:170
CelestialBody * getJupiter() const
获取木星
定义 SolarSystem.hpp:102
CelestialBody * getSaturn() const
获取土星
定义 SolarSystem.hpp:105
CelestialBody * getNeptune() const
获取海王星
定义 SolarSystem.hpp:111
CelestialBody * getMoon() const
获取月球
定义 SolarSystem.hpp:117
CelestialBody * getSolarSystemBarycenter() const
获取太阳系质心
定义 SolarSystem.hpp:84
SharedPtr< CelestialBody > moon_
月球
定义 SolarSystem.hpp:171
CelestialBody * getVenus() const
获取金星
定义 SolarSystem.hpp:93
CelestialBody * getPluto() const
获取冥王星
定义 SolarSystem.hpp:114
BodyVector bodies_
太阳系天体集合
定义 SolarSystem.hpp:174
CelestialBody * getMercury() const
获取水星
定义 SolarSystem.hpp:90
SharedPtr< CelestialBody > venus_
金星
定义 SolarSystem.hpp:163
BodyIndexMap spiceIdMap_
太阳系天体映射表,根据SPICE ID映射
定义 SolarSystem.hpp:177
SharedPtr< CelestialBody > uranus_
天王星
定义 SolarSystem.hpp:168
const std::string & getDirpath() const
获取太阳系数据目录路径
定义 SolarSystem.hpp:81
CelestialBody * getEarth() const
获取地球
定义 SolarSystem.hpp:96
SharedPtr< CelestialBody > solarSystemBarycenter_
太阳系质心
定义 SolarSystem.hpp:159
SharedPtr< CelestialBody > sun_
太阳
定义 SolarSystem.hpp:172
SharedPtr< CelestialBody > saturn_
土星
定义 SolarSystem.hpp:167
CelestialBody * getUranus() const
获取天王星
定义 SolarSystem.hpp:108
CelestialBody * getSun() const
获取火星
定义 SolarSystem.hpp:120