:py:mod:`wolfhece.PyDraw` ========================= .. py:module:: wolfhece.PyDraw .. autoapi-nested-parse:: 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 --------------- .. py:data:: msg .. py:data:: ID_SELECTCS :value: 1000 .. py:data:: ID_SORTALONG :value: 1001 .. py:data:: ID_LOCMINMAX :value: 1002 .. py:data:: ID_PLOTCS :value: 1003 .. py:data:: LIST_1TO9 .. py:data:: PROJECT_ACTION :value: 'action' .. py:data:: PROJECT_CS :value: 'cross_sections' .. py:data:: PROJECT_VECTOR :value: 'vector' .. py:data:: PROJECT_ARRAY :value: 'array' .. py:data:: PROJECT_TILES :value: 'tiles' .. py:data:: PROJECT_LAZ :value: 'laz_grid' .. py:data:: PROJECT_CLOUD :value: 'cloud' .. py:data:: PROJECT_WOLF2D :value: 'wolf2d' .. py:data:: PROJECT_GPU2D :value: 'gpu2d' .. py:data:: PROJECT_PALETTE :value: 'palette' .. py:data:: PROJECT_PALETTE_ARRAY :value: 'palette-array' .. py:data:: PROJECT_LINK_CS :value: 'cross_sections_link' .. py:data:: PROJECT_LINK_VEC_ARRAY :value: 'vector_array_link' .. py:data:: PROJECT_GROUP_KEYS .. py:class:: MplFigViewer(layout=None, idx: str = '', mapviewer: WolfMapViewer = None, caption: str = '', size: tuple = (800, 600), style: int = wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER) Bases: :py:obj:`wolfhece.PyVertexvectors.MplFig` .. autoapi-inheritance-diagram:: wolfhece.PyDraw.MplFigViewer :parts: 1 :private-bases: Matplotlib Figure with wx Frame .. py:property:: mapviewer .. py:property:: idx .. py:method:: OnClose(event) Close the window .. py:class:: Memory_View(screen_width, screen_height, xmin, xmax, ymin, ymax) Memory view .. py:property:: width Width of the view .. py:property:: height Height of the view .. py:method:: serialize() Serialize the view .. py:method:: deserialize(data: dict) :staticmethod: Deserialize the view .. py:class:: Memory_View_encoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None) Bases: :py:obj:`json.JSONEncoder` .. autoapi-inheritance-diagram:: wolfhece.PyDraw.Memory_View_encoder :parts: 1 :private-bases: Memory view encoder .. py:method:: default(o) Default method .. py:class:: Memory_View_decoder(*args, **kwargs) Bases: :py:obj:`json.JSONDecoder` .. autoapi-inheritance-diagram:: wolfhece.PyDraw.Memory_View_decoder :parts: 1 :private-bases: Memory view decoder .. py:method:: object_hook(obj) Decode the object .. py:class:: Memory_Views Memory views .. py:method:: add_view(name: str, screen_width: int, screen_height: int, xmin: float, xmax: float, ymin: float, ymax: float) Add a new view to the memory views .. py:method:: remove_view(name: str) Remove a view from the memory views .. py:method:: reset() Reset the memory views .. py:method:: zoom_on(name: str, mapviewer: WolfMapViewer) Zoom on a view .. py:method:: save(filename: str) Save the memory views .. py:method:: load(filename: str) Load the memory views .. py:class:: Memory_Views_GUI(parent, title, memory_views: Memory_Views, mapviewer: WolfMapViewer) Bases: :py:obj:`wx.Frame` .. autoapi-inheritance-diagram:: wolfhece.PyDraw.Memory_Views_GUI :parts: 1 :private-bases: Memory views GUI .. py:method:: OnSave(event) Save the memory views .. py:method:: OnLoad(event) Load the memory views .. py:method:: OnClose(event) Close the memory views GUI .. py:method:: OnSelectView(event) Select a view .. py:method:: OnZoom(event) Zoom on the current view .. py:method:: OnAdd(event) Add a view .. py:method:: OnDelete(event) Delete a view .. py:method:: OnReset(event) Reset the views .. py:method:: OnApply(event) Apply the changes .. py:method:: OnGet(event) Get the values .. py:class:: draw_type Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.PyDraw.draw_type :parts: 1 :private-bases: Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: ARRAYS :value: 'arrays' .. py:attribute:: BRIDGES :value: 'bridges' .. py:attribute:: WEIRS :value: 'weirs' .. py:attribute:: VECTORS :value: 'vectors' .. py:attribute:: CLOUD :value: 'clouds' .. py:attribute:: TRIANGULATION :value: 'triangulations' .. py:attribute:: PARTICLE_SYSTEM :value: 'particle systems' .. py:attribute:: CROSS_SECTIONS :value: 'cross_sections' .. py:attribute:: OTHER :value: 'others' .. py:attribute:: VIEWS :value: 'views' .. py:attribute:: RES2D :value: 'wolf2d' .. py:attribute:: WMSBACK :value: 'wms-background' .. py:attribute:: WMSFORE :value: 'wms-foreground' .. py:attribute:: TILES :value: 'tiles' .. py:attribute:: IMAGESTILES :value: 'imagestiles' .. py:attribute:: LAZ :value: 'laz' .. py:class:: Colors_1to9(parent) Bases: :py:obj:`wx.Frame` .. autoapi-inheritance-diagram:: wolfhece.PyDraw.Colors_1to9 :parts: 1 :private-bases: .. py:property:: directory .. py:property:: file .. py:method:: change_colors(e) .. py:method:: Apply() .. py:method:: OnOK(event) .. py:method:: OnCancel(event) .. py:method:: OnSetDefault(event) .. py:method:: OnSave(event) .. py:method:: OnLoad(event) .. py:class:: DragdropFileTarget(window: WolfMapViewer) Bases: :py:obj:`wx.FileDropTarget` .. autoapi-inheritance-diagram:: wolfhece.PyDraw.DragdropFileTarget :parts: 1 :private-bases: .. py:method:: OnDropFiles(x, y, filenames) .. py:class:: Sim_Explorer(parent, title, mapviewer: WolfMapViewer, sim: wolfhece.wolfresults_2D.Wolfresults_2D) Bases: :py:obj:`wx.Frame` .. autoapi-inheritance-diagram:: wolfhece.PyDraw.Sim_Explorer :parts: 1 :private-bases: .. py:method:: OnPlot(event) Create a scatter plot of all steps. Major x_axis is time in seconds, Minor X-axis is time by date. Plots: - Computation time step (Dt) - Computation steps (N) - Clock time (s) - Mostly dry mesh (N) .. py:method:: OnInterval(event) Change the interval .. py:method:: _find_next(idx: int) Find the next step based on the mode and interval .. py:method:: _find_prev(idx: int) Find the previous step based on the mode and interval .. py:method:: OnNext(event) Go to the next step .. py:method:: OnPrev(event) Go to the previous step .. py:method:: OnTextTime(event) .. py:method:: OnClose(event) Close the simulation explorer .. py:method:: OnUpdate(event) .. py:method:: OnApply(event) .. py:method:: _set_all(idx: int) .. py:method:: Refresh(idx: int) .. py:method:: OnSliderSteps(event) .. py:method:: OnSelectCurTime(event) .. py:method:: OnSelectNumStep(event) .. py:method:: OnSelectIdxStep(event) .. py:method:: _update() .. py:class:: Select_Begin_end_interval_step(parent, title, sim: wolfhece.wolfresults_2D.Wolfresults_2D, checkbox: bool = False) Bases: :py:obj:`wx.Dialog` .. autoapi-inheritance-diagram:: wolfhece.PyDraw.Select_Begin_end_interval_step :parts: 1 :private-bases: wx.frame to select the begin and end of the interval to extract .. py:method:: OnCheckAll(event) .. py:method:: OnCheckViolin(event) .. py:method:: OnSliderBegin(event) .. py:method:: OnSliderEnd(event) .. py:method:: OnSliderStep(event) .. py:method:: OnApply(event) .. py:method:: OnOK(event) .. py:method:: OnCancel(event) .. py:class:: PrecomputedDEM_DTM Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.PyDraw.PrecomputedDEM_DTM :parts: 1 :private-bases: Enum for Precomputed DEM/DTM array .. py:attribute:: DEMDTM_50cm :value: 'AllData.vrt' .. py:attribute:: DEMDTM_1m_average :value: 'Combine_1m_average.vrt' .. py:attribute:: DEMDTM_1m_min :value: 'Combine_1m_minimum.vrt' .. py:attribute:: DEMDTM_1m_max :value: 'Combine_1m_maximum.vrt' .. py:attribute:: DEMDTM_2m_average :value: 'Combine_2m_average.vrt' .. py:attribute:: DEMDTM_2m_min :value: 'Combine_2m_minimum.vrt' .. py:attribute:: DEMDTM_2m_max :value: 'Combine_2m_maximum.vrt' .. py:attribute:: DEMDTM_5m_average :value: 'Combine_5m_average.vrt' .. py:attribute:: DEMDTM_5m_min :value: 'Combine_5m_minimum.vrt' .. py:attribute:: DEMDTM_5m_max :value: 'Combine_5m_maximum.vrt' .. py:attribute:: DEMDTM_10m_average :value: 'Combine_10m_average.vrt' .. py:attribute:: DEMDTM_10m_min :value: 'Combine_10m_minimum.vrt' .. py:attribute:: DEMDTM_10m_max :value: 'Combine_10m_maximum.vrt' .. py:class:: Precomputed_DEM_DTM_Dialog(parent, title, directory: pathlib.Path | str, mapviewer: WolfMapViewer) Bases: :py:obj:`wx.Dialog` .. autoapi-inheritance-diagram:: wolfhece.PyDraw.Precomputed_DEM_DTM_Dialog :parts: 1 :private-bases: wx.Dialog to select Precomputed DEM/DTM array Resolutions are 50cm, 1m, 2m, 5m, 10m Operators are average, min, max .. py:property:: selected_vrt .. py:method:: OnSameAs(event) Set the Precomputed DEM/DTM array to the same bounds as an existing array .. py:method:: OnSameActive(event) Set the Precomputed DEM/DTM array to the same bounds as the active array .. py:method:: OnZoom(event) Set the Precomputed DEM/DTM array to the current zoom .. py:method:: add_array() Add a new array to the viewer .. py:method:: OnSelectResolution(event) Select the resolution .. py:method:: available_vrt() List all available vrt files in the directory .. py:class:: WolfMapViewer(wxparent=None, title: str = _('Default Wolf Map Viewer'), w: int = 500, h: int = 500, treewidth: int = 200, wolfparent=None, wxlogging=None) Bases: :py:obj:`wx.Frame` .. autoapi-inheritance-diagram:: wolfhece.PyDraw.WolfMapViewer :parts: 1 :private-bases: Fenêtre de visualisation de données WOLF grâce aux WxWidgets .. py:property:: viewer_name .. py:property:: wxlogging .. py:property:: default_dem :type: pathlib.Path Return the default DEM file from configs .. py:property:: default_dtm :type: pathlib.Path Return the default DTM file from configs .. py:property:: default_laz Return the default LAZ file from configs .. py:property:: bkg_color Return the background color from configs .. py:property:: ticks_size :type: float Return the ticks spacing from configs .. py:property:: ticks_xrotation :type: float Return the ticks x rotation from configs .. py:property:: ticks_fontsize :type: int Return the ticks font size from configs .. py:property:: assembly_mode :type: str Return the assembly mode from configs .. py:property:: ticks_bounds :type: bool Return the ticks bounds from configs .. py:property:: palette_for_copy :type: wolfhece.PyPalette.wolfpalette Return the palette for copy from configs .. py:attribute:: TIMER_ID :value: 100 .. py:attribute:: mybc :type: list[wolfhece.mesh2d.bc_manager.BcManager] .. py:attribute:: myarrays :type: list .. py:attribute:: myvectors :type: list[wolfhece.PyVertexvectors.Zones] .. py:attribute:: myclouds :type: list[wolfhece.PyVertexvectors.cloud_vertices] .. py:attribute:: mytri :type: list[wolfhece.PyVertexvectors.Triangulation] .. py:attribute:: myothers :type: list .. py:attribute:: myviews :type: list[wolfhece.wolfresults_2D.views_2D] .. py:attribute:: mywmsback :type: list .. py:attribute:: mywmsfore :type: list .. py:attribute:: myres2D :type: list .. py:attribute:: mytiles :type: list[wolfhece.wolf_tiles.Tiles] .. py:attribute:: myimagestiles :type: list[wolfhece.images_tiles.ImagesTiles] .. py:attribute:: mypartsystems :type: list[wolfhece.lagrangian.particle_system_ui.Particle_system_to_draw] .. py:attribute:: myviewers3d :type: list[wolfhece.opengl.py3d.Wolf_Viewer3D] .. py:attribute:: mylazdata :type: list[wolfhece.lazviewer.laz_viewer.Wolf_LAZ_Data] .. py:attribute:: mymplfigs :type: list[MplFigViewer] .. py:attribute:: sim_explorers :type: dict[Wolfresults_2D:Sim_Explorer] .. py:attribute:: canvas :type: wx.glcanvas.GLCanvas .. py:attribute:: context :type: wx.glcanvas.GLContext .. py:attribute:: mytooltip :type: wolfhece.PyVertexvectors.Wolf_Param .. py:attribute:: treelist :type: wx.dataview.TreeListCtrl .. py:attribute:: _lbl_selecteditem :type: wx.core.StaticText .. py:attribute:: leftbox :type: wx.core.BoxSizer .. py:attribute:: active_vector :type: wolfhece.PyVertexvectors.vector .. py:attribute:: active_zone :type: wolfhece.PyVertexvectors.zone .. py:attribute:: active_zones :type: wolfhece.PyVertexvectors.Zones .. py:attribute:: active_array :type: wolfhece.wolf_array.WolfArray .. py:attribute:: active_bc :type: wolfhece.mesh2d.bc_manager.BcManager .. py:attribute:: active_view :type: wolfhece.pyviews.WolfViews .. py:attribute:: active_vertex :type: wolfhece.PyVertexvectors.wolfvertex .. py:attribute:: active_cs :type: wolfhece.PyCrosssections.crosssections .. py:attribute:: active_tri :type: wolfhece.PyVertexvectors.Triangulation .. py:attribute:: active_tile :type: wolfhece.wolf_tiles.Tiles .. py:attribute:: active_imagestiles :type: wolfhece.images_tiles.ImagesTiles .. py:attribute:: active_particle_system :type: wolfhece.lagrangian.particle_system_ui.Particle_system_to_draw .. py:attribute:: active_viewer3d :type: wolfhece.opengl.py3d.Wolf_Viewer3D .. py:attribute:: active_viewerlaz :type: wolfhece.lazviewer.laz_viewer.viewer .. py:attribute:: active_bridges :type: wolfhece.pybridges.Bridges .. py:attribute:: active_bridge :type: wolfhece.pybridges.Bridge .. py:attribute:: active_weirs :type: wolfhece.pybridges.Weirs .. py:attribute:: active_weir :type: wolfhece.pybridges.Weir .. py:attribute:: active_laz :type: wolfhece.lazviewer.laz_viewer.Wolf_LAZ_Data .. py:attribute:: active_fig :type: MplFigViewer .. py:method:: _check_id_for_fig(idx: str) Check if an ID is already used for a figure .. py:method:: _create_id_for_fig() .. py:method:: _validate_id_for_fig(idx: str) Validate an ID for a figure .. py:method:: new_fig(caption: str, idx: str = None, layout=PRESET_LAYOUTS.DEFAULT, size=(800, 600), show: bool = True) -> MplFigViewer Create a new figure .. py:method:: destroy_fig_by_id(idx: str) -> bool Destroy a figure by its ID .. py:method:: get_fig(idx: str) -> MplFigViewer Get a figure by its ID .. py:method:: list_ids_figs() -> list[str] List all IDs of figures .. py:method:: check_logging() Check if logging window is shown .. py:method:: check_tooltip() Check if tooltip window is shown .. py:method:: open_hydrological_model() Open a hydrological model .. py:method:: create_2D_MB_model() Create a 2D model .. py:method:: create_2D_GPU_model() Create a 2D GPU model .. py:method:: check_2D_MB_headers() Check headers of a 2D simulation without opening viewer .. py:method:: get_mapviewer() Retourne une instance WolfMapViewer .. py:method:: do_quit() .. py:method:: create_triangles_menu() Menu for triangulations .. py:method:: create_cloud_menu() Menu for cloud points .. py:method:: split_cloud_by_vector() Split cloud by vector .. py:method:: get_choices_arrays() Boîte de dialogue permettant de choisir une ou plusieurs matrices parmi celles chargées .. py:method:: menu_tiles() Menu for tiles .. py:method:: pîck_image_tile(event: wx.Event) .. py:method:: menu_imagestiles() Menu for image tiles .. py:method:: pick_tile(event: wx.Event) .. py:method:: create_data_from_tiles_activevec(event: wx.Event) .. py:method:: _create_data_from_tiles_common() .. py:method:: create_data_from_tiles_tmpvec(event: wx.Event) .. py:method:: menu_laz() Menu for LAZ Data .. py:method:: menu_wolf2d() .. py:method:: menu_walous() .. py:method:: get_canvas_bounds(gridsize: float = None) Retourne les limites de la zone d'affichage :return: [xmin, ymin, xmax, ymax] .. py:method:: Onmenuwalous(event: wx.MenuEvent) .. py:method:: _add_sim_explorer(which: wolfhece.wolfresults_2D.Wolfresults_2D) Add a step chooser .. py:method:: _pop_sim_explorer(which: wolfhece.wolfresults_2D.Wolfresults_2D) Pop a step chooser .. py:method:: _update_sim_explorer(which: wolfhece.wolfresults_2D.Wolfresults_2D = None) .. py:method:: Onmenuwolf2d(event: wx.MenuEvent) .. py:method:: menu_2dgpu() .. py:method:: menu_landmaps() .. py:method:: change_transparent_color_landmap(event: wx.Event) .. py:method:: set_tolerance_landmap(event: wx.Event) .. py:method:: change_colors_landmap(event: wx.Event) .. py:method:: pick_landmap_full(event: wx.Event) .. py:method:: pick_landmap_low(event: wx.Event) .. py:method:: menu_particlesystem() .. py:method:: action_menu_particlesystem(event: wx.Event) Action to perform when the timer is triggered .. py:method:: update_particlesystem(event: wx.Event) Animation of the particle system .. py:method:: menu_sim2D() Menu for 2D simulations .. py:method:: menu_sim2DGPU() Menu for 2D GPU simulations .. py:method:: Onmenusim2DGPU(event: wx.MenuEvent) Action to perform when menu 2D GPU entry is selected .. py:method:: Onmenusim2D(event: wx.MenuEvent) Action to perform when menu 2D entry is selected .. py:method:: get_configuration() -> OpenGL.GLUT.Union[wolfhece.PyConfig.WolfConfiguration, None] Get global configuration parameters .. py:method:: GlobalOptionsDialog(event) .. py:method:: triangulate_cs() Triangulate the active cross sections .. py:method:: set_interp_cs(obj: wolfhece.PyCrosssections.Interpolators, add_zones: bool = True) Set the active cross-sections interpolator .. py:method:: interpolate_cloud() Interpolation d'un nuage de point sur une matrice Il est possible d'utiliser une autre valeur que la coordonnées Z des vertices .. py:method:: interpolate_cs() Interpolate the active cross sections by interpolators .. py:method:: interpolate_triangulation() .. py:method:: compare_cloud2array() Compare the active cloud points to the active array .. py:method:: compare_tri2array() .. py:method:: move_triangles() Move the active triangles .. py:method:: rotate_triangles() Rotate the active triangles .. py:method:: display_canvasogl(mpl=True, ds=0.0, fig: wolfhece.PyVertexvectors.Figure = None, ax: wolfhece.PyVertexvectors.Axes = None, clear=True, redraw=True, palette=False, title='') This method takes a matplotlib figure and axe and, returns a clear screenshot of the information displayed in the wolfpy GUI. .. py:method:: get_mpl_plot(center=[0.0, 0.0], width=500.0, height=500.0, title='', toshow=True) -> tuple[wolfhece.PyVertexvectors.Figure, wolfhece.PyVertexvectors.Axes] Récupère un graphique matplotlib sur base de la fenêtre OpenGL et de la palette de la matrice/résultat actif. .. py:method:: create_video(fn: str = '', framerate: int = 0, start_step: int = 0, end_step: int = 0, every: int = 0) Création d'une vidéo sur base des résultats .. py:method:: get_canvas_as_image() -> PIL.Image.Image Récupère la fenêtre OpenGL sous forme d'image .. py:method:: copy_canvasogl(mpl: bool = True, ds: float = 0.0, figsizes=[10.0, 10.0], palette: wolfhece.PyPalette.wolfpalette = None) Generate image based on UI context and copy to the Clipboard :param mpl: Using Matplolib as renderer. Defaults to True. :type mpl: bool, optional :parem ds: Ticks size. Defaults to 0.. :type ds: float, optional :parem figsizes: fig size in inches :type figsizes: list, optional .. py:method:: 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) Sauvegarde de la fenêtre d'affichage dans un fichier :param fn: File name (.png or .jpg file) :param mpl: Using Matplotlib as renderer :param ds: Ticks interval .. py:method:: reporting(dir='') Firsdt attempr to create a reporting. !! Must be improved !! .. py:method:: InitUI() Initialisation de l'interface utilisateur .. py:method:: OnChangeTitle(e) Change the title of the window .. py:method:: OnSize(e) Redimensionnement de la fenêtre .. py:method:: ManageActions(id) Gestion des actions via les menus TODO : A généraliser? .. py:method:: center_view_on(cx, cy) Center the view on the point of (map) coordinates (x,y) .. py:method:: setbounds(updatescale=True) Calcule les limites visibles de la fenêtrte graphique sur base des facteurs d'échelle courants .. py:method:: setsizecanvas(width, height) Redimensionne la fenêtre graphique .. py:method:: updatescalefactors() 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. .. py:method:: add_viewer_and_link() Ajout d'une nouvelle fenêtre de visualisation et liaison avec la fenêtre courante .. py:method:: add_grid() Ajout d'une grille .. py:method:: add_WMS() Ajout de couches WMS .. py:method:: set_compare(ListArrays: list[wolfhece.wolf_array.WolfArray] = None, share_colormap: bool = True) Comparison of 2 arrays :param ListArrays: List of 2 arrays to compare :param share_colormap: Share the colormap between the 2 arrays .. py:method:: set_compare_all(ListArrays=None, names: WolfMapViewer.set_compare_all.list[str] = None) Comparison of 2 or 3 arrays .. py:method:: set_blender_sculpting() 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 .. py:method:: update_blender_sculpting() Mise à jour des fenêtres de visualisation pour la comparaison avec Blender .. py:method:: zoomon_activevector(size: float = 500.0, forceupdate: bool = True) Zoom on active vector :param size: size of the zoomed window :param forceupdate: force the update of the window .. py:method:: zoomon_active_vertex(size: float = 20, forceupdate: bool = True) Zoom on active vertex. :param size: size of the zoomed window :param forceupdate: force the update of the window .. py:method:: zoom_on_id(id: str, drawtype: draw_type = draw_type.ARRAYS, forceupdate=True, canvas_height=1024) Zoom on id :param id: id of the object to zoom on :param drawtype: type of object to zoom on - Different types elements can have the same id .. py:method:: zoom_on_array(array: wolfhece.wolf_array.WolfArray, forceupdate=True, canvas_height=1024) Zoom on array .. py:method:: zoom_on_vector(vector: WolfMapViewer.zoom_on_vector.vector, forceupdate=True, canvas_height=1024) Zoom on vector .. py:method:: create_Zones_from_arrays(arrays: list[wolfhece.wolf_array.WolfArray], id: str = None, add_legend: bool = True) -> wolfhece.PyVertexvectors.Zones Create a Zones instance from list of WolfArrays One zone per array. One vector per zone with the masked contour. :param arrays: list of WolfArrays :param id: id of the Zones instance :param add_legend: add legend to the vector -- centroid of the contour .. py:method:: zoom_on(zoom_dict=None, width=500, height=500, center=None, xll=None, yll=None, forceupdate=True, canvas_height=1024) 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 :param zoom_dict: dictionnary containing the zoom parameters - possible keys : 'width', 'height', 'center', 'xmin', 'ymin', 'xmax', 'ymax' :param width: width of the zoomed window [m] :param height: height of the zoomed window [m] :param center: center of the zoomed window [m] - tuple (x,y) :param xll: lower left X coordinate of the zoomed window [m] :param yll: lower left Y coordinate of the zoomed window [m] :param forceupdate: force the update of the window :param 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)) .. py:method:: zoom_on_active_profile(size: float = 500.0, forceupdate: bool = True) Zoom on active profile .. py:method:: read_project(fn) Projet WOLF GUI Fichier de paramètres contenant les types et chemins d'accès aux données à ajouter A compléter... .. py:method:: save_project(fn, absolute: bool = True) Save project file .. py:method:: help_project() Help for project file. Define which elements can be saved in a project file. .. py:method:: plot_laz_around_active_vec() Plot laz data around active vector .. py:method:: clip_laz_gridded() Clip laz grid on current zoom .. py:method:: filter_active_laz() Filter active laz data .. py:method:: descimate_laz_data(factor: int = 10) Descimate data .. py:method:: select_active_array_from_laz(array: wolfhece.wolf_array.WolfArray = None, used_codes: list = None, chunk_size: float = 500.0) select some nodes from laz data :param array: array to fill :param used_codes: codes to use .. py:method:: fill_active_array_from_laz(array: wolfhece.wolf_array.WolfArray = None, used_codes: list = [], operator: int = -1, chunk_size: float = 500.0) Fill active array with laz data :param array: array to fill :param used_codes: codes to use :param operator: operator to use .. py:method:: count_active_array_from_laz(array: wolfhece.wolf_array.WolfArray = None, used_codes: list = [], chunk_size: float = 500.0) Fill active array with laz data :param array: array to fill :param used_codes: codes to use :param operator: operator to use .. py:method:: init_laz_from_lazlasnpz(fn=None) Read LAZ data stored in one file :param fn: filename (extension .laz, .las, .npz) .. py:method:: _choice_laz_classification() .. py:method:: init_laz_from_gridinfos(dirlaz: str = None, classification: Literal[SPW-Geofit 2023, SPW 2013-2014, SPW 2021-2022] = 'SPW-Geofit 2023') .. py:method:: managebanks() .. py:method:: _set_fn_fnpos_gltf() 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 .. py:method:: set_fn_fnpos_gltf() 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 .. py:method:: read_last_result() Lecture du dernier résultat pour les modèles ajoutés et plottés .. py:method:: read_one_result(which: int) Lecture d'un résultat spécific pour les modèles ajoutés et plottés .. py:method:: simul_previous_step() Mise à jour au pas précédent .. py:method:: particle_next_step() Mise à jour au pas suivant .. py:method:: particle_previous_step() Mise à jour au pas précédent .. py:method:: simul_next_step() Mise à jour au pas suivant .. py:method:: OnMenuHighlight(event: wx.MenuEvent) .. py:method:: _select_laz_source() Select laz source .. py:method:: _choice_laz_colormap() -> int .. py:method:: OnMenubar(event: wx.MenuEvent) 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 .. py:method:: pop_boundary_manager(which: wolfhece.mesh2d.bc_manager.BcManager) Pop a boundary condition manager after Destroying .. py:method:: get_boundary_manager(which: wolfhece.wolf_array.WolfArray) Get a boundary manager .. py:method:: uniquecolormap(loadfromfile=False) Compute unique colormap from all (arrays, 2D results) and apply it to all .. py:method:: loadnap_and_apply() .. py:method:: uniforminparts_all(TrueOrFalse: bool) .. py:method:: filter_inundation() .. py:method:: export_results_as(which: Literal[geotiff, shape, numpy] = None, multiband: bool = None) Export des résultats WOLF2D vers différents formats. Au moins un résultat doit être chargé pour pouvoir être exporté. .. py:method:: export_shape(outdir: str = '', fn: str = '', myarrays: list[wolfhece.wolf_array.WolfArray] = [], descr: list[str] = [], mask: wolfhece.wolf_array.WolfArray = None) Export multiple arrays to shapefile :param outdir: output directory :param fn: filename -- .shp will be added if not present :param myarrays: list of Wolfarrays to export :param descr: list of descriptions :param mask: mask array -- export only where mask > 0 .. py:method:: export_geotif(outdir: str = '', fn: str = '', myarrays: list[wolfhece.wolf_array.WolfArray] = [], descr: list[str] = [], multiband: bool = True) Export multiple arrays to geotiff :param outdir: output directory :param fn: filename -- .tif will be added if not present :param myarrays: list of Wolfarrays to export :param descr: list of descriptions -- Bands names .. py:method:: get_linked_arrays(linked: bool = True) -> dict Get all arrays in the viewer and linked viewers .. py:method:: save_linked_canvas(fn: str, mpl: bool = True, ds: float = 0.0, add_title: bool = True) -> tuple[(str, float), str] Save canvas of all linked viewers :param fn: filename without extension -- '.png' will be added :param mpl: save as matplotlib image :param ds: Ticks size for matplotlib image :return: list of tuple ((filename, ds), viewer_name) .. py:method:: save_arrays_indep(fn: str, mpl: bool = True, ds: float = 0.0, add_title: bool = True) -> tuple[(str, float), str] Save each array in a separate file :param fn: filename without extension -- '.png' will be added :param mpl: save as matplotlib image :param ds: Ticks size for matplotlib image :return: list of tuple ((filename, ds), viewer_name) .. py:method:: assembly_images(all_images, mode: Literal[horizontal, vertical, square] = 'square') Assembly images Every image has the same size (width, height) :param all_images: list of tuple (filename, viewer_name) :param mode: 'horizontal', 'vertical', 'square' .. py:method:: thread_update_blender() .. py:method:: add_object(which: Literal[array, array_lidar_first, array_lidar_second, array_xyz, array_tiles, bridges, weirs, wolfhece.PyVertexvectors.vector, tiles, tilescompcloud, laz, triangulation, cross_sections, other, views, res2d, res2d_gpu, particlesystem, wmsback, wmsfore, imagestiles] = 'array', filename='', newobj=None, ToCheck=True, id='') Add object to current Frame/Drawing area .. py:method:: get_obj_from_treeitem(treeitem) Find the object associated with treeitem .. py:method:: getobj_from_id(id: str) Find the object associated with id .. py:method:: get_obj_from_id(id: str, drawtype: draw_type) Find the object associated with id in a specifid drawtype If you want to search in all drawtypes, use getobj_from_id instead. :param id: str : id of the object :param drawtype: draw_type : type of object to search .. py:method:: _get_list(drawing_type: draw_type = None) return the list of objects of type drawing_type .. py:method:: get_list_keys(drawing_type: draw_type = None, checked_state: bool = True) Create a list of keys of type draw_type :param drawing_type: type of object to search - If None, return all objects :param checked_state: if True/False, return only keys of objects that are plotted or not. None return all objects. .. py:method:: get_list_ids(drawing_type: draw_type = None, checked_state: bool = True) Alias for get_list_keys .. py:method:: get_list_objects(drawing_type: draw_type = None, checked_state: bool = True) Create a list of objects of type draw_type :param drawing_type: type of object to search -- If None, return all objects. :param checked_state: if True/False, return only objects that are plotted or not. None return all objects. .. py:method:: single_choice_key(draw_type: WolfMapViewer.single_choice_key.draw_type, checked_state: bool = True, message: str = _('Make a choice'), title: str = _('Choice')) Create wx dialog to choose a key object of type draw_type .. py:method:: single_choice_object(draw_type: WolfMapViewer.single_choice_object.draw_type, checked_state: bool = True, message: str = _('Make a choice'), title: str = _('Choice')) Create wx dialog to choose an object of type draw_type .. py:method:: multiple_choice_key(draw_type: WolfMapViewer.multiple_choice_key.draw_type, checked_state: bool = True, message: str = _('Make a choice'), title: str = _('Choice')) Create wx dialog to choose multiple keys object of type draw_type .. py:method:: multiple_choice_object(draw_type: WolfMapViewer.multiple_choice_object.draw_type, checked_state: bool = True, message: str = _('Make a choice'), title: str = _('Choice')) Create wx dialog to choose multiple objects of type draw_type .. py:method:: iterator_over_objects(drawing_type: draw_type, checked_state: bool = True) Create iterator over objects of type draw_type .. py:method:: gettreeitem(obj) Find the tree item associated with obj .. py:method:: removeobj() Remove selected item from general tree .. py:method:: removeobj_from_id(id: str) Remove object from id .. py:method:: upobj() Up selected item into general tree .. py:method:: downobj() Down selected item into general tree .. py:method:: OnShowPopup(event) .. py:method:: OnPopupItemSelected(event) Action to do when an item is selected in the popup menu .. py:method:: OnClose(event) Close the application .. py:method:: OnSelectItem(event) Select the item in the tree list .. py:method:: OnCheckItem(event: TreeListEvent) Check the item in the tree list .. py:method:: getXY(pospix) .. py:method:: OnZoomGesture(e) .. py:method:: OnLeave(e) .. py:method:: get_cross_sections() Récupération du premier objet crosssections disponible .. py:method:: set_active_profile(active_profile: wolfhece.PyCrosssections.profile) This method sets the active profile in Pydraw (useful for interfaces communication). .. py:method:: set_active_vector(active_vector: wolfhece.PyVertexvectors.vector) This method sets the active vector in Pydraw (useful for interfaces communication). .. py:method:: get_active_profile() This methods returns the active profile in pydraw (useful for interfaces communication). .. py:method:: plot_cross(x: float, y: float) .. py:method:: On_Mouse_Right_Down(e: wx.MouseEvent) Event when the right button of the mouse is pressed. We use this event to manage "action" set by others objects. .. py:method:: On_Mouse_Right_Up(e) .. py:method:: On_Mouse_Button(e: wx.MouseEvent) .. py:method:: On_Right_Double_Clicks(e) .. py:method:: On_Left_Double_Clicks(e: wx.MouseEvent) .. py:method:: On_Mouse_Left_Down(e) Event when the left button of the mouse is pressed .. py:method:: _set_active_bc() Search and activate BCManager according to active_array .. py:method:: set_statusbar_text(txt: str) Set the status bar text .. py:method:: set_label_selecteditem(nameitem: str) Set the label of the selected item in the tree list .. py:method:: get_label_selecteditem() Get the label of the selected item in the tree list .. py:method:: OnActivateTreeElem(e) Activate the selected item in the tree list .. py:method:: _update_mytooltip() Update the tooltip with the values of the active arrays and results at position x,y .. py:method:: On_Mouse_Motion(e: wx.MouseEvent) Mouse move event .. py:method:: Autoscale(update_backfore=True) Redimensionnement de la fenêtre pour afficher tous les objets .. py:method:: _endactions() 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. .. py:method:: print_About() Print the About window .. py:method:: check_for_updates() Check for updates .. py:method:: print_shortcuts(inframe: bool = None) Print the list of shortcuts into logging .. py:method:: msg_action(which: int = 0) Message to end action .. py:method:: start_action(action: str, message: str = '') Message to start action .. py:method:: end_action(message: str = '') Message to end action .. py:method:: OnHotKey(e: wx.KeyEvent) Gestion des touches clavier -- see print_shortcuts for more details .. py:method:: paste_values(fromarray: wolfhece.wolf_array.WolfArray) Paste selected values from a WolfArray to the active array .. py:method:: paste_selxy(fromarray: wolfhece.wolf_array.WolfArray) Paste selected nodes from a WolfArray to the active array .. py:method:: OntreeRight(e: wx.MouseEvent) Gestion du menu contextuel sur l'arbre des objets .. py:method:: zoom_on_whole_walonia() Zoom on the whole Walonia .. py:method:: update() Update backgournd et foreground elements and arrays if local minmax is checked. .. py:method:: _plotting(drawing_type: draw_type, checked_state: bool = True) Drawing objets on canvas .. py:method:: get_MVP_Viewport_matrix() Get the modelview projection matrix .. py:method:: SetCurrentContext() Set the current OGL context if exists otherwise return False .. py:method:: _set_gl_projection_matrix() .. py:method:: Paint() Dessin des éléments ajoutés au viewer .. py:method:: OnPaint(e) event handler for paint event .. py:method:: findminmax(force=False) Find min/max of all objects .. py:method:: resizeFrame(w: int, h: int) Resize the frame :param w: width in pixels :param h: height in pixels .. py:method:: mimicme() Report des caractéristiques de la fenêtre sur les autres éléments liés .. py:method:: mimicme_copyfrom() .. py:method:: Active_vector(vect) Active un vecteur et sa zone parent si existante .. py:method:: Active_zone(zone: WolfMapViewer.Active_zone.zone) Active une zone et son parent si existant .. py:method:: list_background() .. py:method:: list_foreground() .. py:method:: check_id(id=str, gridsize=100.0) Check an element from its id .. py:method:: uncheck_id(id=str, unload=True, forceresetOGL=True, askquestion=False) Uncheck an element from its id .. py:method:: get_current_zoom() Get the current zoom :return: dict with keys 'center', 'xmin', 'xmax', 'ymin', 'ymax', 'width', 'height' .. py:method:: save_current_zoom(filepath) Save the current zoom in a json file .. py:method:: read_current_zoom(filepath) Read the current zoom from a json file .. py:method:: menu_bridges() .. py:method:: OnAddBridge(e) Add a bridge .. py:method:: OnEditBridge(e) Edit a bridge .. py:method:: OnFindBridge(e) Find the nearest bridge .. py:method:: pick_bridge(x: float, y: float) Find the nearest bridge .. py:method:: menu_weirs() .. py:method:: OnAddWeir(e) Add a weir .. py:method:: OnEditWeir(e) Edit a weir .. py:method:: OnFindWeir(e) Find the nearest weir .. py:method:: pick_weir(x: float, y: float) Find the nearest weir .. py:class:: Comp_Type Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.PyDraw.Comp_Type :parts: 1 :private-bases: Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: ARRAYS :value: 1 .. py:attribute:: ARRAYS_MB :value: 2 .. py:attribute:: RES2D :value: 3 .. py:attribute:: RES2D_GPU :value: 4 .. py:class:: Compare_Arrays_Results(parent: WolfMapViewer = None, share_cmap_array: bool = False, share_cmap_diff: bool = False) .. py:method:: _check_type(file: pathlib.Path) 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. .. py:method:: add(file_or_dir: OpenGL.GLUT.Union[str, pathlib.Path] = None) .. py:method:: check() Check the consystency of the elements to compare .. py:method:: update_comp(idx=list[int]) Update Arrays from 2D modellings :param idx: indexes of the time step to update --> steps to read .. py:method:: update_type_result(newtype) Update the result type for each element .. py:method:: set_elements() Set the elements to compare with the right type .. py:method:: set_diff() Set the differential between the elements and the first one, which is the reference .. py:method:: set_viewers(independent: bool = None) Set viewers .. py:method:: set_shields_param(diamsize: float = 0.001, graindensity: float = 2.65) Set the parameters for the shields diagram .. py:method:: update_viewers() Update the viewers with the new elements .. py:method:: bake() .. py:class:: InPaint_waterlevel(parent, title: str = _('Inpainting'), size: tuple[int, int] = (400, 400), mapviewer: WolfMapViewer = None, **kwargs) Bases: :py:obj:`wx.Dialog` .. autoapi-inheritance-diagram:: wolfhece.PyDraw.InPaint_waterlevel :parts: 1 :private-bases: .. py:method:: _init_UI() Create 2 listboxes for the arrays and the masks .. py:method:: OnUpdateIDs(e) Update the list of arrays/mask/dtm .. py:method:: OnSelectArray(e) Select an array .. py:method:: OnSelectMask(e) Select a mask .. py:method:: OnSelectDTM(e) Select a DTM .. py:method:: OnInpaint(e) Inpaint the array with the mask .. py:method:: OnSelectHoles(e) Select the holes in the array .. py:method:: OnCreateMask(e) Create a mask from the array .. py:class:: InPaint_array(parent, title: str = _('Inpainting'), size: tuple[int, int] = (400, 400), mapviewer: WolfMapViewer = None, **kwargs) Bases: :py:obj:`wx.Dialog` .. autoapi-inheritance-diagram:: wolfhece.PyDraw.InPaint_array :parts: 1 :private-bases: .. py:method:: _init_UI() Create 2 listboxes for the arrays and the masks .. py:method:: OnUpdateIDs(e) Update the list of arrays/mask/dtm .. py:method:: OnSelectArray(e) Select an array .. py:method:: OnSelectMask(e) Select a mask .. py:method:: OnSelectTest(e) Select a DTM .. py:method:: OnInpaint(e) Inpaint the array with the mask .. py:method:: OnSelectHoles(e) Select the holes in the array .. py:method:: OnCreateMask(e) Create a mask from the array