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(*args, **kwds) 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:: ColNames_Ouvrages(*args, **kwds) Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.wolf_zi_db.ColNames_Ouvrages :parts: 1 :private-bases: Enum for the column names in the database .. py:attribute:: KEY :value: 'Clé primaire' .. py:attribute:: X1 :value: 'X Lambert gauche' .. py:attribute:: X2 :value: 'X Lambert droit' .. py:attribute:: Y1 :value: 'Y Lambert gauche' .. py:attribute:: Y2 :value: 'Y Lambert droit' .. py:attribute:: REMARK :value: 'Remarques' .. py:attribute:: RIVER :value: 'Lieu' .. py:attribute:: PHOTO1 :value: 'Photo1' .. py:attribute:: PHOTO2 :value: 'Photo2' .. py:attribute:: PHOTO3 :value: 'Photo3' .. py:attribute:: PHOTO4 :value: 'Photo4' .. py:attribute:: PHOTO5 :value: 'Photo5' .. py:attribute:: PHOTO6 :value: 'Photo6' .. py:attribute:: PHOTO7 :value: 'Photo7' .. py:attribute:: PHOTO8 :value: 'Photo8' .. py:attribute:: PHOTO9 :value: 'Photo9' .. py:attribute:: PHOTO10 :value: 'Photo10' .. py:attribute:: DATE :value: 'Date' .. py:class:: ColNames_Particularites(*args, **kwds) Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.wolf_zi_db.ColNames_Particularites :parts: 1 :private-bases: Enum for the column names in the database .. py:attribute:: KEY :value: 'Clé primaire' .. py:attribute:: X :value: 'Xlambert' .. py:attribute:: Y :value: 'Ylambert' .. py:attribute:: REMARK :value: 'Commentaires' .. py:attribute:: RIVER :value: 'Rivière' .. py:attribute:: PHOTO1 :value: 'Photo 1' .. py:attribute:: PHOTO2 :value: 'Photo 2' .. py:attribute:: PHOTO3 :value: 'Photo 3' .. py:attribute:: PHOTO4 :value: 'Photo 4' .. py:attribute:: PHOTO5 :value: 'Photo 5' .. py:attribute:: ORIENTATION :value: 'Orientation' .. py:attribute:: DATE :value: 'Date' .. py:class:: ColNames_Enquetes(*args, **kwds) Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.wolf_zi_db.ColNames_Enquetes :parts: 1 :private-bases: Enum for the column names in the database .. py:attribute:: KEY :value: 'Clé primaire' .. py:attribute:: X :value: 'XLambert' .. py:attribute:: Y :value: 'YLambert' .. py:attribute:: RIVER :value: 'Rivière' .. py:attribute:: PHOTO :value: 'Photo' .. py:attribute:: ORIENTATION :value: 'Orientation' .. py:attribute:: DATE :value: 'Date' .. py:class:: ColNames_Profils(*args, **kwds) Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.wolf_zi_db.ColNames_Profils :parts: 1 :private-bases: Enum for the column names in the database .. py:attribute:: KEY :value: 'Clé primaire' .. py:attribute:: X :value: 'XLambert' .. py:attribute:: Y :value: 'YLambert' .. py:attribute:: PHOTO :value: 'FichierImage' .. py:attribute:: RIVER :value: 'Rivière' .. py:attribute:: DATE :value: 'DateModif' .. py:function:: _test_bounds(x: float, y: float, bounds: list[list[float, float], list[float, float]]) -> bool Test if the coordinates are inside the bounds :param x: The x coordinate :type x: float :param y: The y coordinate :type y: float :param bounds: The bounds to test against - [ [xmin, xmax], [ymin, ymax] ] :type bounds: list[list[float, float], list[float, float]] :return: True if the coordinates are inside the bounds, False otherwise :rtype: bool .. py:function:: _sanitize_legendtext(text: str) -> str Sanitize the legend text by replacing newlines and special characters :param text: The text to sanitize :type text: str :return: The sanitized text :rtype: str .. 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:attribute:: origx .. py:attribute:: origy .. py:attribute:: endx .. py:attribute:: endy .. py:attribute:: width .. py:attribute:: height .. py:attribute:: fullpath .. py:attribute:: lowpath .. 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:attribute:: maps :type: dict[str, ZI_Databse_Elt] .. py:attribute:: textures :type: dict[ZI_Databse_Elt, wolfhece.wolf_texture.genericImagetexture] .. py:attribute:: color .. py:attribute:: tolerance :value: 0 .. py:attribute:: transparent_color :value: [255, 255, 255] .. py:attribute:: rivers :value: ['Vesdre', 'Hoegne'] .. py:attribute:: initialized :value: False .. py:attribute:: wx_exists .. 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 .. py:class:: Ouvrages(parent=None, idx: str = '', plotted: bool = True, mapviewer=None, rivers: list[str] = None) Bases: :py:obj:`wolfhece.PyPictures.PictureCollection` .. autoapi-inheritance-diagram:: wolfhece.wolf_zi_db.Ouvrages :parts: 1 :private-bases: Class to handle the "Ouvrages" -- Pictures of the structures in the ZI. .. py:attribute:: wx_exists .. py:attribute:: db :value: None .. py:attribute:: rivers :value: None .. py:attribute:: initialized :value: False .. py:attribute:: _columns .. py:method:: check_plot() Activate the plot if the object is initialized .. py:method:: read_db(filename: str | pathlib.Path, sel_rivers: list[str] = None, sheet_name: str = 'Ponts', bounds: list[list[float, float], list[float, float]] = None) Read the database (Excel file) and create the zones and the vectors. The user will be prompted to select the rivers to display. :param filename: The path to the Excel file containing the database :type filename: str | Path :param sel_rivers: The list of rivers to display, if None, the user will be prompted to select the rivers :type sel_rivers: list[str] | None :param sheet_name: The name of the sheet in the Excel file to read :type sheet_name: str :param bounds: The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ] :type bounds: list[list[float, float], list[float, float]] | None .. py:method:: _filter_db(bounds: list[list[float, float], list[float, float]] = None) Filter the database based on the selected rivers and bounds. :param bounds: The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ] :type bounds: list[list[float, float], list[float, float]] | None .. py:class:: Particularites(parent=None, idx='', plotted=True, mapviewer=None, rivers=None) Bases: :py:obj:`Ouvrages` .. autoapi-inheritance-diagram:: wolfhece.wolf_zi_db.Particularites :parts: 1 :private-bases: Class to handle the "Particularités" -- Pictures of the particularities in the ZI. .. py:attribute:: _columns .. py:method:: read_db(filename: str | pathlib.Path, sel_rivers: list[str] = None, sheet_name: str = 'Particularités', bounds: list[list[float, float], list[float, float]] = None) Read the database (Excel file) and create the zones and the vectors. The user will be prompted to select the rivers to display. :param filename: The path to the Excel file containing the database :type filename: str | Path :param sel_rivers: The list of rivers to display, if None, the user will be prompted to select the rivers :type sel_rivers: list[str] | None :param sheet_name: The name of the sheet in the Excel file to read :type sheet_name: str :param bounds: The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ] :type bounds: list[list[float, float], list[float, float]] | None .. py:method:: _filter_db(bounds: list[list[float, float], list[float, float]] = None) Filter the database based on the selected rivers and bounds. :param bounds: The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ] :type bounds: list[list[float, float], list[float, float]] | .. py:class:: Enquetes(parent=None, idx='', plotted=True, mapviewer=None, rivers=None) Bases: :py:obj:`Ouvrages` .. autoapi-inheritance-diagram:: wolfhece.wolf_zi_db.Enquetes :parts: 1 :private-bases: Class to handle the "Enquêtes" -- Pictures of the surveys in the ZI. .. py:attribute:: _columns .. py:method:: read_db(filename: str | pathlib.Path, sel_rivers: list[str] = None, sheet_name: str = 'Photos', bounds: list[list[float, float], list[float, float]] = None) Read the database (Excel file) and create the zones and the vectors. The user will be prompted to select the rivers to display. :param filename: The path to the Excel file containing the database :type filename: str | Path :param sel_rivers: The list of rivers to display, if None, the user will be prompted to select the rivers :type sel_rivers: list[str] | None :param sheet_name: The name of the sheet in the Excel file to read :type sheet_name: str :param bounds: The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ] :type bounds: list[list[float, float], list[float, float]] | .. py:method:: _filter_db(bounds: list[list[float, float], list[float, float]] = None) Filter the database based on the selected rivers and bounds. :param bounds: The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ] :type bounds: list[list[float, float], list[float, float]] | .. py:class:: Profils(parent=None, idx='', plotted=True, mapviewer=None, rivers=None) Bases: :py:obj:`Ouvrages` .. autoapi-inheritance-diagram:: wolfhece.wolf_zi_db.Profils :parts: 1 :private-bases: Class to handle the "Profils en travers" -- Pictures of the corss-sections in the ZI. .. py:attribute:: _columns .. py:method:: read_db(filename: str | pathlib.Path, sel_rivers: list[str] = None, sheet_name: str = 'Sections transversales scannées', bounds: list[list[float, float], list[float, float]] = None) Read the database (Excel file) and create the zones and the vectors. The user will be prompted to select the rivers to display. :param filename: The path to the Excel file containing the database :type filename: str | Path :param sel_rivers: The list of rivers to display, if None, the user will be prompted to select the rivers :type sel_rivers: list[str] | None :param sheet_name: The name of the sheet in the Excel file to read :type sheet_name: str :param bounds: The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ] :type bounds: list[list[float, float], list[float, float]] | .. py:method:: _filter_db(bounds: list[list[float, float], list[float, float]] = None) Filter the database based on the selected rivers and bounds. :param bounds: The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ] :type bounds: list[list[float, float], list[float, float]] |