wolfhece._builtin_plugins.dtm_wallonia_1m.companion

DTM Wallonie 1 m/2 m — built-in companion plugin.

Loads the Wallonia 1 m DTM (LIDAXE) raster for the viewer’s current zoom extent and adds it to the active WolfMapViewer as a WolfArray.

Workflow

  1. On first use the plugin downloads the tile-index shapefile via toys_dtm_wallonia_1m().

  2. When “Charger depuis le zoom actuel” is triggered it: - reads the current view bounds from the viewer,

    • delegates extraction to DtmWalloniaService,

    • inserts the resulting WolfArray in the

      viewer tree.

Module Contents

wolfhece._builtin_plugins.dtm_wallonia_1m.companion._logger[source]
wolfhece._builtin_plugins.dtm_wallonia_1m.companion._DtmWalloniaTiles[source]
class wolfhece._builtin_plugins.dtm_wallonia_1m.companion.DtmWalloniaModel[source]

Bases: wolfhece.plugins.abc.AbstractCompanionModel

Inheritance diagram of wolfhece._builtin_plugins.dtm_wallonia_1m.companion.DtmWalloniaModel

Pure plugin state independent from viewer/wx/OpenGL APIs.

This model intentionally stores only business/session state so that the UI companion remains focused on event wiring and viewer integration.

load_count: int = 0[source]
last_layer_id: str | None = None[source]
last_bounds: tuple[float, float, float, float] | None = None[source]
_service: wolfhece.services.dtm_wallonia.DtmWalloniaService | None = None[source]
reset() None[source]

Reset transient domain state (no-op by default).

next_layer_id() str[source]
static is_valid_extent(xmin: float, xmax: float, ymin: float, ymax: float) bool[source]
property has_service: bool[source]

Whether the cached DTM service is already initialized.

ensure_service() wolfhece.services.dtm_wallonia.DtmWalloniaService[source]

Return the cached DTM service, creating it if needed.

force_download_index() str[source]

Force (re-)download of the tile-index shapefile.

get_dtm_1m(bounds_vec: wolfhece.pyvertexvectors.vector, force: bool = False) wolfhece.wolf_array.WolfArray[source]

Return 1m DTM for the given bounds vector.

get_dtm_2m(bounds_vec: wolfhece.pyvertexvectors.vector, force: bool = False) wolfhece.wolf_array.WolfArray[source]

Return 2m DTM for the given bounds vector.

get_dtm_1m_xx_yy(xmin: float, xmax: float, ymin: float, ymax: float, force: bool = False) wolfhece.wolf_array.WolfArray[source]

Return 1m DTM for raw bounds.

get_dtm_2m_xx_yy(xmin: float, xmax: float, ymin: float, ymax: float, force: bool = False) wolfhece.wolf_array.WolfArray[source]

Return 2m DTM for raw bounds.

load_from_extent(xmin: float, xmax: float, ymin: float, ymax: float, force: bool = False) tuple[wolfhece.wolf_array.WolfArray, str][source]

Execute the domain workflow for one extent.

  1. Validate extent,

  2. Build closed bounds vector,

  3. Fetch DTM,

  4. Allocate next layer id.

class wolfhece._builtin_plugins.dtm_wallonia_1m.companion.DtmWallonia1mCompanion[source]

Bases: wolfhece.plugins.abc.AbstractUICompanion

Inheritance diagram of wolfhece._builtin_plugins.dtm_wallonia_1m.companion.DtmWallonia1mCompanion

Companion plugin that loads Wallonia DTM for the current zoom.

Menu: DTM Wallonie 1m

  • Load from current zoom — adds a 1 m DTM layer for the current view.

  • Public helpers also expose 2 m DTM (mean-rebinned from 1 m).

  • Télécharger l’index des tuiles — (re-)downloads only the tile-index shapefile, useful for an initial setup or refresh.

create_model() DtmWalloniaModel[source]

Create the companion’s optional pure business model.

Override this to keep domain logic independent from UI concerns while staying in the same plugin module (companion + model in one file).

Default implementation returns None.

property model_state: DtmWalloniaModel[source]
menu_spec()[source]

Declare the companion’s menu as a (title, items) pair.

Override this to add a menu without writing wx code:

def menu_spec(self) -> tuple[str, list[MenuEntry]] | None:
    return (_('My Tool'), [
        MenuItem(_('Run'), self._on_run, _('Execute the tool')),
        SEPARATOR,
        SubMenuSpec(_('Settings'), [
            MenuItem(_('Configure…'), self._on_configure),
        ]),
    ])

Return None (the default) when no top-level menu is needed.

Called automatically by build(). Do not call directly.

start() None[source]

Programmatic activation — load DTM for the current view.

_on_load_from_zoom(_ctx: wolfhece._viewer_plugin_handlers.MouseContext) None[source]
_on_load_from_zoom_force(_ctx: wolfhece._viewer_plugin_handlers.MouseContext) None[source]
_on_show_index(_ctx: wolfhece._viewer_plugin_handlers.MouseContext) None[source]
_on_download_index(_ctx: wolfhece._viewer_plugin_handlers.MouseContext) None[source]
_show_index_in_viewer() None[source]

Add the tile-index grid to the viewer, using display lists for performance.

Idempotent — does nothing if the layer is already present. Reuses the already-loaded _DtmWalloniaTiles._tiles object (which already has VectorOGLRenderer.LIST set) instead of re-reading the shapefile.

_do_download_index() None[source]

Force (re-)download of the tile-index shapefile.

get_dtm_1m(bounds_vec: wolfhece.pyvertexvectors.vector, force: bool = False) wolfhece.wolf_array.WolfArray[source]

Return a WolfArray cropped to bounds_vec.

Downloads any missing tiles that intersect the polygon before assembling the result.

Parameters:
  • bounds_vec – A closed vector polygon that defines the region of interest.

  • force – If True, bypass the >100 tiles safeguard in _DtmWalloniaTiles.extract().

Returns:

WolfArray covering the bounding box of bounds_vec.

Raises:

FileNotFoundError – When no tile can be downloaded for the requested area.

get_dtm_2m(bounds_vec: wolfhece.pyvertexvectors.vector, force: bool = False) wolfhece.wolf_array.WolfArray[source]

Return a 2 m WolfArray by mean-rebinning the 1 m raster.

get_dtm_1m_xx_yy(xmin: float, xmax: float, ymin: float, ymax: float, force: bool = False) wolfhece.wolf_array.WolfArray[source]

Convenience wrapper around get_dtm_1m() that takes raw bounds.

Parameters:
  • xmin – Minimum X coordinate of the bounding box.

  • xmax – Maximum X coordinate of the bounding box.

  • ymin – Minimum Y coordinate of the bounding box.

  • ymax – Maximum Y coordinate of the bounding box.

  • force – If True, bypass the >100 tiles safeguard in _DtmWalloniaTiles.extract().

Returns:

WolfArray covering the specified bounding box.

Raises:

FileNotFoundError – When no tile can be downloaded for the requested area.

get_dtm_2m_xx_yy(xmin: float, xmax: float, ymin: float, ymax: float, force: bool = False) wolfhece.wolf_array.WolfArray[source]

Convenience wrapper around get_dtm_2m() that takes raw bounds.

_do_load_from_zoom(force: bool = False) None[source]

Load DTM for the current view extent and add it to the viewer.