ConstellationHandle

template<IsSpectral TSpectral>
class ConstellationHandle : public huira::Handle<Constellation<TSpectral>>

Handle for a constellation: satellites placed by SGP4 and seen as points (see Constellation).

Template Parameters:

TSpectral – The spectral type (e.g., RGB, Visible8)

Public Functions

ConstellationHandle() = delete
ConstellationReport add(const std::vector<SatRec> &element_sets) const

Add satellites, from their element sets, or bring those it holds up to date (see Constellation::add()).

ConstellationReport add(const ElementSetCatalog &catalog) const

Add the satellites of a catalog that was read, or bring those it holds up to date (see Constellation::add()).

ConstellationReport load(const std::filesystem::path &path, const ElementSetOptions &options = {}) const

Read a catalog of element sets, and add its satellites, or bring those it holds up to date (see Constellation::load()).

ConstellationReport load(const std::filesystem::path &path, ElementSetFormat format, const ElementSetOptions &options = {}) const

Read a catalog of element sets in the format given, and add its satellites, or bring those it holds up to date (see Constellation::load()).

bool remove(int catalog_number) const

Remove a satellite, which something else in the scene can then place.

Parameters:

catalog_number – The satellite’s NORAD catalog number.

Returns:

Whether it held the satellite.

void clear() const

Remove every satellite.

std::size_t size() const

The number of satellites it holds.

bool contains(int catalog_number) const

Whether it holds a satellite.

Parameters:

catalog_number – The satellite’s NORAD catalog number.

SatRec element_set(int catalog_number) const

The element set it holds for a satellite.

Parameters:

catalog_number – The satellite’s NORAD catalog number.

Throws:

std::runtime_error – if it doesn’t hold the satellite.

Returns:

Its element set.

std::vector<SatRec> element_sets() const

The element sets it holds, one for each satellite, in no particular order.

void set_unresolved_object(const UnresolvedObjectHandle<TSpectral> &unresolved_object) const

Set the unresolved object each satellite is seen as.

Each satellite is an instance of it, resolved for where that satellite is: a Lambertian sphere lit by the Sun is bright or faint by its phase, and dark in the Earth’s shadow, if the Earth is in the scene to cast one. A scene view resolves the satellites in parallel, so the object must be safe to resolve from several threads at once, as Huira’s own are.

Parameters:

unresolved_object – What each satellite is seen as.

Throws:

std::runtime_error – if there is no unresolved object.

UnresolvedObjectHandle<TSpectral> get_unresolved_object() const

The unresolved object each satellite is seen as.

void set_visible(bool visible) const

Show or hide its satellites: a scene view leaves out those of a hidden constellation.

bool is_visible() const

Whether its satellites are shown.

bool valid() const

Checks if the handle points to a valid, scene-owned object.

Returns:

true if valid, false otherwise

std::shared_ptr<U> get() const

Gets a shared_ptr to the referenced object, optionally downcasting to a derived type.

Template Parameters:

U – Type to cast to (default: T)

Throws:

std::runtime_error – if the handle is invalid or the cast fails

Returns:

std::shared_ptr<U> Shared pointer to the object

inline std::string name() const
inline std::uint64_t id() const
inline std::string type() const

Protected Functions

std::shared_ptr<T> get_() const

Gets a shared_ptr to the referenced object, enforcing validity.

Throws:

std::runtime_error – if the handle is invalid

Returns:

std::shared_ptr<T> Shared pointer to the object

Protected Attributes

std::weak_ptr<T> ptr_