41 lines
1.6 KiB
C++
41 lines
1.6 KiB
C++
#pragma once
|
|
#include "Plottable.h"
|
|
#include "../axis/Axis.h"
|
|
#include <memory_resource>
|
|
#include <span>
|
|
namespace renderive {
|
|
struct Sweep_Spectrum_Properties {
|
|
Range frequency_range{};
|
|
Nonnegative_Count bins_per_block;
|
|
Positive_Count block_count;
|
|
Pen pen{Color::yellow()};
|
|
Pen current_frequency_pen{Color::red(), 2.0};
|
|
bool visible_range_only{true};
|
|
Line_Interpolation_Mode interpolation_mode = Line_Interpolation_Mode::Linear_Value;
|
|
};
|
|
namespace detail {
|
|
class LIB_DECL Sweep_Spectrum_Control : public Plottable_State<Sweep_Spectrum_Properties> {
|
|
public:
|
|
Sweep_Spectrum_Control(::Scene_Base& scene, const Sweep_Spectrum_Properties& properties, std::shared_ptr<Axis> frequency_axis, std::shared_ptr<Axis> power_axis);
|
|
~Sweep_Spectrum_Control() override;
|
|
void append_block(std::span<const double> values);
|
|
void append_block(std::pmr::vector<double>&& values);
|
|
template <class Values>
|
|
void append_block(const Values& values) {
|
|
append_block(std::span<const double>(values.data(), values.size()));
|
|
}
|
|
[[nodiscard]] std::size_t stored_block_count() const;
|
|
[[nodiscard]] std::size_t stored_point_count() const;
|
|
[[nodiscard]] std::size_t rendered_point_count() const;
|
|
protected:
|
|
void prepare_frame(const Prepare_Render_Context& context) override;
|
|
void paint(Painter& painter, const Paint_Render_Context& context) override;
|
|
private:
|
|
struct Impl;
|
|
std::unique_ptr<Impl> impl_;
|
|
void publish() override;
|
|
};
|
|
}
|
|
using Sweep_Spectrum = detail::Attach_Plottable<detail::Sweep_Spectrum_Control, Sweep_Spectrum_Properties>;
|
|
}
|