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

Inheritance diagram of wolfhece.wolf_zi_db.ColNames_PlansTerriers

Enum for the column names in the database

KEY = 'Clé primaire'[source]
ORIGX = 'Origine x'[source]
ORIGY = 'Origine y'[source]
ENDX = 'Xsup'[source]
ENDY = 'Ysup'[source]
WIDTH = 'Largeur'[source]
HEIGHT = 'Hauteur'[source]
FULLRES = 'Acces'[source]
LOWRES = 'Acces2'[source]
RIVER = 'River'[source]
class wolfhece.wolf_zi_db.ColNames_Ouvrages(*args, **kwds)[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.wolf_zi_db.ColNames_Ouvrages

Enum for the column names in the database

KEY = 'Clé primaire'[source]
X1 = 'X Lambert gauche'[source]
X2 = 'X Lambert droit'[source]
Y1 = 'Y Lambert gauche'[source]
Y2 = 'Y Lambert droit'[source]
REMARK = 'Remarques'[source]
RIVER = 'Lieu'[source]
PHOTO1 = 'Photo1'[source]
PHOTO2 = 'Photo2'[source]
PHOTO3 = 'Photo3'[source]
PHOTO4 = 'Photo4'[source]
PHOTO5 = 'Photo5'[source]
PHOTO6 = 'Photo6'[source]
PHOTO7 = 'Photo7'[source]
PHOTO8 = 'Photo8'[source]
PHOTO9 = 'Photo9'[source]
PHOTO10 = 'Photo10'[source]
DATE = 'Date'[source]
class wolfhece.wolf_zi_db.ColNames_Particularites(*args, **kwds)[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.wolf_zi_db.ColNames_Particularites

Enum for the column names in the database

KEY = 'Clé primaire'[source]
X = 'Xlambert'[source]
Y = 'Ylambert'[source]
REMARK = 'Commentaires'[source]
RIVER = 'Rivière'[source]
PHOTO1 = 'Photo 1'[source]
PHOTO2 = 'Photo 2'[source]
PHOTO3 = 'Photo 3'[source]
PHOTO4 = 'Photo 4'[source]
PHOTO5 = 'Photo 5'[source]
ORIENTATION = 'Orientation'[source]
DATE = 'Date'[source]
class wolfhece.wolf_zi_db.ColNames_Enquetes(*args, **kwds)[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.wolf_zi_db.ColNames_Enquetes

Enum for the column names in the database

KEY = 'Clé primaire'[source]
X = 'XLambert'[source]
Y = 'YLambert'[source]
RIVER = 'Rivière'[source]
PHOTO = 'Photo'[source]
ORIENTATION = 'Orientation'[source]
DATE = 'Date'[source]
class wolfhece.wolf_zi_db.ColNames_Profils(*args, **kwds)[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.wolf_zi_db.ColNames_Profils

Enum for the column names in the database

KEY = 'Clé primaire'[source]
X = 'XLambert'[source]
Y = 'YLambert'[source]
PHOTO = 'FichierImage'[source]
RIVER = 'Rivière'[source]
DATE = 'DateModif'[source]
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

origx[source]
origy[source]
endx[source]
endy[source]
width[source]
height[source]
fullpath[source]
lowpath[source]
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

Inheritance diagram of wolfhece.wolf_zi_db.PlansTerrier

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]
color[source]
tolerance = 0[source]
transparent_color = [255, 255, 255][source]
rivers = ['Vesdre', 'Hoegne'][source]
initialized = False[source]
wx_exists[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.

check_plot()[source]

Activate the plot if the object is initialized

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

read_db(filename: str | pathlib.Path, sel_rivers: list[str] = 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.

_filter_db()[source]
_find_map(x: float, y: float)[source]
load_texture(x: float, y: float, which: Literal['full', 'low'] = 'low')[source]
unload_textture(x: float, y: float)[source]
plot(sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None)[source]

Dessine les zones

class wolfhece.wolf_zi_db.Ouvrages(parent=None, idx: str = '', plotted: bool = True, mapviewer=None, rivers: list[str] = None)[source]

Bases: wolfhece.PyPictures.PictureCollection

Inheritance diagram of wolfhece.wolf_zi_db.Ouvrages

Class to handle the “Ouvrages” – Pictures of the structures in the ZI.

wx_exists[source]
db = None[source]
rivers = None[source]
initialized = False[source]
_columns[source]
check_plot()[source]

Activate the plot if the object is initialized

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

Inheritance diagram of wolfhece.wolf_zi_db.Particularites

Class to handle the “Particularités” – Pictures of the particularities in the ZI.

_columns[source]
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

Inheritance diagram of wolfhece.wolf_zi_db.Enquetes

Class to handle the “Enquêtes” – Pictures of the surveys in the ZI.

_columns[source]
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

Inheritance diagram of wolfhece.wolf_zi_db.Profils

Class to handle the “Profils en travers” – Pictures of the corss-sections in the ZI.

_columns[source]
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] ]