feat(map): add five-source drainage styling

This commit is contained in:
2026-07-10 18:45:43 +08:00
parent 2258177726
commit 513c403017
19 changed files with 1303 additions and 182 deletions
+16 -5
View File
@@ -15,6 +15,7 @@ import {
getResponsiveWorkbenchPadding
} from "../map/camera";
import { waterNetworkLayers } from "../map/layers";
import { MAP_MAX_ZOOM } from "../map/map-layer-visuals";
import { setSimulationLayersVisibility } from "../map/simulation-layers";
import {
createBaseStyle,
@@ -36,6 +37,7 @@ type UseWorkbenchMapOptions = {
rightPanelOpen: boolean;
impactVisible: boolean;
onSelectFeature: (feature: DetailFeature) => void;
selectedFeature: DetailFeature | null;
};
type UseWorkbenchMapResult = {
@@ -64,8 +66,11 @@ const SOURCE_STATUS_LABELS: Record<string, string> = {
const SOURCE_GROUP_BY_ID: Record<string, string> = {
"mapbox-light": "mapbox-base",
"mapbox-satellite": "mapbox-base",
pipes: "geoserver-mvt",
conduits: "geoserver-mvt",
junctions: "geoserver-mvt",
orifices: "geoserver-mvt",
outfalls: "geoserver-mvt",
pumps: "geoserver-mvt",
[SIMULATION_SOURCE_IDS.impactArea]: "annotation-source",
[SIMULATION_SOURCE_IDS.annotations]: "annotation-source"
};
@@ -75,7 +80,8 @@ export function useWorkbenchMap({
leftPanelOpen,
rightPanelOpen,
impactVisible,
onSelectFeature
onSelectFeature,
selectedFeature
}: UseWorkbenchMapOptions): UseWorkbenchMapResult {
const mapRef = useRef<MapLibreMap | null>(null);
const impactVisibleRef = useRef(impactVisible);
@@ -104,6 +110,7 @@ export function useWorkbenchMap({
style: createBaseStyle(mapboxToken),
pitch: 0,
bearing: 0,
maxZoom: MAP_MAX_ZOOM,
preserveDrawingBuffer: true,
attributionControl: false
});
@@ -113,8 +120,11 @@ export function useWorkbenchMap({
map.on("load", () => {
map.resize();
const sources = createWaterNetworkSources();
map.addSource("pipes", sources.pipes);
map.addSource("conduits", sources.conduits);
map.addSource("junctions", sources.junctions);
map.addSource("orifices", sources.orifices);
map.addSource("outfalls", sources.outfalls);
map.addSource("pumps", sources.pumps);
map.addSource(SIMULATION_SOURCE_IDS.impactArea, simulationSources.impactArea);
map.addSource(SIMULATION_SOURCE_IDS.annotations, simulationSources.annotations);
waterNetworkLayers.forEach((layer) => map.addLayer(layer));
@@ -165,7 +175,8 @@ export function useWorkbenchMap({
useMapInteractions({
mapRef,
mapReady,
onSelectFeature
onSelectFeature,
selectedFeature
});
useEffect(() => {
@@ -278,7 +289,7 @@ function getSourceStatusMessage(sourceGroupId: string, status: WorkbenchSourceSt
}
if (sourceGroupId === "geoserver-mvt") {
return status === "online" ? "管线和节点矢量瓦片已加载。" : "管线或节点瓦片请求中断,当前视图可能不完整。";
return status === "online" ? "排水管网矢量瓦片已加载。" : "排水管网瓦片请求中断,当前视图可能不完整。";
}
if (sourceGroupId === "annotation-source") {