wolfhece.wolf_zi_db
Author: HECE - University of Liege, Pierre Archambeau Date: 2024
Copyright (c) 2024 University of Liege. All rights reserved.
This script and its content are protected by copyright law. Unauthorized copying or distribution of this file, via any medium, is strictly prohibited.
Module Contents
- class wolfhece.wolf_zi_db.ColNames_PlansTerriers(*args, **kwds)[source]
Bases:
enum.Enum
Enum for the column names in the database
- class wolfhece.wolf_zi_db.ColNames_Ouvrages(*args, **kwds)[source]
Bases:
enum.Enum
Enum for the column names in the database
- class wolfhece.wolf_zi_db.ColNames_Particularites(*args, **kwds)[source]
Bases:
enum.Enum
Enum for the column names in the database
- class wolfhece.wolf_zi_db.ColNames_Enquetes(*args, **kwds)[source]
Bases:
enum.Enum
Enum for the column names in the database
- class wolfhece.wolf_zi_db.ColNames_Profils(*args, **kwds)[source]
Bases:
enum.Enum
Enum for the column names in the database
- wolfhece.wolf_zi_db._test_bounds(x: float, y: float, bounds: list[list[float, float], list[float, float]]) bool [source]
Test if the coordinates are inside the bounds
- Parameters:
x (float) – The x coordinate
y (float) – The y coordinate
bounds (list[list[float, float], list[float, float]]) – The bounds to test against - [ [xmin, xmax], [ymin, ymax] ]
- Returns:
True if the coordinates are inside the bounds, False otherwise
- Return type:
bool
- wolfhece.wolf_zi_db._sanitize_legendtext(text: str) str [source]
Sanitize the legend text by replacing newlines and special characters
- Parameters:
text (str) – The text to sanitize
- Returns:
The sanitized text
- Return type:
str
- class wolfhece.wolf_zi_db.ZI_Databse_Elt(origx: float, origy: float, endx: float, endy: float, width: float, height: float, fullpath: pathlib.Path, lowpath: pathlib.Path)[source]
Class to store the database elements
- class wolfhece.wolf_zi_db.PlansTerrier(parent=None, idx: str = '', plotted: bool = True, mapviewer=None, rivers: list[str] = ['Vesdre', 'Hoegne'])[source]
Bases:
wolfhece.PyVertexvectors.Zones
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.
- Parameters:
parent (wx.Window) – The wx parent of the object
idx (str) – The index of the object
plotted (bool) – If the object is plotted
mapviewer (MapViewer) – The mapviewer object
rivers (list[str]) – The list of rivers to display
- maps: dict[str, ZI_Databse_Elt][source]
- textures: dict[ZI_Databse_Elt, wolfhece.wolf_texture.genericImagetexture][source]
- set_tolerance(tol: int)[source]
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.
- set_transparent_color(color: list[int, int, int])[source]
Set the transparent color.
Color is a list of 3 integers, representing the RGB color (0 -> 255).
- set_color(color: tuple[int, int, int])[source]
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.
- _create_zones()[source]
Create the zones for the selected rivers.
Each river will be a zone, and the vectors will be the contours of the images.
- class wolfhece.wolf_zi_db.Ouvrages(parent=None, idx: str = '', plotted: bool = True, mapviewer=None, rivers: list[str] = None)[source]
Bases:
wolfhece.PyPictures.PictureCollection
Class to handle the “Ouvrages” – Pictures of the structures in the ZI.
- read_db(filename: str | pathlib.Path, sel_rivers: list[str] = None, sheet_name: str = 'Ponts', bounds: list[list[float, float], list[float, float]] = None)[source]
Read the database (Excel file) and create the zones and the vectors.
The user will be prompted to select the rivers to display.
- Parameters:
filename (str | Path) – The path to the Excel file containing the database
sel_rivers (list[str] | None) – The list of rivers to display, if None, the user will be prompted to select the rivers
sheet_name (str) – The name of the sheet in the Excel file to read
bounds (list[list[float, float], list[float, float]] | None) – The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ]
- _filter_db(bounds: list[list[float, float], list[float, float]] = None)[source]
Filter the database based on the selected rivers and bounds.
- Parameters:
bounds (list[list[float, float], list[float, float]] | None) – The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ]
- class wolfhece.wolf_zi_db.Particularites(parent=None, idx='', plotted=True, mapviewer=None, rivers=None)[source]
Bases:
Ouvrages
Class to handle the “Particularités” – Pictures of the particularities in the ZI.
- 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)[source]
Read the database (Excel file) and create the zones and the vectors.
The user will be prompted to select the rivers to display.
- Parameters:
filename (str | Path) – The path to the Excel file containing the database
sel_rivers (list[str] | None) – The list of rivers to display, if None, the user will be prompted to select the rivers
sheet_name (str) – The name of the sheet in the Excel file to read
bounds (list[list[float, float], list[float, float]] | None) – The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ]
- _filter_db(bounds: list[list[float, float], list[float, float]] = None)[source]
Filter the database based on the selected rivers and bounds.
- Parameters:
bounds (list[list[float, float], list[float, float]] |) – The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ]
- class wolfhece.wolf_zi_db.Enquetes(parent=None, idx='', plotted=True, mapviewer=None, rivers=None)[source]
Bases:
Ouvrages
Class to handle the “Enquêtes” – Pictures of the surveys in the ZI.
- read_db(filename: str | pathlib.Path, sel_rivers: list[str] = None, sheet_name: str = 'Photos', bounds: list[list[float, float], list[float, float]] = None)[source]
Read the database (Excel file) and create the zones and the vectors.
The user will be prompted to select the rivers to display.
- Parameters:
filename (str | Path) – The path to the Excel file containing the database
sel_rivers (list[str] | None) – The list of rivers to display, if None, the user will be prompted to select the rivers
sheet_name (str) – The name of the sheet in the Excel file to read
bounds (list[list[float, float], list[float, float]] |) – The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ]
- _filter_db(bounds: list[list[float, float], list[float, float]] = None)[source]
Filter the database based on the selected rivers and bounds.
- Parameters:
bounds (list[list[float, float], list[float, float]] |) – The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ]
- class wolfhece.wolf_zi_db.Profils(parent=None, idx='', plotted=True, mapviewer=None, rivers=None)[source]
Bases:
Ouvrages
Class to handle the “Profils en travers” – Pictures of the corss-sections in the ZI.
- 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)[source]
Read the database (Excel file) and create the zones and the vectors.
The user will be prompted to select the rivers to display.
- Parameters:
filename (str | Path) – The path to the Excel file containing the database
sel_rivers (list[str] | None) – The list of rivers to display, if None, the user will be prompted to select the rivers
sheet_name (str) – The name of the sheet in the Excel file to read
bounds (list[list[float, float], list[float, float]] |) – The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ]
- _filter_db(bounds: list[list[float, float], list[float, float]] = None)[source]
Filter the database based on the selected rivers and bounds.
- Parameters:
bounds (list[list[float, float], list[float, float]] |) – The bounds of the area to display, if None, no test on coordinates will be done - [ [xmin, xmax], [ymin, ymax] ]