| | |
| | | REAL_COMPARE_MAP_OFFSET_Z, |
| | | } from '../config/setting' |
| | | |
| | | const width = 200; |
| | | |
| | | const getMajorPos = (position) => { |
| | | return { |
| | | x: position?.[2] * REAL_COMPARE_MAP_SCALE + REAL_COMPARE_MAP_OFFSET_X, |
| | |
| | | |
| | | }, [points]); |
| | | |
| | | useEffect(() => { |
| | | // console.log(JSON.stringify(props.list)); |
| | | //[{"code":"00000052","position":[4961,0,2420],"serial":6},{"code":"00000053","position":[5491,0,2420],"serial":7},{"code":"00000054","position":[6021,0,2420],"serial":8}] |
| | | }, [props]) |
| | | |
| | | return ( |
| | | <> |
| | | <group> |
| | | {/* <mesh position={} rotation={[]}> |
| | | <planeGeometry |
| | | args={[width, height]} |
| | | ></planeGeometry> |
| | | <meshBasicMaterial color="rgb(23,146,247)"></meshBasicMaterial> |
| | | </mesh> */} |
| | | <line ref={lineRef}> |
| | | <bufferGeometry attach="geometry" /> |
| | | <lineBasicMaterial attach="material" color="rgb(23,146,247)" linewidth={width} /> |
| | | <lineBasicMaterial attach="material" color="rgb(23,146,247)" linewidth={50} /> |
| | | </line> |
| | | </group> |
| | | </> |
| | |
| | | const [agv1Data, setAgv1Data] = useState({}); |
| | | const [agv2Data, setAgv2Data] = useState({}); |
| | | const [boxData, setBoxData] = useState([]); |
| | | const [path1Data, setPath1Data] = useState([]); |
| | | const [pathData, setPathData] = useState([]); |
| | | |
| | | useEffect(() => { |
| | | const websocket = new WebSocketClient('/ws/digitalTwin/websocket'); |
| | |
| | | } |
| | | } |
| | | if (data.type === 'path') { |
| | | switch (data.no) { |
| | | case "1": |
| | | setPath1Data(data.obj); |
| | | break; |
| | | case "2": |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | setPathData(data.obj); |
| | | } |
| | | } |
| | | |
| | |
| | | return <Agv key={2} {...agv2Data} /> |
| | | }, [agv2Data]); |
| | | |
| | | const path1El = useMemo(() => { |
| | | return <Path list={path1Data} /> |
| | | }, [path1Data]) |
| | | const pathEl = useMemo(() => { |
| | | return pathData.map((data, idx) => <Path key={idx} list={data} />) |
| | | }, [pathData]) |
| | | |
| | | useFrame((state, delta) => { |
| | | |
| | |
| | | {agv1El} |
| | | {agv2El} |
| | | {boxEl} |
| | | {path1El} |
| | | {pathEl} |
| | | </group> |
| | | </> |
| | | ) |