From 853ddfba3f7a105e3a82ff2e470a24b380b1cbe5 Mon Sep 17 00:00:00 2001 From: Hcat <2768237203@qq.com> Date: Sun, 21 Jan 2024 21:10:21 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=BB=96=E6=9D=B0=EF=BC=9A=E8=B7=AF?= =?UTF-8?q?=E7=89=8C=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sceneClass/utils/StreetSignTag.JS | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 src/components/content/tunnelScene/sceneClass/utils/StreetSignTag.JS diff --git a/src/components/content/tunnelScene/sceneClass/utils/StreetSignTag.JS b/src/components/content/tunnelScene/sceneClass/utils/StreetSignTag.JS deleted file mode 100644 index 0e736cb..0000000 --- a/src/components/content/tunnelScene/sceneClass/utils/StreetSignTag.JS +++ /dev/null @@ -1,26 +0,0 @@ -import * as THREE from "three";/** -* 返回一个带有文字的的#3D材质 -* 把输入的文字转化为base64的img图片 -* @param {String} text -* @param {String} param 传感器实时检测参数 -*/ -export default function (text = "", param = "", width = 250, height = 150) { - const canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - const ctx = canvas.getContext("2d"); - ctx.fillStyle = "#003BA8"; - ctx.fillRect(0, 0, width, height); - ctx.fillStyle = "white"; - ctx.font = "15px serif"; - ctx.fillText('隧道简称:' + text, (100 - text.length * 1) / 50, 40); - ctx.fillText('隧道长度:' + param + 'm', (100 - param.length * 1) / 50, 115); - ctx.strokeStyle = "white"; - ctx.moveTo(0, 75); - ctx.lineTo(30000, 120); - ctx.stroke(); - const base64 = canvas.toDataURL(); - return new THREE.MeshBasicMaterial({ - map: new THREE.TextureLoader().load(base64), - }); -} \ No newline at end of file From 18d2d52b5e4b4e2cb770c95b0ec8653399ac60a5 Mon Sep 17 00:00:00 2001 From: Hcat <2768237203@qq.com> Date: Sun, 21 Jan 2024 21:14:20 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=BB=96=E6=9D=B0=EF=BC=9A=E8=B7=AF?= =?UTF-8?q?=E7=89=8C=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/tunnelScene/sceneClass/demo.js | 2 +- .../sceneClass/utils/StreetSignTag.js | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/components/content/tunnelScene/sceneClass/utils/StreetSignTag.js diff --git a/src/components/content/tunnelScene/sceneClass/demo.js b/src/components/content/tunnelScene/sceneClass/demo.js index d5975ca..2721671 100644 --- a/src/components/content/tunnelScene/sceneClass/demo.js +++ b/src/components/content/tunnelScene/sceneClass/demo.js @@ -11,7 +11,7 @@ import addFunction from "./addEvent"; import { editTunnelInit } from "./editTunnelInit"; import { addEquipment, removeEquipment } from "./editEquipment"; import previewtunnelModeInit from "./previewTunnelInit" -import StreetSignTag from "./utils/StreetSignTag"; +import { StreetSignTag } from "./utils/StreetSignTag.js"; export default class Demo { // 摄像机看向位置 origin = null; diff --git a/src/components/content/tunnelScene/sceneClass/utils/StreetSignTag.js b/src/components/content/tunnelScene/sceneClass/utils/StreetSignTag.js new file mode 100644 index 0000000..d0f8e64 --- /dev/null +++ b/src/components/content/tunnelScene/sceneClass/utils/StreetSignTag.js @@ -0,0 +1,26 @@ +import * as THREE from "three";/** +* 返回一个带有文字的的#3D材质 +* 把输入的文字转化为base64的img图片 +* @param {String} text +* @param {String} param 传感器实时检测参数 +*/ +export function StreetSignTag(text = "", param = "", width = 250, height = 150) { + const canvas = document.createElement("canvas"); + canvas.width = width; + canvas.height = height; + const ctx = canvas.getContext("2d"); + ctx.fillStyle = "#003BA8"; + ctx.fillRect(0, 0, width, height); + ctx.fillStyle = "white"; + ctx.font = "15px serif"; + ctx.fillText('隧道简称:' + text, (100 - text.length * 1) / 50, 40); + ctx.fillText('隧道长度:' + param + 'm', (100 - param.length * 1) / 50, 115); + ctx.strokeStyle = "white"; + ctx.moveTo(0, 75); + ctx.lineTo(30000, 120); + ctx.stroke(); + const base64 = canvas.toDataURL(); + return new THREE.MeshBasicMaterial({ + map: new THREE.TextureLoader().load(base64), + }); +} \ No newline at end of file From 25828f823f433de179bd7cf6f12804709b1762f9 Mon Sep 17 00:00:00 2001 From: Hcat <2768237203@qq.com> Date: Sun, 21 Jan 2024 21:28:46 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E8=B7=AF=E7=89=8C=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/content/tunnelScene/sceneClass/demo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/content/tunnelScene/sceneClass/demo.js b/src/components/content/tunnelScene/sceneClass/demo.js index 2721671..a680ba8 100644 --- a/src/components/content/tunnelScene/sceneClass/demo.js +++ b/src/components/content/tunnelScene/sceneClass/demo.js @@ -15,7 +15,7 @@ import { StreetSignTag } from "./utils/StreetSignTag.js"; export default class Demo { // 摄像机看向位置 origin = null; - //附着点的模型 + //附着点的模型1 points = []; //设备模型数组 deviceModels = []; From afcc63aa17e440cc14d98fc2e5873dd37cce8258 Mon Sep 17 00:00:00 2001 From: Hcat <2768237203@qq.com> Date: Sun, 21 Jan 2024 21:30:06 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=B7=AF=E7=89=8C=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/content/tunnelScene/sceneClass/demo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/content/tunnelScene/sceneClass/demo.js b/src/components/content/tunnelScene/sceneClass/demo.js index a680ba8..80393bb 100644 --- a/src/components/content/tunnelScene/sceneClass/demo.js +++ b/src/components/content/tunnelScene/sceneClass/demo.js @@ -15,7 +15,7 @@ import { StreetSignTag } from "./utils/StreetSignTag.js"; export default class Demo { // 摄像机看向位置 origin = null; - //附着点的模型1 + //附着点的模型122 points = []; //设备模型数组 deviceModels = []; From 98b28eccbdacc3e432db2548b4e4b33f1fc1a265 Mon Sep 17 00:00:00 2001 From: Hcat <2768237203@qq.com> Date: Sun, 21 Jan 2024 21:46:58 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B7=AF=E7=89=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/content/tunnelScene/sceneClass/demo.js | 4 ++-- .../sceneClass/utils/{ => StreetSignTag}/StreetSignTag.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/components/content/tunnelScene/sceneClass/utils/{ => StreetSignTag}/StreetSignTag.js (96%) diff --git a/src/components/content/tunnelScene/sceneClass/demo.js b/src/components/content/tunnelScene/sceneClass/demo.js index 80393bb..4b65ecc 100644 --- a/src/components/content/tunnelScene/sceneClass/demo.js +++ b/src/components/content/tunnelScene/sceneClass/demo.js @@ -11,9 +11,9 @@ import addFunction from "./addEvent"; import { editTunnelInit } from "./editTunnelInit"; import { addEquipment, removeEquipment } from "./editEquipment"; import previewtunnelModeInit from "./previewTunnelInit" -import { StreetSignTag } from "./utils/StreetSignTag.js"; +import { StreetSignTag } from "./utils/StreetSignTag/StreetSignTag.js"; export default class Demo { - // 摄像机看向位置 + // 摄像机看向位置s origin = null; //附着点的模型122 points = []; diff --git a/src/components/content/tunnelScene/sceneClass/utils/StreetSignTag.js b/src/components/content/tunnelScene/sceneClass/utils/StreetSignTag/StreetSignTag.js similarity index 96% rename from src/components/content/tunnelScene/sceneClass/utils/StreetSignTag.js rename to src/components/content/tunnelScene/sceneClass/utils/StreetSignTag/StreetSignTag.js index d0f8e64..09be94b 100644 --- a/src/components/content/tunnelScene/sceneClass/utils/StreetSignTag.js +++ b/src/components/content/tunnelScene/sceneClass/utils/StreetSignTag/StreetSignTag.js @@ -12,7 +12,7 @@ export function StreetSignTag(text = "", param = "", width = 250, height = 150) ctx.fillStyle = "#003BA8"; ctx.fillRect(0, 0, width, height); ctx.fillStyle = "white"; - ctx.font = "15px serif"; + ctx.font = "20px serif"; ctx.fillText('隧道简称:' + text, (100 - text.length * 1) / 50, 40); ctx.fillText('隧道长度:' + param + 'm', (100 - param.length * 1) / 50, 115); ctx.strokeStyle = "white";