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
On first use the plugin downloads the tile-index shapefile via
toys_dtm_wallonia_1m().When “Charger depuis le zoom actuel” is triggered it: - reads the current view bounds from the viewer,
delegates extraction to
DtmWalloniaService,- inserts the resulting
WolfArrayin the viewer tree.
- inserts the resulting
Module Contents
- class wolfhece._builtin_plugins.dtm_wallonia_1m.companion.DtmWalloniaModel[source]
Bases:
wolfhece.plugins.abc.AbstractCompanionModel
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.
- _service: wolfhece.services.dtm_wallonia.DtmWalloniaService | None = None[source]
- ensure_service() wolfhece.services.dtm_wallonia.DtmWalloniaService[source]
Return the cached DTM service, creating it if needed.
- 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.
- class wolfhece._builtin_plugins.dtm_wallonia_1m.companion.DtmWallonia1mCompanion[source]
Bases:
wolfhece.plugins.abc.AbstractUICompanion
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]
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.
- _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._tilesobject (which already hasVectorOGLRenderer.LISTset) instead of re-reading the shapefile.
- get_dtm_1m(bounds_vec: wolfhece.pyvertexvectors.vector, force: bool = False) wolfhece.wolf_array.WolfArray[source]
Return a
WolfArraycropped to bounds_vec.Downloads any missing tiles that intersect the polygon before assembling the result.
- Parameters:
bounds_vec – A closed
vectorpolygon 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
WolfArrayby 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.