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

wolfhece.PyDraw.msg[source]
wolfhece.PyDraw.WOLFPYDIKE_AVAILABLE = True[source]
wolfhece.PyDraw.THROTTLING_FREQUENCY = 10[source]
wolfhece.PyDraw.THROTTLING_FREQUENCY_SCROLL = 30[source]
wolfhece.PyDraw.LIST_1TO9[source]
wolfhece.PyDraw.PROJECT_ACTION = 'action'[source]
wolfhece.PyDraw.PROJECT_CS = 'cross_sections'[source]
wolfhece.PyDraw.PROJECT_VECTOR = 'vector'[source]
wolfhece.PyDraw.PROJECT_ARRAY = 'array'[source]
wolfhece.PyDraw.PROJECT_TILES = 'tiles'[source]
wolfhece.PyDraw.PROJECT_LAZ = 'laz_grid'[source]
wolfhece.PyDraw.PROJECT_CLOUD = 'cloud'[source]
wolfhece.PyDraw.PROJECT_WOLF2D = 'wolf2d'[source]
wolfhece.PyDraw.PROJECT_GPU2D = 'gpu2d'[source]
wolfhece.PyDraw.PROJECT_PALETTE = 'palette'[source]
wolfhece.PyDraw.PROJECT_PALETTE_ARRAY = 'palette-array'[source]
wolfhece.PyDraw.PROJECT_GROUP_KEYS[source]
wolfhece.PyDraw._POLLED_KEYS: tuple[int, Ellipsis][source]
wolfhece.PyDraw._T[source]
class wolfhece.PyDraw.ActiveSlot(expected_type: type[_T] | tuple[type, ...] | None = None)[source]

Bases: Generic[_T]

Inheritance diagram of wolfhece.PyDraw.ActiveSlot

Descripteur d’attribut active_* auto-enregistré.

L’objet descripteur est unique au niveau de la classe (attribut de classe), mais la valeur est stockée par instance dans instance.__dict__ sous la clé privée _slot_<name>. Cela garantit une parfaite isolation entre instances et une interface publique indiscernable d’un attribut d’instance classique.

À l’affectation de active_X = ActiveSlot() dans le corps de la classe, Python appelle automatiquement __set_name__ qui enregistre le slot dans le registre de classe _active_slots. Ce registre permet les opérations groupées (reset, recherche par identité d’objet).

Rétrocompatibilité : instance.active_X = val et instance.active_X fonctionnent exactement comme avant pour tout code interne ou externe.

Gardien de type :
  • expected_type est passé au constructeur (type unique ou tuple de types).

  • À l’affectation, un isinstance vérifie la valeur (hors None).

  • Les overloads __get__ permettent à Pylance d’inférer _T | None directement depuis la déclaration de classe, sans analyser tous les sites d’affectation.

_expected_type = None[source]
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

Inheritance diagram of wolfhece.PyDraw.WolfMapViewer

Fenêtre de visualisation de données WOLF grâce aux WxWidgets

TIMER_ID = 100[source]
mybc: list[wolfhece.mesh2d.bc_manager.BcManager][source]
myarrays: list[source]
myvectors: list[wolfhece.PyVertexvectors.Zones][source]
myclouds: list[wolfhece.PyVertexvectors.cloud_vertices, wolfhece.PyVertex.cloud_of_clouds][source]
mytri: list[wolfhece.PyVertexvectors.Triangulation][source]
myothers: list[source]
myviews: list[wolfhece.wolfresults_2D.views_2D][source]
mywmsback: list[source]
mywmsfore: list[source]
myres2D: list[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]
mypicturecollections: list[wolfhece.PyPictures.PictureCollection][source]
myinjectors: list[wolfhece.dike.InjectorWolfDike][source]
mymplfigs: list[wolfhece._pydraw_utils.MplFigViewer][source]
sim_explorers: dict[Wolfresults_2D:Sim_Explorer][source]
canvas: wx.glcanvas.GLCanvas[source]
context: wx.glcanvas.GLContext[source]
mytooltip: wolfhece.PyParams.Wolf_Param[source]
treelist: wx.dataview.TreeListCtrl[source]
_lbl_selecteditem: wx.core.StaticText[source]
leftbox: wx.core.BoxSizer[source]
_active_slots: dict[str, ActiveSlot][source]
active_vector[source]
active_zone[source]
active_zones[source]
active_array[source]
active_bc[source]
active_view[source]
active_vertex[source]
active_cs[source]
active_tri[source]
active_tile[source]
active_imagestiles[source]
active_particle_system[source]
active_viewer3d[source]
active_viewerlaz[source]
active_bridges[source]
active_bridge[source]
active_weirs[source]
active_weir[source]
active_laz[source]
active_injector[source]
active_picturecollection[source]
active_fig[source]
active_cloud[source]
active_profile[source]
active_res2d[source]
active_landmap[source]
active_qdfidf[source]
active_cloud_vertex_id[source]
alaro_navigator: wolfhece.PyWMS.Alaro_Navigator[source]
_init_runtime_state(wxparent, title: str, w: int, h: int, treewidth: int, wolfparent, wxlogging, enable_async_background_updates: bool) None[source]

Initialize non-menu runtime state and base frame.

_init_active_state_and_managers() None[source]

Initialize active selections and manager objects.

reset_all_actives() None[source]

Set every active_* slot to None (slots + delegated-manager actives).

clear_active_if_is(obj) bool[source]

If obj is currently stored in any active_* slot, set that slot to None.

Returns True if at least one slot was cleared, False otherwise. This replaces the long if/elif chain in removeobj_from_id.

_init_menus_and_bindings() None[source]

Build all top-level menus and wire their handlers.

_init_canvas_tree_layout(w: int, h: int) None[source]

Create OpenGL canvas, object tree and left layout.

_init_auxiliary_ui_state() None[source]

Initialize tooltip, notebook placeholders and figure references.

_init_post_init_objects() None[source]

Initialize UI bindings and post-UI runtime objects.

_init_wintab_context() None[source]

WinTab pressure context initialisation.

DISABLED: WTOpenA/WTEnable in wintab32.dll corrupt the Windows process heap on certain Wacom driver versions, causing STATUS_HEAP_CORRUPTION (0xC0000374) regardless of when the call is made (during init or via wx.CallAfter after MainLoop). The bug is inside the Wacom driver and cannot be worked around by changing call timing.

Pressure is still available via wx.MouseEvent.GetPressure() when the tablet driver operates in Windows Ink mode (Wacom Desktop Center → “Use Windows Ink”). See _sculpt_manager.get_event_pressure().

To re-enable WinTab (e.g. after a Wacom driver update that fixes the heap bug), set WolfMapViewer._WINTAB_ENABLED = True before creating the viewer.

_WINTAB_ENABLED: bool = False[source]
_do_init_wintab_context() None[source]

Actual WinTab initialisation, called by wx.CallAfter after MainLoop.

_check_id_for_fig(idx: str)[source]

Check if an ID is already used for a figure

_create_id_for_fig()[source]
_validate_id_for_fig(idx: str)[source]

Validate an ID for a figure

new_fig(caption: str, idx: str = None, layout=PRESET_LAYOUTS.DEFAULT, size=(800, 600), show: bool = True) wolfhece._pydraw_utils.MplFigViewer[source]

Create a new figure

destroy_fig_by_id(idx: str) bool[source]

Destroy a figure by its ID

get_fig(idx: str) wolfhece._pydraw_utils.MplFigViewer[source]

Get a figure by its ID

list_ids_figs() list[str][source]

List all IDs of figures

property viewer_name[source]
property wxlogging[source]
check_logging()[source]

Check if logging window is shown

check_tooltip()[source]

Check if tooltip window is shown

open_hydrological_model()[source]

Open a hydrological model

create_2D_MB_model()[source]

Create a 2D model

create_2D_GPU_model()[source]

Create a 2D GPU model

check_2D_MB_headers()[source]

Check headers of a 2D simulation without opening viewer

get_mapviewer()[source]

Retourne une instance WolfMapViewer

do_quit()[source]
create_triangles_menu()[source]

Menu for triangulations

create_cloud_menu()[source]

Menu for cloud points

add_points_to_cloud()[source]

Add points to cloud

_on_split_cloud(event: wx.dataview.wx.Event) None[source]
move_point_in_cloud()[source]

Interactive move of one cloud point preserving row id.

_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]
_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.

split_cloud_by_vector()[source]

Split cloud by vector

get_choices_arrays()[source]

Boîte de dialogue permettant de choisir une ou plusieurs matrices parmi celles chargées

menu_tiles()[source]

Menu for tiles

pîck_image_tile(event: wx.dataview.wx.Event)[source]
menu_pictcollection()[source]

Menu for picture collections

menu_qdfidf()[source]
action_qdfidf(event: wx.dataview.wx.Event)[source]
action_pictcollections(event: wx.dataview.wx.Event)[source]
menu_imagestiles()[source]

Menu for image tiles

pick_tile(event: wx.dataview.wx.Event)[source]
create_data_from_tiles_activevec(event: wx.dataview.wx.Event)[source]
_create_data_from_tiles_common()[source]
create_data_from_tiles_tmpvec(event: wx.dataview.wx.Event)[source]
menu_laz()[source]
menu_wolf2d()[source]
menu_alaro_forecasts()[source]
Onmenualaro(event: wx.dataview.wx.MenuEvent)[source]
menu_landuse_landcover()[source]
Onmenu_landuse_landcover_importfromfile(event: wx.dataview.wx.MenuEvent)[source]
Onmenuwalous_ocs(event: wx.dataview.wx.MenuEvent)[source]
Onmenuwalous_uts(event: wx.dataview.wx.MenuEvent)[source]
property mydrownings[source]
property active_drowning[source]
menu_drowning()[source]
Onmenudrowning(event: wx.dataview.wx.MenuEvent)[source]
newdrowning(itemlabel)[source]
property mydikes[source]
property active_dike[source]
menu_dike()[source]
Onmenudike(event: wx.dataview.wx.MenuEvent)[source]
new_dike(itemlabel)[source]
property active_alaro[source]
property active_lidaxe[source]
add_lidaxe()[source]
menu_lidaxe()[source]
Onmenulidaxe(event: wx.dataview.wx.MenuEvent)[source]
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

_lulc_handle_importfromfile(event: wx.dataview.wx.MenuEvent)[source]
_lulc_handle_walous_ocs(event: wx.dataview.wx.MenuEvent)[source]
_lulc_handle_walous_uts(event: wx.dataview.wx.MenuEvent)[source]
_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]
Onmenuwolf2d(event: wx.dataview.wx.MenuEvent)[source]
menu_2dgpu()[source]
menu_landmaps()[source]
change_transparent_color_landmap(event: wx.dataview.wx.Event)[source]
set_tolerance_landmap(event: wx.dataview.wx.Event)[source]
change_colors_landmap(event: wx.dataview.wx.Event)[source]
pick_landmap_full(event: wx.dataview.wx.Event)[source]
pick_landmap_low(event: wx.dataview.wx.Event)[source]
menu_particlesystem()[source]
action_menu_particlesystem(event: wx.dataview.wx.Event)[source]
update_particlesystem(event: wx.dataview.wx.Event)[source]
menu_sim2D()[source]

Menu for 2D simulations

menu_sim2DGPU()[source]

Menu for 2D GPU simulations

Onmenusim2DGPU(event: wx.dataview.wx.MenuEvent)[source]
Onmenusim2D(event: wx.dataview.wx.MenuEvent)[source]
get_configuration() OpenGL.GLUT.Union[wolfhece.PyConfig.WolfConfiguration, None][source]

Get global configuration parameters

property epsg: int[source]

Return the EPSG code from configs

property active_vector_color: list[int][source]

Return the active vector color from configs

property active_vector_square_size: list[int][source]

Return the active vector square size from configs

property default_dem: pathlib.Path[source]

Return the default DEM file from configs

property default_dtm: pathlib.Path[source]

Return the default DTM file from configs

property default_laz[source]

Return the default LAZ file from configs

property default_hece_database: pathlib.Path[source]

Return the default HECE database file from configs

property bkg_color[source]

Return the background color from configs

property ticks_size: float[source]

Return the ticks spacing from configs

property ticks_xrotation: float[source]

Return the ticks x rotation from configs

property ticks_fontsize: int[source]

Return the ticks font size from configs

property overlay_xy_font_name: str[source]

Return font name used by OpenGL XY overlay text.

property overlay_xy_font_size: int[source]

Return font size in pixels used by OpenGL XY overlay text.

property toolbar_tooltip_font_size: int[source]

Return font size in pixels used by toolbar tooltip text.

property overlay_bg_color: tuple[source]

Return overlay background as an (R, G, B, A) float tuple in [0, 1].

property snap_grid_unit: float[source]

Return the base snap grid unit [m].

property snap_grid_round_base: float[source]

Return the coarse base used to align the snap origin [m].

property assembly_mode: str[source]

Return the assembly mode from configs

property ticks_bounds: bool[source]

Return the ticks bounds from configs

property palette_for_copy: wolfhece.PyVertexvectors.wolfpalette[source]

Return the palette for copy from configs

GlobalOptionsDialog(event)[source]
triangulate_cs()[source]

Triangulate the active cross sections

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_cs()[source]

Interpolate the active cross sections by interpolators

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

compare_cloud2array()[source]

Compare the active cloud points to the active array

compare_tri2array()[source]
move_triangles()[source]

Move the active triangles

rotate_triangles()[source]

Rotate the active triangles

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

get_canvas_as_image() PIL.Image.Image[source]

Récupère la fenêtre OpenGL sous forme d’image

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

reporting(dir='')[source]

First attempt to create a reporting. !! Must be improved !!

InitUI()[source]

Initialisation de l’interface utilisateur

OnChangeTitle(e)[source]

Change the title of the window

OnSize(e)[source]

Redimensionnement de la fenêtre

center_view_on(cx, cy)[source]

Center the view on the point of (map) coordinates (x,y)

setbounds(updatescale=True)[source]

Calcule les limites visibles de la fenêtre graphique sur base des facteurs d’échelle courants

setsizecanvas(width, height)[source]

Redimensionne la fenêtre graphique

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.

Ajout d’une nouvelle fenêtre de visualisation et liaison avec la fenêtre courante

add_grid()[source]

Ajout d’une grille

add_WMS()[source]

Ajout de couches WMS

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: wolfhece._pydraw_utils.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…

save_project(fn, absolute: bool = True)[source]

Save project file

help_project()[source]

Help for project file.

Define which elements can be saved in a project file.

plot_laz_around_active_vec()[source]

Plot laz data around active vector

clip_laz_gridded()[source]

Clip laz grid on current zoom

filter_active_laz()[source]

Filter active laz data

descimate_laz_data(factor: int = 10)[source]

Descimate data

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)

_choice_laz_classification()[source]
init_laz_from_gridinfos(dirlaz: str = None, classification: Literal['SPW-Geofit 2023', 'SPW 2013-2014', 'SPW 2021-2022'] = 'SPW-Geofit 2023')[source]
managebanks()[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_last_result()[source]

Lecture du dernier résultat pour les modèles ajoutés et plottés

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

simul_previous_step()[source]

Mise à jour au pas précédent

particle_next_step()[source]

Mise à jour au pas suivant

particle_previous_step()[source]

Mise à jour au pas précédent

simul_next_step()[source]

Mise à jour au pas suivant

OnMenuHighlight(event: wx.dataview.wx.MenuEvent)[source]
_select_laz_source()[source]

Select laz source

_choice_laz_colormap() int[source]
_run_compare_arrays(dlg)[source]

Run the comparison of two arrays

_compare_arrays()[source]

Compare two arrays

_on_open_project(event)[source]
_on_save_project(event)[source]
_on_save_canvas(event)[source]
_on_copy_canvas(event)[source]
_on_gltf_export(event)[source]
_on_gltf_import(event)[source]
_on_gltf_compare(event)[source]
_on_gltf_update(event)[source]
_on_sim_create_mb(event)[source]
_on_sim_check_headers(event)[source]
_on_sim_create_gpu(event)[source]
_on_sim_create_1d(event)[source]
_on_sim_create_hydro(event)[source]
_on_add_lidaxe(event)[source]
_on_set_comparison(event)[source]
_on_multiviewer(event)[source]
_on_viewer3d(event)[source]
_on_create_array_xyz(event)[source]
_on_create_array_lidar2002(event)[source]
_on_create_view(event)[source]
_on_create_array(event)[source]
_on_create_vector(event)[source]
_on_create_clouds(event)[source]
_on_create_manager2d(event)[source]
_on_create_scenario2d(event)[source]
_on_create_acceptability(event)[source]
_on_create_inbe(event)[source]
_on_create_bc_manager(event)[source]
_on_create_particle_system(event)[source]
_on_create_drowning(event)[source]
_on_add_array(event)[source]
_on_add_vector(event)[source]
_on_add_cloud(event)[source]
_on_add_cross_sections(event)[source]
_on_add_array_crop(event)[source]
_on_add_picture_collection(event)[source]
_on_add_tiles(event)[source]
_on_add_images_tiles(event)[source]
_on_add_tiles_comparator(event)[source]
_on_add_tiles_gpu(event)[source]
_on_add_clouds(event)[source]
_on_add_triangulation(event)[source]
_on_add_wolf2d(event)[source]
_on_add_wolf2d_gpu(event)[source]
_on_add_particle_system(event)[source]
_on_add_bridges(event)[source]
_on_add_weirs(event)[source]
_on_add_view(event)[source]
_on_add_drowning(event)[source]
_on_contour_from_arrays(event)[source]
_on_calculator(event)[source]
_on_memory_views(event)[source]
_on_memory_distances(event)[source]
_on_add_distances_viewer(event)[source]
_on_image_digitizer(event)[source]
_on_jupyter_kernel(event)[source]

Start (or show info for) the embedded Jupyter kernel.

_on_cs_manage_banks(event)[source]
_on_cs_create_banks(event)[source]
_on_cs_rename(event)[source]
_on_cs_triangulate(event)[source]
_on_cs_export_gltf(event)[source]
_on_cs_bridge_gltf(event)[source]
_on_select_cs(event: wx.dataview.wx.MenuEvent) None[source]
_on_plot_cs(event: wx.dataview.wx.MenuEvent) None[source]
_on_sort_along(event: wx.dataview.wx.MenuEvent) None[source]
_on_locminmax(event: wx.dataview.wx.MenuEvent) None[source]
_on_colormap_unique(event)[source]
_on_colormap_from_file(event)[source]
_on_colormap_uniform_parts(event)[source]
_on_colormap_linear(event)[source]
_autoscale_if_needed()[source]

Trigger Autoscale when the viewer has exactly 2 total objects (1 new).

_on_save_all(event)[source]
_on_save_all_as(event)[source]
_on_recursive_scan(event)[source]
_on_create_dike(event)[source]
_on_add_dike(event)[source]
_on_precomputed_dem(event)[source]
_on_precomputed_dtm(event)[source]
_on_exit(event)[source]
_on_viewer_interpcs(event)[source]
_on_interpcs(event)[source]
pop_boundary_manager(which: wolfhece.mesh2d.bc_manager.BcManager)[source]

Pop a boundary condition manager after Destroying

get_boundary_manager(which: wolfhece.wolf_array.WolfArray)[source]

Get a boundary manager

uniquecolormap(loadfromfile=False)[source]

Compute unique colormap from all (arrays, 2D results) and apply it to all

loadnap_and_apply()[source]
uniforminparts_all(TrueOrFalse: bool)[source]
filter_inundation()[source]
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’

thread_update_blender()[source]
_ADD_FILTER_ARRAY = 'All supported formats|*.bin;*.tif;*.tiff;*.top;*.flt;*.npy;*.npz;*.vrt|bin...[source]
_ADD_FILTER_JSON = 'json (*.json)|*.json|all (*.*)|*.*'[source]
_ADD_FILTER_ALL = 'all (*.*)|*.*'[source]
_ADD_FILTER_VECTOR = 'All supported formats|*.vec;*.vecz;*.dxf;*.shp|vec (*.vec)|*.vec|vecz (*.vecz)|*.vecz|dxf...[source]
_ADD_FILTER_CLOUD = 'All supported formats|*.xyz;*.laz;*.las;*.json|xyz (*.xyz)|*.xyz|laz (*.laz)|*.laz|las...[source]
_ADD_FILTER_LAZ = 'laz (*.laz)|*.laz|las (*.las)|*.las|Numpy (*.npz)|*.npz|all (*.*)|*.*'[source]
_ADD_FILTER_TRI = "tri (*.tri)|*.tri|text (*.txt)|*.txt|dxf (*.dxf)|*.dxf|gltf (*.gltf)|*.gltf|gltf binary...[source]
_ADD_FILTER_CS = 'vecz WOLF (*.vecz)|*.vecz|txt 2022 (*.txt)|*.txt|WOLF (*.sxy)|*.sxy|text 2000...[source]
_ADD_FILTER_IMAGE = 'Geotif (*.tif)|*.tif|all (*.*)|*.*'[source]
_ADD_DIALOG_SPECS: dict[source]
_ADD_HANDLERS: dict[source]
add_object(which: Literal['array', 'array_lidar_first', 'array_lidar_second', 'array_xyz', 'array_tiles', 'bridges', 'weirs', 'vector', 'tiles', 'tilescomp', 'cloud', '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.

_prompt_file_for_type(which: str)[source]

Show a file or directory dialog for which. Returns (filename, curfilter) or None on cancel.

_resolve_object_id(id: str, filename: str, all_ids: list) str[source]

Prompt for ID when blank; ensure the result is unique across all loaded objects.

_register_object_in_tree(newobj, curtree, id: str, ToCheck: bool, filename: str) None[source]

Assign idx, insert into treelist, and handle post-registration side-effects.

_add_array(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_picture_collection(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_array_tiles(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_imagestiles(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_bridges(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_weirs(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_tiles(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_array_xyz(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_array_lidar(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_res2d(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_res2d_gpu(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_vector(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_cross_sections(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_laz(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_cloud(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_clouds(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_triangulation(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_other(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_views(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_wmsback(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_wmsfore(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_particlesystem(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_drowning(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_dike(which, filename, newobj, curfilter, ToCheck, id)[source]
_add_injector(which, filename, newobj, curfilter, ToCheck, id)[source]
add_pie_asset(*args, **kwargs) Zones | PieZonesController[source]
_bind_pie_controller_to_zones(controller, zones) None[source]
_iter_pie_controllers() list[source]
_get_pie_controller(pie_id: str)[source]
OnCreatePieChart(event: wx.dataview.wx.Event) None[source]
OnEditPieChart(event: wx.dataview.wx.Event) None[source]
OnLoadPieChartJSON(event: wx.dataview.wx.Event) None[source]
add_bar_asset(*args, **kwargs) Zones | BarZonesController[source]
_bind_bar_controller_to_zones(controller, zones) None[source]
_iter_bar_controllers() list[source]
_get_bar_controller(bar_id: str)[source]
OnCreateBarChart(event: wx.dataview.wx.Event) None[source]
OnEditBarChart(event: wx.dataview.wx.Event) None[source]
OnLoadBarChartJSON(event: wx.dataview.wx.Event) None[source]
add_curve_asset(*args, **kwargs) Zones | CurveZonesController[source]
_bind_curve_controller_to_zones(controller, zones) None[source]
_iter_curve_controllers() list[source]
_get_curve_controller(curve_id: str)[source]
OnCreateCurveChart(event: wx.dataview.wx.Event) None[source]
OnEditCurveChart(event: wx.dataview.wx.Event) None[source]
OnLoadCurveChartJSON(event: wx.dataview.wx.Event) None[source]
OnCreateBoxplot(event: wx.dataview.wx.Event) None[source]
OnEditBoxplot(event: wx.dataview.wx.Event) None[source]
OnLoadBoxplotJSON(event: wx.dataview.wx.Event) None[source]
replace_object(id: str, newobj, drawing_type: wolfhece._pydraw_utils.draw_type = None)[source]

Replace an object in the list of objects of type drawing_type

get_obj_from_treeitem(treeitem)[source]

Find the object associated with treeitem

get_treeitem_from_id(id: str, drawing_type: wolfhece._pydraw_utils.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”.

getobj_from_id(id: str, drawing_type: wolfhece._pydraw_utils.draw_type = None)[source]

Find the object associated with id

get_obj_from_id(id: str, drawing_type: wolfhece._pydraw_utils.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(drawing_type: wolfhece._pydraw_utils.draw_type = None)[source]

return the list of objects of type drawing_type

get_list_keys(drawing_type: wolfhece._pydraw_utils.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: wolfhece._pydraw_utils.draw_type = None, checked_state: bool = True)[source]

Alias for get_list_keys

get_list_objects(drawing_type: wolfhece._pydraw_utils.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: wolfhece._pydraw_utils.draw_type, checked_state: bool = True)[source]

Create iterator over objects of type draw_type

gettreeitem(obj)[source]

Find the tree item associated with obj

removeobj()[source]

Remove selected item from general tree

checkuncheckobj()[source]

Check/uncheck selected item from general tree

removeobj_from_id(id: str, draw_type: WolfMapViewer.removeobj_from_id.draw_type = None)[source]

Remove object from id

_tree_drag_active: bool = False[source]
_tree_drag_source_item = None[source]
_tree_drag_source_obj = None[source]
_tree_drag_start_pos = None[source]
_tree_drag_drop_before: bool = False[source]
_tree_drag_overlay = None[source]
_TREE_DRAG_THRESHOLD: int = 6[source]
_tree_drag_init()[source]

Bind mouse events on the DataView’s main window for DnD.

_on_tree_left_down(e: wx.dataview.wx.MouseEvent)[source]

Record potential drag start position.

_on_tree_motion(e: wx.dataview.wx.MouseEvent)[source]

Detect drag start, update cursor and draw drop indicator.

_on_tree_left_up(e: wx.dataview.wx.MouseEvent)[source]

Perform drop if drag was active.

_tree_drag_cancel()[source]

Reset drag state, cursor and overlay.

_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).

upobj()[source]

Up selected item into general tree

downobj()[source]

Down selected item into general tree

OnShowPopup(event)[source]

Deprecated — context menu is now built and shown directly by OntreeRight.

OnPopupItemSelected(event)[source]

Deprecated — event routing is now handled by direct wx.EVT_MENU bindings in OntreeRight.

_popup_up() None[source]
_popup_down() None[source]
_popup_delete() None[source]
_popup_check_uncheck() None[source]
_popup_save() None[source]
_popup_save_as() None[source]
_popup_rename() None[source]
_popup_duplicate() None[source]
_popup_properties() None[source]
_popup_boundary_conditions() None[source]
_popup_contours() None[source]
_popup_rebin() None[source]
_popup_set_nullvalue() None[source]
_popup_reload() None[source]
_popup_clip_from_view() None[source]
_popup_clip_h_slider() None[source]
_popup_clip_v_slider() None[source]
_popup_clip_h_band() None[source]
_popup_clip_v_band() None[source]
_popup_clip_save_config() None[source]
_popup_clip_load_config() None[source]
_popup_clip_remove_all() None[source]
_popup_clip_toggle_bars() None[source]
_popup_convert_mono() None[source]
_popup_convert_multi() None[source]
_popup_extract_ic() None[source]
_popup_export_shapefile() None[source]
_popup_export_active_zone_shapefile() None[source]
_popup_laz_set_colormap() None[source]
_popup_laz_edit_colormap() None[source]
_popup_laz_set_classification() None[source]
_popup_laz_edit_selection() None[source]
_popup_laz_all_to_cloud() None[source]
_popup_laz_selection_to_cloud() None[source]
_popup_laz_selection_to_vector() None[source]
_popup_laz_play() None[source]
_popup_laz_add_point() None[source]
_popup_laz_record() None[source]
_popup_laz_load_flight() None[source]
_popup_laz_save_flight() None[source]
_popup_rasterize_zone() None[source]
_popup_rasterize_vector() None[source]
_popup_extrude() None[source]
_popup_interpolate_on_array() None[source]
OnClose(event)[source]

Close the application

OnSelectItem(event)[source]

Select the item in the tree list

OnCheckItem(event: TreeListEvent)[source]

Check the item in the tree list

_alaro_update_time()[source]

Update the time of the alaro navigator

_alaro_legends()[source]

Show images of the checked alaro layers

getXY(pospix)[source]
OnZoomGesture(e)[source]
OnLeave(e)[source]
get_cross_sections()[source]

Récupération du premier objet crosssections disponible

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).

plot_cross(x: float, y: float)[source]
_bridge_gltf_dialog(x: float, y: float) None[source]

wx dialog workflow for BRIDGE_GLTF (called from the mouse handler).

_ensure_notebookcs() None[source]

Create or show the cross-section notebook (shared by SET_1D_PROFILE and SELECT_NEAREST_PROFILE).

_set_1d_profile_rdown(x: float, y: float) None[source]

Logic for SET_1D_PROFILE right-click (called from the mouse handler).

_select_nearest_profile_rdown(x: float, y: float) None[source]

Logic for SELECT_NEAREST_PROFILE right-click (called from the mouse handler).

_wx_mouse_context(e: wx.dataview.wx.MouseEvent) wolfhece._viewer_plugin_handlers.MouseContext[source]
_wx_keyboard_snapshot(e: wx.dataview.wx.KeyEvent) wolfhece._viewer_plugin_handlers.KeyboardSnapshot[source]

Build a KeyboardSnapshot from a raw wx.KeyEvent.

schedule_once(delay_ms: int, fn) None[source]

Run fn() once after delay_ms milliseconds (wx.CallLater wrapper).

post_idle(fn) None[source]

Defer fn() to the next event-loop idle (wx.CallAfter wrapper).

On_Mouse_Motion(e: wx.dataview.wx.MouseEvent)[source]

Mouse move event

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.

On_Mouse_Right_Up(e)[source]
On_Mouse_Button(e: wx.dataview.wx.MouseEvent)[source]
On_Right_Double_Clicks(e)[source]
On_Left_Double_Clicks(e: wx.dataview.wx.MouseEvent)[source]
On_Mouse_Left_Down(e)[source]

Event when the left button of the mouse is pressed

On_Mouse_Left_Up(e)[source]

Event when the left button of the mouse is released

_active_clip_slider = None[source]
_iter_clip_sliders()[source]

Yield all (clip_zone, slider) from checked arrays, 2D results and vectors.

_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:

True if 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:

True if a drag is in progress.

_end_clip_slider_drag()[source]

Finish any active slider drag.

_get_asset_transform_bounds()[source]
static _compute_asset_handles(bounds)[source]
_asset_handle_hit_test(x: float, y: float)[source]
static _cursor_for_asset_handle(handle)[source]
_set_asset_transform_cursor(handle) None[source]
static _nice_step(raw_step: float) float[source]
_ensure_snap_grid_origin() tuple[float, float][source]
_adaptive_snap_step_from_span(span: float, target_divisions: float = 20.0) float[source]
_asset_transform_snap_steps() tuple[float, float][source]
_asset_transform_snap_origin() tuple[float, float][source]
static _snap_value(v: float, step: float, origin: float = 0.0) float[source]
_apply_asset_transform_drag(x: float, y: float, **kwargs) bool[source]
_update_asset_transform_cursor(x: float, y: float) None[source]
_plot_grid_transform_overlay()[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.

_plot_distance_overlay() None[source]

Draw cumulative distance near the cursor, stacked below/above the XY overlay.

_set_active_bc()[source]

Search and activate BCManager according to active_array

_ACTIVE_DEFAULT_MSG: dict[source]
_check_active(**slot_messages: str | None) bool[source]

Vérifie que chaque slot actif nommé est non-None.

Log un warning pour chaque slot manquant et retourne False si au moins un slot est absent. Retourne True si tous sont présents.

Passer None comme message utilise le texte par défaut de _ACTIVE_DEFAULT_MSG.

Usage:

# message explicite
if not self._check_active(
    active_array=_('No active array -- Please activate one first'),
):
    return

# message par défaut (None)
if not self._check_active(active_array=None, active_vector=None):
    return
set_statusbar_text(txt: str)[source]

Set the status bar text

set_label_selecteditem(nameitem: str)[source]

Set the label of the selected item in the tree list

get_label_selecteditem()[source]

Get the label of the selected item in the tree list

OnActivateTreeElem(e)[source]

Activate the selected item in the tree list

SetActiveCloud(cloud: wolfhece.PyVertexvectors.cloud_vertices | None)[source]

Set the active cloud of vertices, and update the tooltip if needed

_update_tooltip()[source]

Update the tooltip with the values of the active arrays and results at position x,y

_update_tooltip_position() None[source]

Position the tooltip window after each mouse motion.

Called at the end of On_Mouse_Motion once _update_tooltip() has refreshed the tooltip content. Two modes:

  • CTRL held — tooltip follows the cursor (CTRL-follow mode).

  • CTRL released — tooltip is placed at its last stored position (or stacked next to the frame when Shift is held or the position has never been set).

Autoscale(update_backfore=True)[source]

Redimensionnement de la fenêtre pour afficher tous les objets

print_About()[source]

Print the About window

check_for_updates()[source]

Check for updates

print_shortcuts(inframe: bool = None)[source]

Print the list of shortcuts into logging

msg_action(which: int = 0)[source]

Message to end action

Parameters:

which – 0 to start action, 1 to end action

register_action(action_id: str, *, rdown_handler: _MouseHandler | None = None, motion_handler: _MouseHandler | None = None, ldown_handler: _LeftDownHandler | None = None, key_handler: _KeyHandler | None = None, paint_handler: _PaintHandler | None = None, overload: bool = False) None[source]

Register custom event handlers for action_id on this instance only.

The handlers are looked up before the global dispatch tables, so a plugin can shadow or extend any built-in action without modifying core files.

Typical usage from a Jupyter notebook:

from wolfhece._viewer_plugin_handlers import MouseContext, KeyboardSnapshot

def my_rdown(viewer, ctx: MouseContext) -> None:
    print(f"Click at ({ctx.x:.2f}, {ctx.y:.2f})")

def my_key(viewer, kb: KeyboardSnapshot) -> bool:
    if kb.key_code == ord('C') and kb.ctrl:
        my_data.clear()
        return True   # consume the event
    return False

def my_paint(viewer) -> None:
    pass  # raw OpenGL drawing here

viewer.register_action('my action',
                       rdown_handler=my_rdown,
                       key_handler=my_key,
                       paint_handler=my_paint)
viewer.start_action('my action', 'Click on the map…')
Parameters:
  • action_id – Lowercase string that identifies the action.

  • rdown_handler(viewer, MouseContext) -> None — right mouse-button press.

  • motion_handler(viewer, MouseContext) -> None — mouse motion.

  • ldown_handler(viewer, MouseContext) -> None — left mouse-button press.

  • key_handler(viewer, KeyboardSnapshot) -> bool — key press. Return True to consume the event (prevents default).

  • paint_handler(viewer) -> None — raw OpenGL drawing hook, called after all data layers, before UI overlays.

  • overload – When True, the current handler for each slot is saved and automatically restored when unregister_action() is called. A warning is emitted in both cases whenever an existing handler is replaced.

unregister_action(action_id: str) None[source]

Remove a previously registered custom action from this instance.

If the action was registered with overload=True, the previously displaced handlers are automatically restored.

Parameters:

action_id – The action id passed to register_action().

start_action(action: str | ActionKind, message: str = '')[source]

Message to start action

Parameters:
  • action – name of the action (used to manage the end of the action in “end_action” method)

  • message – message to print in the log (if empty, the action name will be printed)

end_action(message: str = '')[source]

Message to end action

Parameters:

message – message to print in the log (if empty, “End of action” will be printed)

_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.

_sculpt_hide_size() None[source]
_sculpt_hide_zone() None[source]
_get_event_pressure(e)[source]
_profile_apply_at(x: float, y: float) None[source]
_draw_profile_cursor() None[source]
_request_brush_refresh() None[source]
_do_brush_refresh() None[source]
_sculpt_apply_at(x: float, y: float, pressure: float = 1.0) None[source]
_draw_sculpt_cursor() None[source]
distance_by_multiple_clicks()[source]

Distance between multiple clicks

toggle_automatic_background()[source]

Toggle automatic background update mode

OnHotKey(e: wx.dataview.wx.KeyEvent)[source]

Gestion des touches clavier – see print_shortcuts for more details

_hotkey_with_modifier(kb: wolfhece._viewer_plugin_handlers.KeyboardSnapshot) None[source]

Key presses with Ctrl or Alt held.

_hotkey_bare(kb: wolfhece._viewer_plugin_handlers.KeyboardSnapshot) None[source]

Key presses with no modifier (bare key or Shift only).

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

_popup_append_clip_submenu(popup: wx.dataview.wx.Menu) None[source]

Append a Clip zone sub-menu with per-item bindings to popup.

zoom_on_whole_walonia()[source]

Zoom on the whole Walonia

_update_background()[source]

Update background (synchronous - blocking)

_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.

_update_foreground()[source]

Update foreground (synchronous - blocking)

update()[source]

Update backgournd et foreground elements and arrays if local minmax is checked.

_plotting(drawing_type: wolfhece._pydraw_utils.draw_type, checked_state: bool = True)[source]

Drawing objets on canvas

_tracking_label_zones: set[source]
set_tracking_label(zone_id: int, active: bool)[source]

Register or unregister a zone as having active tracking labels.

Parameters:
  • zone_idid(zone) of the calling zone.

  • activeTrue to register, False to unregister.

property has_tracking_labels: bool[source]

Return True if at least one zone has active tracking labels.

_ORTHO_NEAR = -99999.0[source]
_ORTHO_FAR = 99999.0[source]
get_MVP_Viewport_matrix()[source]

Read back the current GL modelview, projection and viewport.

Requires an active OpenGL context. The returned projection matrix has the same byte layout as mvp (C-contiguous, column-major) because PyOpenGL wraps glGetFloatv that way.

Returns:

(modelview, projection, viewport) — each a numpy array, or (None, None, None) when no context is available.

get_ortho_mvp_c_contiguous() numpy.ndarray | None[source]

Build the 2D orthographic MVP purely from Python attributes.

Uses self.xmin / xmax / ymin / ymax and the shared :pyattr:`_ORTHO_NEAR` / :pyattr:`_ORTHO_FAR` planes so the result is always consistent with _set_gl_projection_matrix().

Returns:

np.ndarray shape (4, 4), dtype float32, C-contiguous (numpy rows = OpenGL columns), or None when the current view bounds are degenerate.

_set_gl_projection_matrix()[source]

Set the fixed-function projection from current view bounds.

Uses the same near/far as get_ortho_mvp_c_contiguous() so the fixed-function pipeline and shader path always agree.

property mvp: numpy.ndarray[source]

Model-view-projection matrix (C-contiguous, float32).

Preferred path: pure-Python computation via get_ortho_mvp_c_contiguous() (no GL context needed).

Fallback: GL state readback via get_MVP_Viewport_matrix() wrapped with np.ascontiguousarray (requires active context).

Last resort: identity matrix.

property sunposition[source]

Sun position as glm.vec3 derived from altitude/azimuth angles.

The position is placed on a large sphere centred on the current view so that the resulting directional light is consistent regardless of pan/zoom.

property sunintensity[source]
property hillshade: bool[source]

Whether the shader hillshade is active.

property sun_altitude: float[source]

Sun elevation angle in degrees (0 = horizon, 90 = zenith).

property sun_azimuth: float[source]

Sun azimuth in degrees (0 = North, 90 = East, clockwise).

property sun_intensity: float[source]

Sun intensity multiplier (0 to 2).

property hillshade_multidirectional: bool[source]

Whether multi-directional hillshade (8 azimuths) is active.

property active_hillshade_params: wolfhece.wolf_array.HillshadeRenderParams[source]

Return the material params that the panel/overlay should read/write.

In sync mode → shared params. In per-array mode → active_array.hillshade_params (fallback to shared). When selected_object is a Wolfresults_2D, returns the first block’s current array params so the panel controls them.

resolve_hillshade_params(wa) wolfhece.wolf_array.HillshadeRenderParams[source]

Return the material params for a specific WolfArray wa.

Called by the shader upload to get per-array or shared params.

property hillshade_sync: bool[source]

True → all arrays share the same material params.

property hillshade_z_exaggeration: float[source]
property hillshade_specular: float[source]
property hillshade_glossiness: float[source]
property hillshade_highlight: float[source]
_propagate_hillshade_to_children()[source]

Copy active hillshade params to every child array.

Handles Wolfresults_2D (via iter_current_arrays) and WolfArrayMB (via myblocks).

_show_hillshade_panel()[source]

Show (or raise) the persistent hillshade control panel.

_refresh_hillshade_panel_for_active()[source]

Refresh the hillshade panel controls after the active array changed.

SetCurrentContext()[source]

Set the current OGL context if exists otherwise return False

Paint(ignore_overlays: bool = False)[source]

Plotting elements on canvas

OnPaint(e)[source]

event handler for paint event

findminmax(force=False)[source]

Find min/max of all objects

resizeFrame(w: int, h: int)[source]

Resize the frame

Parameters:
  • w – width in pixels

  • h – height in pixels

mimicme()[source]

Report des caractéristiques de la fenêtre sur les autres éléments liés

mimicme_copyfrom()[source]
Active_vector(vect)[source]

Active un vecteur et sa zone parent si existante

Active_zone(zone: WolfMapViewer.Active_zone.zone)[source]

Active une zone et son parent si existant

list_background()[source]
list_foreground()[source]
check_id(id=str, gridsize=100.0)[source]

Check an element from its id

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’

save_current_zoom(filepath)[source]

Save the current zoom in a json file

read_current_zoom(filepath)[source]

Read the current zoom from a json file

menu_bridges()[source]
OnAddBridge(e: wx.dataview.wx.Event)[source]
OnEditBridge(e: wx.dataview.wx.Event)[source]
OnFindBridge(e: wx.dataview.wx.Event)[source]
pick_bridge(x: float, y: float)[source]
menu_weirs()[source]
OnAddWeir(e: wx.dataview.wx.Event)[source]
OnEditWeir(e: wx.dataview.wx.Event)[source]
OnFindWeir(e: wx.dataview.wx.Event)[source]
pick_weir(x: float, y: float)[source]
class wolfhece.PyDraw.Comp_Type(*args, **kwds)[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.PyDraw.Comp_Type

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.

ARRAYS = 1[source]
ARRAYS_MB = 2[source]
RES2D = 3[source]
RES2D_GPU = 4[source]
class wolfhece.PyDraw.Compare_Arrays_Results(parent: WolfMapViewer = None, share_cmap_array: bool = False, share_cmap_diff: bool = False)[source]
parent = None[source]
paths = [][source]
elements = [][source]
linked_elts = [][source]
diff = [][source]
mapviewers = [][source]
mapviewers_diff = [][source]
times = None[source]
share_cmap_array = False[source]
share_cmap_diff = False[source]
type[source]
_initialized_viewers = False[source]
independent = True[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.

add(file_or_dir: OpenGL.GLUT.Union[str, pathlib.Path] = None)[source]
check()[source]

Check the consystency of the elements to compare

update_comp(idx=list[int])[source]

Update Arrays from 2D modellings

Parameters:

idx – indexes of the time step to update –> steps to read

update_type_result(newtype)[source]

Update the result type for each element

set_elements()[source]

Set the elements to compare with the right type

set_diff()[source]

Set the differential between the elements and the first one, which is the reference

set_viewers(independent: bool = None)[source]

Set viewers

set_shields_param(diamsize: float = 0.001, graindensity: float = 2.65)[source]

Set the parameters for the shields diagram

update_viewers()[source]

Update the viewers with the new elements

bake()[source]
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

Inheritance diagram of wolfhece.PyDraw.InPaint_waterlevel
_array: wolfhece.wolf_array.WolfArray = None[source]
_dem: wolfhece.wolf_array.WolfArray = None[source]
_dtm: wolfhece.wolf_array.WolfArray = None[source]
_mapviewer = None[source]
_init_UI()[source]

Create 2 listboxes for the arrays and the masks

OnUpdateIDs(e)[source]

Update the list of arrays/mask/dtm

OnSelectArray(e)[source]

Select an array

OnSelectMask(e)[source]

Select a mask

OnSelectDTM(e)[source]

Select a DTM

OnInpaint(e)[source]

Inpaint the array with the mask

OnSelectHoles(e)[source]

Select the holes in the array

OnCreateMask(e)[source]

Create a mask from the array

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

Inheritance diagram of wolfhece.PyDraw.InPaint_array
_array: wolfhece.wolf_array.WolfArray = None[source]
_mask: wolfhece.wolf_array.WolfArray = None[source]
_test: wolfhece.wolf_array.WolfArray = None[source]
_mapviewer = None[source]
_init_UI()[source]

Create 2 listboxes for the arrays and the masks

OnUpdateIDs(e)[source]

Update the list of arrays/mask/dtm

OnSelectArray(e)[source]

Select an array

OnSelectMask(e)[source]

Select a mask

OnSelectTest(e)[source]

Select a DTM

OnInpaint(e)[source]

Inpaint the array with the mask

OnSelectHoles(e)[source]

Select the holes in the array

OnCreateMask(e)[source]

Create a mask from the array