Просмотр исходного кода

Merge branch 'master' into merge-selection

bill 2 месяцев назад
Родитель
Сommit
f30618bf66

+ 14 - 0
.env.hx

@@ -0,0 +1,14 @@
+VITE_PRIMARY='#109BE0'
+VITE_TITLE='绘图'
+VITE_ENTRY='/example/fuse/enter.ts'
+VITE_ENTRY_EXAMPLE='./main.ts'
+VITE_MESH_OSS='/oss/'
+VITE_OSS_ROOT="/"
+VITE_MESH_API='/'
+VITE_CLOUD_API='/'
+VITE_FUSE_API='/'
+
+VITE_MESH_VIEW='./static/kankan.html?m={m}&lang=zh'
+VITE_CLOUD_VIEW='/swss/index.html?m={m}&lang=zh'
+VITE_FUSE_VIEW='/code/'
+VITE_LOGIN_VIEW='/admin/index.html#/login?redirect={redirect}'

+ 19 - 0
.env.hxdev

@@ -0,0 +1,19 @@
+VITE_PRIMARY='#109BE0'
+VITE_TITLE='绘图'
+VITE_ENTRY='/example/fuse/enter.ts'
+VITE_ENTRY_EXAMPLE='./main.ts'
+VITE_MOCK_ENV=hxtest
+
+
+VITE_STATIC='http://192.168.0.125:1804/'
+VITE_OSS='/oss/'
+VITE_OSS_ROOT="/rootOss/"
+VITE_MESH_OSS='/meshOSS/'
+VITE_MESH_API='/meshAPI/'
+VITE_CLOUD_API='/cloudAPI/'
+VITE_FUSE_API='/fuseAPI/'
+
+VITE_MESH_VIEW='./static/kankan.html?m={m}&lang=zh&token={token}&host=https://survey.4dkankan.com/'
+VITE_CLOUD_VIEW='http://192.168.0.125:1804/swss/index.html?m={m}&lang=zh&token={token}'
+VITE_FUSE_VIEW='http://192.168.0.125:1804/code/'
+VITE_LOGIN_VIEW='http://192.168.0.125:1804/admin/index.html#/login?redirect={redirect}'

+ 17 - 0
.env.hxtest

@@ -0,0 +1,17 @@
+VITE_PRIMARY='#109BE0'
+VITE_TITLE='绘图'
+VITE_ENTRY='/example/fuse/enter.ts'
+VITE_ENTRY_EXAMPLE='./main.ts'
+
+
+VITE_OSS_ROOT="http://192.168.0.125:1804/"
+VITE_OSS='http://192.168.0.125:1804/oss/'
+VITE_MESH_OSS='http://192.168.0.125:1804/oss/'
+VITE_MESH_API='http://192.168.0.125:1804/'
+VITE_CLOUD_API='http://192.168.0.125:1804/'
+VITE_FUSE_API='http://192.168.0.125:1804/'
+
+VITE_MESH_VIEW='./static/kankan.html?m={m}&lang=zh&env=dev'
+VITE_CLOUD_VIEW='http://192.168.0.125:1804/swss/index.html?m={m}&lang=zh'
+VITE_FUSE_VIEW='http://192.168.0.125:1804/code/'
+VITE_LOGIN_VIEW='http://192.168.0.125:1804/admin/#/statistics/scene?redirect={redirect}'

+ 2 - 0
package.json

@@ -7,6 +7,8 @@
     "dev:fuse": "vite --mode=fusedev",
     "build:fusetest": "vite build --mode=fusetest",
     "build:fuse": "vite build --mode=fuse",
+    "dev:hx": "vite --mode=hxdev",
+    "build:hx": "vite build --mode=hx",
 
     "dev:jm": "vite --mode=jmdev",
     "build:jm": "vite build --mode=jm"

+ 0 - 7
public/icons/cad-chuang.svg

@@ -1,7 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg class="icon" width="64px" height="64.00px" viewBox="0 0 1024 1024" version="1.1"
-  xmlns="http://www.w3.org/2000/svg">
-  <path d="M192 416v32h640v-32h192v192H0v-192h192z m640 128H192v32h640v-32z m0-64H192v32h640v-32z"
-    fill="#000000" />
-</svg>

+ 0 - 8
public/icons/cad-loudao.svg

@@ -1,8 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg class="icon" width="64px" height="64.00px" viewBox="0 0 1024 1024" version="1.1"
-  xmlns="http://www.w3.org/2000/svg">
-  <path
-    fill="#000000"
-    d="M960 960H64V64h896v896z m-512-96H96v64h352v-64z m96-768h-64v832h64V96z m32 672v160h352v-160H576z m-128 0H96v64h352v-64z m0-96H96v64h352v-64z m0-96H96v64h352v-64z m0-96H96v64h352v-64z m0-96H96v64h352v-64z m0-96H96v64h352V288z m0-192H96v160h352V96z m128 640h352v-64H576v64z m0-96h352v-64H576v64z m0-96h352v-64H576v64z m0-96h352v-64H576v64z m0-96h352V288H576v64z m0-96h352V192H576v64z m0-96h352V96H576v64z" />
-</svg>

+ 0 - 8
public/icons/cad-luodichuang.svg

@@ -1,8 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg class="icon" width="64px" height="64.00px" viewBox="0 0 1024 1024" version="1.1"
-  xmlns="http://www.w3.org/2000/svg">
-  <path
-    fill="#000000"
-    d="M832 608v-64H192v32h32v32H0v-192h192v32h32v32H192v32h640v-96h192v192h-192z m-512-32v32H256v-32h64z m96 0v32h-64v-32h64z m96 0v32h-64v-32h64z m96 0v32h-64v-32h64z m96 0v32h-64v-32h64z m96 0v32h-64v-32h64z m-480-128v32H256v-32h64z m96 0v32h-64v-32h64z m96 0v32h-64v-32h64z m96 0v32h-64v-32h64z m96 0v32h-64v-32h64z m96 0v32h-64v-32h64z" />
-</svg>

+ 0 - 8
public/icons/cad-men.svg

@@ -1,8 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg class="icon" width="64px" height="64.00px" viewBox="0 0 1024 1024" version="1.1"
-  xmlns="http://www.w3.org/2000/svg">
-  <path
-    fill="#000000"
-    d="M800.32 192H864v416h160v192h-192v-128h-64V222.56c-162.496-5.216-287.104 26.336-374.176 94.08-92.8 72.192-160.064 170.048-201.824 293.984V800H0v-192h160a16 16 0 0 1 0.832-5.056c43.616-130.912 114.784-234.912 213.344-311.584C473.536 214.112 615.744 181.216 800.32 192zM832 224h-32v416h32V224z" />
-</svg>

+ 0 - 9
public/icons/cad-piaochuang.svg

@@ -1,9 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg class="icon" width="64px" height="64.00px" viewBox="0 0 1024 1024" version="1.1"
-  xmlns="http://www.w3.org/2000/svg">
-  <path
-
-    fill="#000000"
-    d="M896 256v320h96v192H32v-192h96V256h768zM224 736h576V352H224v384zM864 288H160v288h32v-256h640v256h32V288z" />
-</svg>

+ 0 - 8
public/icons/cad-shuangkaimen.svg

@@ -1,8 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg class="icon" width="64px" height="64.00px" viewBox="0 0 1024 1024" version="1.1"
-  xmlns="http://www.w3.org/2000/svg">
-  <path
-    fill="#000000"
-    d="M864 192v416h160v192h-192v-128h-64l0.032-448H768c-108.096 0-205.824 119.936-240.384 275.456-3.712 16.736-27.52 16.736-31.232 0C461.824 343.936 364.096 224 256 224v448H192v128H0v-192h159.968L160 192h96c109.12 0 204.16 98.208 252.288 233.28l3.712 10.752 0.416-1.28c45.952-136.8 139.616-238.176 248.16-242.592L768 192h96z m-32 32h-32v416h32V224zM224.032 224h-32v416h32V224z" />
-</svg>

+ 0 - 8
public/icons/cad-yakou.svg

@@ -1,8 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg class="icon" width="64px" height="64.00px" viewBox="0 0 1024 1024" version="1.1"
-  xmlns="http://www.w3.org/2000/svg">
-  <path
-    fill="#000000"
-    d="M896.096 352v64h128v192h-128v64h-768v-64h-128v-192h128v-64h768z m-32 32h-704v32h64v192h-64v32h704v-32h-64v-192h64v-32zM352 544v32H288v-32h64z m128 0v32h-64v-32h64z m128 0v32h-64v-32h64z m128 0v32h-64v-32h64z m-384-96v32H288v-32h64z m128 0v32h-64v-32h64z m128 0v32h-64v-32h64z m128 0v32h-64v-32h64z" />
-</svg>

+ 0 - 8
public/icons/cad-yandao.svg

@@ -1,8 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg class="icon" width="64px" height="64.00px" viewBox="0 0 1024 1024" version="1.1"
-  xmlns="http://www.w3.org/2000/svg">
-  <path
-    fill="#000000"
-    d="M960 64v896H64V64h896z m-32 32H96v832h832V96z m-32 32v768H128V128h768zM160 176.512V864h687.488L709.984 313.984 160 176.512zM864 160H226.08l510.304 127.616L864 798.016V160z" />
-</svg>

+ 0 - 8
public/icons/cad-yimen.svg

@@ -1,8 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg class="icon" width="64px" height="64.00px" viewBox="0 0 1024 1024" version="1.1"
-  xmlns="http://www.w3.org/2000/svg">
-  <path
-    fill="#000000"
-    d="M832 512v-96h192v192H416v-96H192v96H0v-192h608v96h224z m0 32H448v32h384v-32z m-256-96H192v32h384v-32z" />
-</svg>

+ 0 - 8
public/icons/cad-zhuzi.svg

@@ -1,8 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg class="icon" width="64px" height="64.00px" viewBox="0 0 1024 1024" version="1.1"
-  xmlns="http://www.w3.org/2000/svg">
-  <path
-    fill="#000000"
-    d="M960 64v896H64V64h896zM512 534.624L118.592 928h786.784L512 534.624zM928 118.592L534.624 512 928 905.376V118.592zM96 118.624v786.72L489.376 512 96 118.624zM905.344 96H118.624L512 489.376 905.344 96z" />
-</svg>

+ 1 - 1
src/core/components/icon/temp-icon.vue

@@ -37,7 +37,7 @@ watch(
     const content = parseSvgContent(svgContent);
     if (content.paths.length === 0) {
       svg.value = null;
-      console.error(props.data, "路径数据不正确不是svg");
+      console.error(props.data.url, content, "路径数据不正确不是svg");
     } else {
       svg.value = content;
     }

+ 1 - 1
src/core/hook/use-status.ts

@@ -87,7 +87,7 @@ export const useOperMode = installGlobalVar(() => {
 
   return computed(() => ({
     // 多选模式
-    mulSelection: keys.has('Ctrl') && !keys.has(' ') && !keys.has('Alt'),
+    mulSelection: keys.has('Shift') && !keys.has(' ') && !keys.has('Alt'),
     // mulSelection: false,
     // 自由移动视图
     freeView: keys.has(' '),

+ 63 - 18
src/example/constant.ts

@@ -1,30 +1,46 @@
-export const iconGroups = [
+type IconItem = {
+  wall?: boolean;
+  icon: string;
+  name: string;
+  color?: string
+  parse?: { fill?: string; stroke?: string };
+};
+type IconGroup = {
+  name: string,
+  children: {
+    name: string,
+    children: IconItem[]
+  }[]
+}
+
+export const iconGroups: IconGroup[] = [
   {
     name: "常用名称",
     children: [
       {
         name: "门",
         children: [
-          { wall: true, icon: "cad-men", name: "门" },
-          { wall: true, icon: "cad-shuangkaimen", name: "双开门" },
-          { wall: true, icon: "cad-yimen", name: "移门" },
-          { wall: true, icon: "cad-yakou", name: "哑口" },
+          { wall: true, icon: "men_l", name: "门" },
+          { wall: true, icon: "men", name: "门" },
+          { wall: true, icon: "shuangkaimen", name: "双开门" },
+          { wall: true, icon: "yimen", name: "移门" },
+          { wall: true, icon: "yakou", name: "哑口" },
         ],
       },
       {
         name: "窗",
         children: [
-          { wall: true, icon: "cad-chuang", name: "窗" },
-          { wall: true, icon: "cad-piaochuang", name: "飘窗" },
-          { wall: true, icon: "cad-luodichuang", name: "落地窗" },
+          { wall: true, icon: "chuang", name: "窗" },
+          { wall: true, icon: "piaochuang", name: "飘窗" },
+          { wall: true, icon: "luodichuang", name: "落地窗" },
         ],
       },
       {
         name: "构件",
         children: [
-          { icon: "cad-zhuzi", name: "柱子" },
-          { icon: "cad-yandao", name: "烟道" },
-          { icon: "cad-loudao", name: "楼道" },
+          { icon: "zhuzi", name: "柱子" },
+          { icon: "yandao", name: "烟道" },
+          { icon: "loudao", name: "楼道" },
         ],
       },
     ],
@@ -112,13 +128,42 @@ export const iconGroups = [
     ],
   },
 ];
+
+export const getIconItem = (icon: string) => {
+  for (const group of iconGroups) {
+    for (const itemGroup of group.children) {
+      for (const item of itemGroup.children) {
+        if (item.icon === icon) {
+          return item;
+        }
+      }
+    }
+  }
+};
+
 export const aiIconMap = {
-  SingleDoor: "cad-men",
-  DoubleDoor: "cad-shuangkaimen",
-  SlideDoor: "cad-yimen",
-  Pass: "cad-yakou",
-  SingleWindow: "cad-chuang",
-  BayWindow: "cad-piaochuang",
-  FrenchWindow: "cad-luodichuang",
+  SingleDoor: "men",
+  DoubleDoor: "shuangkaimen",
+  SlideDoor: "yimen",
+  Pass: "yakou",
+  SingleWindow: "chuang",
+  BayWindow: "piaochuang",
+  FrenchWindow: "luodichuang",
   Chair: "Chair",
 };
+export const styleIconMap = {
+  "style-4": "zhiwen_o",
+  "style-5": "youzuji_o",
+  "style-6": "zuozuji_o",
+  "style-7": "xieyin_o",
+  "style-8": "xuepo_o",
+  "style-9": "xueji_o",
+  "style-10": "shitiz_o",
+  "style-11": "shitib_o",
+  "style-12": "shitifuhao_o",
+  "style-13": "buqiang_o",
+  "style-14": "shouqiang_o",
+  "style-15": "dantou_o",
+  "style-16": "danke_o",
+  "style-17": "chelunhenji_o",
+};

+ 2 - 2
src/example/fuse/views/overview/slide-icons.vue

@@ -41,11 +41,11 @@ const drawIcon = async (url: string, name: string, item: any) => {
   props.draw.enterDrawShape(
     "icon",
     {
-      url,
-      name,
       ...defaultStyle,
       ...(item.parse || {}),
       ...parset,
+      url,
+      name,
     },
     true
   );

+ 0 - 2
src/example/platform/platform-draw.ts

@@ -228,7 +228,6 @@ const drawLayerResource = async (
       url: layerResource.thumb,
       mat: mat.m,
       width,
-      lock: import.meta.env.DEV ? false : true,
       height,
       cornerRadius: 0,
       zIndex: -1,
@@ -329,7 +328,6 @@ const drawLayerResource = async (
         name: item.name,
         createTime: createTime + layerResource.geos.length + ndx,
         url: item.url,
-        lock: import.meta.env.DEV ? false : true,
         mat: tf.m,
         cornerRadius: 0,
         ...attach,

+ 43 - 37
src/example/platform/platform-resource.ts

@@ -1,7 +1,7 @@
 import { Pos, Size } from "@/utils/math";
 import { extractConnectedSegments } from "@/utils/polygon";
 import { validNum } from "@/utils/shared";
-import { aiIconMap, iconGroups } from "../constant";
+import { aiIconMap, getIconItem, iconGroups, styleIconMap } from "../constant";
 import { Euler, MathUtils, Object3D, Quaternion, Vector3 } from "three";
 import { getSvgContent, parseSvgContent } from "@/utils/resource";
 
@@ -249,15 +249,18 @@ export const taggingGets = {
 
       const reqs = signages.map((signage: any) => {
         if (!validNum(signage.pos[0]) || !validNum(signage.pos[2])) return;
+        const styleMap = (styleIconMap as any)[signage.icon];
         const getIcon =
           signage.icon.indexOf("style-") === 0
-            ? getSceneApi("./", `./styles/${signage.icon}.svg`).catch((e) => {
-                console.error(e);
-                return getSceneApi(
-                  "ossRoot",
-                  `/sdk/images/billboard/${signage.icon}.png`
-                );
-              })
+            ? styleMap
+              ? Promise.resolve(`./icons/${styleMap}.svg`)
+              : getSceneApi("./", `./styles/${signage.icon}.svg`).catch((e) => {
+                  console.error(e);
+                  return getSceneApi(
+                    "ossRoot",
+                    `/sdk/images/billboard/${signage.icon}.png`
+                  );
+                })
             : getSceneApi("oss", `${prev}/user/${signage.icon}`);
 
         const yRotate = getBillYaw(signage);
@@ -265,8 +268,11 @@ export const taggingGets = {
         console.log(signage);
         return getIcon
           .then((url) => {
+            const name = (styleMap && getIconItem(styleMap)?.name) || ''
+
             tags.push({
               url,
+              name,
               position: {
                 x: signage.pos[0],
                 y: signage.pos[2],
@@ -315,18 +321,11 @@ export const taggingGets = {
               shape.category in aiIconMap
                 ? (aiIconMap as any)[shape.category]
                 : shape.category;
-            let name = "";
-            let isWall = false;
-            for (const group of iconGroups) {
-              for (const itemGroup of group.children) {
-                for (const item of itemGroup.children) {
-                  if (item.icon === icon) {
-                    name = item.name;
-                    isWall = "wall" in item && item.wall;
-                  }
-                }
-              }
-            }
+            
+            
+            const itemIcon = getIconItem(icon)
+            const name = itemIcon?.name
+            const isWall = itemIcon && "wall" in itemIcon ? itemIcon.wall : false;
             const isTag = icon === "Tag";
             if (name || isTag) {
               const item = {
@@ -345,22 +344,29 @@ export const taggingGets = {
               if (isWall) {
                 const wh = Math.max(item.size.width, item.size.height);
                 loadPromises.push(
-                  getSvgContent(item.url).then((svgContent) => {
-                    const content = parseSvgContent(svgContent);
-                    item.fixed = true
-                    // item.size.width = item.size.height = wh
-                    if (wh === item.size.width) {
-                      item.size.width = wh
-                      item.size.height = data.imageWidth / data.imageHeight * (content.height / content.width * wh) 
-                      item.position.y -= item.size.height / 2;
-                    } else {
-                      item.size.height = wh
-                      item.size.width = data.imageHeight / data.imageWidth * (content.width / content.height * wh) 
-                      item.position.x += item.size.height / 2;
-                      item.rotate = Math.PI / 2;
-                    }
-                    tags.push(item as any);
-                  }).catch(() => {})
+                  getSvgContent(item.url)
+                    .then((svgContent) => {
+                      const content = parseSvgContent(svgContent);
+                      item.fixed = true;
+                      // item.size.width = item.size.height = wh
+
+                      if (wh === item.size.width) {
+                        item.size.width = wh;
+                        item.size.height =
+                          (data.imageWidth / data.imageHeight) *
+                          ((content.height / content.width) * wh);
+                        item.position.y -= item.size.height / 2;
+                      } else {
+                        item.size.width = wh;
+                        item.size.height =
+                          (data.imageWidth / data.imageHeight) *
+                          ((content.height / content.width) * wh);
+                        item.position.x += item.size.height / 2;
+                        item.rotate = Math.PI / 2;
+                      }
+                      tags.push(item as any);
+                    })
+                    .catch(() => {})
                 );
               } else {
                 tags.push(item as any);
@@ -370,7 +376,7 @@ export const taggingGets = {
             }
           }
         }
-        return Promise.all(loadPromises)
+        return Promise.all(loadPromises);
       })
       .catch((e) => {
         console.error(e);