/* eslint-disable */ import React, { useRef, useState, useEffect } from "react"; import styles from "./index.less"; import { createPathElement, createTopTongue, createTopTongueType1, createTrapezoid, createDynamicTop, createNoneProject, createLineWeltTop, createIsoscelesTrapezoidWeltTop, createTrapezoidWeltTop, createFoldWeltTop, createFoldWeltTopLine, createPathElements, createRoundedCornersWeltTop, createRightAngleBoxBottomComponent, createBoxBottomComponent1, createBoxBottomComponent2, createBoxBottomComponent3, createBoxBottomComponent4, createBoxBottomComponent5, createBoxBottomComponent6, createBoxComponentNew, createBoxComponentNew1, createBoxComponentNew2, createBoxComponentNew3, createBoxComponentNew4, createBoxComponentNew5, createBoxComponentNew6, createBoxComponentNew4_1, createWelt, createWelt1, createWelt2, createWelt2Right, createWelt3, createWelt4, createWelt3Right, createWelt4Right, createText, createDoubleArrow, createHorizontalDoubleArrow, createFullTelescope, createBoxComponentNewFull, createBoxComponentNewFull1, createBoxComponentNewFull2, createBoxComponentNewFul3, createBoxComponentNewFul4, createBoxComponentNewFul5, createBoxComponentNewFul6, } from "../BoxDesign/createAirplaneBox"; const SvgBox = props => { const svgContainerRef = useRef(null); const svgRef = useRef(null); const [boxKey, setBoxKey] = useState(new Date().getTime()); const { boxList, dSvgBoxWidth, dSvgBoxHeight, iFAngle } = props; const [width, setWidth] = useState(0); const [height, setHeight] = useState(0); const [deep, setDeep] = useState(0); const [svgType, setSvgType] = useState(1); // 盒身 useEffect(() => { setTimeout(() => { const svg = svgRef.current; if (svg) { initSVG(); } }, 0); }, [boxList, svgType]); // 初始化svg const initSVG = () => { // setBoxKey(new Date().getTime()); const svg = svgRef.current; const g = document.createElementNS("http://www.w3.org/2000/svg", "g"); // 创建 svg.innerHTML = ""; if (!(boxList && boxList.length)) return; // 获取盒型类型 const svgTypes = boxList.find(x => x.sName === "盒身")?.type || 1; setSvgType(svgTypes); // 获取盒长、盒宽、盒高 const boxLength = Number(boxList.find(x => x.sName === "盒长")?.value) || 0; const boxWidth = Number(boxList.find(x => x.sName === "盒宽")?.value) || 0; let boxHeight = Number(boxList.find(x => x.sName === "盒高")?.value) || 0; setWidth(boxLength); setHeight(boxWidth); setDeep(boxHeight); let headLength = 0; let headWidth = 0; let orderLength = 0; let orderWidth = 0; if (svgTypes === "8") { headLength = Number(boxList.find(x => x.sName === "首盒长")?.value) || 0; headWidth = Number(boxList.find(x => x.sName === "首盒宽")?.value) || 0; orderLength = Number(boxList.find(x => x.sName === "次盒长")?.value) || 0; orderWidth = Number(boxList.find(x => x.sName === "次盒宽")?.value) || 0; } // 计算视口宽度和高度 const zbtb = boxList.find(x => x.sName === "左贴边位"); const ybtb = boxList.find(x => x.sName === "右贴边位"); const dZTBW = Number(zbtb?.value) || 0; const dYTBW = Number(ybtb?.value) || 0; const sfhs = boxList.find(x => x.sName === "上方盒舌"); const dSFHS = Number(sfhs?.value) || 0; const hdzj = boxList.find(x => x.sName === "盒底组件"); const xfhs = boxList.find(x => x.sName === "下方盒舌"); const dXFHS = Number(xfhs?.value) || 0; const zsbj = boxList.find(x => x.sName === "左(上)插位组件"); const dZSCW = Number(zsbj?.value) || 0; const ysbj = boxList.find(x => x.sName === "右(上)插位组件"); const dYSCW = Number(ysbj?.value) || 0; const zxbj = boxList.find(x => x.sName === "左(下)插位组件"); const dZXCW = Number(zxbj?.value) || 0; const yxbj = boxList.find(x => x.sName === "右(下)插位组件"); const dYXCW = Number(yxbj?.value) || 0; // 根据选择不同的部件 计算尺寸 // const viewBoxWidth = (boxLength * 2 + boxHeight * 2 + dYTBW + dZTBW); let viewBoxWidth = 0; let max = 0; // 展宽 if (boxList && boxList.length) { // 如果存在部件和盒舌 取最大的 const top = topOffect(boxList, boxLength, boxWidth, boxHeight); const bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight); max = Number(top) + Number(bottom); if (Number(svgType) === 8) { const top = topOffect(boxList, headLength, headWidth); const bottom = bottomOffect(boxList, orderLength, orderWidth); max = Number(top) + Number(bottom); } } let viewBoxHeight = Number(boxHeight) + max; if (Number(svgType) === 1) { // 四面盒身 viewBoxWidth = Number(boxLength) * 2 + Number(boxWidth) * 2 + dZTBW + dYTBW; } else if (Number(svgType) === 2) { viewBoxWidth = boxLength * 2 + boxWidth + dYTBW + dZTBW; } else if (Number(svgType) === 3) { viewBoxWidth = boxLength + boxWidth * 2 + dYTBW + dZTBW; } else if (Number(svgType) === 4) { // 天地盒 const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); const zscw = boxList.find(x => x.sName === "左(上)插位组件"); const yscw = boxList.find(x => x.sName === "右(上)插位组件"); const yxcw = boxList.find(x => x.sName === "右(下)插位组件"); const zxcwType = zxcw?.type; const zxcwValue = zxcw?.value; const zscwType = zscw?.type; const zscwValue = zscw?.value; const yscwType = yscw?.type; const yscwValue = yscw?.value; const yxcwType = yxcw?.type; const yxcwValue = yxcw?.value; let leftValue = 0; let rightValue = 0; let topValue = 0; let bottomValue = 0; if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { leftValue = leftValue + Number(zxcwValue) + boxHeight * 2; } else if (zxcwType === "4002" || zxcwType === "4003") { leftValue = leftValue + Number(zxcwValue) + boxHeight; } else if (zxcwType === "4004") { leftValue = leftValue + Number(zxcwValue) + boxHeight * 3; } else if (zxcwType === "4005") { leftValue = boxHeight * 3; } if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { rightValue = rightValue + Number(yscwValue) + boxHeight * 2; } else if (yscwType === "6002" || yscwType === "6003") { rightValue = rightValue + Number(yscwValue) + boxHeight; } else if (yscwType === "6004") { rightValue = rightValue + Number(yscwValue) + boxHeight * 3; } else if (yscwType === "6005") { rightValue = boxHeight * 3; } if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { topValue = topValue + Number(zscwValue) + boxHeight * 2; } else if (zscwType === "3002" || zscwType === "3003") { topValue = topValue + Number(zscwValue) + boxHeight; } else if (zscwType === "3004") { topValue = topValue + Number(zscwValue) + boxHeight * 3; } else if (zscwType === "3005") { topValue = boxHeight * 3; } if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { bottomValue = bottomValue + Number(yxcwValue) + boxHeight * 2; } else if (yxcwType === "7002" || yxcwType === "7003") { bottomValue = bottomValue + Number(yxcwValue) + boxHeight; } else if (yxcwType === "7004") { bottomValue = bottomValue + Number(yxcwValue) + boxHeight * 3; } else if (yxcwType === "7005") { bottomValue = boxHeight * 3; } viewBoxWidth = Number(boxLength) + leftValue + rightValue; viewBoxHeight = Number(boxWidth) + topValue + bottomValue; } else if (Number(svgType) === 5) { viewBoxWidth = (boxHeight + boxWidth) * 2 + dYTBW + dZTBW; viewBoxHeight = boxLength + max; } else if (Number(svgType) === 6) { viewBoxWidth = boxWidth + 2; viewBoxHeight = boxLength + 2; } else if (Number(svgType) === 7) { boxHeight = boxWidth; const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); const zscw = boxList.find(x => x.sName === "左(上)插位组件"); const yscw = boxList.find(x => x.sName === "右(上)插位组件"); const yxcw = boxList.find(x => x.sName === "右(下)插位组件"); const zxcwType = zxcw?.type; const zxcwValue = zxcw?.value; const zscwType = zscw?.type; const zscwValue = zscw?.value; const yscwType = yscw?.type; const yscwValue = yscw?.value; const yxcwType = yxcw?.type; const yxcwValue = yxcw?.value; let leftValue = 0; let rightValue = 0; let topValue = 0; let bottomValue = 0; if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { leftValue = leftValue + Number(zxcwValue) + boxHeight * 2; } else if (zxcwType === "4002" || zxcwType === "4003") { leftValue = leftValue + Number(zxcwValue) + boxHeight; } else if (zxcwType === "4004") { leftValue = leftValue + Number(zxcwValue) + boxHeight * 3; } else if (zxcwType === "4005") { leftValue = boxHeight * 3; } if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { rightValue = rightValue + Number(yscwValue) + boxHeight * 2; } else if (yscwType === "6002" || yscwType === "6003") { rightValue = rightValue + Number(yscwValue) + boxHeight; } else if (yscwType === "6004") { rightValue = rightValue + Number(yscwValue) + boxHeight * 3; } else if (yscwType === "6005") { rightValue = boxHeight * 3; } if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { topValue = topValue + Number(zscwValue) + boxHeight * 2; } else if (zscwType === "3002" || zscwType === "3003") { topValue = topValue + Number(zscwValue) + boxHeight; } else if (zscwType === "3004") { topValue = topValue + Number(zscwValue) + boxHeight * 3; } else if (zscwType === "3005") { topValue = boxHeight * 3; } if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { bottomValue = bottomValue + Number(yxcwValue) + boxHeight * 2; } else if (yxcwType === "7002" || yxcwType === "7003") { bottomValue = bottomValue + Number(yxcwValue) + boxHeight; } else if (yxcwType === "7004") { bottomValue = bottomValue + Number(yxcwValue) + boxHeight * 3; } else if (yxcwType === "7005") { bottomValue = boxHeight * 3; } viewBoxWidth = Number(boxLength) + leftValue + rightValue; viewBoxHeight = Number(boxWidth) + topValue + bottomValue; // viewBoxWidth = boxWidth + leftValue + rightValue; // viewBoxHeight = boxLength + dZSCW + dYXCW; } else if (Number(svgType) === 8) { const getTop = (item, offset = 0) => { const map = { 10001: headWidth + Number(item?.value), 10002: Number(item?.value), 10003: Number(item?.value), 10004: Number(item?.value) + headWidth * 2, 10005: headWidth * 2, 10006: Number(item?.value) + headWidth, 10007: Number(item?.value) + headWidth, }; return map[item?.type - offset] ?? 0; // 根据偏移量统一处理 }; const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件")); const topRight = getTop( boxList.find(x => x.sName === "右上插位组件"), 2000 ); const topLength = headLength + topLeft + topRight; const bottomLeft = getTop( boxList.find(x => x.sName === "左插位组件"), 3000 ); const bottomRight = getTop( boxList.find(x => x.sName === "右插位组件"), 5000 ); const bottomLength = orderLength * 2 + bottomLeft + bottomRight; const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; const rightOffect = boxList.find(x => x.sName === "右偏移")?.value || 0; viewBoxWidth = Math.max(topLength, bottomLength) + Number(leftOffect) + Number(rightOffect); viewBoxHeight = Number(headWidth) + Number(orderWidth) + max; } // 计算缩放比例 let scale = 1; if (props.showNew === 0) { if (viewBoxWidth > (dSvgBoxWidth ? dSvgBoxWidth : 500) || viewBoxHeight > (dSvgBoxHeight ? dSvgBoxHeight : 250)) { const widthScale = (dSvgBoxWidth ? dSvgBoxWidth : 500) / viewBoxWidth; const heightScale = (dSvgBoxHeight ? dSvgBoxHeight : 250) / viewBoxHeight; scale = Math.min(widthScale, heightScale); let ySvg = dSvgBoxHeight ? topOffect(boxList, boxLength, boxWidth, boxHeight) * scale : topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; let bottom = 0; if (Number(svgType) !== 8) { bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight); } else { bottom = bottomOffect(boxList, orderLength, orderWidth); } if (Number(svgType) === 4) { ySvg = ySvg + boxHeight * scale; } else if (Number(svgType) === 8) { ySvg = topOffect(boxList, headLength, headWidth) * scale; } ySvg = ySvg + 50 * scale; let xSvg = 0; if (Number(svgType) === 7) { xSvg = scaledWidth + dZXCW * scale; } else if (Number(svgType) === 8) { const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; // 计算首盒部件与次盒部件尺寸 const getTop = (item, offset = 0) => { const map = { 10001: headWidth + Number(item?.value), 10002: Number(item?.value), 10003: Number(item?.value), 10004: Number(item?.value) + headWidth * 2, 10005: headWidth * 2, 10006: Number(item?.value) + headWidth, 10007: Number(item?.value) + headWidth, }; return map[item?.type - offset] ?? 0; // 根据偏移量统一处理 }; const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件")); const topLength = headLength + topLeft; const bottomLeft = getTop( boxList.find(x => x.sName === "左插位组件"), 3000 ); const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect); xSvg = Math.max(Math.abs(bottomLength), Math.abs(topLength)); } else { xSvg = zbtb?.value; } svg.setAttribute( "viewBox", `${-(xSvg * scale)} ${dSvgBoxWidth ? (dSvgBoxWidth === 100 ? -ySvg : 0) : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth + ySvg : 500} ${ dSvgBoxHeight ? dSvgBoxHeight - ySvg - bottom * scale : 250 + ySvg }` ); svg.setAttribute("width", `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`); svg.setAttribute("height", `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`); svgContainerRef.current.style.width = `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`; svgContainerRef.current.style.height = `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`; } else { scale = 0.5; let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; if (Number(svgType) === 4) { ySvg = ySvg + boxHeight; } else if (Number(svgType) === 8) { ySvg = topOffect(boxList, headLength, headWidth) * scale; } ySvg = ySvg + 50 * scale; let xSvg = 0; if (Number(svgType) === 7) { xSvg = scaledWidth + dZXCW * scale; } else if (Number(svgType) === 8) { const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; // 计算首盒部件与次盒部件尺寸 const getTop = (item, offset = 0) => { const map = { 10001: headWidth + Number(item?.value), 10002: Number(item?.value), 10003: Number(item?.value), 10004: Number(item?.value) + headWidth * 2, 10005: headWidth * 2, 10006: Number(item?.value) + headWidth, 10007: Number(item?.value) + headWidth, }; return map[item?.type - offset] ?? 0; // 根据偏移量统一处理 }; const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件")); const topLength = headLength + topLeft; const bottomLeft = getTop( boxList.find(x => x.sName === "左插位组件"), 3000 ); const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect); xSvg = Math.max(Math.abs(bottomLength), Math.abs(topLength)); } else { xSvg = zbtb?.value; } svg.setAttribute( "viewBox", `${-(dSvgBoxWidth ? xSvg : viewBoxWidth / 2)} ${dSvgBoxWidth ? -0 : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth : 500} ${ dSvgBoxHeight ? dSvgBoxHeight : 250 }` ); svg.setAttribute("width", `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`); svg.setAttribute("height", `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`); svgContainerRef.current.style.width = `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`; svgContainerRef.current.style.height = `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`; } } else if (props.showNew === 1) { let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; let leftSize = 0; let topSize = 0; if (Number(svgType) === 4) { const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); const zxcwType = zxcw?.type; const zxcwValue = zxcw?.value; if (zxcwType === "4001" || zxcwType === "4006") { leftSize = Number(zxcwValue) + boxHeight * 2; } else if (zxcwType === "4002" || zxcwType === "4003") { leftSize = Number(zxcwValue) + boxHeight; } else if (zxcwType === "4004") { leftSize = Number(zxcwValue) + boxHeight * 3; } else if (zxcwType === "4005") { leftSize = Number(zxcwValue) + boxHeight * 3; } const zscw = boxList.find(x => x.sName === "左(上)插位组件"); const zscwType = zscw?.type; const zscwValue = zscw?.value; if (zscwType === "3001" || zscwType === "3006") { topSize = Number(zscwValue) + boxHeight * 2; } else if (zscwType === "3002" || zscwType === "3003") { topSize = Number(zscwValue) + boxHeight; } else if (zscwType === "3004") { topSize = Number(zscwValue) + boxHeight * 3; } else if (zscwType === "3005") { topSize = Number(zscwValue) + boxHeight * 3; } ySvg = topSize; } else if (Number(svgType) === 6) { leftSize = 0; } else if (Number(svgType) === 8) { const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; // 计算首盒部件与次盒部件尺寸 const getTop = (item, offset = 0) => { const map = { 10001: headWidth + Number(item?.value), 10002: Number(item?.value), 10003: Number(item?.value), 10004: Number(item?.value) + headWidth * 2, 10005: headWidth * 2, 10006: Number(item?.value) + headWidth, 10007: Number(item?.value) + headWidth, }; return map[item?.type - offset] ?? 0; // 根据偏移量统一处理 }; const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件")); const topLength = topLeft; const bottomLeft = getTop( boxList.find(x => x.sName === "左插位组件"), 3000 ); const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect); leftSize = Math.max(Math.abs(bottomLength), Math.abs(topLength)); ySvg = topOffect(boxList, headLength, headWidth); } else { leftSize = zbtb?.value; } svg.setAttribute("viewBox", `${-(leftSize * scale) || 0} ${-ySvg} ${viewBoxWidth + 2} ${viewBoxHeight + 2}`); svg.setAttribute("width", `${viewBoxWidth}px`); svg.setAttribute("height", `${viewBoxHeight}px`); svgContainerRef.current.style.width = `${viewBoxWidth}px`; svgContainerRef.current.style.height = `${viewBoxHeight}px`; const scaleX = (dSvgBoxWidth ? dSvgBoxWidth : 450) / viewBoxWidth; const scaleY = (dSvgBoxHeight ? dSvgBoxHeight : 200) / viewBoxHeight; svgContainerRef.current.style.transform = `scale(${scaleX >= 1 ? 1 : scaleX}, ${scaleY >= 1 ? 1 : scaleY})`; svgContainerRef.current.style.transformOrigin = "top left"; svgContainerRef.current.style.paddingTop = dSvgBoxWidth ? "0" : "25px"; svgContainerRef.current.style.backgroundColor = props.isMobile ? "#EDF4FF" : ""; // svgContainerRef.current.style.position = 'absolute'; // svgContainerRef.current.style.left = '50%'; // svgContainerRef.current.style.top = '50%'; // svgContainerRef.current.style.transform = 'translate(-50%, -50%)'; } else if (props.showNew === 2) { // g.setAttribute("transform", `rotate(${iFAngle, dSvgBoxWidth/2,dSvgBoxHeight*2})`); let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; let leftSize = 0; let topSize = 0; if (Number(svgType) === 4) { const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); const zxcwType = zxcw?.type; const zxcwValue = zxcw?.value; if (zxcwType === "4001" || zxcwType === "4006") { leftSize = Number(zxcwValue) + boxHeight * 2; } else if (zxcwType === "4002" || zxcwType === "4003") { leftSize = Number(zxcwValue) + boxHeight; } else if (zxcwType === "4004") { leftSize = Number(zxcwValue) + boxHeight * 3; } else if (zxcwType === "4005") { leftSize = Number(zxcwValue) + boxHeight * 3; } const zscw = boxList.find(x => x.sName === "左(上)插位组件"); const zscwType = zscw?.type; const zscwValue = zscw?.value; if (zscwType === "3001" || zscwType === "3006") { topSize = Number(zscwValue) + boxHeight * 2; } else if (zscwType === "3002" || zscwType === "3003") { topSize = Number(zscwValue) + boxHeight; } else if (zscwType === "3004") { topSize = Number(zscwValue) + boxHeight * 3; } else if (zscwType === "3005") { topSize = Number(zscwValue) + boxHeight * 3; } ySvg = topSize; } else if (Number(svgType) === 6) { leftSize = 0; } else if (Number(svgType) === 8) { const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; // 计算首盒部件与次盒部件尺寸 const getTop = (item, offset = 0) => { const map = { 10001: headWidth + Number(item?.value), 10002: Number(item?.value), 10003: Number(item?.value), 10004: Number(item?.value) + headWidth * 2, 10005: headWidth * 2, 10006: Number(item?.value) + headWidth, 10007: Number(item?.value) + headWidth, }; return map[item?.type - offset] ?? 0; // 根据偏移量统一处理 }; const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件")); const topLength = topLeft; const bottomLeft = getTop( boxList.find(x => x.sName === "左插位组件"), 3000 ); const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect); leftSize = Math.max(Math.abs(bottomLength), Math.abs(topLength)); ySvg = topOffect(boxList, headLength, headWidth); } else { leftSize = zbtb?.value; } svg.setAttribute("viewBox", `${-(leftSize * scale || 0)} ${-ySvg} ${dSvgBoxWidth} ${dSvgBoxHeight}`); svg.setAttribute("width", `${dSvgBoxWidth}px`); svg.setAttribute("height", `${dSvgBoxHeight}px`); svgContainerRef.current.style.width = `${dSvgBoxWidth}px`; svgContainerRef.current.style.height = `${dSvgBoxHeight}px`; } const scaledWidth = boxLength * scale; const scaledHeight = boxWidth * scale; const scaledDeep = boxHeight * scale; const scales = dSvgBoxWidth ? scale : 1; // 根据盒型类型生成不同的盒身 四面盒身 if (Number(svgType) === 1) { const rectangles = [ { x: 0, y: 0, width: scaledWidth, height: scaledDeep }, { x: 0 + scaledWidth, y: 0, width: scaledHeight, height: scaledDeep }, { x: 0 + scaledWidth + scaledHeight, y: 0, width: scaledWidth, height: scaledDeep }, { x: 0 + scaledWidth * 2 + scaledHeight, y: 0, width: scaledHeight, height: scaledDeep }, ]; rectangles.forEach(rect => { g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); }); svg.appendChild(g); let pathList = []; // 上方盒舌 pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth, 0)); pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledHeight, -dSFHS * scale, scaledWidth * 2 + scaledHeight * 2, 0)); if (sfhs?.type && dSFHS) { pathList.push(createText(scaledWidth + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); pathList.push(createText(scaledWidth * 2 + scaledHeight + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); } // 盒底组件 if (hdzj && hdzj.type) { // 盒底组件 pathList.push(createBoxBottomComponent(hdzj?.type, scaledWidth, scaledHeight, Number(hdzj?.value) * scale, 0, scaledDeep)); pathList.push(createText(scaledWidth / 2, scaledDeep + (Number(hdzj?.value) / 2) * scales, 10 * scales, Number(hdzj?.value))); } else { // 下方盒舌 pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, scaledWidth, scaledDeep)); pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledHeight, dXFHS * scale, scaledWidth * 2 + scaledHeight * 2, scaledDeep)); if (xfhs?.type && dXFHS) { pathList.push(createText(scaledWidth + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 10) * scales, 10 * scales, dXFHS)); pathList.push(createText(scaledWidth * 2 + scaledHeight + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 10) * scales, 10 * scales, dXFHS)); } } // 左边贴边 pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); if (zbtb?.type && dZTBW) { pathList.push(createText(-dZTBW * 0.4, scaledDeep / 2, 10 * scales, dZTBW)); } // 右边贴边 pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight * 2, 0, dSFHS * scale, dXFHS * scale)); if (ybtb?.type && dYTBW) { pathList.push(createText(scaledWidth * 2 + scaledHeight * 2 + dYTBW * 0.4, scaledDeep / 2, 10 * scales, dYTBW)); } // 左上部件 pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); // 插位值 pathList.push(createText(scaledWidth / 2, -scaledHeight - dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3002" && dZSCW) { pathList.push(createText(scaledWidth / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3003" && dZSCW) { pathList.push(createText(scaledWidth / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3004" && zsbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); pathList.push(createText(scaledWidth * 0.3, -(scaledHeight * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3005" && zsbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); } else if (zsbj?.type && dZSCW) { pathList.push(createText(scaledWidth / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); } // 右上部件 pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledWidth + scaledHeight, 0)); if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW)); } else if (ysbj?.type === "6002" && dYSCW) { pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); } else if (ysbj?.type === "6003" && dYSCW) { pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); } else if (ysbj?.type === "6004" && ysbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); pathList.push( createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W") ); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, -(scaledHeight * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW)); } else if (ysbj?.type === "6005" && ysbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); } else if (ysbj?.type && dYSCW) { pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); } // 左下部件- if (!(hdzj && hdzj.type)) { pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, 0, scaledDeep)); if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2 - 4, 10 * scales, dZXCW)); } else if (zxbj?.type === "4002" && dZXCW) { pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); } else if (zxbj?.type === "4003" && dZXCW) { pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); } else if (zxbj?.type === "4004" && zxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); pathList.push(createText(scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW)); } else if (zxbj?.type === "4005" && zxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); } else if (zxbj?.type && dZXCW) { pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); } } if (!(hdzj && hdzj.type)) { pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, scaledWidth + scaledHeight, scaledDeep)); if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2, 10 * scales, dYXCW)); } else if (yxbj?.type === "7004" && yxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 - 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push( createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales) ); pathList.push( createText( scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W" ) ); pathList.push( createText(scaledWidth + scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW) ); } else if (yxbj?.type === "7005" && yxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push( createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales) ); pathList.push( createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W") ); } else if (dYXCW && yxbj?.type) { pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + dYXCW / 2 - 4, 10 * scales, dYXCW)); } } // 右下部件 // 纵向 D if (scaledDeep && scaledWidth && scaledHeight) { pathList.push(createDoubleArrow(scaledDeep, scaledWidth + scaledHeight + scaledWidth / 2, scaledDeep / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth / 2 + 10 * scales, scaledDeep / 2, 10 * scales, "D")); // 横向 L pathList.push(createHorizontalDoubleArrow(scaledWidth, scaledWidth / 2, scaledDeep / 2, scales)); pathList.push(createText(scaledWidth / 2, scaledDeep / 2 + 10 * scales, 10 * scales, "L")); // W pathList.push(createHorizontalDoubleArrow(scaledHeight, scaledWidth + scaledHeight / 2, scaledDeep * 0.3, scale)); pathList.push(createText(scaledWidth + scaledHeight / 2, scaledDeep * 0.3 + 10 * scales, 10 * scales, "W")); } pathList.forEach(x => { g.appendChild(x); }); svg.appendChild(g); } else if (Number(svgType) === 2) { // 单折盒身 const rectangles = [ { x: 0, y: 0, width: scaledWidth, height: scaledDeep }, { x: 0 + scaledWidth, y: 0, width: scaledHeight, height: scaledDeep }, { x: 0 + scaledWidth + scaledHeight, y: 0, width: scaledWidth, height: scaledDeep }, ]; rectangles.forEach(rect => { g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); }); svg.appendChild(g); let pathList = []; // 上方盒舌 pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth, 0)); if (sfhs?.type && dSFHS) { pathList.push(createText(scaledWidth + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); } // 下方盒舌 pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, scaledWidth, scaledDeep)); if (xfhs?.type && dXFHS) { pathList.push(createText(scaledWidth + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dSFHS)); } // 左边贴边 pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); if (zbtb?.type && dZTBW) { pathList.push(createText(-dZTBW / 2, scaledDeep / 2, 10 * scales, dZTBW)); } // 右边贴边 pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight, 0, dSFHS * scale, dXFHS * scale)); if (zbtb?.type && dYTBW) { pathList.push(createText(scaledWidth * 2 + scaledHeight + dYTBW / 2, scaledDeep / 2, 10 * scales, dYTBW)); } // 左上部件 pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledWidth / 2, -scaledHeight - dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3004" && zsbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); pathList.push(createText(scaledWidth * 0.3, -(scaledHeight * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3005" && zsbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); } else if (zsbj?.type && dZSCW) { pathList.push(createText(scaledWidth / 2, -(dZSCW / 2 - 5), 10 * scales, dZSCW)); } // 右上部件 pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledWidth + scaledHeight, 0)); if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW)); } else if (ysbj?.type === "6004" && ysbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); pathList.push( createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W") ); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, -(scaledHeight * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW)); } else if (ysbj?.type === "6005" && ysbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); } else if (ysbj?.type && dYSCW) { pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); } // 左下部件- pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, 0, scaledDeep)); if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2, 10 * scales, dZXCW)); } else if (zxbj?.type === "4004" && zxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); pathList.push(createText(scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW)); } else if (zxbj?.type === "4005" && zxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); } else if (zxbj?.type && dZXCW) { pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); } // 右下部件 pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW, scaledWidth + scaledHeight, scaledDeep)); if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2 - 4, 10 * scales, dYXCW)); } else if (yxbj?.type === "7004" && yxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 - 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push( createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales) ); pathList.push( createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W") ); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW)); } else if (yxbj?.type === "7005" && yxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push( createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales) ); pathList.push( createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scale, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scale, "W") ); } else if (dYXCW && yxbj?.type) { pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + dYXCW / 2 - 4, 10 * scales, dYXCW)); } if (scaledDeep && scaledWidth && scaledHeight) { // 纵向 D pathList.push(createDoubleArrow(scaledDeep, scaledWidth + scaledHeight + scaledWidth / 2, scaledDeep / 2, scales)); pathList.push(createText(scaledWidth + scaledHeight + scaledWidth / 2 + 10, scaledDeep / 2, 10 * scales, "D")); // 横向 L pathList.push(createHorizontalDoubleArrow(scaledWidth, scaledWidth / 2, scaledDeep / 2, scales)); pathList.push(createText(scaledWidth / 2, scaledDeep / 2 + 10, 10 * scales, "L")); // W pathList.push(createHorizontalDoubleArrow(scaledHeight, scaledWidth + scaledHeight / 2, scaledDeep * 0.3, scales)); pathList.push(createText(scaledWidth + scaledHeight / 2, scaledDeep * 0.3 + 10, 10 * scales, "W")); } pathList.forEach(x => { g.appendChild(x); }); svg.appendChild(g); } else if (Number(svgType) === 3) { // 双折盒 const rectangles = [ { x: 0, y: 0, width: scaledHeight, height: scaledDeep }, { x: 0 + scaledHeight, y: 0, width: scaledWidth, height: scaledDeep }, { x: 0 + scaledWidth + scaledHeight, y: 0, width: scaledHeight, height: scaledDeep }, ]; rectangles.forEach(rect => { g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); }); svg.appendChild(g); let pathList = []; // 上方盒舌 pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, 0, 0)); pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth + scaledHeight, 0)); if (sfhs?.type && dSFHS) { pathList.push(createText(scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); pathList.push(createText(scaledWidth + scaledHeight + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); } // 下方盒舌 pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, 0, scaledDeep)); pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, scaledWidth + scaledHeight, scaledDeep)); if (xfhs?.type && dXFHS) { pathList.push(createText(scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS)); pathList.push(createText(scaledWidth + scaledHeight + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS)); } // 左边贴边 pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); if (zbtb?.type && dZTBW) { pathList.push(createText(-dZTBW / 2, scaledDeep / 2, 10 * scales, dZTBW)); } // 右边贴边 pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth + scaledHeight * 2, 0, dSFHS * scale, dXFHS * scale)); if (zbtb?.type && dYTBW) { pathList.push(createText(scaledWidth + scaledHeight * 2 + dYTBW / 2, scaledDeep / 2, 10 * scales, dYTBW)); } // 左下部件- pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, scaledHeight, scaledDeep)); if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledHeight + scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2 - 4, 10 * scales, dZXCW)); } else if (zxbj?.type === "4004" && zxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledHeight + scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); pathList.push(createText(scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW)); } else if (zxbj?.type === "4005" && zxbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); pathList.push(createText(scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledHeight + scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); } else if (zxbj?.type && dZXCW) { pathList.push(createText(scaledHeight + scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); } // 右上部件 pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledHeight, 0)); if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW)); } else if (ysbj?.type === "6004" && ysbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledHeight + scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); pathList.push(createText(scaledHeight + scaledWidth * 0.3, -(scaledHeight * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW)); } else if (ysbj?.type === "6005" && ysbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.1, -scaledHeight / 2, scales)); pathList.push(createText(scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); } else if (ysbj?.type && dYSCW) { pathList.push(createText(scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); } if (scaledDeep && scaledWidth && scaledHeight) { // 纵向 D pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledWidth + scaledHeight / 2, scaledDeep / 2, scales)); pathList.push(createText(scaledHeight + scaledWidth + scaledHeight / 2 + 10, scaledDeep / 2, 10 * scales, "D")); // 横向 L pathList.push(createHorizontalDoubleArrow(scaledWidth, scaledHeight + scaledWidth / 2, scaledDeep / 2, scales)); pathList.push(createText(scaledHeight + scaledWidth / 2, scaledDeep / 2 + 10, 10 * scales, "L")); // W pathList.push(createHorizontalDoubleArrow(scaledHeight, scaledHeight / 2, scaledDeep * 0.3, scales)); pathList.push(createText(scaledHeight / 2, scaledDeep * 0.3 + 10, 10 * scales, "W")); } pathList.forEach(x => { g.appendChild(x); }); svg.appendChild(g); } else if (Number(svgType) === 4) { g.appendChild(createFullTelescope(scaledWidth, scaledHeight, scaledDeep, 0, 0)); svg.appendChild(g); // createFullTelescope let pathList = []; // 上方盒舌 pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledDeep, -dSFHS * scale, -scaledDeep, 0)); pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledDeep, -dSFHS * scale, scaledWidth + scaledDeep, 0)); if (sfhs?.type && dSFHS) { pathList.push(createText(-scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); pathList.push(createText(scaledWidth + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); } // 下方盒舌 pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledDeep, dXFHS * scale, -scaledDeep, scaledHeight)); pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledDeep, dXFHS * scale, scaledDeep + scaledWidth, scaledHeight)); if (xfhs?.type && dXFHS) { pathList.push(createText(-scaledDeep / 2, scaledHeight + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS)); pathList.push(createText(scaledWidth + scaledDeep / 2, scaledHeight + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS)); } // 上方部件 pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledDeep, -dZSCW * scale, 0, -scaledDeep)); if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, -scaledDeep - scaledDeep / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledDeep - scaledDeep / 2, 10 * scales, "D")); // 插位值 pathList.push(createText(scaledWidth / 2, -scaledDeep * 2 - dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3002" && dZSCW) { pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3003" && dZSCW) { pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3004" && zsbj?.value) { pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, -scaledDeep - scaledDeep / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight - scaledDeep / 2, 10 * scales, "D")); pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.85, -(scaledDeep * 2 + scaledDeep / 2), scales)); pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledDeep * 2 + scaledDeep / 2), 10 * scales, "D")); pathList.push(createText(scaledWidth * 0.3, -(scaledDeep * 3) - dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3005" && zsbj?.value) { pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.1, -scaledDeep - scaledDeep / 2, scales)); pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledDeep - scaledDeep / 2, 10 * scales, "D")); pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.8, -(scaledDeep * 2 + scaledDeep / 2), scales)); pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledDeep * 2 + scaledDeep / 2), 10 * scales, "D")); } else if (zsbj?.type && dZSCW) { pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW)); } // 左边部件 pathList.push(createFull(zxbj?.type, scaledHeight, -scaledDeep, -dZXCW, -scaledDeep, 0)); if ((zxbj?.type === "4001" && dZXCW) || (zxbj?.type === "4006" && dZXCW) || (zxbj?.type === "4007" && dZXCW)) { pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); pathList.push(createText(-scaledDeep - scaledDeep - dZXCW / 2, scaledHeight * 0.5, 10 * scales, dZXCW)); } else if (zxbj?.type === "4004") { pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); pathList.push(createText(-scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); pathList.push(createText(-scaledDeep - scaledDeep - scaledDeep - dZXCW / 2, scaledHeight * 0.2, 10 * scales, dZXCW)); } else if (zxbj?.type === "4005" && dZXCW) { pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); pathList.push(createText(-scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); } else { pathList.push(createText(-scaledDeep - dZXCW / 2, scaledHeight * 0.5, 10 * scales, dZXCW)); } // 右边 pathList.push(createFull(ysbj?.type, scaledHeight, scaledDeep, dYSCW, scaledWidth + scaledDeep, 0)); if ((ysbj?.type === "6001" && dYSCW) || (ysbj?.type === "6006" && dYSCW) || (ysbj?.type === "6007" && dYSCW)) { pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + dYSCW / 2, scaledHeight * 0.5, 10 * scales, dYSCW)); } else if (ysbj?.type === "6004" && dYSCW) { pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + scaledDeep + dYSCW / 2, scaledHeight * 0.2, 10 * scales, dYSCW)); } else if (zxbj?.type === "4005" && dYSCW) { pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); } else { pathList.push(createText(scaledWidth + scaledDeep + dYSCW / 2, scaledHeight * 0.5, 10 * scales, dYSCW)); } // 下方部件 pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledDeep, dYXCW * scale, 0, scaledHeight + scaledDeep)); if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, scaledHeight + scaledDeep + scaledDeep / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D")); // 插位值 pathList.push(createText(scaledWidth / 2, scaledHeight + scaledDeep * 2 + dYXCW / 2 - 5, 10 * scales, dYXCW)); } else if (yxbj?.type === "7004" && yxbj?.value) { pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, scaledHeight + scaledDeep + scaledDeep / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D")); pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.85, scaledHeight + scaledDeep * 2 + scaledDeep / 2, scales)); pathList.push(createText(scaledWidth * 0.85 + 10 * scales, scaledHeight + scaledDeep * 2 + scaledDeep / 2, 10 * scales, "D")); pathList.push(createText(scaledWidth * 0.3, scaledHeight + scaledDeep * 3 + dYXCW / 2 - 5, 10 * scales, dYXCW)); } else if (yxbj?.type === "7005" && yxbj?.value) { pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.1, scaledHeight + scaledDeep + scaledDeep / 2, scales)); pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D")); pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.8, scaledHeight + scaledDeep * 2 + scaledDeep / 2, scales)); pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledHeight + scaledDeep * 2 + scaledDeep / 2, 10 * scales, "D")); } else if (dYXCW && yxbj?.type) { pathList.push(createText(scaledWidth / 2, scaledHeight + scaledDeep + dYXCW / 2 - 5, 10 * scales, dYXCW)); } if (scaledDeep && scaledWidth && scaledHeight) { // 纵向 D pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10, scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.7, -scaledDeep / 2, scales)); pathList.push(createText(scaledWidth * 0.7 + 10, -scaledDeep / 2, 10 * scales, "D")); // 横向 L pathList.push(createHorizontalDoubleArrow(scaledWidth, scaledWidth / 2, scaledHeight * 0.8, scales)); pathList.push(createText(scaledWidth / 2, scaledHeight * 0.8 + 10, 10 * scales, "L")); // W pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep / 2, scaledHeight * 0.3, scales)); pathList.push(createText(-scaledDeep / 2, scaledHeight * 0.3 + 10, 10 * scales, "D")); } pathList.forEach(x => { g.appendChild(x); }); svg.appendChild(g); } else if (Number(svgType) === 5) { const rectangles = [ { x: 0, y: 0, width: scaledHeight, height: scaledWidth }, { x: 0 + scaledHeight, y: 0, width: scaledDeep, height: scaledWidth }, { x: 0 + scaledHeight + scaledDeep, y: 0, width: scaledHeight, height: scaledWidth }, { x: 0 + scaledHeight * 2 + scaledDeep, y: 0, width: scaledDeep, height: scaledWidth }, ]; rectangles.forEach(rect => { g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); }); svg.appendChild(g); let pathList = []; // 上方盒舌 pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledDeep, -dSFHS * scale, scaledHeight, 0)); pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledDeep, -dSFHS * scale, scaledHeight * 2 + scaledDeep * 2, 0)); if (sfhs?.type && dSFHS) { pathList.push(createText(scaledHeight + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); pathList.push(createText(scaledHeight * 2 + scaledDeep + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); } // 下方盒舌 pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledDeep, dXFHS * scale, scaledHeight, scaledWidth)); pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledDeep, dXFHS * scale, scaledHeight * 2 + scaledDeep * 2, scaledWidth)); if (xfhs?.type && dXFHS) { pathList.push(createText(scaledHeight + scaledDeep / 2, scaledWidth + (dXFHS / 2) * scales, 10 * scales, dXFHS)); pathList.push(createText(scaledHeight * 2 + scaledDeep + scaledDeep / 2, scaledWidth + (dXFHS / 2) * scales, 10 * scales, dXFHS)); } // 左边贴边 pathList.push(createTrapezoidLeft(zbtb?.type, scaledWidth, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); if (zbtb?.type && dZTBW) { pathList.push(createText(-dZTBW * 0.4, scaledWidth / 2, 10 * scales, dZTBW)); } // 右边贴边 pathList.push(createTrapezoidRight(ybtb?.type, scaledWidth, dYTBW * scale, scaledHeight * 2 + scaledDeep * 2, 0, dSFHS * scale, dXFHS * scale)); if (ybtb?.type && dYTBW) { pathList.push(createText(scaledHeight * 2 + scaledDeep * 2 + dYTBW * 0.4, scaledWidth / 2, 10 * scales, dYTBW)); } // 左上部件 pathList.push(createDynamicTopLeft(zsbj?.type, scaledHeight, -scaledDeep, -dZSCW * scale, 0, 0)); if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, -scaledDeep / 2, scales)); pathList.push(createText(scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); // 插位值 pathList.push(createText(scaledHeight / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3002" && dZSCW) { pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3003" && dZSCW) { pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3004" && zsbj?.value) { pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, -scaledDeep / 2, scales)); pathList.push(createText(scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.85, -(scaledDeep + scaledDeep / 2), scales)); pathList.push(createText(scaledHeight * 0.85 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D")); pathList.push(createText(scaledHeight * 0.3, -(scaledDeep * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3005" && zsbj?.value) { pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.1, -scaledDeep / 2, scales)); pathList.push(createText(scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales)); pathList.push(createText(scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledHeight / 2), 10 * scales, "D")); } else if (zsbj?.type && dZSCW) { pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); } // 右上部件 pathList.push(createDynamicTopLeft(ysbj?.type, scaledHeight, -scaledDeep, -dYSCW * scale, scaledHeight + scaledDeep, 0)); if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, -scaledDeep / 2, scales)); pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -scaledDeep - dYSCW / 2, 10 * scales, dYSCW)); } else if (ysbj?.type === "6002" && dYSCW) { pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); } else if (ysbj?.type === "6003" && dYSCW) { pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); } else if (ysbj?.type === "6004" && ysbj?.value) { pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, -scaledDeep / 2, scales)); pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.85, -(scaledDeep + scaledDeep / 2), scales)); pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.85 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D")); pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.3, -(scaledDeep * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW)); } else if (ysbj?.type === "6005" && ysbj?.value) { pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.1, -scaledDeep / 2, scales)); pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales)); pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D")); } else if (ysbj?.type && dYSCW) { pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); } // 左下部件- if (!(hdzj && hdzj.type)) { pathList.push(createDynamicTopLeft(zxbj?.type, scaledHeight, scaledDeep, dZXCW * scale, 0, scaledWidth)); if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales)); pathList.push(createText(scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); pathList.push(createText(scaledHeight / 2, scaledWidth + scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); } else if (zxbj?.type === "4002" && dZXCW) { pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW)); } else if (zxbj?.type === "4003" && dZXCW) { pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW)); } else if (zxbj?.type === "4004" && zxbj?.value) { pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales)); pathList.push(createText(scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.85, scaledWidth + (scaledDeep + scaledDeep / 2), scales)); pathList.push(createText(scaledHeight * 0.85 + 10 * scales, scaledHeight + (scaledWidth + scaledWidth / 2), 10 * scales, "D")); pathList.push(createText(scaledHeight * 0.3, scaledWidth + scaledDeep * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW)); } else if (zxbj?.type === "4005" && zxbj?.value) { pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.1, scaledWidth + scaledDeep / 2, scales)); pathList.push(createText(scaledHeight * 0.1 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, scaledWidth + (scaledDeep + scaledDeep / 2), scales)); pathList.push(createText(scaledHeight * 0.8 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D")); } else if (zxbj?.type && dZXCW) { pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW)); } } if (!(hdzj && hdzj.type)) { pathList.push(createDynamicTopLeft(yxbj?.type, scaledHeight, scaledDeep, dYXCW * scale, scaledHeight + scaledDeep, scaledWidth)); if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales)); pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, scaledWidth + scaledDeep + dYXCW / 2, 10 * scales, dYXCW)); } else if (yxbj?.type === "7004" && yxbj?.value) { pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledDeep * 0.2, scaledWidth + scaledDeep / 2, scales)); pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 - 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); pathList.push( createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.85, scaledWidth + (scaledDeep + scaledDeep / 2), scales) ); pathList.push( createText(scaledHeight + scaledDeep + scaledHeight * 0.85 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D") ); pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.3, scaledWidth + scaledDeep * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW)); } else if (yxbj?.type === "7005" && yxbj?.value) { pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.1, scaledWidth + scaledDeep / 2, scales)); pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.1 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); pathList.push( createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.8, scaledWidth + (scaledDeep + scaledDeep / 2), scales) ); pathList.push( createText(scaledHeight + scaledDeep + scaledHeight * 0.8 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D") ); } else if (dYXCW && yxbj?.type) { pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, scaledWidth + dYXCW / 2 - 4, 10 * scales, dYXCW)); } } // 右下部件 // 纵向 L if (scaledDeep && scaledWidth && scaledHeight) { pathList.push(createDoubleArrow(scaledWidth, scaledHeight * 0.8, scaledWidth / 2, scales)); pathList.push(createText(scaledHeight * 0.8 - 10 * scales, scaledWidth / 2, 10 * scales, "L")); // 横向 L pathList.push(createHorizontalDoubleArrow(scaledHeight, scaledHeight / 2, scaledWidth * 0.3, scales)); pathList.push(createText(scaledHeight / 2, scaledWidth * 0.3 + 10 * scales, 10 * scales, "W")); // W pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledHeight + scaledDeep / 2, scaledWidth * 0.5, scale)); pathList.push(createText(scaledHeight + scaledDeep / 2, scaledWidth * 0.5 + 10 * scales, 10 * scales, "D")); } pathList.forEach(x => { g.appendChild(x); }); svg.appendChild(g); // g.setAttribute('transform', `rotate(90, ${viewBoxWidth/2}, ${viewBoxHeight/2})`); } else if (Number(svgType) === 6) { const rectangles = [{ x: 0, y: 0, width: scaledHeight, height: scaledWidth }]; rectangles.forEach(rect => { g.appendChild(createPathElements(rect.x, rect.y, rect.width, rect.height)); }); svg.appendChild(g); } else if (Number(svgType) === 7) { const rectangles = [{ x: 0, y: 0, width: scaledWidth, height: scaledHeight }]; rectangles.forEach(rect => { g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); }); // svg.appendChild(g); let pathList = []; // 左上部件 pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createText(scaledWidth / 2, -scaledHeight - dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3004" && zsbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); pathList.push(createText(scaledWidth * 0.3, -(scaledHeight * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW)); } else if (zsbj?.type === "3005" && zsbj?.value) { pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, -scaledHeight / 2, scales)); pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); } else if (zsbj?.type && dZSCW) { pathList.push(createText(scaledWidth / 2, -(dZSCW / 2 - 5), 10 * scales, dZSCW)); } // 右下部件 pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, 0, scaledHeight)); // 右边 pathList.push(createFull(ysbj?.type, scaledWidth, scaledHeight, dYSCW * scale, scaledWidth, 0)); pathList.push(createFull(zxbj?.type, scaledWidth, -scaledHeight, -dZXCW * scale, 0, 0)); pathList.forEach(x => { g.appendChild(x); }); svg.appendChild(g); } else if (Number(svgType) === 8) { const scaleHeadLength = headLength * scale; const scaleHeadWidth = headWidth * scale; const scaleOrderLength = orderLength * scale; const scaleOrderWidth = orderWidth * scale; // 获取他的偏移距离 const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; const rightOffect = boxList.find(x => x.sName === "右偏移")?.value || 0; const rectangles = [{ x: 0, y: 0, width: scaleHeadLength, height: scaleHeadWidth }]; rectangles.forEach(rect => { g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); }); const rectanglesLeft = [ { x: scaleHeadLength / 2 - scaleOrderLength - Number(leftOffect), y: scaleHeadWidth, width: scaleOrderLength, height: scaleOrderWidth }, ]; rectanglesLeft.forEach(rect => { g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); }); const rectanglesRight = [{ x: scaleHeadLength / 2 + Number(rightOffect), y: scaleHeadWidth, width: scaleOrderLength, height: scaleOrderWidth }]; rectanglesRight.forEach(rect => { g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); }); // 处理双盒的插位组件 let pathList = []; // 获取左上 const scw = boxList.find(x => x.sName === "上插位组件"); const zscw = boxList.find(x => x.sName === "左上插位组件"); const yscw = boxList.find(x => x.sName === "右上插位组件"); const zcw = boxList.find(x => x.sName === "左插位组件"); const ycw = boxList.find(x => x.sName === "右插位组件"); const zxcw = boxList.find(x => x.sName === "左下插位组件"); const yxcw = boxList.find(x => x.sName === "右下插位组件"); const dSCW = scw?.value; const dZSCW = zscw?.value; const dYSCW = yscw?.value; const dZCW = zcw?.value; const dYCW = ycw?.value; const dZXCW = zxcw?.value; const dYXCW = yxcw?.value; // 上插位 pathList.push(createDynamicTopLeft(scw?.type, scaleHeadLength, -scaleHeadWidth, -dSCW * scale, 0, 0)); if ((scw?.type === "11001" && scw?.value) || (scw?.type === "11006" && scw?.value) || (scw?.type === "11007" && scw?.value)) { pathList.push(createDoubleArrow(scaleHeadWidth, scaleHeadWidth * 0.2, -scaleHeadWidth / 2, scales)); pathList.push(createText(scaleHeadWidth * 0.2 + 10 * scales, -scaleHeadWidth / 2, 10 * scales, "dSHK")); pathList.push(createText(scaleHeadLength / 2, -scaleHeadWidth - dSCW / 2 + 4, 10 * scales, dSCW)); } else if (scw?.type === "11004" && scw?.value) { pathList.push(createDoubleArrow(scaleHeadWidth, scaleHeadLength * 0.2, -scaleHeadWidth / 2, scales)); pathList.push(createText(scaleHeadLength * 0.2 + 10 * scales, -scaleHeadWidth / 2, 10 * scales, "dSHK")); pathList.push(createDoubleArrow(scaleHeadWidth, scaleHeadLength * 0.85, -(scaleHeadWidth + scaleHeadWidth / 2), scales)); pathList.push(createText(scaleHeadLength * 0.5 + 10 * scales, -(scaleHeadWidth + scaleHeadWidth / 2), 10 * scales, "dSHK")); pathList.push(createText(scaleHeadLength * 0.3, -(scaleHeadWidth * 2), 10 * scales, dSCW)); } else if (scw?.type === "11005" && scw?.value) { pathList.push(createDoubleArrow(scaleHeadWidth, scaleHeadLength * 0.1, -scaleHeadWidth / 2, scales)); pathList.push(createText(scaleHeadLength * 0.1 + 10 * scales, -scaleHeadWidth / 2, 10 * scales, "dSHK")); pathList.push(createDoubleArrow(scaleHeadWidth, scaleHeadLength * 0.8, -(scaleHeadWidth + scaleHeadWidth / 2), scales)); pathList.push(createText(scaleHeadLength * 0.8 + 10 * scales, -(scaleHeadWidth + scaleHeadWidth / 2), 10 * scales, "dSHK")); pathList.push(createText(scaleHeadLength * 0.8 + 10 * scales, -(scaleHeadWidth + scaleHeadWidth / 2), 10 * scales, "dSHK")); } else if (scw?.type && dSCW) { pathList.push(createText(scaleHeadLength / 2, -(dSCW / 2 - 5), 10 * scales, dSCW)); } // 左上插位 pathList.push(createFull(zscw?.type, scaleHeadWidth, -scaleHeadWidth, -dZSCW * scale, 0, 0)); // 左插位 pathList.push( createFull( zcw?.type, scaleOrderWidth, -scaleOrderWidth, -dZCW * scale, scaleHeadLength / 2 - scaleOrderLength - Number(leftOffect), scaleHeadWidth ) ); // 左下 pathList.push( createDynamicTopLeft( zxcw?.type, scaleOrderLength, scaleOrderWidth, dZXCW * scale, scaleHeadLength / 2 - scaleOrderLength - Number(leftOffect), scaleHeadWidth + scaleOrderWidth ) ); // 右上 pathList.push(createFull(yscw?.type, scaleHeadWidth, scaleHeadWidth, dYSCW * scale, scaleHeadLength, 0)); // 右插位 pathList.push( createFull( ycw?.type, scaleOrderWidth, scaleOrderWidth, dYCW * scale, scaleHeadLength / 2 + Number(rightOffect) + scaleOrderLength, scaleHeadWidth ) ); // 右下 pathList.push( createDynamicTopLeft( yxcw?.type, scaleOrderLength, scaleOrderWidth, dYXCW * scale, scaleHeadLength / 2 + Number(rightOffect), scaleHeadWidth + scaleOrderWidth ) ); if (scaleHeadLength && scaleHeadWidth) { pathList.push(createDoubleArrow(scaleHeadWidth, scaleHeadLength * 0.8, scaleHeadWidth / 2, scales)); pathList.push(createText(scaleHeadLength * 0.8 - 10 * scales, scaleHeadWidth / 2, 10 * scales, "dSHK")); pathList.push(createHorizontalDoubleArrow(scaleHeadLength, scaleHeadLength / 2, scaleHeadWidth * 0.7, scales)); pathList.push(createText(scaleHeadWidth / 2, scaleHeadLength * 0.3 + 10 * scales, 10 * scales, "dSHC")); } if (scaleOrderLength && scaleOrderWidth) { pathList.push(createDoubleArrow(scaleOrderWidth, scaleOrderLength * 0.6, scaleHeadWidth + scaleOrderWidth / 2, scales)); pathList.push(createText(scaleOrderLength * 0.8 - 10 * scales, scaleHeadWidth + scaleOrderWidth / 2, 10 * scales, "dCHK")); pathList.push(createHorizontalDoubleArrow(scaleOrderLength, scaleOrderLength / 2 - (leftOffect ), scaleHeadWidth + scaleOrderWidth * 0.7, scales)); pathList.push(createText(scaleOrderWidth / 2 - (leftOffect ), scaleHeadWidth + scaleOrderLength * 0.8 * scales, 10 * scales, "dCHC")); } pathList.forEach(x => { g.appendChild(x); }); svg.appendChild(g); } }; // 计算头部偏移 const topOffect = (list, length, width, height) => { const val = list.filter(x => x.type); const sfhs = val.find(x => x.sName === "上方盒舌"); const zscw = val.find(x => x.sName === "左(上)插位组件"); const yscw = val.find(x => x.sName === "右(上)插位组件"); const box = val.find(x => x.sName === "盒身"); const svg = Number(box?.type); if (svg === 6) return 0; const dZ = Number(zscw?.value) || 0; const dY = Number(yscw?.value) || 0; if (svg === 8) { const scw = val.find(x => x.sName === "上插位组件"); const topsMap = { 11001: width + Number(scw?.value), 11002: Number(scw?.value), 11003: Number(scw?.value), 11004: Number(scw?.value) + width * 2, 11005: width * 2, 11006: Number(scw?.value) + width, 11007: Number(scw?.value) + width, }; return topsMap[scw?.type] ?? 0; } const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"]; const four = ["6004", "3004", "4004", "7004"]; const five = ["6005", "3005", "4005", "7005"]; const coef = box?.type === "5" ? height : width; const pick = (cw, d) => { const t = cw?.type; if (five.includes(t)) return 2 * coef; if (four.includes(t)) return 2 * coef + d; if (one.includes(t)) return coef + d; return d; }; let top = 0; if (zscw?.type && yscw?.type) { const z = pick(zscw, dZ); const y = pick(yscw, dY); top = Math.max(z, y, sfhs?.value || 0); } else if (yscw?.type) { top = Math.max(pick(yscw, dY), sfhs?.value || 0); } else if (zscw?.type) { top = Math.max(pick(zscw, dZ), sfhs?.value || 0); } else { top = sfhs?.value || 0; } if (svg === 4) top += height; return isNaN(top) ? 0 : top; }; const bottomOffect = (list, length, width, height) => { const val = list.filter(x => x.type); const sfhs = val.find(x => x.sName === "下方盒舌"); const zscw = val.find(x => x.sName === "左(下)插位组件"); const yscw = val.find(x => x.sName === "右(下)插位组件"); const hdzj = val.find(x => x.sName === "盒底组件"); const box = val.find(x => x.sName === "盒身"); const svg = Number(box?.type); if (svg === 6) return 0; if (hdzj?.type) return Number(hdzj.value); const dZ = Number(zscw?.value) || 0; const dY = Number(yscw?.value) || 0; if (svg === 8) { const zxcw = val.find(x => x.sName === "左下插位组件"); const yxcw = val.find(x => x.sName === "右下插位组件"); const topsMap = { 14001: width + Number(zxcw?.value), 14002: Number(zxcw?.value), 14003: Number(zxcw?.value), 14004: Number(zxcw?.value) + width * 2, 14005: width * 2, 14006: Number(zxcw?.value) + width, 14007: Number(zxcw?.value) + width, }; const topsMapRight = { 16001: width + Number(yxcw?.value), 16002: Number(yxcw?.value), 16003: Number(yxcw?.value), 16004: Number(yxcw?.value) + width * 2, 16005: width * 2, 16006: Number(yxcw?.value) + width, 16007: Number(yxcw?.value) + width, }; return Math.max(topsMap[zxcw?.type], topsMapRight[yxcw?.type]) ?? 0; } const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"]; const four = ["6004", "3004", "4004", "7004"]; const five = ["6005", "3005", "4005", "7005"]; const coef = box?.type === "5" ? height : width; const pick = (cw, d) => { const t = cw?.type; if (five.includes(t)) return 2 * coef; if (four.includes(t)) return 2 * coef + d; if (one.includes(t)) return coef + d; return d; }; let top = 0; if (zscw?.type && yscw?.type) { const z = pick(zscw, dZ); const y = pick(yscw, dY); top = Math.max(z, y, sfhs?.value || 0); } else if (yscw?.type) { top = Math.max(pick(yscw, dY), sfhs?.value || 0); } else if (zscw?.type) { top = Math.max(pick(zscw, dZ), sfhs?.value || 0); } else { top = sfhs?.value || 0; } if (svg === 4) top += height; return isNaN(top) ? 0 : top; }; // 上方盒舌左边 const createUpperBoxTongueLeft = (type, w, h, ox, oy) => { if (!h) return createNoneProject(); const fnMap = { 1001: createLineWeltTop, 1002: createIsoscelesTrapezoidWeltTop, 1003: createTrapezoidWeltTop, 1004: createFoldWeltTop, 1005: createRoundedCornersWeltTop, 2001: createLineWeltTop, 2002: createIsoscelesTrapezoidWeltTop, 2003: createTrapezoidWeltTop, 2004: createFoldWeltTop, 2005: createRoundedCornersWeltTop, }; return (fnMap[type] || createNoneProject)(w, h, ox, oy); }; // 右上方盒舌 // 左边贴位 const createTrapezoidLeft = (trapezoidLeftType, height, size, offsetX, offsetY, dSFHS, dXFHS) => { if (!size) return createNoneProject(); const fnMap = { 8001: createWelt, 8002: createWelt1, 8003: createWelt2, 8004: createWelt3, 8005: createWelt4, }; const fn = fnMap[trapezoidLeftType]; return fn ? trapezoidLeftType === "8005" ? fn(height, size, offsetX, offsetY, dSFHS, dXFHS) : fn(height, size, offsetX, offsetY) : createNoneProject(); }; // 右边贴位 const createTrapezoidRight = (trapezoidLeftType, height, size, offsetX, offsetY, dSFHS, dXFHS) => { const suffix = trapezoidLeftType; const fnMap = { 9001: createWelt, 9002: createWelt1, 9003: createWelt2Right, 9004: createWelt3Right, 9005: createWelt4Right, }; const fn = fnMap[suffix]; return fn ? (suffix === "9005" ? fn(height, size, offsetX, offsetY, dSFHS, dXFHS) : fn(height, size, offsetX, offsetY)) : createNoneProject(); }; // 左上部件 const createDynamicTopLeft = (trapezoidLeftType, width, height, size, offsetX, offsetY) => { if (!size) return createNoneProject(); const suffix = trapezoidLeftType?.slice(-2); const fnMap = { "01": createBoxComponentNew, "02": createBoxComponentNew1, "03": createBoxComponentNew2, "04": createBoxComponentNew3, "05": createBoxComponentNew4, "06": createBoxComponentNew5, "07": createBoxComponentNew6, }; const fn = fnMap[suffix]; return fn ? fn(width, height, size, offsetX, offsetY) : createNoneProject(); }; // 盒底组件 特殊的盒底组件 const createBoxBottomComponent = (trapezoidLeftType, width, deep, size, offsetX, offsetY) => { const suffix = trapezoidLeftType?.slice(-2); const fnMap = { "01": createRightAngleBoxBottomComponent, "02": createBoxBottomComponent1, "03": createBoxBottomComponent2, "04": createBoxBottomComponent3, "05": createBoxBottomComponent4, "06": createBoxBottomComponent5, "07": createBoxBottomComponent6, }; return (fnMap[suffix] || createNoneProject)(width, deep, size, offsetX, offsetY); }; // 天地盒部件 const createFull = (trapezoidLeftType, width, deep, size, offsetX, offsetY) => { if (!size) return createNoneProject(); const suffix = trapezoidLeftType?.slice(-2); switch (suffix) { case "01": // 4001,10001,12001,13001,15001,6001 return createBoxComponentNewFull(width, deep, size, offsetX, offsetY); case "02": // 4002,10002,11002,12002,13002,15002,6002 return createBoxComponentNewFull1(width, size, offsetX, offsetY); case "03": // 4003,6003 return createBoxComponentNewFull2(width, size, offsetX, offsetY); case "04": // 4004,6004 return createBoxComponentNewFul3(width, deep, size, offsetX, offsetY); case "05": // 4005,6005 return createBoxComponentNewFul4(width, deep, size, offsetX, offsetY); case "06": // 4006,6006 return createBoxComponentNewFul5(width, deep, size, offsetX, offsetY); case "07": // 4007,6007 return createBoxComponentNewFul6(width, deep, size, offsetX, offsetY); default: return createNoneProject(); } }; return (
); }; export default SvgBox;