结构优化
This commit is contained in:
@@ -12,22 +12,29 @@ TEST(Renderive_Qt, WidgetLifecycleDrivesAndStopsKernelScene) {
|
||||
Latency_Eager_Plot plot;
|
||||
plot.resize(240, 120);
|
||||
plot.init();
|
||||
auto x_axis = Frequency_Axis::Builder(plot.root_renderable(), Orientation::Horizontal)
|
||||
.set_x(20)
|
||||
.set_y(100)
|
||||
.set_pixel_length(200)
|
||||
.set_coord_range({0.0, 10.0})
|
||||
.build();
|
||||
auto y_axis = Axis::Builder(plot.root_renderable(), Orientation::Vertical)
|
||||
.set_x(20)
|
||||
.set_y(10)
|
||||
.set_pixel_length(90)
|
||||
.set_coord_range({1.0, 0.0})
|
||||
.build();
|
||||
auto spectrum = Spectrum::Builder{}
|
||||
.set<&Spectrum::Properties::frequency_range>(Range{0.0, 10.0})
|
||||
.set<&Spectrum::Properties::frequency_point_size>(8)
|
||||
.build(plot.root_renderable(), x_axis, y_axis);
|
||||
const auto root = plot.root_renderable();
|
||||
renderive_Owner<Frequency_Axis> x_axis;
|
||||
renderive_Owner<Axis> y_axis;
|
||||
renderive_Owner<Spectrum> spectrum;
|
||||
{
|
||||
auto attach = plot.scene()->attach_builder();
|
||||
x_axis = Frequency_Axis::Builder(root, Orientation::Horizontal, &attach)
|
||||
.set_x(20)
|
||||
.set_y(100)
|
||||
.set_pixel_length(200)
|
||||
.set_coord_range({0.0, 10.0})
|
||||
.build();
|
||||
y_axis = Axis::Builder(root, Orientation::Vertical, &attach)
|
||||
.set_x(20)
|
||||
.set_y(10)
|
||||
.set_pixel_length(90)
|
||||
.set_coord_range({1.0, 0.0})
|
||||
.build();
|
||||
spectrum = Spectrum::Builder{&attach}
|
||||
.set<&Spectrum::Properties::frequency_range>(Range{0.0, 10.0})
|
||||
.set<&Spectrum::Properties::frequency_point_size>(8)
|
||||
.build(root, x_axis, y_axis);
|
||||
}
|
||||
spectrum->update_samples(std::vector<double>{0.1, 0.3, 0.8, 0.5, 0.9, 0.4, 0.2, 0.7});
|
||||
plot.show();
|
||||
QTimer::singleShot(150, application, &QCoreApplication::quit);
|
||||
|
||||
Reference in New Issue
Block a user