Files
Renderive/render_2D/plottable/Constellation_Diagram.h
T
2026-08-12 00:06:44 +08:00

37 lines
1.3 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
};
struct Constellation_Diagram_Properties {
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{};
};
namespace detail {
class LIB_DECL Constellation_Diagram_Control : public Plottable_State<Constellation_Diagram_Properties> {
public:
Constellation_Diagram_Control(Plot_Core& plot, const Constellation_Diagram_Properties& properties, std::shared_ptr<Axis> i_axis, std::shared_ptr<Axis> q_axis);
~Constellation_Diagram_Control() override;
void append_point(PointF point);
[[nodiscard]] std::size_t point_count() const;
void fit_square_to_axes();
protected:
void paint(Painter& painter, const Render_State_View& state) override;
private:
struct Impl;
std::unique_ptr<Impl> impl_;
void publish() override;
};
}
using Constellation_Diagram = detail::Attach_Plottable<detail::Constellation_Diagram_Control, Constellation_Diagram_Properties>;
}