"""Facade mixin for processed-radar plot rendering.""" from __future__ import annotations from python_app.gui.controllers.app_window_plot import ( AppWindowBscanPlotMixin, AppWindowGprPlotMixin, AppWindowTracePlotMixin, ) from python_app.models.dataset_model import ResultCollection class AppWindowPlotMixin( AppWindowTracePlotMixin, AppWindowBscanPlotMixin, AppWindowGprPlotMixin, ): """Routes plotting to trace, B-scan, or GPR-specific mixins.""" def _draw_preferred_collection( self, *, result_latest: ResultCollection | None, ) -> None: """Draw latest available result collection if present.""" if result_latest is None: return self._draw_results(result_latest) def _draw_results(self, collection: ResultCollection) -> bool: """Draw collection based on currently selected processing mode.""" if self._processing_mode.currentText() == "bscan": return self._draw_bscan_heatmap(collection) if self._processing_mode.currentText() == "gpr": return self._draw_gpr_map(collection) return self._draw_trace_lines(collection) def _result_collection_has_trace(self, collection: ResultCollection) -> bool: """Return `True` when collection contains at least one trace payload.""" if collection.collection_payloads: return True for block in collection.blocks: for payload in block.payloads: if payload.kind == 1 and payload.trace.size > 0: return True return False