FEAT - FOUNDRY: activate sector workspace

This commit is contained in:
Codex
2026-08-08 14:09:51 +03:00
parent 30c9b8c5fd
commit 58800d9576
10 changed files with 675 additions and 80 deletions
+26 -1
View File
@@ -34,7 +34,32 @@ test("joined detail aspects do not become independent map layers", async () => {
assert.match(preview, /dataProductBindings\.filter\(\(binding\) => !binding\.joinToBindingId\)/);
assert.match(preview, /runtimeBindings\.filter\(\(binding\) => primaryBindingIds\.has\(binding\.bindingId\)\)/);
assert.match(preview, /runtimeBindings=\{\[\.\.\.primaryRuntimeBindings, \.\.\.referenceRuntimeBindings\]\}/);
assert.match(preview, /runtimeBindings=\{\[\.\.\.sectorScopedPrimaryRuntimeBindings, \.\.\.referenceRuntimeBindings\]\}/);
});
test("map windows share one bounded activation and z-index stack", async () => {
const preview = await readFile(new URL("../apps/catalog/src/MapFixturePreview.tsx", import.meta.url), "utf8");
assert.match(preview, /type MapWorkspaceWindowId = "settings" \| "layers" \| "sector" \| "subject-card" \| `binding:\$\{string\}`/);
assert.match(preview, /const activateWorkspaceWindow = useCallback/);
assert.match(preview, /settingsWindowZIndex[\s\S]*layersWindowZIndex[\s\S]*sectorWindowZIndex[\s\S]*subjectCardZIndex/);
assert.match(preview, /title="Настройки карты"[\s\S]*active=\{activeWorkspaceWindowId === "settings"\}/);
assert.doesNotMatch(preview, /<Window\b/);
});
test("an active sector scopes point facts, exposes data facets and deactivates on close", async () => {
const preview = await readFile(new URL("../apps/catalog/src/MapFixturePreview.tsx", import.meta.url), "utf8");
assert.match(preview, /function mapFactInsideGridSector/);
assert.match(preview, /localSectorAtGeodetic/);
assert.match(preview, /label="Скрыть объекты за сектором"/);
assert.match(preview, />Домены данных</);
assert.match(preview, />Провайдеры</);
assert.match(preview, />Типы объектов</);
assert.match(preview, />Объекты сектора</);
assert.match(preview, /onClose=\{deactivateGridSector\}/);
assert.match(preview, />\s*Деактивировать сектор\s*</);
assert.match(preview, /setSelectedGridSector\(null\)/);
});
test("reference stations are first-class Objects menu layers without provider settings actions", async () => {
+2 -2
View File
@@ -109,7 +109,7 @@ test("interactive deselect preserves other values and facet constraints", () =>
});
});
test("chips from different facets form one global union", () => {
test("chips are OR within one facet and AND between facets", () => {
const filters = {
fleet: {
visible: true,
@@ -121,7 +121,7 @@ test("chips from different facets form one global union", () => {
};
assert.equal(mapFactMatchesFilters(onlineMoving, profile, filters, "fleet"), true);
assert.equal(mapFactMatchesFilters({ attributes: { signal_state: "active", movement_state: "stopped" } }, profile, filters, "fleet"), true);
assert.equal(mapFactMatchesFilters({ attributes: { signal_state: "active", movement_state: "stopped" } }, profile, filters, "fleet"), false);
assert.equal(mapFactMatchesFilters({ attributes: { signal_state: "inactive", movement_state: "moving" } }, profile, filters, "fleet"), false);
});
+29
View File
@@ -4,15 +4,19 @@ import {
ArcType,
ApproximateTerrainHeights,
Cartesian3,
Ellipsoid,
GroundPolylineGeometry,
Matrix4,
Math as CesiumMath,
PolylineGeometry,
Transforms,
} from "cesium";
import {
alignedGridValues,
boundedAngularParts,
fixedGridOrigin,
geodeticRectangleAreaSquareMeters,
geodeticToLocalGridPlane,
graticuleGranularity,
graticuleLinePlan,
graticuleMajorTileAt,
@@ -42,6 +46,7 @@ import {
localParentSector,
localSectorAreaSquareMeters,
localSectorAt,
localSectorAtGeodetic,
localSectorBounds,
localSectorNeighbors,
localSectorSummary,
@@ -108,6 +113,30 @@ test("local sectors use half-open floor boundaries on both sides of the ENU orig
);
});
test("WGS84 positions use the same tangent-plane address as Cesium sector picking", () => {
const origin = Cartesian3.fromDegrees(localDefinition.originLongitude, localDefinition.originLatitude, 0);
const inverseEnu = Matrix4.inverse(Transforms.eastNorthUpToFixedFrame(origin), new Matrix4());
const point = { longitude: 37.645, latitude: 55.773 };
const worldPosition = Cartesian3.fromDegrees(point.longitude, point.latitude, 0);
const surface = Ellipsoid.WGS84.scaleToGeodeticSurface(worldPosition, new Cartesian3());
const normal = Ellipsoid.WGS84.geodeticSurfaceNormal(surface, new Cartesian3());
const localSurface = Matrix4.multiplyByPoint(inverseEnu, surface, new Cartesian3());
const localNormal = Matrix4.multiplyByPointAsVector(inverseEnu, normal, new Cartesian3());
const normalScale = -localSurface.z / localNormal.z;
const expected = {
eastMeters: localSurface.x + localNormal.x * normalScale,
northMeters: localSurface.y + localNormal.y * normalScale,
};
const actual = geodeticToLocalGridPlane(point, localDefinition);
assert.ok(Math.abs(actual.eastMeters - expected.eastMeters) < 1e-6);
assert.ok(Math.abs(actual.northMeters - expected.northMeters) < 1e-6);
assert.equal(
localSectorAtGeodetic(point, localDefinition).id,
localSectorAt(expected, localDefinition).id,
);
});
test("local sector IDs and bounds stay stable across calls and normalized equivalent origins", () => {
const first = localSectorAt({ eastMeters: -1, northMeters: 2_500 }, localDefinition);
const second = localSectorAt({ eastMeters: -1, northMeters: 2_500 }, {