Commit a3b095f
committed
refactor: extract Q10 map compositing into a single render result object
Addresses review feedback that `_render_packet` mutated ~8 trait fields
through 3-4 layers of side-effecting methods, making the trait hard to
review and blurring the state-management / pixel-work boundary.
- Add `roborock/map/b01_q10_render.py`: `render_q10_map()` composes a map
packet + path + overlays + calibration into one `Q10MapRender` result
(image + MapData + layers), and owns the erase blanking, world->pixel
overlay placement, path drawing and calibration policy that previously
lived on the trait. The whole data flow reads top-to-bottom in one
function instead of nested mutations.
- `MapContentTrait` is now just state management: it accumulates the pushed
inputs and rebuilds the single `Q10MapRender` wholesale on each change,
exposing read-only properties. No more per-field clearing. The derived
rendering scaffolding (erase zones, header calibration) is off the public
surface; layers/calibration stay (used by the CLI + frontend compositing).
- Move the geometry/pixel tests to tests/map/test_b01_q10_render.py; the
trait tests now cover state management.
- `UpdatableTrait` explicitly declares the `DpsUpdatable` protocol so the
heterogeneous fan-out list's shared shape is documented (the map trait
satisfies it structurally without being a converter-backed read-model).1 parent c646086 commit a3b095f
5 files changed
Lines changed: 796 additions & 504 deletions
File tree
- roborock
- devices/traits/b01/q10
- map
- tests
- devices/traits/b01/q10
- map
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
35 | | - | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
0 commit comments