改结构
This commit is contained in:
+147
-97
@@ -114,14 +114,18 @@ private:
|
||||
std::function<void(const Plot_Event&)> update_scene;
|
||||
};
|
||||
|
||||
#define AETHERA_PROP(Type, Name) detail::Prop_Field<&Type::Prop::Name, #Name>
|
||||
#define AETHERA_STATE(Type, Name) detail::State_Field<typename Type::Base_Tag, &Type::State::Name, #Name>
|
||||
template <auto Member, structive::Fixed_String Key>
|
||||
using Prop_Field = detail::Prop_Field<Member, Key>;
|
||||
|
||||
template <typename Definition, typename... Fields, typename Object>
|
||||
template <typename Definition, auto Member, structive::Fixed_String Key>
|
||||
using State_Field = detail::State_Field<typename Definition::Base_Tag, Member, Key>;
|
||||
|
||||
template <typename... Fields, typename Object>
|
||||
std::unique_ptr<Plot::Scene_View> make_scene_view(
|
||||
Object& object,
|
||||
std::vector<std::shared_ptr<void>> owners,
|
||||
std::function<void(const Plot_Event&)> update) {
|
||||
using Definition = typename Object::Attached_Object;
|
||||
using Tag = typename Definition::Base_Tag;
|
||||
using State = typename Definition::State;
|
||||
using Adapter = detail::Renderable_Adapter<Object, Fields...,
|
||||
@@ -181,17 +185,20 @@ void resize_axes(Size viewport, Axes*... axes) {
|
||||
(axes->template set<&Abs_Axis::Prop::canvas_size>(viewport), ...);
|
||||
}
|
||||
|
||||
template <typename Definition>
|
||||
std::shared_ptr<Plot> build_2d_plot(asio::any_io_executor executor) {
|
||||
std::unique_ptr<Scene_2D> make_scene_2d() {
|
||||
constexpr Size canvas{720, 420};
|
||||
Scene_2D::Builder scene_builder;
|
||||
scene_builder
|
||||
.set(&Render_Scene_2D::Prop::viewport, canvas)
|
||||
.set(&Render_Scene_2D::Prop::background, Color{7, 13, 24, 255})
|
||||
.set(&Render_Scene_2D::Prop::view_active, true);
|
||||
auto scene = finish_build(std::move(scene_builder));
|
||||
return finish_build(std::move(scene_builder));
|
||||
}
|
||||
}
|
||||
|
||||
if constexpr (std::same_as<Definition, Spectrum>) {
|
||||
std::shared_ptr<Plot> make_spectrum_plot(asio::any_io_executor executor) {
|
||||
constexpr Size canvas{720, 420};
|
||||
auto scene = make_scene_2d();
|
||||
auto frequency = finish_shared<Frequency_Axis_Object>(frequency_axis_builder(canvas));
|
||||
auto vertical = finish_shared<Numeric_Axis_Object>(numeric_axis_builder(
|
||||
Axis_Orientation::vertical, {64.0, 370.0}, -320.0, {-110.0, 0.0}, canvas));
|
||||
@@ -214,23 +221,41 @@ std::shared_ptr<Plot> build_2d_plot(asio::any_io_executor executor) {
|
||||
raw->update_samples(samples);
|
||||
};
|
||||
std::vector<std::shared_ptr<void>> owners{frequency, vertical, object};
|
||||
auto view = make_scene_view<Spectrum,
|
||||
AETHERA_PROP(Spectrum, center_frequency), AETHERA_PROP(Spectrum, partition_count),
|
||||
AETHERA_PROP(Spectrum, max_hold_visible), AETHERA_PROP(Spectrum, min_hold_visible),
|
||||
AETHERA_PROP(Spectrum, max_marker_visible), AETHERA_PROP(Spectrum, min_marker_visible),
|
||||
AETHERA_PROP(Spectrum, sweep_region_visible), AETHERA_PROP(Spectrum, visible_range_only),
|
||||
AETHERA_PROP(Spectrum, frequency_range), AETHERA_PROP(Spectrum, sweep_frequency_range),
|
||||
AETHERA_PROP(Spectrum, partition_mode), AETHERA_PROP(Spectrum, interpolation_mode),
|
||||
AETHERA_PROP(Spectrum, max_brush), AETHERA_PROP(Spectrum, current_brush),
|
||||
AETHERA_PROP(Spectrum, min_brush), AETHERA_PROP(Spectrum, max_pen),
|
||||
AETHERA_PROP(Spectrum, current_pen), AETHERA_PROP(Spectrum, min_pen),
|
||||
AETHERA_PROP(Spectrum, selected_marker_pen), AETHERA_PROP(Spectrum, marker_pen),
|
||||
AETHERA_PROP(Spectrum, middle_frequency_pen), AETHERA_PROP(Spectrum, sweep_region_brush),
|
||||
AETHERA_PROP(Spectrum, custom_markers), AETHERA_PROP(Spectrum, selected_marker),
|
||||
AETHERA_STATE(Spectrum, sample_count), AETHERA_STATE(Spectrum, rendered_point_count),
|
||||
AETHERA_STATE(Spectrum, selectable_marker_count)>(*object, std::move(owners), std::move(update));
|
||||
auto view = make_scene_view<
|
||||
Prop_Field<&Spectrum::Prop::center_frequency, "center_frequency">,
|
||||
Prop_Field<&Spectrum::Prop::partition_count, "partition_count">,
|
||||
Prop_Field<&Spectrum::Prop::max_hold_visible, "max_hold_visible">,
|
||||
Prop_Field<&Spectrum::Prop::min_hold_visible, "min_hold_visible">,
|
||||
Prop_Field<&Spectrum::Prop::max_marker_visible, "max_marker_visible">,
|
||||
Prop_Field<&Spectrum::Prop::min_marker_visible, "min_marker_visible">,
|
||||
Prop_Field<&Spectrum::Prop::sweep_region_visible, "sweep_region_visible">,
|
||||
Prop_Field<&Spectrum::Prop::visible_range_only, "visible_range_only">,
|
||||
Prop_Field<&Spectrum::Prop::frequency_range, "frequency_range">,
|
||||
Prop_Field<&Spectrum::Prop::sweep_frequency_range, "sweep_frequency_range">,
|
||||
Prop_Field<&Spectrum::Prop::partition_mode, "partition_mode">,
|
||||
Prop_Field<&Spectrum::Prop::interpolation_mode, "interpolation_mode">,
|
||||
Prop_Field<&Spectrum::Prop::max_brush, "max_brush">,
|
||||
Prop_Field<&Spectrum::Prop::current_brush, "current_brush">,
|
||||
Prop_Field<&Spectrum::Prop::min_brush, "min_brush">,
|
||||
Prop_Field<&Spectrum::Prop::max_pen, "max_pen">,
|
||||
Prop_Field<&Spectrum::Prop::current_pen, "current_pen">,
|
||||
Prop_Field<&Spectrum::Prop::min_pen, "min_pen">,
|
||||
Prop_Field<&Spectrum::Prop::selected_marker_pen, "selected_marker_pen">,
|
||||
Prop_Field<&Spectrum::Prop::marker_pen, "marker_pen">,
|
||||
Prop_Field<&Spectrum::Prop::middle_frequency_pen, "middle_frequency_pen">,
|
||||
Prop_Field<&Spectrum::Prop::sweep_region_brush, "sweep_region_brush">,
|
||||
Prop_Field<&Spectrum::Prop::custom_markers, "custom_markers">,
|
||||
Prop_Field<&Spectrum::Prop::selected_marker, "selected_marker">,
|
||||
State_Field<Spectrum, &Spectrum::State::sample_count, "sample_count">,
|
||||
State_Field<Spectrum, &Spectrum::State::rendered_point_count, "rendered_point_count">,
|
||||
State_Field<Spectrum, &Spectrum::State::selectable_marker_count, "selectable_marker_count">>(
|
||||
*object, std::move(owners), std::move(update));
|
||||
return std::make_shared<Plot>(std::move(executor), std::move(scene), std::move(view));
|
||||
} else if constexpr (std::same_as<Definition, Frequency_Trace>) {
|
||||
}
|
||||
|
||||
std::shared_ptr<Plot> make_frequency_trace_plot(asio::any_io_executor executor) {
|
||||
constexpr Size canvas{720, 420};
|
||||
auto scene = make_scene_2d();
|
||||
auto time = finish_shared<Time_Axis_Object>(time_axis_builder(
|
||||
Axis_Orientation::horizontal, {64.0, 370.0}, 620.0, canvas));
|
||||
auto vertical = finish_shared<Numeric_Axis_Object>(numeric_axis_builder(
|
||||
@@ -246,13 +271,20 @@ std::shared_ptr<Plot> build_2d_plot(asio::any_io_executor executor) {
|
||||
+ std::sin(event.time_milliseconds * 0.0007) * 0.2);
|
||||
};
|
||||
std::vector<std::shared_ptr<void>> owners{time, vertical, object, tick};
|
||||
auto view = make_scene_view<Frequency_Trace,
|
||||
AETHERA_PROP(Frequency_Trace, partition_count), AETHERA_PROP(Frequency_Trace, pen),
|
||||
AETHERA_PROP(Frequency_Trace, partition_mode), AETHERA_PROP(Frequency_Trace, samples),
|
||||
AETHERA_STATE(Frequency_Trace, sample_count), AETHERA_STATE(Frequency_Trace, rendered_point_count)>(
|
||||
auto view = make_scene_view<
|
||||
Prop_Field<&Frequency_Trace::Prop::partition_count, "partition_count">,
|
||||
Prop_Field<&Frequency_Trace::Prop::pen, "pen">,
|
||||
Prop_Field<&Frequency_Trace::Prop::partition_mode, "partition_mode">,
|
||||
Prop_Field<&Frequency_Trace::Prop::samples, "samples">,
|
||||
State_Field<Frequency_Trace, &Frequency_Trace::State::sample_count, "sample_count">,
|
||||
State_Field<Frequency_Trace, &Frequency_Trace::State::rendered_point_count, "rendered_point_count">>(
|
||||
*object, std::move(owners), std::move(update));
|
||||
return std::make_shared<Plot>(std::move(executor), std::move(scene), std::move(view));
|
||||
} else if constexpr (std::same_as<Definition, Sweep_Spectrum>) {
|
||||
}
|
||||
|
||||
std::shared_ptr<Plot> make_sweep_spectrum_plot(asio::any_io_executor executor) {
|
||||
constexpr Size canvas{720, 420};
|
||||
auto scene = make_scene_2d();
|
||||
auto frequency = finish_shared<Frequency_Axis_Object>(frequency_axis_builder(canvas));
|
||||
auto vertical = finish_shared<Numeric_Axis_Object>(numeric_axis_builder(
|
||||
Axis_Orientation::vertical, {64.0, 370.0}, -320.0, {-110.0, 0.0}, canvas));
|
||||
@@ -269,16 +301,27 @@ std::shared_ptr<Plot> build_2d_plot(asio::any_io_executor executor) {
|
||||
raw->append_block(values);
|
||||
};
|
||||
std::vector<std::shared_ptr<void>> owners{frequency, vertical, object};
|
||||
auto view = make_scene_view<Sweep_Spectrum,
|
||||
AETHERA_PROP(Sweep_Spectrum, bins_per_block), AETHERA_PROP(Sweep_Spectrum, block_count),
|
||||
AETHERA_PROP(Sweep_Spectrum, partition_count), AETHERA_PROP(Sweep_Spectrum, visible_range_only),
|
||||
AETHERA_PROP(Sweep_Spectrum, frequency_range), AETHERA_PROP(Sweep_Spectrum, partition_mode),
|
||||
AETHERA_PROP(Sweep_Spectrum, pen), AETHERA_PROP(Sweep_Spectrum, current_frequency_pen),
|
||||
AETHERA_PROP(Sweep_Spectrum, interpolation_mode), AETHERA_PROP(Sweep_Spectrum, blocks),
|
||||
AETHERA_STATE(Sweep_Spectrum, stored_block_count), AETHERA_STATE(Sweep_Spectrum, stored_point_count),
|
||||
AETHERA_STATE(Sweep_Spectrum, rendered_point_count)>(*object, std::move(owners), std::move(update));
|
||||
auto view = make_scene_view<
|
||||
Prop_Field<&Sweep_Spectrum::Prop::bins_per_block, "bins_per_block">,
|
||||
Prop_Field<&Sweep_Spectrum::Prop::block_count, "block_count">,
|
||||
Prop_Field<&Sweep_Spectrum::Prop::partition_count, "partition_count">,
|
||||
Prop_Field<&Sweep_Spectrum::Prop::visible_range_only, "visible_range_only">,
|
||||
Prop_Field<&Sweep_Spectrum::Prop::frequency_range, "frequency_range">,
|
||||
Prop_Field<&Sweep_Spectrum::Prop::partition_mode, "partition_mode">,
|
||||
Prop_Field<&Sweep_Spectrum::Prop::pen, "pen">,
|
||||
Prop_Field<&Sweep_Spectrum::Prop::current_frequency_pen, "current_frequency_pen">,
|
||||
Prop_Field<&Sweep_Spectrum::Prop::interpolation_mode, "interpolation_mode">,
|
||||
Prop_Field<&Sweep_Spectrum::Prop::blocks, "blocks">,
|
||||
State_Field<Sweep_Spectrum, &Sweep_Spectrum::State::stored_block_count, "stored_block_count">,
|
||||
State_Field<Sweep_Spectrum, &Sweep_Spectrum::State::stored_point_count, "stored_point_count">,
|
||||
State_Field<Sweep_Spectrum, &Sweep_Spectrum::State::rendered_point_count, "rendered_point_count">>(
|
||||
*object, std::move(owners), std::move(update));
|
||||
return std::make_shared<Plot>(std::move(executor), std::move(scene), std::move(view));
|
||||
} else if constexpr (std::same_as<Definition, Afterglow>) {
|
||||
}
|
||||
|
||||
std::shared_ptr<Plot> make_afterglow_plot(asio::any_io_executor executor) {
|
||||
constexpr Size canvas{720, 420};
|
||||
auto scene = make_scene_2d();
|
||||
auto frequency = finish_shared<Frequency_Axis_Object>(frequency_axis_builder(canvas));
|
||||
auto vertical = finish_shared<Numeric_Axis_Object>(numeric_axis_builder(
|
||||
Axis_Orientation::vertical, {64.0, 370.0}, -320.0, {-110.0, 0.0}, canvas));
|
||||
@@ -300,16 +343,27 @@ std::shared_ptr<Plot> build_2d_plot(asio::any_io_executor executor) {
|
||||
raw->append_spectrum(values);
|
||||
};
|
||||
std::vector<std::shared_ptr<void>> owners{frequency, vertical, object};
|
||||
auto view = make_scene_view<Afterglow,
|
||||
AETHERA_PROP(Afterglow, frequency_point_size), AETHERA_PROP(Afterglow, power_point_size),
|
||||
AETHERA_PROP(Afterglow, partition_count), AETHERA_PROP(Afterglow, interpolate),
|
||||
AETHERA_PROP(Afterglow, attenuation_rate), AETHERA_PROP(Afterglow, frequency_range),
|
||||
AETHERA_PROP(Afterglow, power_range), AETHERA_PROP(Afterglow, partition_mode),
|
||||
AETHERA_PROP(Afterglow, color_map), AETHERA_PROP(Afterglow, spectra),
|
||||
AETHERA_STATE(Afterglow, history_count), AETHERA_STATE(Afterglow, latest_spectrum_point_count),
|
||||
AETHERA_STATE(Afterglow, rendered_cell_count)>(*object, std::move(owners), std::move(update));
|
||||
auto view = make_scene_view<
|
||||
Prop_Field<&Afterglow::Prop::frequency_point_size, "frequency_point_size">,
|
||||
Prop_Field<&Afterglow::Prop::power_point_size, "power_point_size">,
|
||||
Prop_Field<&Afterglow::Prop::partition_count, "partition_count">,
|
||||
Prop_Field<&Afterglow::Prop::interpolate, "interpolate">,
|
||||
Prop_Field<&Afterglow::Prop::attenuation_rate, "attenuation_rate">,
|
||||
Prop_Field<&Afterglow::Prop::frequency_range, "frequency_range">,
|
||||
Prop_Field<&Afterglow::Prop::power_range, "power_range">,
|
||||
Prop_Field<&Afterglow::Prop::partition_mode, "partition_mode">,
|
||||
Prop_Field<&Afterglow::Prop::color_map, "color_map">,
|
||||
Prop_Field<&Afterglow::Prop::spectra, "spectra">,
|
||||
State_Field<Afterglow, &Afterglow::State::history_count, "history_count">,
|
||||
State_Field<Afterglow, &Afterglow::State::latest_spectrum_point_count, "latest_spectrum_point_count">,
|
||||
State_Field<Afterglow, &Afterglow::State::rendered_cell_count, "rendered_cell_count">>(
|
||||
*object, std::move(owners), std::move(update));
|
||||
return std::make_shared<Plot>(std::move(executor), std::move(scene), std::move(view));
|
||||
} else if constexpr (std::same_as<Definition, Waterfall>) {
|
||||
}
|
||||
|
||||
std::shared_ptr<Plot> make_waterfall_plot(asio::any_io_executor executor) {
|
||||
constexpr Size canvas{720, 420};
|
||||
auto scene = make_scene_2d();
|
||||
auto frequency = finish_shared<Frequency_Axis_Object>(frequency_axis_builder(canvas));
|
||||
auto time = finish_shared<Time_Axis_Object>(time_axis_builder(
|
||||
Axis_Orientation::vertical, {64.0, 370.0}, -320.0, canvas));
|
||||
@@ -331,18 +385,30 @@ std::shared_ptr<Plot> build_2d_plot(asio::any_io_executor executor) {
|
||||
raw->append_row((*tick)++, values);
|
||||
};
|
||||
std::vector<std::shared_ptr<void>> owners{frequency, time, object, tick};
|
||||
auto view = make_scene_view<Waterfall,
|
||||
AETHERA_PROP(Waterfall, tooltip_enabled), AETHERA_PROP(Waterfall, tooltip_font),
|
||||
AETHERA_PROP(Waterfall, tooltip_text_pen), AETHERA_PROP(Waterfall, tooltip_background_brush),
|
||||
AETHERA_PROP(Waterfall, frequency_bin_count), AETHERA_PROP(Waterfall, partition_count),
|
||||
AETHERA_PROP(Waterfall, visible_range_only), AETHERA_PROP(Waterfall, frequency_range),
|
||||
AETHERA_PROP(Waterfall, power_range), AETHERA_PROP(Waterfall, partition_mode),
|
||||
AETHERA_PROP(Waterfall, interpolation_mode), AETHERA_PROP(Waterfall, color_map),
|
||||
AETHERA_PROP(Waterfall, rows), AETHERA_STATE(Waterfall, row_count),
|
||||
AETHERA_STATE(Waterfall, stored_point_count), AETHERA_STATE(Waterfall, rendered_cell_count)>(
|
||||
auto view = make_scene_view<
|
||||
Prop_Field<&Waterfall::Prop::tooltip_enabled, "tooltip_enabled">,
|
||||
Prop_Field<&Waterfall::Prop::tooltip_font, "tooltip_font">,
|
||||
Prop_Field<&Waterfall::Prop::tooltip_text_pen, "tooltip_text_pen">,
|
||||
Prop_Field<&Waterfall::Prop::tooltip_background_brush, "tooltip_background_brush">,
|
||||
Prop_Field<&Waterfall::Prop::frequency_bin_count, "frequency_bin_count">,
|
||||
Prop_Field<&Waterfall::Prop::partition_count, "partition_count">,
|
||||
Prop_Field<&Waterfall::Prop::visible_range_only, "visible_range_only">,
|
||||
Prop_Field<&Waterfall::Prop::frequency_range, "frequency_range">,
|
||||
Prop_Field<&Waterfall::Prop::power_range, "power_range">,
|
||||
Prop_Field<&Waterfall::Prop::partition_mode, "partition_mode">,
|
||||
Prop_Field<&Waterfall::Prop::interpolation_mode, "interpolation_mode">,
|
||||
Prop_Field<&Waterfall::Prop::color_map, "color_map">,
|
||||
Prop_Field<&Waterfall::Prop::rows, "rows">,
|
||||
State_Field<Waterfall, &Waterfall::State::row_count, "row_count">,
|
||||
State_Field<Waterfall, &Waterfall::State::stored_point_count, "stored_point_count">,
|
||||
State_Field<Waterfall, &Waterfall::State::rendered_cell_count, "rendered_cell_count">>(
|
||||
*object, std::move(owners), std::move(update));
|
||||
return std::make_shared<Plot>(std::move(executor), std::move(scene), std::move(view));
|
||||
} else if constexpr (std::same_as<Definition, Constellation_Diagram>) {
|
||||
}
|
||||
|
||||
std::shared_ptr<Plot> make_constellation_plot(asio::any_io_executor executor) {
|
||||
constexpr Size canvas{720, 420};
|
||||
auto scene = make_scene_2d();
|
||||
auto horizontal = finish_shared<Numeric_Axis_Object>(numeric_axis_builder(
|
||||
Axis_Orientation::horizontal, {64.0, 370.0}, 620.0, {-1.2, 1.2}, canvas));
|
||||
auto vertical = finish_shared<Numeric_Axis_Object>(numeric_axis_builder(
|
||||
@@ -361,14 +427,23 @@ std::shared_ptr<Plot> build_2d_plot(asio::any_io_executor executor) {
|
||||
std::sin(phase) * 0.82 + 0.04 * std::cos(phase * 5.0)});
|
||||
};
|
||||
std::vector<std::shared_ptr<void>> owners{horizontal, vertical, object};
|
||||
auto view = make_scene_view<Constellation_Diagram,
|
||||
AETHERA_PROP(Constellation_Diagram, point_lifetime_ms), AETHERA_PROP(Constellation_Diagram, type),
|
||||
AETHERA_PROP(Constellation_Diagram, phase_offset_radians), AETHERA_PROP(Constellation_Diagram, i_range),
|
||||
AETHERA_PROP(Constellation_Diagram, q_range), AETHERA_PROP(Constellation_Diagram, point_color),
|
||||
AETHERA_PROP(Constellation_Diagram, anchor_color), AETHERA_PROP(Constellation_Diagram, points),
|
||||
AETHERA_STATE(Constellation_Diagram, point_count)>(*object, std::move(owners), std::move(update));
|
||||
auto view = make_scene_view<
|
||||
Prop_Field<&Constellation_Diagram::Prop::point_lifetime_ms, "point_lifetime_ms">,
|
||||
Prop_Field<&Constellation_Diagram::Prop::type, "type">,
|
||||
Prop_Field<&Constellation_Diagram::Prop::phase_offset_radians, "phase_offset_radians">,
|
||||
Prop_Field<&Constellation_Diagram::Prop::i_range, "i_range">,
|
||||
Prop_Field<&Constellation_Diagram::Prop::q_range, "q_range">,
|
||||
Prop_Field<&Constellation_Diagram::Prop::point_color, "point_color">,
|
||||
Prop_Field<&Constellation_Diagram::Prop::anchor_color, "anchor_color">,
|
||||
Prop_Field<&Constellation_Diagram::Prop::points, "points">,
|
||||
State_Field<Constellation_Diagram, &Constellation_Diagram::State::point_count, "point_count">>(
|
||||
*object, std::move(owners), std::move(update));
|
||||
return std::make_shared<Plot>(std::move(executor), std::move(scene), std::move(view));
|
||||
} else if constexpr (std::same_as<Definition, Selection_Rectangle_Overlay>) {
|
||||
}
|
||||
|
||||
std::shared_ptr<Plot> make_selection_overlay_plot(asio::any_io_executor executor) {
|
||||
constexpr Size canvas{720, 420};
|
||||
auto scene = make_scene_2d();
|
||||
auto horizontal = finish_shared<Numeric_Axis_Object>(numeric_axis_builder(
|
||||
Axis_Orientation::horizontal, {64.0, 370.0}, 620.0, {0.0, 100.0}, canvas));
|
||||
auto vertical = finish_shared<Numeric_Axis_Object>(numeric_axis_builder(
|
||||
@@ -381,20 +456,17 @@ std::shared_ptr<Plot> build_2d_plot(asio::any_io_executor executor) {
|
||||
resize_axes({static_cast<int>(event.width), static_cast<int>(event.height)}, horizontal, vertical);
|
||||
};
|
||||
std::vector<std::shared_ptr<void>> owners{horizontal, vertical, object};
|
||||
auto view = make_scene_view<Selection_Rectangle_Overlay,
|
||||
AETHERA_PROP(Selection_Rectangle_Overlay, label_font),
|
||||
AETHERA_PROP(Selection_Rectangle_Overlay, label_pen),
|
||||
AETHERA_PROP(Selection_Rectangle_Overlay, selection_brush),
|
||||
AETHERA_PROP(Selection_Rectangle_Overlay, selection_border_pen),
|
||||
AETHERA_PROP(Selection_Rectangle_Overlay, selected_regions),
|
||||
AETHERA_STATE(Selection_Rectangle_Overlay, selected_region_count)>(
|
||||
auto view = make_scene_view<
|
||||
Prop_Field<&Selection_Rectangle_Overlay::Prop::label_font, "label_font">,
|
||||
Prop_Field<&Selection_Rectangle_Overlay::Prop::label_pen, "label_pen">,
|
||||
Prop_Field<&Selection_Rectangle_Overlay::Prop::selection_brush, "selection_brush">,
|
||||
Prop_Field<&Selection_Rectangle_Overlay::Prop::selection_border_pen, "selection_border_pen">,
|
||||
Prop_Field<&Selection_Rectangle_Overlay::Prop::selected_regions, "selected_regions">,
|
||||
State_Field<Selection_Rectangle_Overlay,
|
||||
&Selection_Rectangle_Overlay::State::selected_region_count,
|
||||
"selected_region_count">>(
|
||||
*object, std::move(owners), std::move(update));
|
||||
return std::make_shared<Plot>(std::move(executor), std::move(scene), std::move(view));
|
||||
}
|
||||
}
|
||||
|
||||
#undef AETHERA_STATE
|
||||
#undef AETHERA_PROP
|
||||
}
|
||||
|
||||
struct Plot::Private {
|
||||
@@ -523,28 +595,6 @@ void Plot::async_write_prop(std::string key, nlohmann::json value, Json_Handler
|
||||
throw std::runtime_error("plot input queue is unavailable");
|
||||
}
|
||||
|
||||
std::shared_ptr<Plot> make_spectrum_plot(asio::any_io_executor executor) {
|
||||
return build_2d_plot<Spectrum>(std::move(executor));
|
||||
}
|
||||
std::shared_ptr<Plot> make_frequency_trace_plot(asio::any_io_executor executor) {
|
||||
return build_2d_plot<Frequency_Trace>(std::move(executor));
|
||||
}
|
||||
std::shared_ptr<Plot> make_sweep_spectrum_plot(asio::any_io_executor executor) {
|
||||
return build_2d_plot<Sweep_Spectrum>(std::move(executor));
|
||||
}
|
||||
std::shared_ptr<Plot> make_afterglow_plot(asio::any_io_executor executor) {
|
||||
return build_2d_plot<Afterglow>(std::move(executor));
|
||||
}
|
||||
std::shared_ptr<Plot> make_waterfall_plot(asio::any_io_executor executor) {
|
||||
return build_2d_plot<Waterfall>(std::move(executor));
|
||||
}
|
||||
std::shared_ptr<Plot> make_constellation_plot(asio::any_io_executor executor) {
|
||||
return build_2d_plot<Constellation_Diagram>(std::move(executor));
|
||||
}
|
||||
std::shared_ptr<Plot> make_selection_overlay_plot(asio::any_io_executor executor) {
|
||||
return build_2d_plot<Selection_Rectangle_Overlay>(std::move(executor));
|
||||
}
|
||||
|
||||
std::shared_ptr<Plot> make_datoviz_point_plot(asio::any_io_executor executor) {
|
||||
using Visual_Object = Impl<Point_Visual>;
|
||||
Visual_Object::Builder visual_builder;
|
||||
|
||||
@@ -41,23 +41,32 @@ struct Value_Adapter<std::array<Value, Size>, Json> {
|
||||
static void decode(value_type& target, const Json& value);
|
||||
};
|
||||
|
||||
#define AETHERA_WEB_JSON_REFLECTION(Type) \
|
||||
template <> struct Reflection_Adapter<Type> : Boost_Pfr_Reflection_Adapter<Type> {}; \
|
||||
template <> struct Type_Descriptor<Type> { static auto get(); };
|
||||
AETHERA_WEB_JSON_REFLECTION(aethera::Color)
|
||||
AETHERA_WEB_JSON_REFLECTION(aethera::render_2d::Point_F)
|
||||
AETHERA_WEB_JSON_REFLECTION(aethera::render_2d::Rect_F)
|
||||
AETHERA_WEB_JSON_REFLECTION(aethera::render_2d::Axis_Range)
|
||||
AETHERA_WEB_JSON_REFLECTION(aethera::render_2d::Pen)
|
||||
AETHERA_WEB_JSON_REFLECTION(aethera::render_2d::Brush)
|
||||
AETHERA_WEB_JSON_REFLECTION(aethera::render_2d::Font)
|
||||
AETHERA_WEB_JSON_REFLECTION(aethera::render_2d::Frequency_Trace_Sample)
|
||||
AETHERA_WEB_JSON_REFLECTION(aethera::render_2d::Waterfall_Row)
|
||||
AETHERA_WEB_JSON_REFLECTION(aethera::render_2d::Constellation_Point)
|
||||
AETHERA_WEB_JSON_REFLECTION(aethera::render_3d::Vec3)
|
||||
AETHERA_WEB_JSON_REFLECTION(aethera::render_3d::Matrix4)
|
||||
AETHERA_WEB_JSON_REFLECTION(aethera::render_3d::Point)
|
||||
#undef AETHERA_WEB_JSON_REFLECTION
|
||||
template <> struct Reflection_Adapter<aethera::Color> : Boost_Pfr_Reflection_Adapter<aethera::Color> {};
|
||||
template <> struct Type_Descriptor<aethera::Color> { static auto get(); };
|
||||
template <> struct Reflection_Adapter<aethera::render_2d::Point_F> : Boost_Pfr_Reflection_Adapter<aethera::render_2d::Point_F> {};
|
||||
template <> struct Type_Descriptor<aethera::render_2d::Point_F> { static auto get(); };
|
||||
template <> struct Reflection_Adapter<aethera::render_2d::Rect_F> : Boost_Pfr_Reflection_Adapter<aethera::render_2d::Rect_F> {};
|
||||
template <> struct Type_Descriptor<aethera::render_2d::Rect_F> { static auto get(); };
|
||||
template <> struct Reflection_Adapter<aethera::render_2d::Axis_Range> : Boost_Pfr_Reflection_Adapter<aethera::render_2d::Axis_Range> {};
|
||||
template <> struct Type_Descriptor<aethera::render_2d::Axis_Range> { static auto get(); };
|
||||
template <> struct Reflection_Adapter<aethera::render_2d::Pen> : Boost_Pfr_Reflection_Adapter<aethera::render_2d::Pen> {};
|
||||
template <> struct Type_Descriptor<aethera::render_2d::Pen> { static auto get(); };
|
||||
template <> struct Reflection_Adapter<aethera::render_2d::Brush> : Boost_Pfr_Reflection_Adapter<aethera::render_2d::Brush> {};
|
||||
template <> struct Type_Descriptor<aethera::render_2d::Brush> { static auto get(); };
|
||||
template <> struct Reflection_Adapter<aethera::render_2d::Font> : Boost_Pfr_Reflection_Adapter<aethera::render_2d::Font> {};
|
||||
template <> struct Type_Descriptor<aethera::render_2d::Font> { static auto get(); };
|
||||
template <> struct Reflection_Adapter<aethera::render_2d::Frequency_Trace_Sample> : Boost_Pfr_Reflection_Adapter<aethera::render_2d::Frequency_Trace_Sample> {};
|
||||
template <> struct Type_Descriptor<aethera::render_2d::Frequency_Trace_Sample> { static auto get(); };
|
||||
template <> struct Reflection_Adapter<aethera::render_2d::Waterfall_Row> : Boost_Pfr_Reflection_Adapter<aethera::render_2d::Waterfall_Row> {};
|
||||
template <> struct Type_Descriptor<aethera::render_2d::Waterfall_Row> { static auto get(); };
|
||||
template <> struct Reflection_Adapter<aethera::render_2d::Constellation_Point> : Boost_Pfr_Reflection_Adapter<aethera::render_2d::Constellation_Point> {};
|
||||
template <> struct Type_Descriptor<aethera::render_2d::Constellation_Point> { static auto get(); };
|
||||
template <> struct Reflection_Adapter<aethera::render_3d::Vec3> : Boost_Pfr_Reflection_Adapter<aethera::render_3d::Vec3> {};
|
||||
template <> struct Type_Descriptor<aethera::render_3d::Vec3> { static auto get(); };
|
||||
template <> struct Reflection_Adapter<aethera::render_3d::Matrix4> : Boost_Pfr_Reflection_Adapter<aethera::render_3d::Matrix4> {};
|
||||
template <> struct Type_Descriptor<aethera::render_3d::Matrix4> { static auto get(); };
|
||||
template <> struct Reflection_Adapter<aethera::render_3d::Point> : Boost_Pfr_Reflection_Adapter<aethera::render_3d::Point> {};
|
||||
template <> struct Type_Descriptor<aethera::render_3d::Point> { static auto get(); };
|
||||
|
||||
template <>
|
||||
struct Reflection_Adapter<aethera::render_2d::Color_Map>
|
||||
@@ -320,21 +329,46 @@ void Value_Adapter<std::array<Value, Size>, Json>::decode(value_type& target, co
|
||||
target = std::move(updated);
|
||||
}
|
||||
|
||||
#define AETHERA_WEB_DEFINE_JSON_DESCRIPTOR(Type, Id, Label) \
|
||||
inline auto Type_Descriptor<Type>::get() { return reflected_object_with<Type>(Id, Label, Identity_Field_Customizer{}); }
|
||||
AETHERA_WEB_DEFINE_JSON_DESCRIPTOR(aethera::Color, "color", "Color")
|
||||
AETHERA_WEB_DEFINE_JSON_DESCRIPTOR(aethera::render_2d::Point_F, "point", "Point")
|
||||
AETHERA_WEB_DEFINE_JSON_DESCRIPTOR(aethera::render_2d::Rect_F, "rectangle", "Rectangle")
|
||||
AETHERA_WEB_DEFINE_JSON_DESCRIPTOR(aethera::render_2d::Axis_Range, "axis_range", "Axis range")
|
||||
AETHERA_WEB_DEFINE_JSON_DESCRIPTOR(aethera::render_2d::Pen, "pen", "Pen")
|
||||
AETHERA_WEB_DEFINE_JSON_DESCRIPTOR(aethera::render_2d::Brush, "brush", "Brush")
|
||||
AETHERA_WEB_DEFINE_JSON_DESCRIPTOR(aethera::render_2d::Font, "font", "Font")
|
||||
AETHERA_WEB_DEFINE_JSON_DESCRIPTOR(aethera::render_2d::Frequency_Trace_Sample, "frequency_trace_sample", "Frequency trace sample")
|
||||
AETHERA_WEB_DEFINE_JSON_DESCRIPTOR(aethera::render_2d::Waterfall_Row, "waterfall_row", "Waterfall row")
|
||||
AETHERA_WEB_DEFINE_JSON_DESCRIPTOR(aethera::render_2d::Constellation_Point, "constellation_point", "Constellation point")
|
||||
AETHERA_WEB_DEFINE_JSON_DESCRIPTOR(aethera::render_2d::Color_Map, "color_map", "Color map")
|
||||
AETHERA_WEB_DEFINE_JSON_DESCRIPTOR(aethera::render_3d::Vec3, "vec3", "3D vector")
|
||||
AETHERA_WEB_DEFINE_JSON_DESCRIPTOR(aethera::render_3d::Matrix4, "matrix4", "Transform")
|
||||
AETHERA_WEB_DEFINE_JSON_DESCRIPTOR(aethera::render_3d::Point, "point_3d", "3D point")
|
||||
#undef AETHERA_WEB_DEFINE_JSON_DESCRIPTOR
|
||||
inline auto Type_Descriptor<aethera::Color>::get() {
|
||||
return reflected_object_with<aethera::Color>("color", "Color", Identity_Field_Customizer{});
|
||||
}
|
||||
inline auto Type_Descriptor<aethera::render_2d::Point_F>::get() {
|
||||
return reflected_object_with<aethera::render_2d::Point_F>("point", "Point", Identity_Field_Customizer{});
|
||||
}
|
||||
inline auto Type_Descriptor<aethera::render_2d::Rect_F>::get() {
|
||||
return reflected_object_with<aethera::render_2d::Rect_F>("rectangle", "Rectangle", Identity_Field_Customizer{});
|
||||
}
|
||||
inline auto Type_Descriptor<aethera::render_2d::Axis_Range>::get() {
|
||||
return reflected_object_with<aethera::render_2d::Axis_Range>("axis_range", "Axis range", Identity_Field_Customizer{});
|
||||
}
|
||||
inline auto Type_Descriptor<aethera::render_2d::Pen>::get() {
|
||||
return reflected_object_with<aethera::render_2d::Pen>("pen", "Pen", Identity_Field_Customizer{});
|
||||
}
|
||||
inline auto Type_Descriptor<aethera::render_2d::Brush>::get() {
|
||||
return reflected_object_with<aethera::render_2d::Brush>("brush", "Brush", Identity_Field_Customizer{});
|
||||
}
|
||||
inline auto Type_Descriptor<aethera::render_2d::Font>::get() {
|
||||
return reflected_object_with<aethera::render_2d::Font>("font", "Font", Identity_Field_Customizer{});
|
||||
}
|
||||
inline auto Type_Descriptor<aethera::render_2d::Frequency_Trace_Sample>::get() {
|
||||
return reflected_object_with<aethera::render_2d::Frequency_Trace_Sample>("frequency_trace_sample", "Frequency trace sample", Identity_Field_Customizer{});
|
||||
}
|
||||
inline auto Type_Descriptor<aethera::render_2d::Waterfall_Row>::get() {
|
||||
return reflected_object_with<aethera::render_2d::Waterfall_Row>("waterfall_row", "Waterfall row", Identity_Field_Customizer{});
|
||||
}
|
||||
inline auto Type_Descriptor<aethera::render_2d::Constellation_Point>::get() {
|
||||
return reflected_object_with<aethera::render_2d::Constellation_Point>("constellation_point", "Constellation point", Identity_Field_Customizer{});
|
||||
}
|
||||
inline auto Type_Descriptor<aethera::render_2d::Color_Map>::get() {
|
||||
return reflected_object_with<aethera::render_2d::Color_Map>("color_map", "Color map", Identity_Field_Customizer{});
|
||||
}
|
||||
inline auto Type_Descriptor<aethera::render_3d::Vec3>::get() {
|
||||
return reflected_object_with<aethera::render_3d::Vec3>("vec3", "3D vector", Identity_Field_Customizer{});
|
||||
}
|
||||
inline auto Type_Descriptor<aethera::render_3d::Matrix4>::get() {
|
||||
return reflected_object_with<aethera::render_3d::Matrix4>("matrix4", "Transform", Identity_Field_Customizer{});
|
||||
}
|
||||
inline auto Type_Descriptor<aethera::render_3d::Point>::get() {
|
||||
return reflected_object_with<aethera::render_3d::Point>("point_3d", "3D point", Identity_Field_Customizer{});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user