feat(module-studio): add configurable map page

This commit is contained in:
DCCONSTRUCTIONS
2026-07-13 17:14:34 +03:00
parent 1f2dffc031
commit 1a2ca8c82c
23 changed files with 2700 additions and 31 deletions
@@ -0,0 +1,31 @@
{
"schemaVersion": "0.1.0",
"fixtureId": "map.empty-offline",
"template": { "id": "map", "version": "0.1.0" },
"title": "Empty offline spatial scene",
"description": "Acceptance state proving that the page shell remains usable without provider data or live entity streams.",
"state": "offline",
"viewport": {
"center": [37.6176, 55.7558, 250],
"heading": 0,
"pitch": -45,
"range": 18000
},
"capabilities": ["camera", "selection"],
"styleProfiles": [],
"scene": {
"layers": [],
"places": [],
"movingObjects": [],
"stations": [],
"routes": [],
"tracks": [],
"zones": []
},
"selection": { "entityId": null },
"acceptance": [
{ "id": "state.offline-shell", "expect": ["Header, navigation, Inspector entry and retry action remain available."] },
{ "id": "state.no-phantom-data", "expect": ["The renderer does not retain entities from a previously opened scene."] },
{ "id": "state.explainable", "expect": ["The page distinguishes offline from loading, empty and error states."] }
]
}
@@ -0,0 +1,71 @@
{
"schemaVersion": "0.1.0",
"template": { "id": "map", "version": "0.1.0" },
"metric": "camera-range-meters",
"intervalRule": "min-inclusive-max-exclusive",
"policies": [
{
"id": "grid.planetary",
"target": "grid",
"outsideRange": "nearest-band",
"hysteresisRatio": 0.08,
"bands": [
{ "id": "local", "minRange": 0, "maxRange": 40000, "representation": "geometry", "styleVariant": "grid-local", "density": 1 },
{ "id": "district", "minRange": 40000, "maxRange": 180000, "representation": "geometry", "styleVariant": "grid-district", "density": 0.5 },
{ "id": "regional", "minRange": 180000, "maxRange": 700000, "representation": "geometry", "styleVariant": "grid-regional", "density": 0.2 },
{ "id": "continental", "minRange": 700000, "maxRange": 3000000, "representation": "geometry", "styleVariant": "grid-continental", "density": 0.08 },
{ "id": "planetary", "minRange": 3000000, "maxRange": 50000000, "representation": "geometry", "styleVariant": "grid-planetary", "density": 0.02 }
]
},
{
"id": "place.city",
"target": "place",
"outsideRange": "hidden",
"hysteresisRatio": 0.1,
"bands": [
{ "id": "regional", "minRange": 100000, "maxRange": 900000, "representation": "standard", "styleVariant": "place-medium" },
{ "id": "planetary", "minRange": 900000, "maxRange": 50000000, "representation": "summary", "styleVariant": "place-large" }
]
},
{
"id": "moving-object.transport",
"target": "moving-object",
"outsideRange": "hidden",
"hysteresisRatio": 0.08,
"bands": [
{ "id": "detail", "minRange": 0, "maxRange": 15000, "representation": "detailed", "styleVariant": "transport-detail", "maxItems": 2500 },
{ "id": "standard", "minRange": 15000, "maxRange": 70000, "representation": "standard", "styleVariant": "transport-standard", "maxItems": 1500 },
{ "id": "cluster", "minRange": 70000, "maxRange": 300000, "representation": "cluster", "styleVariant": "transport-cluster", "maxItems": 400 }
]
},
{
"id": "station.transport",
"target": "station",
"outsideRange": "hidden",
"hysteresisRatio": 0.08,
"bands": [
{ "id": "detail", "minRange": 0, "maxRange": 30000, "representation": "detailed", "styleVariant": "station-detail" },
{ "id": "standard", "minRange": 30000, "maxRange": 120000, "representation": "standard", "styleVariant": "station-standard" }
]
},
{
"id": "zone.operational",
"target": "zone",
"outsideRange": "hidden",
"hysteresisRatio": 0.05,
"bands": [
{ "id": "geometry", "minRange": 0, "maxRange": 100000, "representation": "geometry", "styleVariant": "zone-geometry", "maxItems": 500 },
{ "id": "summary", "minRange": 100000, "maxRange": 500000, "representation": "summary", "styleVariant": "zone-summary", "maxItems": 100 }
]
},
{
"id": "track.rail",
"target": "track",
"outsideRange": "hidden",
"hysteresisRatio": 0.05,
"bands": [
{ "id": "geometry", "minRange": 0, "maxRange": 600000, "representation": "geometry", "styleVariant": "rail-track" }
]
}
]
}
@@ -0,0 +1,128 @@
{
"schemaVersion": "0.1.0",
"fixtureId": "map.operational",
"template": { "id": "map", "version": "0.1.0" },
"title": "Operational spatial scene",
"description": "Minimal provider-neutral scene covering the reusable spatial entities already proven in NODE.DC Engine.",
"state": "ready",
"viewport": {
"center": [37.6176, 55.7558, 250],
"heading": 15,
"pitch": -42,
"range": 18000
},
"capabilities": ["camera", "base-layer", "buildings", "grid", "labels", "pins", "moving-objects", "traces", "routes", "tracks", "stations", "zones", "selection"],
"styleProfiles": [
{ "id": "layer.base.neutral", "kind": "layer", "variant": "neutral-dark", "opacity": 1 },
{ "id": "layer.buildings.default", "kind": "layer", "variant": "extruded-neutral", "opacity": 0.86 },
{ "id": "grid.planetary.major", "kind": "grid", "variant": "major", "color": "#8f72dc", "opacity": 0.48, "width": 1 },
{ "id": "label.place.large", "kind": "label", "variant": "place-large", "color": "#ffffff", "opacity": 1, "size": 28 },
{ "id": "label.entity.compact", "kind": "label", "variant": "entity-compact", "color": "#ffffff", "opacity": 0.92, "size": 13 },
{ "id": "label.station.medium", "kind": "label", "variant": "station-medium", "color": "#ffffff", "opacity": 0.95, "size": 16 },
{ "id": "pin.transport.active", "kind": "pin", "variant": "transport-active", "color": "#ff2f92", "opacity": 1, "size": 22 },
{ "id": "pin.station.metro", "kind": "pin", "variant": "station-metro", "color": "#8f72dc", "opacity": 1, "size": 26 },
{ "id": "pin.station.rail", "kind": "pin", "variant": "station-rail", "color": "#ffffff", "opacity": 1, "size": 22 },
{ "id": "line.route.primary", "kind": "line", "variant": "route-primary", "color": "#ff2f92", "opacity": 0.9, "width": 4 },
{ "id": "line.track.rail", "kind": "line", "variant": "track-rail", "color": "#8f72dc", "opacity": 0.8, "width": 2 },
{ "id": "fill.zone.operational", "kind": "fill", "variant": "operational-zone", "color": "#ff2f92", "opacity": 0.22 }
],
"scene": {
"layers": [
{ "id": "base.default", "type": "base", "visible": true, "mode": "surface", "styleProfileId": "layer.base.neutral" },
{ "id": "buildings.default", "type": "buildings", "visible": true, "mode": "volume", "styleProfileId": "layer.buildings.default", "visibility": { "minRange": 0, "maxRange": 70000 } },
{
"id": "grid.planetary",
"type": "grid",
"visible": true,
"mode": "graticule",
"styleProfileId": "grid.planetary.major",
"lodLevels": [
{ "level": 0, "minRange": 3000000, "maxRange": 50000000 },
{ "level": 1, "minRange": 700000, "maxRange": 3000000 },
{ "level": 2, "minRange": 180000, "maxRange": 700000 },
{ "level": 3, "minRange": 40000, "maxRange": 180000 },
{ "level": 4, "minRange": 0, "maxRange": 40000 }
]
}
],
"places": [
{
"id": "place.moscow",
"name": "Москва",
"position": [37.6176, 55.7558, 220],
"label": { "text": "МОСКВА", "styleProfileId": "label.place.large" },
"visibility": { "minRange": 100000, "maxRange": 50000000 }
}
],
"movingObjects": [
{
"id": "vehicle.tram.017",
"objectType": "tram",
"status": "active",
"position": [37.6242, 55.7604, 4],
"heading": 124,
"pinStyleProfileId": "pin.transport.active",
"label": { "text": "ТМ 17", "styleProfileId": "label.entity.compact" },
"trace": [[37.615, 55.756, 4], [37.619, 55.758, 4], [37.6242, 55.7604, 4]]
},
{
"id": "vehicle.rail.mcd2",
"objectType": "rail",
"status": "delayed",
"position": [37.579, 55.769, 4],
"heading": 82,
"pinStyleProfileId": "pin.transport.active",
"label": { "text": "МЦД-2 · +3 мин", "styleProfileId": "label.entity.compact" }
}
],
"stations": [
{
"id": "station.metro.tverskaya",
"stationType": "metro",
"position": [37.604, 55.7647, -20],
"pinStyleProfileId": "pin.station.metro",
"label": { "text": "Тверская", "styleProfileId": "label.station.medium" }
},
{
"id": "station.rail.rizhskaya",
"stationType": "rail",
"position": [37.6328, 55.7927, 4],
"pinStyleProfileId": "pin.station.rail",
"label": { "text": "Рижская", "styleProfileId": "label.station.medium" }
}
],
"routes": [
{
"id": "route.tram.017",
"coordinates": [[37.595, 55.748, 4], [37.607, 55.754, 4], [37.6242, 55.7604, 4], [37.64, 55.772, 4]],
"styleProfileId": "line.route.primary",
"label": { "text": "Маршрут 17", "styleProfileId": "label.entity.compact" }
}
],
"tracks": [
{
"id": "track.rail.north-east",
"coordinates": [[37.579, 55.769, 4], [37.606, 55.781, 4], [37.6328, 55.7927, 4]],
"styleProfileId": "line.track.rail"
}
],
"zones": [
{
"id": "zone.depot.control",
"geometry": {
"type": "Polygon",
"coordinates": [[[37.61, 55.752], [37.632, 55.752], [37.632, 55.765], [37.61, 55.765], [37.61, 55.752]]]
},
"styleProfileId": "fill.zone.operational",
"label": { "text": "Операционная зона", "styleProfileId": "label.entity.compact" }
}
]
},
"selection": { "entityId": "vehicle.tram.017" },
"acceptance": [
{ "id": "scene.provider-neutral", "expect": ["Scene contains no renderer credentials or provider-specific object types."] },
{ "id": "scene.shared-label-language", "expect": ["Places, vehicles, stations, routes and zones resolve labels through shared style profiles."] },
{ "id": "scene.grid-lod", "expect": ["Grid changes density through five non-overlapping range bands without disappearing at a boundary."] },
{ "id": "scene.selection", "expect": ["Selection resolves to an existing scene entity and can open the canonical Inspector."] }
]
}
+10 -1
View File
@@ -32,7 +32,16 @@
{ "id": "open-inspector", "label": "Inspector", "command": "map.inspector.open", "feature": "inspector" },
{ "id": "toggle-toolbar", "label": "Toolbar", "command": "map.toolbar.toggle", "feature": "toolbar" },
{ "id": "open-assistant", "label": "Assistant", "command": "assistant.open", "feature": "assistant" }
]
],
"contracts": {
"fixtureSchema": "registry/schemas/map-scene-fixture-v0.1.schema.json",
"acceptanceFixtures": [
"registry/fixtures/map/map-operational-v0.1.json",
"registry/fixtures/map/map-empty-offline-v0.1.json"
],
"lodPolicySchema": "registry/schemas/map-lod-policy-v0.1.schema.json",
"lodPolicies": "registry/fixtures/map/map-lod-policies-v0.1.json"
}
}
]
}
+3
View File
@@ -46,10 +46,13 @@
"candidates": "../docs/CANDIDATES.md",
"applicationTemplate": "../docs/APPLICATION_TEMPLATE.md",
"moduleStudio": "../docs/MODULE_STUDIO.md",
"mapTemplate": "../docs/MAP_TEMPLATE.md",
"icons": "../docs/ICONS.md",
"consumption": "../docs/CONSUMPTION.md"
},
"applicationManifestSchema": "schemas/application-manifest-v0.1.schema.json",
"designProfileSchema": "schemas/design-profile-v0.1.schema.json",
"mapSceneFixtureSchema": "schemas/map-scene-fixture-v0.1.schema.json",
"mapLodPolicySchema": "schemas/map-lod-policy-v0.1.schema.json",
"operatingRule": "Check this registry before creating a NODE.DC interface element. Reuse or extend the canonical export instead of creating an application-local copy."
}
@@ -0,0 +1,59 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://nodedc.ru/schemas/map-lod-policy-v0.1.schema.json",
"title": "NODE.DC Map LOD Policy v0.1",
"description": "Provider-neutral visibility and representation policy based on camera range in meters.",
"type": "object",
"additionalProperties": false,
"required": ["schemaVersion", "template", "metric", "intervalRule", "policies"],
"properties": {
"schemaVersion": { "const": "0.1.0" },
"template": {
"type": "object",
"additionalProperties": false,
"required": ["id", "version"],
"properties": {
"id": { "const": "map" },
"version": { "const": "0.1.0" }
}
},
"metric": { "const": "camera-range-meters" },
"intervalRule": { "const": "min-inclusive-max-exclusive" },
"policies": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["id", "target", "outsideRange", "hysteresisRatio", "bands"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"target": { "enum": ["grid", "place", "moving-object", "station", "route", "track", "zone", "label", "pin"] },
"outsideRange": { "enum": ["hidden", "nearest-band"] },
"hysteresisRatio": { "type": "number", "minimum": 0, "maximum": 0.5 },
"bands": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["id", "minRange", "maxRange", "representation"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"minRange": { "type": "number", "minimum": 0 },
"maxRange": { "type": "number", "exclusiveMinimum": 0 },
"representation": { "enum": ["hidden", "cluster", "summary", "compact", "standard", "detailed", "geometry"] },
"styleVariant": { "type": "string", "minLength": 1 },
"density": { "type": "number", "exclusiveMinimum": 0 },
"maxItems": { "type": "integer", "minimum": 1 }
}
}
}
}
}
}
},
"$defs": {
"id": { "type": "string", "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$" }
}
}
@@ -0,0 +1,223 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://nodedc.ru/schemas/map-scene-fixture-v0.1.schema.json",
"title": "NODE.DC Map Scene Fixture v0.1",
"description": "Provider-neutral acceptance scene for the canonical Map Page Template.",
"type": "object",
"additionalProperties": false,
"required": ["schemaVersion", "fixtureId", "template", "title", "state", "viewport", "capabilities", "styleProfiles", "scene", "selection", "acceptance"],
"properties": {
"schemaVersion": { "const": "0.1.0" },
"fixtureId": { "$ref": "#/$defs/id" },
"template": {
"type": "object",
"additionalProperties": false,
"required": ["id", "version"],
"properties": {
"id": { "const": "map" },
"version": { "const": "0.1.0" }
}
},
"title": { "type": "string", "minLength": 1, "maxLength": 120 },
"description": { "type": "string", "maxLength": 500 },
"state": { "enum": ["ready", "loading", "empty", "stale", "error", "offline"] },
"viewport": {
"type": "object",
"additionalProperties": false,
"required": ["center", "heading", "pitch", "range"],
"properties": {
"center": { "$ref": "#/$defs/position" },
"heading": { "type": "number", "minimum": 0, "maximum": 360 },
"pitch": { "type": "number", "minimum": -90, "maximum": 90 },
"range": { "type": "number", "exclusiveMinimum": 0 }
}
},
"capabilities": {
"type": "array",
"uniqueItems": true,
"items": {
"enum": ["camera", "base-layer", "buildings", "grid", "labels", "pins", "moving-objects", "traces", "routes", "tracks", "stations", "zones", "selection"]
}
},
"styleProfiles": {
"type": "array",
"items": { "$ref": "#/$defs/styleProfile" }
},
"scene": {
"type": "object",
"additionalProperties": false,
"required": ["layers", "places", "movingObjects", "stations", "routes", "tracks", "zones"],
"properties": {
"layers": { "type": "array", "items": { "$ref": "#/$defs/layer" } },
"places": { "type": "array", "items": { "$ref": "#/$defs/place" } },
"movingObjects": { "type": "array", "items": { "$ref": "#/$defs/movingObject" } },
"stations": { "type": "array", "items": { "$ref": "#/$defs/station" } },
"routes": { "type": "array", "items": { "$ref": "#/$defs/linearEntity" } },
"tracks": { "type": "array", "items": { "$ref": "#/$defs/linearEntity" } },
"zones": { "type": "array", "items": { "$ref": "#/$defs/zone" } }
}
},
"selection": {
"type": "object",
"additionalProperties": false,
"required": ["entityId"],
"properties": {
"entityId": { "type": ["string", "null"] }
}
},
"acceptance": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["id", "expect"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"expect": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 } }
}
}
}
},
"$defs": {
"id": { "type": "string", "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$" },
"position": {
"type": "array",
"minItems": 2,
"maxItems": 3,
"prefixItems": [
{ "type": "number", "minimum": -180, "maximum": 180 },
{ "type": "number", "minimum": -90, "maximum": 90 },
{ "type": "number" }
]
},
"styleProfile": {
"type": "object",
"additionalProperties": false,
"required": ["id", "kind", "variant"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"kind": { "enum": ["layer", "grid", "label", "pin", "line", "fill"] },
"variant": { "type": "string", "minLength": 1 },
"color": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
"opacity": { "type": "number", "minimum": 0, "maximum": 1 },
"width": { "type": "number", "exclusiveMinimum": 0 },
"size": { "type": "number", "exclusiveMinimum": 0 }
}
},
"visibility": {
"type": "object",
"additionalProperties": false,
"required": ["minRange", "maxRange"],
"properties": {
"minRange": { "type": "number", "minimum": 0 },
"maxRange": { "type": "number", "exclusiveMinimum": 0 }
}
},
"label": {
"type": "object",
"additionalProperties": false,
"required": ["text", "styleProfileId"],
"properties": {
"text": { "type": "string", "minLength": 1 },
"styleProfileId": { "$ref": "#/$defs/id" }
}
},
"layer": {
"type": "object",
"additionalProperties": false,
"required": ["id", "type", "visible", "styleProfileId"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"type": { "enum": ["base", "buildings", "grid"] },
"visible": { "type": "boolean" },
"mode": { "enum": ["surface", "volume", "graticule"] },
"styleProfileId": { "$ref": "#/$defs/id" },
"visibility": { "$ref": "#/$defs/visibility" },
"lodLevels": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["level", "minRange", "maxRange"],
"properties": {
"level": { "type": "integer", "minimum": 0 },
"minRange": { "type": "number", "minimum": 0 },
"maxRange": { "type": "number", "exclusiveMinimum": 0 }
}
}
}
}
},
"place": {
"type": "object",
"additionalProperties": false,
"required": ["id", "name", "position", "label", "visibility"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"name": { "type": "string", "minLength": 1 },
"position": { "$ref": "#/$defs/position" },
"label": { "$ref": "#/$defs/label" },
"visibility": { "$ref": "#/$defs/visibility" }
}
},
"movingObject": {
"type": "object",
"additionalProperties": false,
"required": ["id", "objectType", "status", "position", "heading", "pinStyleProfileId", "label"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"objectType": { "enum": ["rail", "metro", "tram", "bus", "vehicle", "drone", "generic"] },
"status": { "enum": ["active", "idle", "delayed", "warning", "offline", "unknown"] },
"position": { "$ref": "#/$defs/position" },
"heading": { "type": "number", "minimum": 0, "maximum": 360 },
"pinStyleProfileId": { "$ref": "#/$defs/id" },
"label": { "$ref": "#/$defs/label" },
"trace": { "type": "array", "minItems": 2, "items": { "$ref": "#/$defs/position" } }
}
},
"station": {
"type": "object",
"additionalProperties": false,
"required": ["id", "stationType", "position", "pinStyleProfileId", "label"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"stationType": { "enum": ["rail", "metro", "stop", "terminal", "generic"] },
"position": { "$ref": "#/$defs/position" },
"pinStyleProfileId": { "$ref": "#/$defs/id" },
"label": { "$ref": "#/$defs/label" }
}
},
"linearEntity": {
"type": "object",
"additionalProperties": false,
"required": ["id", "coordinates", "styleProfileId"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"coordinates": { "type": "array", "minItems": 2, "items": { "$ref": "#/$defs/position" } },
"styleProfileId": { "$ref": "#/$defs/id" },
"label": { "$ref": "#/$defs/label" }
}
},
"zone": {
"type": "object",
"additionalProperties": false,
"required": ["id", "geometry", "styleProfileId", "label"],
"properties": {
"id": { "$ref": "#/$defs/id" },
"geometry": {
"type": "object",
"additionalProperties": false,
"required": ["type", "coordinates"],
"properties": {
"type": { "enum": ["Polygon", "MultiPolygon"] },
"coordinates": { "type": "array", "minItems": 1 }
}
},
"styleProfileId": { "$ref": "#/$defs/id" },
"label": { "$ref": "#/$defs/label" }
}
}
}
}