47 lines
1.7 KiB
C++
47 lines
1.7 KiB
C++
#pragma once
|
|
#include "Plottable.h"
|
|
#include "../axis/Axis.h"
|
|
#include <memory_resource>
|
|
#include <span>
|
|
namespace renderive {
|
|
namespace detail {
|
|
struct LIB_DECL Sweep_Spectrum : Renderable<Sweep_Spectrum> {
|
|
using Base = Renderable<Sweep_Spectrum>;
|
|
struct Builder : Base::template next_Builder<Builder> {};
|
|
~Sweep_Spectrum() 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;
|
|
struct State : Base::template next_State<State> {
|
|
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;
|
|
};
|
|
struct Observer : Base::template next_Observer<Observer> {
|
|
State state;
|
|
std::size_t stored_block_count{};
|
|
std::size_t stored_point_count{};
|
|
std::size_t rendered_point_count{};
|
|
};
|
|
private:
|
|
[[nodiscard]] Observer capture_observation() const;
|
|
friend struct renderable::attach<Sweep_Spectrum>;
|
|
Sweep_Spectrum(renderive_Owner<Axis> frequency_axis,
|
|
renderive_Owner<Axis> power_axis);
|
|
struct Impl;
|
|
};
|
|
}
|
|
using Sweep_Spectrum = renderable::attach<detail::Sweep_Spectrum>;
|
|
}
|