#
luxiaotao1123
2025-01-08 36dcec12994c82fffe2a86a6acf12ecbd071fffb
zy-acs-flow/src/map/tool.js
@@ -1,14 +1,15 @@
import * as PIXI from 'pixi.js';
import * as TWEEDLE from 'tweedle.js';
import {
    MAP_DEFAULT_ROTATION,
    DEVICE_TYPE,
    DEVICE_Z_INDEX,
    AGV_STATUS_MODE,
    DEVICE_SPRITE_TINT,
    DEVICE_SPRITE_TINT_DARK,
    DEVICE_SELECTED_EFFECT_PADDING,
    DEVICE_SELECTED_EFFECT_COLOR,
    POINT_ROUTE_DIRECTION,
    DEVICE_SPRITE_TINT_DARK,
    ANIMATE_DURING_TIME,
} from './constants';
import { getRouteList } from './http';
@@ -54,19 +55,16 @@
export function setThemeMode(param) {
    themeMode = param;
    if (mapContainer) {
        // mapContainer.children.forEach(child => {
        //     const deviceType = child.data?.type;
        //     if (deviceType) {
        //         if (themeMode === 'dark') {
        //             const tint = DEVICE_SPRITE_TINT_DARK[deviceType]
        //             if (tint) {
        //                 child.tint = tint;
        //             }
        //         } else {
        //             DEVICE_SPRITE_TINT[deviceType] != null && (child.tint = DEVICE_SPRITE_TINT[deviceType]);
        //         }
        //     }
        // })
        mapContainer.children.forEach(child => {
            const deviceType = child.data?.type;
            if (deviceType) {
                if (themeMode === 'dark') {
                    DEVICE_SPRITE_TINT_DARK[deviceType] != null && (child.tint = DEVICE_SPRITE_TINT_DARK[deviceType]);
                } else {
                    DEVICE_SPRITE_TINT[deviceType] != null && (child.tint = DEVICE_SPRITE_TINT[deviceType]);
                }
            }
        })
    }
}
@@ -491,22 +489,30 @@
    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(Math.max(7, 2 * (1 / mapContainer.scale.x)), themeMode === 'light' ? '#ced6e0' : '#535c68');
            pointRoute.moveTo(startPoint.position.x, startPoint.position.y);
            pointRoute.lineTo(endPoint.position.x, endPoint.position.y);
            pointRoute.alpha = 1;
            mapContainer.addChild(pointRoute);
        })
    })
export const showRoutes = (curZone, setShowRoutes, setLoading) => {
    setLoading(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(Math.max(7, 2 * (1 / mapContainer.scale.x)), themeMode === 'light' ? '#ced6e0' : '#535c68');
                pointRoute.moveTo(startPoint.position.x, startPoint.position.y);
                pointRoute.lineTo(endPoint.position.x, endPoint.position.y);
                pointRoute.alpha = 1;
                mapContainer.addChild(pointRoute);
            })
            setLoading(false);
            setShowRoutes(true);
        },
        () => {
            setLoading(false);
        },
    )
};
export const hideRoutes = (curZone, setShowRoutes) => {
@@ -690,12 +696,12 @@
            fill: 0x000000,
        });
        agvText.anchor.set(0.5, 0.5);
        agvText.position.set(0, 5);
        agvText.position.set(0, 8);
        agvSprite.addChild(agvText);
        agvSprite.updateTextRotation = () => {
            if (agvText && agvSprite) {
                agvText.rotation = -agvSprite.rotation;
                agvText.rotation = -agvSprite.rotation - rotationParseNum(MAP_DEFAULT_ROTATION);
            }
        };
        agvSprite.updateTextRotation();
@@ -718,6 +724,10 @@
    if (error) {
        agvSprite.tint = 0xff3f34;
    } else {
        agvSprite.tint = themeMode === 'dark'
            ? DEVICE_SPRITE_TINT_DARK[DEVICE_TYPE.AGV]
            : DEVICE_SPRITE_TINT[DEVICE_TYPE.AGV];
    }
    beInsight(agvSprite, setCurSprite);
@@ -744,7 +754,11 @@
    }
    agvPath = new PIXI.Graphics();
    agvPath.name = agvPathName;
    agvPath.lineStyle(Math.max(20, 4 * (1 / mapContainer?.scale.x || 1)), 0x2f68ac, 0.8);
    agvPath.lineStyle(
        Math.max(200, 4 * (1 / mapContainer?.scale.x || 1)),
        themeMode === 'dark' ? 0x40739e : 0x2f68ac,
        0.8,
    );
    agvPath.zIndex = DEVICE_Z_INDEX.DYNAMIC_ROUTE;
    // agvPath.blendMode = PIXI.BLEND_MODES.NORMAL;