:py:mod:`wolfhece.wolf_zi_db` ============================= .. py:module:: wolfhece.wolf_zi_db .. 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:class:: ColNames_PlansTerriers Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.wolf_zi_db.ColNames_PlansTerriers :parts: 1 :private-bases: Enum for the column names in the database .. py:attribute:: KEY :value: 'Clé primaire' .. py:attribute:: ORIGX :value: 'Origine x' .. py:attribute:: ORIGY :value: 'Origine y' .. py:attribute:: ENDX :value: 'Xsup' .. py:attribute:: ENDY :value: 'Ysup' .. py:attribute:: WIDTH :value: 'Largeur' .. py:attribute:: HEIGHT :value: 'Hauteur' .. py:attribute:: FULLRES :value: 'Acces' .. py:attribute:: LOWRES :value: 'Acces2' .. py:attribute:: RIVER :value: 'River' .. py:class:: ZI_Databse_Elt(origx: float, origy: float, endx: float, endy: float, width: float, height: float, fullpath: pathlib.Path, lowpath: pathlib.Path) Class to store the database elements .. py:class:: PlansTerrier(parent=None, idx: str = '', plotted: bool = True, mapviewer=None, rivers: list[str] = ['Vesdre', 'Hoegne']) Bases: :py:obj:`wolfhece.PyVertexvectors.Zones` .. autoapi-inheritance-diagram:: wolfhece.wolf_zi_db.PlansTerrier :parts: 1 :private-bases: Class to handle the "Plans Terriers" -- Black and white scanned tif files from SPW. Override the Zones class to handle the 'plans terriers' contours. In the "myzones" list, the object will store the contours for each river. Elements will be stored in the self.maps dictionary, with the key being the name of the river and the name of the file. The textures (images) will be stored in the self.textures dictionary, with the key being the ZI_Databse_Elt object. In the mapviewer, the user can choose the rivers to display, and the images will be loaded/unloaded on the fly when the user clicks on the map. During import of the images, the system will apply transparency based on a color and a tolerance, and, if necessary, will replace the other colors with another one (self.color). If self.color is None, no replacement will be done. :param parent: The wx parent of the object :type parent: wx.Window :param idx: The index of the object :type idx: str :param plotted: If the object is plotted :type plotted: bool :param mapviewer: The mapviewer object :type mapviewer: MapViewer :param rivers: The list of rivers to display :type rivers: list[str] .. py:method:: set_tolerance(tol: int) Set the tolerance for the transparency Color will be considered transparent if the difference between the color and the transparent color is less than the tolerance. .. py:method:: set_transparent_color(color: list[int, int, int]) Set the transparent color. Color is a list of 3 integers, representing the RGB color (0 -> 255). .. py:method:: set_color(color: tuple[int, int, int]) Set the color of the image. As the provided images are black and white, the color will be used to replace the black color. If the images are not black and white, the color will be used to replace all non-transparent colors. .. py:method:: check_plot() Activate the plot if the object is initialized .. py:method:: _create_zones() Create the zones for the selected rivers. Each river will be a zone, and the vectors will be the contours of the images. .. py:method:: read_db(filename: Union[str, pathlib.Path], sel_rivers: list[str] = None) Read the database (Excel file) and create the zones and the vectors. The user will be prompted to select the rivers to display. .. py:method:: _filter_db() .. py:method:: _find_map(x: float, y: float) .. py:method:: load_texture(x: float, y: float, which: Literal[full, low] = 'low') .. py:method:: unload_textture(x: float, y: float) .. py:method:: plot(sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None) Dessine les zones