55 lines
2.4 KiB
C++
55 lines
2.4 KiB
C++
#pragma once
|
|
#include "Hover_Tooltip.h"
|
|
#include "Plottable.h"
|
|
#include "../axis/Axis.h"
|
|
#include "../renderable/Render_Partition.h"
|
|
#include <memory_resource>
|
|
#include <span>
|
|
namespace renderive {
|
|
struct Waterfall_Properties : Hover_Tooltip_Properties {
|
|
Range frequency_range{0.0, 10.0};
|
|
Range power_range{0.0, 10.0};
|
|
Nonnegative_Count frequency_bin_count;
|
|
Render_Partition_Mode partition_mode{Render_Partition_Mode::Automatic};
|
|
Positive_Count partition_count;
|
|
bool visible_range_only{true};
|
|
Image_Interpolation_Mode interpolation_mode = Image_Interpolation_Mode::Nearest;
|
|
Color_Map color_map;
|
|
};
|
|
namespace detail {
|
|
class LIB_DECL Waterfall_Control : public Plottable_State<Waterfall_Properties>, public Event_Handler {
|
|
public:
|
|
Waterfall_Control(Plot_Core& plot, const Waterfall_Properties& properties, std::shared_ptr<Frequency_Axis> frequency_axis, std::shared_ptr<Time_Axis> time_axis);
|
|
~Waterfall_Control() override;
|
|
void append_row(int tick, std::span<const double> values);
|
|
void append_row(int tick, std::pmr::vector<double>&& values);
|
|
void append_row(Time_Of_Day time, std::span<const double> values);
|
|
void append_row(Time_Of_Day time, std::pmr::vector<double>&& values);
|
|
template <class Values>
|
|
void append_row(int tick, const Values& values) {
|
|
append_row(tick, std::span<const double>(values.data(), values.size()));
|
|
}
|
|
template <class Values>
|
|
void append_row(Time_Of_Day time, const Values& values) {
|
|
append_row(time, std::span<const double>(values.data(), values.size()));
|
|
}
|
|
[[nodiscard]] std::size_t row_count() const;
|
|
[[nodiscard]] std::size_t stored_point_count() const;
|
|
[[nodiscard]] std::size_t rendered_cell_count() const;
|
|
void handle_event(const Event& event) override;
|
|
protected:
|
|
void paint(Painter& painter, const Render_State_View& state) override;
|
|
void build_paint_task_graph(Renderable_Task_Graph& graph) override;
|
|
private:
|
|
struct Impl;
|
|
std::unique_ptr<Impl> impl_;
|
|
void prepare_render_frame(const Render_State_View& state, int graph_partition_count);
|
|
void paint_render_frame(Painter& painter, const Render_State_View& state,
|
|
std::uint64_t frame_interval_ns);
|
|
void render_partition(const Render_State_View& state, int partition_index);
|
|
void publish() override;
|
|
};
|
|
}
|
|
using Waterfall = detail::Attach_Plottable<detail::Waterfall_Control, Waterfall_Properties>;
|
|
}
|