wolfhece.wolf_texture

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

wolfhece.wolf_texture.msg[source]
class wolfhece.wolf_texture.genericImagetexture(which: str, label: str, mapviewer, xmin: float, xmax: float, ymin: float, ymax: float, imageFile: str = '', imageObj=None, transparent_color=None, tolerance: int = 3, replace_color=None, drawing_scale: float = 1.0, offset: list[float, float] = [0.0, 0.0])[source]

Bases: wolfhece.drawing_obj.Element_To_Draw

Inheritance diagram of wolfhece.wolf_texture.genericImagetexture

Affichage d’une image en OpenGL via une texture

name: str[source]
idtexture: int[source]
width: int[source]
height: int[source]
which: str[source]
myImage: PIL.Image[source]
time = None[source]
xmin[source]
xmax[source]
ymin[source]
ymax[source]
idx[source]
imageFile = ''[source]
drawing_scale = 1.0[source]
offset = [0.0, 0.0][source]
oldview[source]
newview[source]
_loader = None[source]
_pending_load_request_id: str | None = None[source]
_pending_async_image: PIL.Image.Image | None = None[source]
_async_load_bounds: tuple[float, float, float, float] | None = None[source]
unload()[source]

Unload the texture from memory

load(imageFile='')[source]

Load the image texture into OpenGL

Parameters:

imageFile – Optional file path to load the image from

This method first checks if an asynchronous image has been loaded and is ready. If so, it uses that image. Otherwise, it proceeds with synchronous loading.

update_minmax()[source]

Update the spatial extent of the texture based on its size

reload(xmin=-99999, xmax=-99999, ymin=-99999, ymax=-99999)[source]

Reload the texture with new spatial bounds and trigger async image update if using cache.

When spatial bounds change, this method: 1. Updates the bounds 2. Checks if the view has changed significantly 3. If using a cache service, schedules async image loading 4. Immediately updates the texture if using direct service (non-cached)

_schedule_async_image_update()[source]

Schedule an asynchronous image update based on current bounds and service.

This is called when bounds change and the texture is using a cached service. The image is loaded in the background without blocking the UI.

Optimizations: 1. Cancel obsolete requests for this texture (old bounds become irrelevant) 2. Load a degraded image (lower resolution, larger bounds) while waiting for best quality

_load_degraded_image_for_fallback(service) bool[source]

Load a lower-resolution image at wider bounds for immediate display while best quality loads.

This improves perceived responsiveness by showing a degraded image immediately. The wider bounds ensure the degraded image covers the viewport during fast pans/zooms.

Parameters:

service – WebService enum for the source

Returns:

True if fallback was loaded, False otherwise

_get_current_service() wolfhece.PyWMS.WebService | None[source]

Determine the current service based on texture type.

Returns:

WebService enum value or None

plot(sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None)[source]

alias for paint

find_minmax(update=False)[source]

Generic function to find min and max spatial extent in data

uv(x: float, y: float) tuple[float, float][source]

Convert coordinates to texture coordinates taking into account the texture’s spatial extent, the scaleing factor, and the offset.

Parameters:
  • x – X coordinate in pixels

  • y – Y coordinate in pixels

Returns:

Tuple of (u, v) texture coordinates

paint()[source]

Paint the image texture on the OpenGL canvas

class wolfhece.wolf_texture.imagetexture(which: str, label: str, cat: str, subc: str, mapviewer, xmin: float, xmax: float, ymin: float, ymax: float, width: int = 1000, height: int = 1000, France: bool = False, epsg='31370', Vlaanderen: bool = False, LifeWatch: bool = False, IGN_Belgium: bool = False, IGN_Cartoweb: bool = False, postFlood2021: bool = False, Alaro: bool = False)[source]

Bases: wolfhece.drawing_obj.Element_To_Draw

Inheritance diagram of wolfhece.wolf_texture.imagetexture

Affichage d’une image, obtenue depuis un Web service, en OpenGL via une texture

name: str[source]
idtexture: int[source]
width: int[source]
height: int[source]
which: str[source]
category: str[source]
subcategory: str[source]
France: bool[source]
epsg: str[source]
_program = None[source]
_cache = None[source]
Vlaanderen = False[source]
LifeWatch = False[source]
IGN_Belgium = False[source]
IGN_Cartoweb = False[source]
postFlood2021 = False[source]
Alaro = False[source]
xmin[source]
xmax[source]
ymin[source]
ymax[source]
idx[source]
time = None[source]
alpha = 1.0[source]
force_alpha = False[source]
oldview[source]
_init_cache()[source]

Initialize the cache for this texture based on its category and subcategory

load()[source]

Load the image texture into OpenGL, fetching it from the appropriate web service if necessary and caching it for future use.

_update_texture_from_image(image)[source]

Update the OpenGL texture with a new image (used for progressive tile updates).

reload()[source]
plot(sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None)[source]

alias for paint

find_minmax(update=False)[source]

Generic function to find min and max spatial extent in data

init_shader()[source]
paint(sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None)[source]
check_plot()[source]

Generic function responding to check operation from mapviewer

uncheck_plot(unload=True)[source]

Generic function responding to uncheck operation from mapviewer

class wolfhece.wolf_texture.Text_Image_Texture(text: str, mapviewer, proptext: wolfhece.textpillow.Text_Infos, vector, x: float, y: float)[source]

Bases: genericImagetexture

Inheritance diagram of wolfhece.wolf_texture.Text_Image_Texture

Affichage d’une image en OpenGL via une texture

x[source]
y[source]
vector[source]
proptext[source]
mapviewer[source]
oldview[source]
findscale()[source]
load(imageFile='')[source]

Load the image texture into OpenGL

Parameters:

imageFile – Optional file path to load the image from

This method first checks if an asynchronous image has been loaded and is ready. If so, it uses that image. Otherwise, it proceeds with synchronous loading.

paint()[source]

Paint the image texture on the OpenGL canvas

update_image(newtext: str = '', proptext: wolfhece.textpillow.Text_Infos = None)[source]