From e603c82e6f4628fcc05fceeddaa062dcf8c91388 Mon Sep 17 00:00:00 2001 From: Uwe Fechner Date: Fri, 5 Apr 2024 11:20:22 +0200 Subject: [PATCH] Add t_sim --- CHANGELOG.md | 1 + mwes/mwe_05.jl | 2 +- src/viewer3D.jl | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aecbc12..8cdc51a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ #### Added - add menu time_lapse for changing the simulation/ replay speed - add field `mod_text` to Viewer3D; it defines the quotient of the update rate and the text update rate +- add textbox `t_sim` to enter the simulation time ### KiteViewers v0.4.10 - 2024-03-30 diff --git a/mwes/mwe_05.jl b/mwes/mwe_05.jl index 570a24b..2a3bd63 100644 --- a/mwes/mwe_05.jl +++ b/mwes/mwe_05.jl @@ -5,4 +5,4 @@ segments=se().segments state=demo_state_4p(segments+1) update_system(viewer, state, kite_scale=0.25) sleep(5) -close(viewer.screen) \ No newline at end of file +#close(viewer.screen) \ No newline at end of file diff --git a/src/viewer3D.jl b/src/viewer3D.jl index 5c3e031..2151a04 100644 --- a/src/viewer3D.jl +++ b/src/viewer3D.jl @@ -85,6 +85,7 @@ mutable struct Viewer3D <: AKV menu::Union{Menu, Nothing} menu_rel_tol::Union{Menu, Nothing} menu_time_lapse::Union{Menu, Nothing} + t_sim::Union{Textbox, Nothing} btn_OK::Union{Button, Nothing} sw::Toggle step::Int64 @@ -158,6 +159,17 @@ function Viewer3D(set::Settings, show_kite=true, autolabel="Autopilot"; precompi label3.halign[]=:left label3.valign[]=:top label3.alignmode=Outside(160, 0, 0, 100) + tb = Textbox(fig, bbox = fig.scene.viewport, placeholder = "Simulation time", + validator = UInt16, stored_string="460") + tb.width[] =120 + tb.halign[]=:left + tb.valign[]=:top + tb.alignmode[]=Outside(30, 0, 0, 130) + # tb.stored_string[]="460" + label3 = Label(fig, "t_sim [s]", bbox=fig.scene.viewport) + label3.halign[]=:left + label3.valign[]=:top + label3.alignmode=Outside(160, 0, 0, 137) btn_OK = Button(fig, bbox=fig.scene.viewport, label = "OK") btn_OK.halign[]=:left btn_OK.valign[]=:top @@ -166,6 +178,7 @@ function Viewer3D(set::Settings, show_kite=true, autolabel="Autopilot"; precompi menu1=nothing menu2=nothing menu3=nothing + tb = nothing btn_OK=nothing end @@ -229,7 +242,7 @@ function Viewer3D(set::Settings, show_kite=true, autolabel="Autopilot"; precompi mod_text = 4 s = Viewer3D(fig, scene3D, cam, gl_screen, points, pos, part_pos, markersizes, rotations, set, btn_RESET, btn_ZOOM_in, btn_ZOOM_out, - btn_PLAY_PAUSE, btn_AUTO, btn_PARKING, btn_STOP, menu1, menu2, menu3, btn_OK, + btn_PLAY_PAUSE, btn_AUTO, btn_PARKING, btn_STOP, menu1, menu2, menu3, tb, btn_OK, sw, 0, mod_text, 0, show_kite, false) txt2 = init_system(s, s.scene3D; show_kite=show_kite)