From 5a0f2b32674ffdc85bc4b9f1dbb21d7bd7a55761 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期六, 19 十月 2024 17:08:27 +0800 Subject: [PATCH] # --- zy-acs-flow/src/map/tool.js | 37 ++++++++++++++++++++++++++++++++++--- 1 files changed, 34 insertions(+), 3 deletions(-) diff --git a/zy-acs-flow/src/map/tool.js b/zy-acs-flow/src/map/tool.js index 05c3f3c..e47361a 100644 --- a/zy-acs-flow/src/map/tool.js +++ b/zy-acs-flow/src/map/tool.js @@ -7,7 +7,10 @@ DEVICE_SPRITE_TINT, DEVICE_SELECTED_EFFECT_PADDING, DEVICE_SELECTED_EFFECT_COLOR, + POINT_ROUTE_DIRECTION, } from './constants'; +import { getRouteList } from './http'; +import PointRoute from "./PointRoute"; import shelf from '/map/shelf.svg'; import charge from '/map/charge.svg'; @@ -304,16 +307,16 @@ const style = new PIXI.TextStyle({ fontFamily: 'Roboto', fontSize: 12, - fill: '#000000', + fill: themeMode === 'light' ? '#000' : '#eee', }); const text = new PIXI.Text(`${sprite.data?.type} ${sprite.data?.no}`, style); const background = new PIXI.Graphics(); // shadow - background.beginFill(0x000000, 0.1); + background.beginFill(themeMode === 'light' ? '#000' : '#eee', 0.1); background.drawRoundedRect(4, 4, text.width + 6, text.height + 6, 4); background.endFill(); // background - background.beginFill(0xffffff, 1); + background.beginFill(themeMode === 'light' ? '#fff' : '#333', 1); background.drawRoundedRect(0, 0, text.width + 8, text.height + 8, 4); background.endFill(); @@ -467,6 +470,34 @@ effectCircle.position.set(selectedSprite.x, selectedSprite.y); }; +export const showRoutes = (curZone, setShowRoutes) => { + setShowRoutes(true); + getRouteList(curZone, (routeList) => { + routeList.forEach(route => { + const startPoint = querySprite(DEVICE_TYPE.POINT, route.startCodeStr); + const endPoint = querySprite(DEVICE_TYPE.POINT, route.endCodeStr); + const pointRoute = new PointRoute(POINT_ROUTE_DIRECTION[route.direction]); + pointRoute.setPoint(startPoint, endPoint); + pointRoute.clear(); + pointRoute.lineStyle(10, 0x2d3436); + pointRoute.moveTo(startPoint.position.x, startPoint.position.y); + pointRoute.lineTo(endPoint.position.x, endPoint.position.y); + pointRoute.alpha = 1; + mapContainer.addChild(pointRoute); + }) + }) +}; + +export const hideRoutes = (curZone, setShowRoutes) => { + setShowRoutes(false); + for (let i = mapContainer.children.length - 1; i >= 0; i--) { + const child = mapContainer.children[i]; + if (child?.type === DEVICE_TYPE.ROUTE) { + mapContainer.removeChild(child); + } + } +} + export const multipleSelectEnhancer = (selectedSprites, setCurSprite, setBatchSprites) => { selectedSprites = selectedSprites.filter(sprite => sprite.data?.type); -- Gitblit v1.9.1