wolfhece._sim_panels
Simulation explorer, video-creation, drowning, animation and DEM/DTM
dialog classes extracted from PyDraw.py.
Author: HECE - University of Liege, Pierre Archambeau
Date: 2024
Copyright (c) 2024 University of Liege. All rights reserved.
This script and its content are protected by copyright law. Unauthorized
copying or distribution of this file, via any medium, is strictly prohibited.
Module Contents
-
class wolfhece._sim_panels.Sim_Explorer(parent, title, mapviewer: wolfhece.PyDraw.WolfMapViewer, sim: wolfhece.wolfresults_2D.Wolfresults_2D)[source]
Bases: wx.Frame
-
_panel[source]
-
mapviewer[source]
-
active_res2d: wolfhece.wolfresults_2D.Wolfresults_2D[source]
-
_all_times_steps[source]
-
_slider_steps[source]
-
_label_idx[source]
-
_step_idx[source]
-
_label_time[source]
-
_starting_date[source]
-
_texttime[source]
-
_step_time[source]
-
_label_steps[source]
-
_step_num[source]
-
_cmd_apply[source]
-
_cmd_update[source]
-
_cmd_plot[source]
-
_cmd_next[source]
-
_cmd_prev[source]
-
_mode[source]
-
_interval[source]
-
MinSize = (450, 500)[source]
-
OnPlot(event)[source]
Create a scatter plot of all steps.
Major x_axis is time in seconds, Minor X-axis is time by date.
- Plots:
-
-
OnInterval(event)[source]
Change the interval
-
_find_next(idx: int)[source]
Find the next step based on the mode and interval
-
_find_prev(idx: int)[source]
Find the previous step based on the mode and interval
-
OnNext(event)[source]
Go to the next step
-
OnPrev(event)[source]
Go to the previous step
-
OnTextTime(event)[source]
-
OnClose(event)[source]
Close the simulation explorer
-
OnUpdate(event)[source]
-
OnApply(event)[source]
-
_set_all(idx: int)[source]
-
Refresh(idx: int)[source]
-
OnSliderSteps(event)[source]
-
OnSelectCurTime(event)[source]
-
OnSelectNumStep(event)[source]
-
OnSelectIdxStep(event)[source]
-
_update()[source]
-
class wolfhece._sim_panels.Sim_VideoCreation(parent, title, mapviewer: wolfhece.PyDraw.WolfMapViewer, sim: wolfhece.wolfresults_2D.Wolfresults_2D)[source]
Bases: wx.Dialog
-
mapviewer[source]
-
active_res2d: wolfhece.wolfresults_2D.Wolfresults_2D[source]
-
_framerate = 25[source]
-
_start_step = 1[source]
-
_end_step[source]
-
_interval = 1[source]
-
_fn = ''[source]
-
_tz_ref[source]
-
_tz_plot[source]
-
_date_ref[source]
-
_fontsize = 16[source]
-
_fontcolor = (255, 255, 255, 255)[source]
-
_timeposition = 'top-left'[source]
-
tc1[source]
-
btn_browse[source]
-
tc2[source]
-
tc3[source]
-
tc4[source]
-
tc5[source]
-
tc7[source]
-
tc8[source]
-
tc9[source]
-
btn1[source]
-
btn2[source]
-
check_date[source]
-
calendar[source]
-
timezone_ref[source]
-
timezone_plot[source]
-
OnBrowse(event)[source]
Browse a file name to save the video
-
get_values()[source]
Return the values set in the dialog
-
OnValidate(event)[source]
Validate the text controls to be sure that the values are correct
-
OnOk(event)[source]
Create the video file
-
OnCancel(event)[source]
Cancel the video creation
-
class wolfhece._sim_panels.Drowning_Explorer(parent, title, mapviewer: any, sim: wolfhece.drowning_victims.drowning_class.Drowning_victim_Viewer)[source]
Bases: wx.Frame
-
_panel[source]
-
mapviewer[source]
-
active_drowning: wolfhece.drowning_victims.drowning_class.Drowning_victim_Viewer[source]
-
_all_times_steps[source]
-
_slider_steps[source]
-
_time_drowning[source]
-
_label_time[source]
-
_starting_date[source]
-
_texttime[source]
-
_step_time[source]
-
_step_idx[source]
-
_cmd_apply[source]
-
_cmd_next[source]
-
_cmd_prev[source]
-
MinSize = (450, 500)[source]
-
_find_next(idx: int)[source]
Find the next step based on the mode and interval
-
_find_prev(idx: int)[source]
Find the previous step based on the mode and interval
-
OnNext(event)[source]
Go to the next step
-
OnTextTime(event)[source]
-
OnPrev(event)[source]
Go to the previous step
-
OnClose(event)[source]
Close the simulation explorer
-
OnUpdate(event)[source]
-
OnApply(event)[source]
-
_set_all(idx: int)[source]
-
Refresh(idx: int)[source]
-
OnSliderSteps(event)[source]
-
OnSelectNumStep(event)[source]
-
OnSelectIdxStep(event)[source]
-
_update()[source]
-
class wolfhece._sim_panels.Select_Begin_end_interval_step(parent, title, sim: wolfhece.wolfresults_2D.Wolfresults_2D, checkbox: bool = False)[source]
Bases: wx.Dialog
wx.frame to select the begin and end of the interval to extract
-
_panel[source]
-
begin = 1[source]
-
end[source]
-
step = 1[source]
-
check_all = True[source]
-
check_violin = False[source]
-
_slider_begin[source]
-
_slider_end[source]
-
_label_range[source]
-
_text_range[source]
-
_slider_step[source]
-
_label_step[source]
-
_text_step[source]
-
_cmd_apply[source]
-
_cmd_ok[source]
-
_cmd_cancel[source]
-
OnCheckAll(event)[source]
-
OnCheckViolin(event)[source]
-
OnSliderBegin(event)[source]
-
OnSliderEnd(event)[source]
-
OnSliderStep(event)[source]
-
OnApply(event)[source]
-
OnOK(event)[source]
-
OnCancel(event)[source]
-
class wolfhece._sim_panels.PrecomputedDEM_DTM(*args, **kwds)[source]
Bases: enum.Enum
Enum for Precomputed DEM/DTM array
-
DEMDTM_50cm = 'AllData.vrt'[source]
-
DEMDTM_1m_average = 'Combine_1m_average.vrt'[source]
-
DEMDTM_1m_min = 'Combine_1m_minimum.vrt'[source]
-
DEMDTM_1m_max = 'Combine_1m_maximum.vrt'[source]
-
DEMDTM_2m_average = 'Combine_2m_average.vrt'[source]
-
DEMDTM_2m_min = 'Combine_2m_minimum.vrt'[source]
-
DEMDTM_2m_max = 'Combine_2m_maximum.vrt'[source]
-
DEMDTM_5m_average = 'Combine_5m_average.vrt'[source]
-
DEMDTM_5m_min = 'Combine_5m_minimum.vrt'[source]
-
DEMDTM_5m_max = 'Combine_5m_maximum.vrt'[source]
-
DEMDTM_10m_average = 'Combine_10m_average.vrt'[source]
-
DEMDTM_10m_min = 'Combine_10m_minimum.vrt'[source]
-
DEMDTM_10m_max = 'Combine_10m_maximum.vrt'[source]
-
class wolfhece._sim_panels.Precomputed_DEM_DTM_Dialog(parent, title, directory: pathlib.Path | str, mapviewer: wolfhece.PyDraw.WolfMapViewer)[source]
Bases: wx.Dialog
wx.Dialog to select Precomputed DEM/DTM array
Resolutions are 50cm, 1m, 2m, 5m, 10m
Operators are average, min, max
-
_dir[source]
-
_vrt = None[source]
-
_mapviewer[source]
-
_panel[source]
-
_res = ['50cm', '1m', '2m', '5m', '10m'][source]
-
_ops = ['average', 'minimum', 'maximum'][source]
-
_resolution[source]
-
_operations[source]
-
_cmd_sameactive[source]
-
_cmd_sameas[source]
-
_cmd_zoom[source]
-
OnSameAs(event)[source]
Set the Precomputed DEM/DTM array to the same bounds as an existing array
-
OnSameActive(event)[source]
Set the Precomputed DEM/DTM array to the same bounds as the active array
-
OnZoom(event)[source]
Set the Precomputed DEM/DTM array to the current zoom
-
property selected_vrt[source]
-
add_array()[source]
Add a new array to the viewer
-
OnSelectResolution(event)[source]
Select the resolution
-
available_vrt()[source]
List all available vrt files in the directory
-
class wolfhece._sim_panels.GlobalAnimationClock(mapviewer: wolfhece.PyDraw.WolfMapViewer)[source]
Global animation clock manager for all zones with animations.
Replaces per-zone wx.Timer instances with a single centralized timer.
This avoids flooding the wxPython event queue with redundant refresh events
when dozens of zones are animated simultaneously.
Features:
- Single ~30 fps timer for the entire WolfMapViewer
- Zones register/unregister their animation needs
- Adaptive throttling based on total animation load
- On each tick, updates a shared time base and requests one redraw
- Automatically stops the timer when no animations are active
-
_FPS_STEPS[source]
-
mapviewer[source]
-
timer: wx.Timer | None = None[source]
-
subscribed_zones: dict[int, int][source]
-
current_time: float = 0.0[source]
-
_timer_start_time: float | None = None[source]
-
_interval_ms: int | None = None[source]
-
property total_load: int[source]
Return the total declared animation load across all zones.
-
subscribe(zone, load: int = 1)[source]
Register a zone as animated with its estimated rendering load.
Automatically starts the timer if this is the first subscription.
-
unsubscribe(zone)[source]
Unregister a zone from animation.
Automatically stops the timer if this was the last subscription.
-
_get_target_interval_ms() → int[source]
Return the timer interval based on the current animation load.
-
_ensure_timer_state()[source]
Start, stop, or retune the timer according to current load.
-
_start_timer(interval_ms: int)[source]
Start the global animation timer.
-
_stop_timer()[source]
Stop the global animation timer.
-
_on_timer_tick(event)[source]
Handle timer tick: update time and request canvas refresh.
-
get_phase(anim_speed: float = 1.0) → float[source]
Compute animation phase for a given speed.
- Parameters:
anim_speed – Animation speed multiplier (default 1.0).
- Returns:
Phase in range [0, 1), cycling at rate = anim_speed.
-
destroy()[source]
Clean up the timer and disconnect.