Files
Renderive/render_2D/render_2D/plottable/Constellation_Diagram.h
T
2026-08-17 14:28:19 +08:00

41 lines
1.4 KiB
C++

#pragma once
#include "Plottable.h"
#include "../axis/Axis.h"
namespace renderive {
enum class Constellation_Diagram_Type : std::uint8_t {
Psk4 = 4,
Psk8 = 8,
Psk16 = 16
};
namespace detail {
struct LIB_DECL Constellation_Diagram : Renderable<Constellation_Diagram> {
using Base = Renderable<Constellation_Diagram>;
~Constellation_Diagram() override;
void append_point(PointF point);
[[nodiscard]] std::size_t point_count() const;
void fit_square_to_axes();
struct State : Base::template next_State<State> {
Range i_range{0.0, 100.0};
Range q_range{0.0, 100.0};
Color point_color = Color::red();
Color anchor_color = Color::yellow();
Nonnegative_Count point_lifetime_ms{1000};
Constellation_Diagram_Type type = Constellation_Diagram_Type::Psk8;
double phase_offset_radians{};
};
struct Observer : Base::template next_Observer<Observer> {
State state;
std::size_t point_count{};
};
struct Builder : Base::template next_Builder<Builder> {};
private:
[[nodiscard]] Observer capture_observation() const;
struct Impl;
friend struct renderable::attach<Constellation_Diagram>;
Constellation_Diagram(const State& state, renderive_Owner<Axis> i_axis,
renderive_Owner<Axis> q_axis);
};
} // namespace detail
using Constellation_Diagram = renderable::attach<detail::Constellation_Diagram>;
} // namespace renderive