wolfhece.PyDraw
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.PyDraw.MplFigViewer(layout=None, idx: str = '', mapviewer: WolfMapViewer = None, caption: str = '', size: tuple = (800, 600), style: int = wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)[source]
Bases:
wolfhece.matplotlib_fig.Matplotlib_Figure
Matplotlib Figure with wx Frame
- class wolfhece.PyDraw.Memory_View(screen_width, screen_height, xmin, xmax, ymin, ymax)[source]
Memory view
- class wolfhece.PyDraw.Memory_View_encoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]
Bases:
json.JSONEncoder
Memory view encoder
- class wolfhece.PyDraw.Memory_View_decoder(*args, **kwargs)[source]
Bases:
json.JSONDecoder
Memory view decoder
- class wolfhece.PyDraw.Memory_Views[source]
Memory views
- views: dict[str, Memory_View][source]
- add_view(name: str, screen_width: int, screen_height: int, xmin: float, xmax: float, ymin: float, ymax: float)[source]
Add a new view to the memory views
- zoom_on(name: str, mapviewer: WolfMapViewer)[source]
Zoom on a view
- class wolfhece.PyDraw.Memory_Views_GUI(parent, title, memory_views: Memory_Views, mapviewer: WolfMapViewer)[source]
Bases:
wx.dataview.wx.Frame
Memory views GUI
- class wolfhece.PyDraw.draw_type(*args, **kwds)[source]
Bases:
enum.Enum
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- class wolfhece.PyDraw.Colors_1to9(parent)[source]
Bases:
wx.dataview.wx.Frame
- class wolfhece.PyDraw.DragdropFileTarget(window: WolfMapViewer)[source]
Bases:
wx.dataview.wx.FileDropTarget
- class wolfhece.PyDraw.Sim_Explorer(parent, title, mapviewer: WolfMapViewer, sim: wolfhece.wolfresults_2D.Wolfresults_2D)[source]
Bases:
wx.dataview.wx.Frame
- active_res2d: wolfhece.wolfresults_2D.Wolfresults_2D[source]
- class wolfhece.PyDraw.Sim_VideoCreation(parent, title, mapviewer: WolfMapViewer, sim: wolfhece.wolfresults_2D.Wolfresults_2D)[source]
Bases:
wx.dataview.wx.Dialog
- active_res2d: wolfhece.wolfresults_2D.Wolfresults_2D[source]
- class wolfhece.PyDraw.Drowning_Explorer(parent, title, mapviewer: any, sim: wolfhece.drowning_victims.drowning_class.Drowning_victim_Viewer)[source]
Bases:
wx.dataview.wx.Frame
- class wolfhece.PyDraw.Select_Begin_end_interval_step(parent, title, sim: wolfhece.wolfresults_2D.Wolfresults_2D, checkbox: bool = False)[source]
Bases:
wx.dataview.wx.Dialog
wx.frame to select the begin and end of the interval to extract
- class wolfhece.PyDraw.PrecomputedDEM_DTM(*args, **kwds)[source]
Bases:
enum.Enum
Enum for Precomputed DEM/DTM array
- class wolfhece.PyDraw.Precomputed_DEM_DTM_Dialog(parent, title, directory: pathlib.Path | str, mapviewer: WolfMapViewer)[source]
Bases:
wx.dataview.wx.Dialog
wx.Dialog to select Precomputed DEM/DTM array
Resolutions are 50cm, 1m, 2m, 5m, 10m Operators are average, min, max
- class wolfhece.PyDraw.GlobalAnimationClock(mapviewer: 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
- 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.
- class wolfhece.PyDraw.WolfMapViewer(wxparent=None, title: str = _('Default Wolf Map Viewer'), w: int = 500, h: int = 500, treewidth: int = 200, wolfparent=None, wxlogging=None, enable_async_background_updates: bool = False)[source]
Bases:
wx.dataview.wx.Frame
Fenêtre de visualisation de données WOLF grâce aux WxWidgets
- mybc: list[wolfhece.mesh2d.bc_manager.BcManager][source]
- myviews: list[wolfhece.wolfresults_2D.views_2D][source]
- mytiles: list[wolfhece.wolf_tiles.Tiles][source]
- myimagestiles: list[wolfhece.images_tiles.ImagesTiles][source]
- mypartsystems: list[wolfhece.lagrangian.particle_system_ui.Particle_system_to_draw][source]
- myviewers3d: list[wolfhece.opengl.py3d.Wolf_Viewer3D][source]
- mylazdata: list[wolfhece.lazviewer.laz_viewer.Wolf_LAZ_Data][source]
- mydrownings: list[wolfhece.drowning_victims.drowning_class.Drowning_victim_Viewer][source]
- mypicturecollections: list[wolfhece.PyPictures.PictureCollection][source]
- mydikes: list[wolfhece.dike.DikeWolf][source]
- mymplfigs: list[MplFigViewer][source]
- mytooltip: wolfhece.PyParams.Wolf_Param[source]
- active_view: wolfhece.pyviews.WolfViews[source]
- active_tile: wolfhece.wolf_tiles.Tiles[source]
- active_imagestiles: wolfhece.images_tiles.ImagesTiles[source]
- active_particle_system: wolfhece.lagrangian.particle_system_ui.Particle_system_to_draw[source]
- active_viewer3d: wolfhece.opengl.py3d.Wolf_Viewer3D[source]
- active_bridges: wolfhece.pybridges.Bridges[source]
- active_bridge: wolfhece.pybridges.Bridge[source]
- active_weirs: wolfhece.pybridges.Weirs[source]
- active_weir: wolfhece.pybridges.Weir[source]
- active_dike: wolfhece.dike.DikeWolf[source]
- active_picturecollection: wolfhece.PyPictures.PictureCollection[source]
- active_alaro: wolfhece.irm_alaro.IRM_Alaro[source]
- active_fig: MplFigViewer[source]
- mylazgrid: wolfhece.lazviewer.laz_viewer.xyz_laz_grids = None[source]
- active_landmap: wolfhece.wolf_zi_db.PlansTerrier = None[source]
- new_fig(caption: str, idx: str = None, layout=PRESET_LAYOUTS.DEFAULT, size=(800, 600), show: bool = True) MplFigViewer[source]
Create a new figure
- get_fig(idx: str) MplFigViewer[source]
Get a figure by its ID
Menu for triangulations
Menu for cloud points
- _cloud_move_pick_tolerance(pixel_tol: float = 40.0) float[source]
Convert a pixel tolerance to map units for nearest-point picking.
- _snap_xy_on_grid(x: float, y: float, do_snap: bool = True) tuple[float, float][source]
Snap point coordinates using the grid.
- _overlay_xy_for_mouse(x: float, y: float, altdown: bool) tuple[float, float][source]
Return XY used by OpenGL overlay, with snap when interaction supports it.
- get_choices_arrays()[source]
Boîte de dialogue permettant de choisir une ou plusieurs matrices parmi celles chargées
Menu for tiles
Menu for picture collections
Menu for QDF/IDF files
Menu for image tiles
Menu for LAZ Data
Menu for Alaro forecasts
Action for Alaro forecasts
- get_canvas_bounds(gridsize: float = None)[source]
Retourne les limites de la zone d’affichage
- Returns:
[xmin, ymin, xmax, ymax]
- get_bounds(gridsize: float = None) tuple[source]
Retourne les limites de la zone d’affichage, voir aussi get_canvas_bounds
- Returns:
([xmin, xmax], [ymin, ymax])
- get_bounds_as_polygon(gridsize: float = None) wolfhece.PyVertexvectors.vector[source]
Retourne les limites de la zone d’affichage sous forme de polygone :return: vector
Handle the Landuse/Landcover import from file menu events
Handle the Walous OCS menu events
Handle the Walous UTS menu events
- _add_sim_explorer(which: wolfhece.wolfresults_2D.Wolfresults_2D)[source]
Add a step chooser
- _pop_sim_explorer(which: wolfhece.wolfresults_2D.Wolfresults_2D)[source]
Pop a step chooser
- _update_sim_explorer(which: wolfhece.wolfresults_2D.Wolfresults_2D = None)[source]
Action to perform when the timer is triggered
Menu for 2D simulations
Menu for 2D GPU simulations
Action to perform when menu 2D GPU entry is selected
Action to perform when menu 2D entry is selected
- get_configuration() OpenGL.GLUT.Union[wolfhece.PyConfig.WolfConfiguration, None][source]
Get global configuration parameters
- property active_vector_square_size: list[int][source]
Return the active vector square size from configs
- property default_hece_database: pathlib.Path[source]
Return the default HECE database file from configs
- property overlay_xy_font_size: int[source]
Return font size in pixels used by OpenGL XY overlay text.
- property snap_grid_round_base: float[source]
Return the coarse base used to align the snap origin [m].
- property palette_for_copy: wolfhece.PyVertexvectors.wolfpalette[source]
Return the palette for copy from configs
- set_interp_cs(obj: wolfhece.PyCrosssections.Interpolators, add_zones: bool = True)[source]
Set the active cross-sections interpolator
- interpolate_cloud()[source]
Interpolation d’un nuage de point sur une matrice
Il est possible d’utiliser une autre valeur que la coordonnées Z des vertices
- interpolate_triangulation(keep: Literal['all', 'above', 'below'] = 'all')[source]
Alias to interpolate on triangulation
- Parameters:
keep – ‘all’ to keep all points, ‘above’ to keep only points above the current array’s value, ‘below’ to keep only points below the current array’s value
- display_canvasogl(mpl=True, ds=0.0, fig: wolfhece.tools_mpl.Figure = None, ax: wolfhece.tools_mpl.Axes = None, clear=True, redraw=True, palette=False, title='')[source]
This method takes a matplotlib figure and axe and, returns a clear screenshot of the information displayed in the wolfpy GUI.
- get_mpl_plot(center=[0.0, 0.0], width=500.0, height=500.0, title='', toshow=True) tuple[wolfhece.tools_mpl.Figure, wolfhece.tools_mpl.Axes][source]
Récupère un graphique matplotlib sur base de la fenêtre OpenGL et de la palette de la matrice/résultat actif.
- create_video(fn: str = '', framerate: int = 0, start_step: int = 0, end_step: int = 0, every: int = 0)[source]
Création d’une vidéo sur base des résultats
- copy_canvasogl(mpl: bool = True, ds: float = 0.0, figsizes=[10.0, 10.0], palette: wolfhece.PyVertexvectors.wolfpalette = None)[source]
Generate image based on UI context and copy to the Clipboard
- Parameters:
mpl (bool, optional) – Using Matplolib as renderer. Defaults to True.
- Parem ds:
Ticks size. Defaults to 0..
- Parem figsizes:
fig size in inches
- save_canvasogl(fn: str = '', mpl: bool = True, ds: float = 0.0, dpi: int = 300, add_title: bool = False, figsizes=[10.0, 10.0], arrayid_as_title: bool = False, resid_as_title: bool = False)[source]
Sauvegarde de la fenêtre d’affichage dans un fichier
- Parameters:
fn – File name (.png or .jpg file)
mpl – Using Matplotlib as renderer
ds – Ticks interval
- setbounds(updatescale=True)[source]
Calcule les limites visibles de la fenêtre graphique sur base des facteurs d’échelle courants
- updatescalefactors()[source]
Mise à jour des facteurs d’échelle This one updates the scale factors based on the relative sizes of the GLCanvas and the footprint that should fit in it.
- add_viewer_and_link()[source]
Ajout d’une nouvelle fenêtre de visualisation et liaison avec la fenêtre courante
- set_compare(ListArrays: list[wolfhece.wolf_array.WolfArray] = None, share_colormap: bool = True)[source]
Comparison of 2 arrays
- Parameters:
ListArrays – List of 2 arrays to compare
share_colormap – Share the colormap between the 2 arrays
- set_compare_all(ListArrays=None, names: WolfMapViewer.set_compare_all.list[str] = None)[source]
Comparison of 2 or 3 arrays
- set_blender_sculpting()[source]
Mise en place de la structure nécessaire pour comparer la donnée de base avec la donnée sculptée sous Blender
La donnée de base est la matrice contenue dans la fenêtre actuelle
- Fenêtres additionnelles :
information sur les volumes de déblai/remblai et bilan
matrice sculptée
différentiel entre scultage - source
gradient
laplacien
masque de modification
- update_blender_sculpting()[source]
Mise à jour des fenêtres de visualisation pour la comparaison avec Blender
- zoomon_activevector(size: float = 500.0, forceupdate: bool = True)[source]
Zoom on active vector
- Parameters:
size – size of the zoomed window
forceupdate – force the update of the window
- zoomon_active_vertex(size: float = 20, forceupdate: bool = True)[source]
Zoom on active vertex.
- Parameters:
size – size of the zoomed window
forceupdate – force the update of the window
- zoom_on_id(id: str, drawtype: draw_type = draw_type.ARRAYS, forceupdate=True, canvas_height=1024)[source]
Zoom on id
- Parameters:
id – id of the object to zoom on
drawtype – type of object to zoom on - Different types elements can have the same id
- zoom_on_array(array: wolfhece.wolf_array.WolfArray, forceupdate=True, canvas_height=1024)[source]
Zoom on array
- zoom_on_vector(vector: WolfMapViewer.zoom_on_vector.vector, forceupdate=True, canvas_height=1024)[source]
Zoom on vector
- create_Zones_from_arrays(arrays: list[wolfhece.wolf_array.WolfArray], id: str = None, add_legend: bool = True) wolfhece.PyVertexvectors.Zones[source]
Create a Zones instance from list of WolfArrays
One zone per array.
One vector per zone with the masked contour.
- Parameters:
arrays – list of WolfArrays
id – id of the Zones instance
add_legend – add legend to the vector – centroid of the contour
- zoom_on(zoom_dict=None, width=500, height=500, center=None, xll=None, yll=None, forceupdate=True, canvas_height=1024)[source]
Zoom on a specific area
- It is possible to zoom on a specific area by providing the zoom parameters in :
a dictionnary
width and height of the zoomed window and the lower left corner coordinates
width and height of the zoomed window and the center coordinates
- Parameters:
zoom_dict – dictionnary containing the zoom parameters - possible keys : ‘width’, ‘height’, ‘center’, ‘xmin’, ‘ymin’, ‘xmax’, ‘ymax’
width – width of the zoomed window [m]
height – height of the zoomed window [m]
center – center of the zoomed window [m] - tuple (x,y)
xll – lower left X coordinate of the zoomed window [m]
yll – lower left Y coordinate of the zoomed window [m]
forceupdate – force the update of the window
canvas_height – height of the canvas [pixels]
Examples :
zoom_on(zoom_dict = {‘center’:(500,500), ‘width’:1000, ‘height’:1000})
zoom_on(width = 1000, height = 1000, xll = 500, yll = 500)
zoom_on(width = 1000, height = 1000, center = (500,500))
- zoom_on_active_profile(size: float = 500.0, forceupdate: bool = True)[source]
Zoom on active profile
- read_project(fn)[source]
Projet WOLF GUI
Fichier de paramètres contenant les types et chemins d’accès aux données à ajouter
A compléter…
- help_project()[source]
Help for project file.
Define which elements can be saved in a project file.
- select_active_array_from_laz(array: wolfhece.wolf_array.WolfArray = None, used_codes: list = None, chunk_size: float = 500.0)[source]
select some nodes from laz data
- Parameters:
array – array to fill
used_codes – codes to use
- fill_active_array_from_laz(array: wolfhece.wolf_array.WolfArray = None, used_codes: list = [], operator: int = -1, chunk_size: float = 500.0)[source]
Fill active array with laz data
- Parameters:
array – array to fill
used_codes – codes to use
operator – operator to use
- count_active_array_from_laz(array: wolfhece.wolf_array.WolfArray = None, used_codes: list = [], chunk_size: float = 500.0)[source]
Fill active array with laz data
- Parameters:
array – array to fill
used_codes – codes to use
operator – operator to use
- init_laz_from_lazlasnpz(fn=None)[source]
Read LAZ data stored in one file
- Parameters:
fn – filename (extension .laz, .las, .npz)
- init_laz_from_gridinfos(dirlaz: str = None, classification: Literal['SPW-Geofit 2023', 'SPW 2013-2014', 'SPW 2021-2022'] = 'SPW-Geofit 2023')[source]
- _set_fn_fnpos_gltf()[source]
Définition du nom de fichier GLTF/GLB à lire pour réaliser la comparaison Utilisation d’une fenêtre de dialogue WX
Cette fonction n’est a priori appelée que depuis set_fn_fnpos_gltf
- set_fn_fnpos_gltf()[source]
Définition ou récupération du nom de fichier GLTF/GLB à lire pour réaliser la comparaison
Le nom de fichier est stocké dans la liste des paramètres partagés de façon à ce que l’appel de mise à jour puisse s’effectuer dans n’importe quel frame
- read_one_result(which: int)[source]
Lecture d’un résultat spécific pour les modèles ajoutés et plottés
- Parameters:
which – result index (0-based) – -1 for last result
0 = first result
- OnMenubar(event: wx.dataview.wx.MenuEvent)[source]
Gestion des clicks sur le menu quel que soit le niveau
- Idée générale :
récupérer le label du menu sur base de l’id de l’event WX passé en argument –> itemlabel
tester le label du menu sur base de la chaîne traduite
a priori appeler une autre routine spécifique au traitement choisi
éviter autant que possible de coder des fonctions directement dans cette routine ce qui la rendrait complexe à lire
- AUTRE POSSIBILITE:
mettre en place un dictionnaire avec key==label, value==action qui se contenterait de tester la présence du label dans les clés et d’appeler l’action
dans ce dernier cas, il faudrait que les routines possèdent idéalement une interface unique
- pop_boundary_manager(which: wolfhece.mesh2d.bc_manager.BcManager)[source]
Pop a boundary condition manager after Destroying
- uniquecolormap(loadfromfile=False)[source]
Compute unique colormap from all (arrays, 2D results) and apply it to all
- export_results_as(which: Literal['geotiff', 'shape', 'numpy'] = None, multiband: bool = None)[source]
Export des résultats WOLF2D vers différents formats. Au moins un résultat doit être chargé pour pouvoir être exporté.
- export_shape(outdir: str = '', fn: str = '', myarrays: list[wolfhece.wolf_array.WolfArray] = [], descr: list[str] = [], mask: wolfhece.wolf_array.WolfArray = None)[source]
Export multiple arrays to shapefile
- Parameters:
outdir – output directory
fn – filename – .shp will be added if not present
myarrays – list of Wolfarrays to export
descr – list of descriptions
mask – mask array – export only where mask > 0
- export_geotif(outdir: str = '', fn: str = '', myarrays: list[wolfhece.wolf_array.WolfArray] = [], descr: list[str] = [], multiband: bool = True)[source]
Export multiple arrays to geotiff
- Parameters:
outdir – output directory
fn – filename – .tif will be added if not present
myarrays – list of Wolfarrays to export
descr – list of descriptions – Bands names
- get_linked_arrays(linked: bool = True) dict[source]
Get all arrays in the viewer and linked viewers
- save_linked_canvas(fn: str, mpl: bool = True, ds: float = 0.0, add_title: bool = True) tuple[str, float, str][source]
Save canvas of all linked viewers
- Parameters:
fn – filename without extension – ‘.png’ will be added
mpl – save as matplotlib image
ds – Ticks size for matplotlib image
- Returns:
list of tuple ((filename, ds), viewer_name)
- save_arrays_indep(fn: str, mpl: bool = True, ds: float = 0.0, add_title: bool = True) tuple[str, float, str][source]
Save each array in a separate file
- Parameters:
fn – filename without extension – ‘.png’ will be added
mpl – save as matplotlib image
ds – Ticks size for matplotlib image
- Returns:
list of tuple ((filename, ds), viewer_name)
- assembly_images(all_images, mode: Literal['horizontal', 'vertical', 'square'] = 'square')[source]
Assembly images
Every image has the same size (width, height)
- Parameters:
all_images – list of tuple (filename, viewer_name)
mode – ‘horizontal’, ‘vertical’, ‘square’
- add_object(which: Literal['array', 'array_lidar_first', 'array_lidar_second', 'array_xyz', 'array_tiles', 'bridges', 'weirs', 'vector', 'tiles', 'tilescompcloud', 'laz', 'clouds', 'triangulation', 'cross_sections', 'other', 'views', 'res2d', 'res2d_gpu', 'particlesystem', 'wmsback', 'wmsfore', 'drowning', 'imagestiles', 'dike', 'injector', 'picture_collection'] = 'array', filename='', newobj=None, ToCheck=True, id='')[source]
Add object to current Frame/Drawing area
- add_pie_asset(values: Sequence[float], x: float, y: float, radius: float, id: str = 'pie_chart', labels: Sequence[str] = None, colors: Sequence[tuple[int, int, int] | tuple[int, int, int, int]] = None, ToCheck: bool = True, return_controller: bool = False, open_editor: bool = False, **kwargs) wolfhece.PyVertexvectors.Zones | wolfhece.assets.pie.PieZonesController[source]
Create and add a world-space pie chart with persistent controller.
The pie is generated as native
Zonesand managed by aPieZonesControllerthat can rebuild geometry dynamically.- Parameters:
return_controller – if True, return the controller instead of Zones.
open_editor – if True, open the dedicated wx editor window.
- _bind_pie_controller_to_zones(controller: wolfhece.assets.pie.PieZonesController, zones: wolfhece.PyVertexvectors.Zones | None) None[source]
Attach pie controller metadata directly to the vector object (Zones).
- _iter_pie_controllers() list[wolfhece.assets.pie.PieZonesController][source]
Collect pie controllers from native vector objects.
- OnCreatePieChart(event: wx.dataview.wx.Event)[source]
Create a new editable pie chart and open the full wx editor.
- OnLoadPieChartJSON(event: wx.dataview.wx.Event)[source]
Load an editable pie chart from JSON and attach it to this viewer.
- add_bar_asset(values: Sequence[float], x: float, y: float, width: float, height: float, id: str = 'bar_chart', labels: Sequence[str] = None, colors: Sequence[tuple[int, int, int] | tuple[int, int, int, int]] = None, orientation: str = 'horizontal', ToCheck: bool = True, return_controller: bool = False, open_editor: bool = False, **kwargs) wolfhece.PyVertexvectors.Zones | wolfhece.assets.bar.BarZonesController[source]
Create and add a world-space bar chart with persistent controller.
The bar chart is generated as native
Zonesand managed by aBarZonesControllerthat can rebuild geometry dynamically.- Parameters:
orientation – ‘horizontal’ or ‘vertical’
return_controller – if True, return the controller instead of Zones.
open_editor – if True, open the dedicated wx editor window.
- _bind_bar_controller_to_zones(controller: wolfhece.assets.bar.BarZonesController, zones: wolfhece.PyVertexvectors.Zones | None) None[source]
Attach bar controller metadata directly to the vector object (Zones).
- _iter_bar_controllers() list[wolfhece.assets.bar.BarZonesController][source]
Collect bar controllers from native vector objects.
- OnCreateBarChart(event: wx.dataview.wx.Event)[source]
Create a new editable bar chart and open the full wx editor.
- OnLoadBarChartJSON(event: wx.dataview.wx.Event)[source]
Load an editable bar chart from JSON and attach it to this viewer.
- add_curve_asset(curves: Sequence[Sequence[tuple[float, float]]], id: str = 'curve_plot', labels: Sequence[str] = None, colors: Sequence[tuple[int, int, int] | tuple[int, int, int, int]] = None, canvas_origin: tuple[float, float] = (0.0, 0.0), canvas_size: tuple[float, float] = (100.0, 100.0), area_fraction: tuple[float, float, float, float] = (0.1, 0.1, 0.8, 0.3), ToCheck: bool = True, return_controller: bool = False, open_editor: bool = False, **kwargs) wolfhece.PyVertexvectors.Zones | wolfhece.assets.curve.CurveZonesController[source]
Create and add a world-space curve chart with persistent controller.
- _bind_curve_controller_to_zones(controller: wolfhece.assets.curve.CurveZonesController, zones: wolfhece.PyVertexvectors.Zones | None) None[source]
Attach curve controller metadata directly to the vector object (Zones).
- _iter_curve_controllers() list[wolfhece.assets.curve.CurveZonesController][source]
Collect curve controllers from native vector objects.
- OnCreateCurveChart(event: wx.dataview.wx.Event)[source]
Create a new editable curve chart and open the full wx editor.
- OnEditCurveChart(event: wx.dataview.wx.Event)[source]
Open curve editor for an existing controller.
- OnLoadCurveChartJSON(event: wx.dataview.wx.Event)[source]
Load an editable curve chart from JSON and attach it to this viewer.
- replace_object(id: str, newobj, drawing_type: draw_type = None)[source]
Replace an object in the list of objects of type drawing_type
- get_treeitem_from_id(id: str, drawing_type: draw_type = None)[source]
Find the tree item associated with id
- get_treeitem_from_obj(obj)[source]
Find the tree item associated with obj.
Alias for “gettreeitem”.
- get_obj_from_id(id: str, drawing_type: draw_type = None)[source]
Find the object associated with id in a specifid drawtype
If you want to search in all drawtypes, use getobj_from_id instead.
- Parameters:
id – str : id of the object
drawtype – draw_type : type of object to search
- get_list_keys(drawing_type: draw_type = None, checked_state: bool = True)[source]
Create a list of keys of type draw_type.
Return a list of keys (idx) in LOWER CASE of objects of type draw_type.
- Parameters:
drawing_type – type of object to search - If None, return all objects
checked_state – if True/False, return only keys of objects that are plotted or not. None return all objects.
- get_list_ids(drawing_type: draw_type = None, checked_state: bool = True)[source]
Alias for get_list_keys
- get_list_objects(drawing_type: draw_type = None, checked_state: bool = True)[source]
Create a list of objects of type draw_type.
Return a list of keys (idx) in LOWER CASE of objects of type draw_type.
- Parameters:
drawing_type – type of object to search – If None, return all objects.
checked_state – if True/False, return only objects that are plotted or not. None return all objects.
- single_choice_key(draw_type: WolfMapViewer.single_choice_key.draw_type, checked_state: bool = True, message: str = _('Make a choice'), title: str = _('Choice'))[source]
Create wx dialog to choose a key object of type draw_type
- single_choice_object(draw_type: WolfMapViewer.single_choice_object.draw_type, checked_state: bool = True, message: str = _('Make a choice'), title: str = _('Choice'))[source]
Create wx dialog to choose an object of type draw_type
- multiple_choice_key(draw_type: WolfMapViewer.multiple_choice_key.draw_type, checked_state: bool = True, message: str = _('Make a choice'), title: str = _('Choice'))[source]
Create wx dialog to choose multiple keys object of type draw_type
- multiple_choice_object(draw_type: WolfMapViewer.multiple_choice_object.draw_type, checked_state: bool = True, message: str = _('Make a choice'), title: str = _('Choice'))[source]
Create wx dialog to choose multiple objects of type draw_type
- iterator_over_objects(drawing_type: draw_type, checked_state: bool = True)[source]
Create iterator over objects of type draw_type
- removeobj_from_id(id: str, draw_type: WolfMapViewer.removeobj_from_id.draw_type = None)[source]
Remove object from id
- _on_tree_motion(e: wx.dataview.wx.MouseEvent)[source]
Detect drag start, update cursor and draw drop indicator.
- _move_obj_to(src_item, src_obj, target_item, before=False)[source]
Move src_item before or after target_item in the tree and lists.
Both items must share the same parent (category).
- set_active_profile(active_profile: wolfhece.PyCrosssections.profile)[source]
This method sets the active profile in Pydraw (useful for interfaces communication).
- set_active_vector(active_vector: wolfhece.PyVertexvectors.vector)[source]
This method sets the active vector in Pydraw (useful for interfaces communication).
- get_active_profile()[source]
This methods returns the active profile in pydraw (useful for interfaces communication).
- On_Mouse_Right_Down(e: wx.dataview.wx.MouseEvent)[source]
Event when the right button of the mouse is pressed.
We use this event to manage “action” set by others objects.
- _get_nearest_clip_slider(world_x: float, world_y: float)[source]
Return the nearest slider label if cursor is close, else ‘’.
- _try_start_clip_slider_drag(world_x: float, world_y: float) bool[source]
If a slider bar is under the cursor, start dragging it.
- Returns:
Trueif a drag was started (caller should skip normal handling).
- _update_clip_slider_drag(world_x: float, world_y: float) bool[source]
Update the active slider position during a drag.
- Returns:
Trueif a drag is in progress.
- static _nice_step(raw_step: float) float[source]
Round a raw spacing to a readable 1-2-5 x 10^n step.
- _ensure_snap_grid_origin() tuple[float, float][source]
Return a stable world origin for snapping, initialized once.
The origin is rounded on a coarse base to keep values readable while remaining invariant across zoom changes.
- _adaptive_snap_step_from_span(span: float, target_divisions: float = 20.0) float[source]
Compute zoom-adaptive step as power-of-two multiple of base unit.
Using powers of two guarantees hierarchical nesting: every coarser grid line remains compatible with all finer levels.
- _asset_transform_snap_steps() tuple[float, float][source]
Return adaptive grid steps as nested multiples of base snap unit.
- _asset_transform_snap_origin() tuple[float, float][source]
Return stable world origin shared by all snap operations.
- _apply_asset_transform_drag(x: float, y: float, *, keep_ratio: bool = False, resize_from_center: bool = False, do_snap: bool = True)[source]
- _is_heavy_gl_action_active() bool[source]
Return True when an interaction is likely to stress OpenGL drawing.
- _plot_mouse_xy_overlay() None[source]
Draw current world XY near the cursor directly on the OpenGL canvas.
- SetActiveCloud(cloud: wolfhece.PyVertexvectors.cloud_vertices | None)[source]
Set the active cloud of vertices, and update the tooltip if needed
- _update_mytooltip()[source]
Update the tooltip with the values of the active arrays and results at position x,y
- Autoscale(update_backfore=True)[source]
Redimensionnement de la fenêtre pour afficher tous les objets
- _endactions()[source]
End of actions
Call when the user double click on the right button of the mouse or press return.
Depending on the action, the method will call differnt routines and refresh the figure.
Each action must call self.end_action() to nullify the action and print a message.
- OnHotKey(e: wx.dataview.wx.KeyEvent)[source]
Gestion des touches clavier – see print_shortcuts for more details
- paste_values(fromarray: wolfhece.wolf_array.WolfArray)[source]
Paste selected values from a WolfArray to the active array
- paste_selxy(fromarray: wolfhece.wolf_array.WolfArray)[source]
Paste selected nodes from a WolfArray to the active array
- OntreeRight(e: wx.dataview.wx.MouseEvent)[source]
Gestion du menu contextuel sur l’arbre des objets
- _update_background_async()[source]
Trigger asynchronous background image updates.
This method is called when viewport bounds change (during panning/zooming). It triggers non-blocking image loads in the background via the AsyncImageLoader. The textures are updated as images are loaded, without blocking the UI.
- set_tracking_label(zone_id: int, active: bool)[source]
Register or unregister a zone as having active tracking labels.
- Parameters:
zone_id –
id(zone)of the calling zone.active – True to register, False to unregister.
- property has_tracking_labels: bool[source]
Return True if at least one zone has active tracking labels.
- get_ortho_mvp_c_contiguous() numpy.ndarray | None[source]
Build a 2D orthographic MVP in C-contiguous layout.
- Returns:
np.ndarray shape (4, 4), dtype float32, C-contiguous, or None if current view bounds are degenerate.
- resizeFrame(w: int, h: int)[source]
Resize the frame
- Parameters:
w – width in pixels
h – height in pixels
- Active_zone(zone: WolfMapViewer.Active_zone.zone)[source]
Active une zone et son parent si existant
- uncheck_id(id=str, unload=True, forceresetOGL=True, askquestion=False)[source]
Uncheck an element from its id
- get_current_zoom()[source]
Get the current zoom
- Returns:
dict with keys ‘center’, ‘xmin’, ‘xmax’, ‘ymin’, ‘ymax’, ‘width’, ‘height’
- class wolfhece.PyDraw.Comp_Type(*args, **kwds)[source]
Bases:
enum.Enum
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- class wolfhece.PyDraw.Compare_Arrays_Results(parent: WolfMapViewer = None, share_cmap_array: bool = False, share_cmap_diff: bool = False)[source]
-
- _check_type(file: pathlib.Path)[source]
Check the type of the file/directory
If it is a file and suffix is empty, it is considered as RES2D. If it is a directory and contains a simul_gpu_results, it is considered as RES2D_GPU. If it is a file and suffix is not empty, it is considered as ARRAYS. A check is done to see if it is a multi-block array.
- update_comp(idx=list[int])[source]
Update Arrays from 2D modellings
- Parameters:
idx – indexes of the time step to update –> steps to read
- set_diff()[source]
Set the differential between the elements and the first one, which is the reference
- class wolfhece.PyDraw.InPaint_waterlevel(parent, title: str = _('Inpainting'), size: tuple[int, int] = (400, 400), mapviewer: WolfMapViewer = None, **kwargs)[source]
Bases:
wx.dataview.wx.Dialog
- class wolfhece.PyDraw.InPaint_array(parent, title: str = _('Inpainting'), size: tuple[int, int] = (400, 400), mapviewer: WolfMapViewer = None, **kwargs)[source]
Bases:
wx.dataview.wx.Dialog