wolfhece._asset_manager
Asset-chart and interactive-transform companion object for WolfMapViewer.
All pie / bar / curve chart CRUD logic and the asset-transform drag / snap
machinery live here. WolfMapViewer holds a single instance as
self._assets and exposes one-line delegators for every public method so
that external callers and the retrocompatibility test remain unaffected.
Design notes
AssetManagerowns all mutable transform state (8 attrs) and the snap grid cache (2 attrs) — none of these were ever part of the public API.Viewer-level settings (
snap_grid_unit,snap_grid_round_base) remain properties onWolfMapViewer;AssetManagerreads them viaself._viewer.wx parent for dialogs is always
self._viewer.Three event-hook methods (
on_left_down,on_left_up,on_end_action) let the viewer delegate its mouse / action events with a single call rather than scattering attribute access.
Module Contents
- class wolfhece._asset_manager.AssetManager(viewer: wolfhece.PyDraw.WolfMapViewer)[source]
Companion object that owns chart CRUD and asset-transform state.
Instantiated once as
viewer._assets = AssetManager(viewer)insideWolfMapViewer.__init__.- on_left_down(x: float, y: float) bool[source]
Handle left-mouse-down in transform asset bounds mode.
Returns
Trueif the event was consumed (no further processing needed by the caller).
- on_left_up(x: float, y: float) None[source]
Flush pending editor refresh, reset drag state, update cursor.
- add_pie_asset(values: Sequence[float], x: float, y: float, radius: float, id: str = 'pie_chart', labels: Sequence[str] = None, colors: Sequence[tuple] = None, ToCheck: bool = True, return_controller: bool = False, open_editor: bool = False, **kwargs) Zones | PieZonesController[source]
Create and add a world-space pie chart with persistent controller.
- _bind_pie_controller_to_zones(controller: wolfhece.assets.pie.PieZonesController, zones: Zones | None) None[source]
Attach pie controller metadata to the Zones object.
- _iter_pie_controllers() list[wolfhece.assets.pie.PieZonesController][source]
Collect pie controllers from the viewer’s vector objects.
- _get_pie_controller(pie_id: str) PieZonesController | None[source]
- OnCreatePieChart(event: wx.Event) None[source]
Create a new editable pie chart and open the full wx editor.
- OnLoadPieChartJSON(event: wx.Event) None[source]
Load an editable pie chart from JSON and attach it to the viewer.
- add_bar_asset(values: Sequence[float], x: float, y: float, width: float, height: float, id: str = 'bar_chart', labels: Sequence[str] = None, colors: Sequence[tuple] = None, orientation: str = 'horizontal', ToCheck: bool = True, return_controller: bool = False, open_editor: bool = False, **kwargs) Zones | BarZonesController[source]
Create and add a world-space bar chart with persistent controller.
- _bind_bar_controller_to_zones(controller: wolfhece.assets.bar.BarZonesController, zones: Zones | None) None[source]
- _get_bar_controller(bar_id: str) BarZonesController | None[source]
- add_curve_asset(curves: Sequence, id: str = 'curve_plot', labels: Sequence[str] = None, colors: Sequence[tuple] = None, canvas_origin: tuple[float, float] = (0.0, 0.0), canvas_size: tuple[float, float] = (100.0, 100.0), area_fraction: tuple[float, float, float, float] = (0.1, 0.1, 0.8, 0.3), ToCheck: bool = True, return_controller: bool = False, open_editor: bool = False, **kwargs) Zones | CurveZonesController[source]
Create and add a world-space curve chart with persistent controller.
- _bind_curve_controller_to_zones(controller: wolfhece.assets.curve.CurveZonesController, zones: Zones | None) None[source]
- _get_curve_controller(curve_id: str) CurveZonesController | None[source]
- add_boxplot_asset(series, *, id: str = 'boxplot', canvas_origin: tuple = (0.0, 0.0), canvas_size: tuple = (100.0, 80.0), area_fraction: tuple = (0.1, 0.08, 0.92, 0.88), open_editor: bool = False, return_controller: bool = False, **kwargs)[source]
- _bind_boxplot_controller_to_zones(controller: wolfhece.assets.boxplot.BoxplotZonesController, zones: Zones | None) None[source]
- _get_boxplot_controller(boxplot_id: str) BoxplotZonesController | None[source]
- static _nice_step(raw_step: float) float[source]
Round a raw spacing to a readable 1-2-5 × 10ⁿ step.
- _ensure_snap_grid_origin() tuple[float, float][source]
Return a stable world origin for snapping, initialized once.
- _adaptive_snap_step_from_span(span: float, target_divisions: float = 20.0) float[source]
Compute zoom-adaptive step as power-of-two multiple of base unit.
- _asset_transform_snap_steps() tuple[float, float][source]
Return adaptive grid steps as nested multiples of base snap unit.