网页升级
This commit is contained in:
@@ -145,6 +145,40 @@ void Waterfall::set_frequency_bin_count(int value) {
|
||||
changed();
|
||||
}
|
||||
|
||||
std::size_t Waterfall::row_count() const {
|
||||
std::lock_guard lock(mutex_);
|
||||
return state_.rows.size();
|
||||
}
|
||||
|
||||
std::size_t Waterfall::stored_point_count() const {
|
||||
std::lock_guard lock(mutex_);
|
||||
std::size_t count{};
|
||||
for (const auto& row : state_.rows)
|
||||
count += row.values.size();
|
||||
return count;
|
||||
}
|
||||
|
||||
std::size_t Waterfall::rendered_cell_count() const {
|
||||
const State state = state_snapshot();
|
||||
if (!state.frequency_axis || state.rows.empty())
|
||||
return 0;
|
||||
const int source_width = std::min(
|
||||
state.bin_count,
|
||||
static_cast<int>(std::min_element(
|
||||
state.rows.begin(), state.rows.end(),
|
||||
[](const Row& left, const Row& right) {
|
||||
return left.values.size() < right.values.size();
|
||||
})->values.size()));
|
||||
if (source_width <= 0)
|
||||
return 0;
|
||||
const auto columns = frequency_columns(state.frequency_range,
|
||||
state.frequency_axis->coord_range(),
|
||||
source_width, state.visible_only);
|
||||
return columns ? static_cast<std::size_t>(columns->last - columns->first + 1) *
|
||||
state.rows.size()
|
||||
: 0;
|
||||
}
|
||||
|
||||
Waterfall::State Waterfall::state_snapshot() const { std::lock_guard lock(mutex_); return state_; }
|
||||
|
||||
void Waterfall::handle_event(const Event& event) { update_hover(event); }
|
||||
@@ -247,6 +281,11 @@ void Frequency_Trace::append_sample(Time_Of_Day time, double value) {
|
||||
|
||||
std::shared_ptr<Time_Axis> Frequency_Trace::time_axis() const { std::lock_guard lock(mutex_); return time_axis_; }
|
||||
std::shared_ptr<Axis> Frequency_Trace::value_axis() const { std::lock_guard lock(mutex_); return value_axis_; }
|
||||
std::size_t Frequency_Trace::sample_count() const { std::lock_guard lock(mutex_); return samples_.size(); }
|
||||
std::size_t Frequency_Trace::rendered_point_count() const {
|
||||
std::lock_guard lock(mutex_);
|
||||
return time_axis_ && value_axis_ && samples_.size() >= 2 ? samples_.size() : 0;
|
||||
}
|
||||
|
||||
void Frequency_Trace::paint(detail::Painter& painter) {
|
||||
std::shared_ptr<Time_Axis> time_axis;
|
||||
@@ -338,6 +377,30 @@ void Afterglow::set_attenuation_rate(double value) {
|
||||
changed();
|
||||
}
|
||||
|
||||
std::size_t Afterglow::history_count() const {
|
||||
std::lock_guard lock(mutex_);
|
||||
return state_.history.size();
|
||||
}
|
||||
|
||||
std::size_t Afterglow::latest_spectrum_point_count() const {
|
||||
std::lock_guard lock(mutex_);
|
||||
return state_.history.empty() ? 0 : state_.history.back().size();
|
||||
}
|
||||
|
||||
std::size_t Afterglow::rendered_cell_count() const {
|
||||
const State state = state_snapshot();
|
||||
if (!state.power_axis || state.history.empty())
|
||||
return 0;
|
||||
const int width = std::min(state.frequency_count,
|
||||
static_cast<int>(state.history.back().size()));
|
||||
const int height = state.power_count > 0
|
||||
? state.power_count
|
||||
: std::max(1, static_cast<int>(state.power_axis->pixel_length()));
|
||||
return width > 0 && height > 0
|
||||
? static_cast<std::size_t>(width) * static_cast<std::size_t>(height)
|
||||
: 0;
|
||||
}
|
||||
|
||||
void Afterglow::append_spectrum(std::span<const double> values) {
|
||||
{
|
||||
std::lock_guard lock(mutex_);
|
||||
|
||||
Reference in New Issue
Block a user