diff --git a/agent-context/README.md b/agent-context/README.md index 38833df..3a9e514 100644 --- a/agent-context/README.md +++ b/agent-context/README.md @@ -33,4 +33,4 @@ method-level behavior, data-shape history — so an agent doesn't have to re-der | `context/testing.md` | `src/test/java/`, `.github/workflows/build.yml`, `.github/workflows/publish.yml` | --- -*Last updated: 2026-09-12 | Verified against: feature/tpwalke2/209-bluemapapiconnector (40f2273)* +*Last updated: 2026-09-12 | Verified against: feature/tpwalke2/209-signtransitionresolver (4d45867)* diff --git a/agent-context/context/core-pipeline.md b/agent-context/context/core-pipeline.md index b6ad0a7..b5cd2ec 100644 --- a/agent-context/context/core-pipeline.md +++ b/agent-context/context/core-pipeline.md @@ -151,15 +151,17 @@ re-querying the cache once per sign. `computeTransitionAction`'s logic (mirrors the table in the spec, generalized to a 4x4 grid of `POI`/`LINE`/`SHAPE`/ `EXTRUDE` alongside `NONE` — see `docs/adr/0002-shape-duplicates-line-pattern.md` for why each new multi-point type -duplicates the same pattern rather than generalizing it): +gets its own row/column and `MIN_MEMBERS` constant here rather than folding into `LINE`'s; the join/leave +*implementation* behind those cells is a single shared parameterized resolver, not duplicated per type — see +`multiPointJoinAction`/`multiPointLeaveAction` below): | Old \ New | NONE | POI | LINE | SHAPE | EXTRUDE | |---|---|---|---|---|---| -| **NONE** | no-op (`null`) | dispatch `createAddPOIAction` | `lineJoinAction` (recompute group *including* this sign; dispatch `SetMultiPointMarkerAction` if ≥2 members, else no-op) | `shapeJoinAction` (same shape, gated on `SHAPE_MIN_MEMBERS = 3` instead of 2) | `extrudeJoinAction` (same shape again, gated on `EXTRUDE_MIN_MEMBERS = 3`) | -| **POI** | dispatch `createRemovePOIAction` | same group (prefix unchanged): label/detail both unchanged is a no-op, either changed dispatches `createUpdatePOIAction`. Different group (prefix changed): leave-effect + join-effect, bundled | leave-effect (Remove POI) + join-effect (`lineJoinAction`) | leave-effect (Remove POI) + join-effect (`shapeJoinAction`) | leave-effect (Remove POI) + join-effect (`extrudeJoinAction`) | -| **LINE** | `lineLeaveAction` (recompute group *excluding* this sign; `SetMultiPointMarkerAction` if ≥2 remain, `RemoveMultiPointMarkerAction` if exactly 1 remains, no-op if 0) | leave-effect (as above) + join-effect (Add POI) | same group+label: `lineJoinAction` with `sameGroupRecompute=true` (refreshes detail/points — always dispatches `Set` since ≥2 members necessarily already existed); different group/label: leave-effect + join-effect | leave-effect (`lineLeaveAction`) + join-effect (`shapeJoinAction`) | leave-effect (`lineLeaveAction`) + join-effect (`extrudeJoinAction`) | -| **SHAPE** | `shapeLeaveAction` (mirrors `lineLeaveAction`, but `RemoveMultiPointMarkerAction` once membership drops below 3) | leave-effect (`shapeLeaveAction`) + join-effect (Add POI) | leave-effect (`shapeLeaveAction`) + join-effect (`lineJoinAction`) | same group+label: `shapeJoinAction` with `sameGroupRecompute=true` (mirrors `LINE`/`LINE`); different group/label: leave-effect + join-effect | leave-effect (`shapeLeaveAction`) + join-effect (`extrudeJoinAction`) | -| **EXTRUDE** | `extrudeLeaveAction` (mirrors `shapeLeaveAction`, `RemoveMultiPointMarkerAction` once membership drops below 3) | leave-effect (`extrudeLeaveAction`) + join-effect (Add POI) | leave-effect (`extrudeLeaveAction`) + join-effect (`lineJoinAction`) | leave-effect (`extrudeLeaveAction`) + join-effect (`shapeJoinAction`) | same group+label: `extrudeJoinAction` with `sameGroupRecompute=true` (mirrors `SHAPE`/`SHAPE`); different group/label: leave-effect + join-effect | +| **NONE** | no-op (`null`) | dispatch `createAddPOIAction` | `multiPointJoinAction` (recompute group *including* this sign; dispatch `SetMultiPointMarkerAction` if ≥2 members, else no-op) | `multiPointJoinAction` (same call, gated on `SHAPE_MIN_MEMBERS = 3` instead of 2) | `multiPointJoinAction` (same call again, gated on `EXTRUDE_MIN_MEMBERS = 3`) | +| **POI** | dispatch `createRemovePOIAction` | same group (prefix unchanged): label/detail both unchanged is a no-op, either changed dispatches `createUpdatePOIAction`. Different group (prefix changed): leave-effect + join-effect, bundled | leave-effect (Remove POI) + join-effect (`multiPointJoinAction`) | leave-effect (Remove POI) + join-effect (`multiPointJoinAction`) | leave-effect (Remove POI) + join-effect (`multiPointJoinAction`) | +| **LINE** | `multiPointLeaveAction` (recompute group *excluding* this sign; `SetMultiPointMarkerAction` if ≥2 remain, `RemoveMultiPointMarkerAction` if exactly 1 remains, no-op if 0) | leave-effect (as above) + join-effect (Add POI) | same group+label: `multiPointJoinAction` with `sameGroupRecompute=true` (refreshes detail/points — always dispatches `Set` since ≥2 members necessarily already existed); different group/label: leave-effect + join-effect | leave-effect (`multiPointLeaveAction`) + join-effect (`multiPointJoinAction`) | leave-effect (`multiPointLeaveAction`) + join-effect (`multiPointJoinAction`) | +| **SHAPE** | `multiPointLeaveAction` (mirrors the `LINE` row, but `RemoveMultiPointMarkerAction` once membership drops below 3) | leave-effect (`multiPointLeaveAction`) + join-effect (Add POI) | leave-effect (`multiPointLeaveAction`) + join-effect (`multiPointJoinAction`) | same group+label: `multiPointJoinAction` with `sameGroupRecompute=true` (mirrors `LINE`/`LINE`); different group/label: leave-effect + join-effect | leave-effect (`multiPointLeaveAction`) + join-effect (`multiPointJoinAction`) | +| **EXTRUDE** | `multiPointLeaveAction` (mirrors the `SHAPE` row, `RemoveMultiPointMarkerAction` once membership drops below 3) | leave-effect (`multiPointLeaveAction`) + join-effect (Add POI) | leave-effect (`multiPointLeaveAction`) + join-effect (`multiPointJoinAction`) | leave-effect (`multiPointLeaveAction`) + join-effect (`multiPointJoinAction`) | same group+label: `multiPointJoinAction` with `sameGroupRecompute=true` (mirrors `SHAPE`/`SHAPE`); different group/label: leave-effect + join-effect | The POI/POI cell deliberately compares only `group().prefix()`, not label — a label-only edit on an unchanged group used to fall through to the different-group (leave+join) branch, because the older check compared @@ -188,26 +190,30 @@ zero effects → `null`, one effect → dispatch it directly, two → bundle int `groupIdentityObsolete` (used by the config-reload path, below) is likewise type-agnostic, detecting a config-only type flip or rename for any of the four types. -`lineJoinAction(allSigns, parentMap, rep, actionFactory, sameGroupRecompute)` and `lineLeaveAction(allSigns, -parentMap, rep, actionFactory)` both call `LineGroupResolver.members(allSigns, parentMap, rep.group().prefix(), -rep.label())` against the caller-supplied snapshot — because `signCache` is a full, live snapshot (never cleared -for a config reload, see below), a snapshot taken once per dispatch always scans every sign currently known, so a -`LINE` group recompute is always complete and order-independent regardless of which member triggered it. -`lineJoinAction`'s `isFirstAppearance` flag (`!sameGroupRecompute && members.size() == 2`) is log-only — see §6 — -not a distinct dispatch type. `shapeJoinAction`/`shapeLeaveAction` and `extrudeJoinAction`/`extrudeLeaveAction` are -the direct `SHAPE`/`EXTRUDE` counterparts: they call `ShapeGroupResolver.members(...)`/`ExtrudeGroupResolver.members(...)`, -both of which just delegate to `LineGroupResolver.members(...)` (identical filtering/ordering — the only real -difference between `LINE`, `SHAPE`, and `EXTRUDE` group resolution is the caller-side minimum-member count, `2` vs. -`SHAPE_MIN_MEMBERS = 3` vs. `EXTRUDE_MIN_MEMBERS = 3`), and dispatch via the single `actionFactory.createSetMultiPointAction`/ -`createRemoveMultiPointAction` pair for all three types (§5) — `ActionFactory` derives which kind (and minimum-member -threshold) to build from `markerGroup.type()` itself, so `SignTransitionResolver` doesn't need per-type factory calls -here. Every join/leave-recompute call site calls `ColorResolver.resolve(members, rep.group())` (see below) immediately -before dispatching, and passes the resolved `lineColor`/`fillColor` into `createSetMultiPointAction` as explicit -parameters (`fillColor` is `null` for `LINE`, which has none) — `ActionFactory` no longer reads -`markerGroup.lineColor()`/`fillColor()` itself for this factory method, keeping it a dumb builder while -`SignTransitionResolver` owns colour resolution. These call sites also now pass `rep.detail()` (not `rep.label()`) -as the dispatched detail text — fixing a bug where a `LINE`/`SHAPE`/`EXTRUDE` marker's rendered detail was always -just its label repeated, since detail text on these signs was never actually threaded through. +`multiPointJoinAction(allSigns, parentMap, rep, actionFactory, sameGroupRecompute, resolver, minMembers, kind)` and +`multiPointLeaveAction(allSigns, parentMap, rep, actionFactory, currentPrefixGroupMap, resolver, minMembers, kind)` +are the single generic implementation behind all three `LINE`/`SHAPE`/`EXTRUDE` cells above — collapsed from three +near-identical `line*Action`/`shape*Action`/`extrude*Action` method pairs (GitHub issue #209) once it was clear they +differed only by which `GroupResolver` (`LineGroupResolver::members`/`ShapeGroupResolver::members`/ +`ExtrudeGroupResolver::members`) they called, the minimum-member threshold (`LINE_MIN_MEMBERS = 2` vs. +`SHAPE_MIN_MEMBERS = 3` vs. `EXTRUDE_MIN_MEMBERS = 3`), and whether a fill colour applies (`hasFill(kind)` is +`false` only for `LINE`, which has no fill). Both call the caller-supplied `resolver` against the caller-supplied +`allSigns` snapshot — because `signCache` is a full, live snapshot (never cleared for a config reload, see below), a +snapshot taken once per dispatch always scans every sign currently known, so a recompute is always complete and +order-independent regardless of which member triggered it. `ShapeGroupResolver.members`/`ExtrudeGroupResolver.members` +just delegate to `LineGroupResolver.members(...)` (identical filtering/ordering — the only real difference between +`LINE`, `SHAPE`, and `EXTRUDE` group resolution is the caller-side minimum-member count). `isFirstAppearance` +(`!sameGroupRecompute && members.size() == minMembers`) is log-only — see §6 — not a distinct dispatch type. Both +dispatch via the single `actionFactory.createSetMultiPointAction`/`createRemoveMultiPointAction` pair for all three +types (§5) — `ActionFactory` derives which kind (and minimum-member threshold) to build from `markerGroup.type()` +itself, so `SignTransitionResolver` doesn't need per-type factory calls here. Every join/leave-recompute call site +calls `ColorResolver.resolve(members, rep.group())` (see below) immediately before dispatching, and passes the +resolved `lineColor`/`fillColor` into `createSetMultiPointAction` as explicit parameters (`fillColor` is `null` for +`LINE`, via `hasFill(kind)`) — `ActionFactory` no longer reads `markerGroup.lineColor()`/`fillColor()` itself for +this factory method, keeping it a dumb builder while `SignTransitionResolver` owns colour resolution. These call +sites also pass `rep.detail()` (not `rep.label()`) as the dispatched detail text — fixing a bug where a +`LINE`/`SHAPE`/`EXTRUDE` marker's rendered detail was always just its label repeated, since detail text on these +signs was never actually threaded through. ### Conflict resolution: `ColorResolver` (player-controlled marker colours, GitHub issue #198) @@ -742,5 +748,5 @@ gating" section. This section covers the code-level mechanics. themselves are otherwise unchanged — the fix is localized to `prepareGated`. --- -*Last updated: 2026-09-12 | Verified against: feature/tpwalke2/209-bluemapapiconnector (40f2273)* +*Last updated: 2026-09-12 | Verified against: feature/tpwalke2/209-signtransitionresolver (4d45867)* diff --git a/agent-context/context/testing.md b/agent-context/context/testing.md index 7252fbd..0aece3f 100644 --- a/agent-context/context/testing.md +++ b/agent-context/context/testing.md @@ -154,7 +154,8 @@ As of `main` (`b2c5fa0`), `src/test/java/com/tpwalke2/bluemapsignmarkers/`: reload-forced), and the full cross-type bundling matrix (POI↔SHAPE, LINE↔SHAPE) both for a live sign change and for a config-reload-driven type flip/rename (`groupIdentityObsolete`). `EXTRUDE` coverage mirrors `SHAPE`'s exactly (same `EXTRUDE_MIN_MEMBERS = 3` threshold, same no-op/first-appearance/recompute/cross-type-bundling - shape), confirming `extrudeJoinAction`/`extrudeLeaveAction` behave identically to their `SHAPE` counterparts. Every + shape), confirming the shared `multiPointJoinAction`/`multiPointLeaveAction` (§209 collapse, see `core-pipeline.md` + §3) behave identically for `EXTRUDE` as for `SHAPE`. Every `LINE`/`SHAPE`/`EXTRUDE` dispatched-`Set` assertion now checks `set.getDetail()` against each member's *own* detail text, not the group label — this test-suite-wide update caught the `rep.label()`-passed-as-detail bug fixed alongside GitHub issue #198 (see `core-pipeline.md` §3's join/leave paragraph). Player-controlled colours @@ -392,5 +393,5 @@ workflow jobs also now declare an explicit `permissions: contents: read` (least- the repo's default token permissions), and `publish.yml`'s job runs under a `modrinth-publish` GitHub Environment. --- -*Last updated: 2026-09-12 | Verified against: feature/tpwalke2/209-bluemapapiconnector (40f2273)* +*Last updated: 2026-09-12 | Verified against: feature/tpwalke2/209-signtransitionresolver (4d45867)* diff --git a/src/main/java/com/tpwalke2/bluemapsignmarkers/core/signs/SignTransitionResolver.java b/src/main/java/com/tpwalke2/bluemapsignmarkers/core/signs/SignTransitionResolver.java index 33a1873..16e61cc 100644 --- a/src/main/java/com/tpwalke2/bluemapsignmarkers/core/signs/SignTransitionResolver.java +++ b/src/main/java/com/tpwalke2/bluemapsignmarkers/core/signs/SignTransitionResolver.java @@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Objects; @@ -138,9 +139,9 @@ static MarkerAction computeTransitionAction( private static MarkerAction leaveEffect(Supplier> allSignsSupplier, SignEntryKey key, Representation rep, ActionFactory actionFactory, Map currentPrefixGroupMap) { return switch (rep.group().type()) { case POI -> actionFactory.createRemovePOIAction(key.x(), key.y(), key.z(), key.parentMap(), rep.group()); - case LINE -> lineLeaveAction(allSignsSupplier, key.parentMap(), rep, actionFactory, currentPrefixGroupMap); - case SHAPE -> shapeLeaveAction(allSignsSupplier, key.parentMap(), rep, actionFactory, currentPrefixGroupMap); - case EXTRUDE -> extrudeLeaveAction(allSignsSupplier, key.parentMap(), rep, actionFactory, currentPrefixGroupMap); + case LINE -> multiPointLeaveAction(allSignsSupplier, key.parentMap(), rep, actionFactory, currentPrefixGroupMap, LineGroupResolver::members, LINE_MIN_MEMBERS, MarkerGroupType.LINE); + case SHAPE -> multiPointLeaveAction(allSignsSupplier, key.parentMap(), rep, actionFactory, currentPrefixGroupMap, ShapeGroupResolver::members, SHAPE_MIN_MEMBERS, MarkerGroupType.SHAPE); + case EXTRUDE -> multiPointLeaveAction(allSignsSupplier, key.parentMap(), rep, actionFactory, currentPrefixGroupMap, ExtrudeGroupResolver::members, EXTRUDE_MIN_MEMBERS, MarkerGroupType.EXTRUDE); }; } @@ -164,115 +165,65 @@ private static boolean groupIdentityObsolete(Representation rep, Map> allSignsSupplier, SignEntryKey key, Representation rep, ActionFactory actionFactory, boolean sameGroupRecompute) { return switch (rep.group().type()) { case POI -> actionFactory.createAddPOIAction(key.x(), key.y(), key.z(), key.parentMap(), rep.label(), rep.detail(), rep.group()); - case LINE -> lineJoinAction(allSignsSupplier, key.parentMap(), rep, actionFactory, sameGroupRecompute); - case SHAPE -> shapeJoinAction(allSignsSupplier, key.parentMap(), rep, actionFactory, sameGroupRecompute); - case EXTRUDE -> extrudeJoinAction(allSignsSupplier, key.parentMap(), rep, actionFactory, sameGroupRecompute); + case LINE -> multiPointJoinAction(allSignsSupplier, key.parentMap(), rep, actionFactory, sameGroupRecompute, LineGroupResolver::members, LINE_MIN_MEMBERS, MarkerGroupType.LINE); + case SHAPE -> multiPointJoinAction(allSignsSupplier, key.parentMap(), rep, actionFactory, sameGroupRecompute, ShapeGroupResolver::members, SHAPE_MIN_MEMBERS, MarkerGroupType.SHAPE); + case EXTRUDE -> multiPointJoinAction(allSignsSupplier, key.parentMap(), rep, actionFactory, sameGroupRecompute, ExtrudeGroupResolver::members, EXTRUDE_MIN_MEMBERS, MarkerGroupType.EXTRUDE); }; } - // Recomputes a line group including the current sign (it must already be in signCache under this - // group/label by the time this is called). Dispatches Set once ≥2 members exist; below that the line - // is still incomplete and nothing is dispatched. sameGroupRecompute forces isFirstAppearance=false, - // since it's used both for same-group/label recomputes (only reachable at ≥2 members if a marker - // already existed) and for reload-forced recreates (isFirstAppearance is log-only there, so the - // false value is harmless either way). - private static MarkerAction lineJoinAction(Supplier> allSignsSupplier, String parentMap, Representation rep, ActionFactory actionFactory, boolean sameGroupRecompute) { - var members = LineGroupResolver.members(allSignsSupplier.get(), parentMap, rep.group().prefix(), rep.label()); - if (members.size() < LINE_MIN_MEMBERS) return null; - - var isFirstAppearance = !sameGroupRecompute && members.size() == LINE_MIN_MEMBERS; - var colors = ColorResolver.resolve(members, rep.group()); - return actionFactory.createSetMultiPointAction(parentMap, rep.group(), rep.label(), rep.detail(), toPoints(members), colors.lineColor(), null, isFirstAppearance); + @FunctionalInterface + private interface GroupResolver { + List members(Collection allSigns, String parentMap, String prefix, String label); } - // Recomputes a line group excluding the current sign (it must already be removed from/no longer - // present in signCache under this group/label by the time this is called). Dispatches Set if ≥2 - // members remain, Remove if it drops below 2 and a marker existed before (i.e. exactly 1 remains - - // meaning there were 2 before), or nothing if there was never a marker to begin with (0 remain). - private static MarkerAction lineLeaveAction(Supplier> allSignsSupplier, String parentMap, Representation rep, ActionFactory actionFactory, Map currentPrefixGroupMap) { - if (groupIdentityObsolete(rep, currentPrefixGroupMap)) { - return actionFactory.createRemoveMultiPointAction(parentMap, rep.group(), rep.label()); - } - - var members = LineGroupResolver.members(allSignsSupplier.get(), parentMap, rep.group().prefix(), rep.label()); - - if (members.size() >= LINE_MIN_MEMBERS) { - var colors = ColorResolver.resolve(members, rep.group()); - return actionFactory.createSetMultiPointAction(parentMap, rep.group(), rep.label(), rep.detail(), toPoints(members), colors.lineColor(), null, false); - } - - if (members.size() == LINE_MIN_MEMBERS - 1) { - return actionFactory.createRemoveMultiPointAction(parentMap, rep.group(), rep.label()); - } - - return null; + // Only LINE has no fill (a stroke-only marker); SHAPE/EXTRUDE both anchor a floor/ceiling from their + // members' Y range and so need ColorResolver's fillColor alongside its lineColor. + private static boolean hasFill(MarkerGroupType kind) { + return kind != MarkerGroupType.LINE; } - private static List toPoints(List members) { - return members.stream().map(e -> new LinePoint(e.key().x(), e.key().y(), e.key().z())).toList(); - } - - // SHAPE mirrors LINE's join/leave/recompute shape (see lineJoinAction/lineLeaveAction above), but at a - // 3-member render threshold instead of 2 - see docs/adr/0002-shape-duplicates-line-pattern.md. Points - // stay ordered by createdAtMillis (toPoints/ShapeGroupResolver.members) purely for polygon vertex order; - // the shape's Y anchor (BlueMapAPIConnector.setShapeMarker) is the tallest member, not the oldest. - private static MarkerAction shapeJoinAction(Supplier> allSignsSupplier, String parentMap, Representation rep, ActionFactory actionFactory, boolean sameGroupRecompute) { - var members = ShapeGroupResolver.members(allSignsSupplier.get(), parentMap, rep.group().prefix(), rep.label()); - if (members.size() < SHAPE_MIN_MEMBERS) return null; - - var isFirstAppearance = !sameGroupRecompute && members.size() == SHAPE_MIN_MEMBERS; + // Recomputes a LINE/SHAPE/EXTRUDE group including the current sign (it must already be in signCache + // under this group/label by the time this is called). Dispatches Set once the kind's member threshold + // is met; below that the marker is still incomplete and nothing is dispatched. sameGroupRecompute + // forces isFirstAppearance=false, since it's used both for same-group/label recomputes (only reachable + // at/above threshold if a marker already existed) and for reload-forced recreates (isFirstAppearance is + // log-only there, so the false value is harmless either way). + private static MarkerAction multiPointJoinAction(Supplier> allSignsSupplier, String parentMap, Representation rep, ActionFactory actionFactory, boolean sameGroupRecompute, GroupResolver resolver, int minMembers, MarkerGroupType kind) { + var members = resolver.members(allSignsSupplier.get(), parentMap, rep.group().prefix(), rep.label()); + if (members.size() < minMembers) return null; + + var isFirstAppearance = !sameGroupRecompute && members.size() == minMembers; var colors = ColorResolver.resolve(members, rep.group()); - return actionFactory.createSetMultiPointAction(parentMap, rep.group(), rep.label(), rep.detail(), toPoints(members), colors.lineColor(), colors.fillColor(), isFirstAppearance); + return actionFactory.createSetMultiPointAction(parentMap, rep.group(), rep.label(), rep.detail(), toPoints(members), colors.lineColor(), hasFill(kind) ? colors.fillColor() : null, isFirstAppearance); } - private static MarkerAction shapeLeaveAction(Supplier> allSignsSupplier, String parentMap, Representation rep, ActionFactory actionFactory, Map currentPrefixGroupMap) { + // Recomputes a LINE/SHAPE/EXTRUDE group excluding the current sign (it must already be removed + // from/no longer present in signCache under this group/label by the time this is called). Dispatches + // Set if the kind's member threshold is still met, Remove if it drops one below that (i.e. a marker + // existed before), or nothing if there was never a marker to begin with. + private static MarkerAction multiPointLeaveAction(Supplier> allSignsSupplier, String parentMap, Representation rep, ActionFactory actionFactory, Map currentPrefixGroupMap, GroupResolver resolver, int minMembers, MarkerGroupType kind) { if (groupIdentityObsolete(rep, currentPrefixGroupMap)) { return actionFactory.createRemoveMultiPointAction(parentMap, rep.group(), rep.label()); } - var members = ShapeGroupResolver.members(allSignsSupplier.get(), parentMap, rep.group().prefix(), rep.label()); + var members = resolver.members(allSignsSupplier.get(), parentMap, rep.group().prefix(), rep.label()); - if (members.size() >= SHAPE_MIN_MEMBERS) { + if (members.size() >= minMembers) { var colors = ColorResolver.resolve(members, rep.group()); - return actionFactory.createSetMultiPointAction(parentMap, rep.group(), rep.label(), rep.detail(), toPoints(members), colors.lineColor(), colors.fillColor(), false); + return actionFactory.createSetMultiPointAction(parentMap, rep.group(), rep.label(), rep.detail(), toPoints(members), colors.lineColor(), hasFill(kind) ? colors.fillColor() : null, false); } - if (members.size() == SHAPE_MIN_MEMBERS - 1) { + if (members.size() == minMembers - 1) { return actionFactory.createRemoveMultiPointAction(parentMap, rep.group(), rep.label()); } return null; } - // EXTRUDE mirrors SHAPE's join/leave/recompute shape (see shapeJoinAction/shapeLeaveAction above) at the - // same 3-member render threshold - the floor/ceiling Y values are computed from the ordered points at - // dispatch time (BlueMapAPIConnector.setExtrudeMarker), not here. - - private static MarkerAction extrudeJoinAction(Supplier> allSignsSupplier, String parentMap, Representation rep, ActionFactory actionFactory, boolean sameGroupRecompute) { - var members = ExtrudeGroupResolver.members(allSignsSupplier.get(), parentMap, rep.group().prefix(), rep.label()); - if (members.size() < EXTRUDE_MIN_MEMBERS) return null; - - var isFirstAppearance = !sameGroupRecompute && members.size() == EXTRUDE_MIN_MEMBERS; - var colors = ColorResolver.resolve(members, rep.group()); - return actionFactory.createSetMultiPointAction(parentMap, rep.group(), rep.label(), rep.detail(), toPoints(members), colors.lineColor(), colors.fillColor(), isFirstAppearance); - } - - private static MarkerAction extrudeLeaveAction(Supplier> allSignsSupplier, String parentMap, Representation rep, ActionFactory actionFactory, Map currentPrefixGroupMap) { - if (groupIdentityObsolete(rep, currentPrefixGroupMap)) { - return actionFactory.createRemoveMultiPointAction(parentMap, rep.group(), rep.label()); - } - - var members = ExtrudeGroupResolver.members(allSignsSupplier.get(), parentMap, rep.group().prefix(), rep.label()); - - if (members.size() >= EXTRUDE_MIN_MEMBERS) { - var colors = ColorResolver.resolve(members, rep.group()); - return actionFactory.createSetMultiPointAction(parentMap, rep.group(), rep.label(), rep.detail(), toPoints(members), colors.lineColor(), colors.fillColor(), false); - } - - if (members.size() == EXTRUDE_MIN_MEMBERS - 1) { - return actionFactory.createRemoveMultiPointAction(parentMap, rep.group(), rep.label()); - } - - return null; + // Points stay ordered by createdAtMillis (the GroupResolver.members contract) purely for polygon/line + // vertex order; a SHAPE/EXTRUDE's Y anchor (BlueMapAPIConnector.setShapeMarker/setExtrudeMarker) is the + // tallest member, not the oldest. + private static List toPoints(List members) { + return members.stream().map(e -> new LinePoint(e.key().x(), e.key().y(), e.key().z())).toList(); } }