bill 3 ماه پیش
والد
کامیت
7b0bf05c79
7فایلهای تغییر یافته به همراه42 افزوده شده و 18 حذف شده
  1. 2 0
      .env.fusetest
  2. 1 0
      .env.jm
  3. 1 0
      .env.jmdev
  4. 2 0
      .env.jmtest
  5. 2 0
      src/example/fuse/enter.ts
  6. 3 0
      src/example/platform/platform-draw.ts
  7. 31 18
      src/example/platform/platform-resource.ts

+ 2 - 0
.env.fusetest

@@ -2,6 +2,8 @@ VITE_PRIMARY='#D8000A'
 VITE_TITLE='绘图'
 VITE_ENTRY='./example/fuse/enter.ts'
 VITE_ENTRY_EXAMPLE='./main.ts'
+
+VITE_OSS_ROOT="https://4dkk.4dage.com/"
 VITE_MESH_OSS='https://4dkk.4dage.com/'
 VITE_MESH_API='https://test.4dkankan.com/'
 VITE_CLOUD_API='https://uat-laser.4dkankan.com/uat/'

+ 1 - 0
.env.jm

@@ -3,6 +3,7 @@ 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='/'

+ 1 - 0
.env.jmdev

@@ -5,6 +5,7 @@ VITE_ENTRY_EXAMPLE='./main.ts'
 VITE_MOCK_ENV=jmtest
 
 VITE_STATIC='http://192.168.0.25'
+VITE_OSS_ROOT="/oss/"
 VITE_MESH_OSS='/meshOSS/'
 VITE_MESH_API='/meshAPI/'
 VITE_CLOUD_API='/cloudAPI/'

+ 2 - 0
.env.jmtest

@@ -3,6 +3,8 @@ VITE_TITLE='绘图'
 VITE_ENTRY='./example/fuse/enter.ts'
 VITE_ENTRY_EXAMPLE='./main.ts'
 
+
+VITE_OSS_ROOT="http://192.168.0.25/"
 VITE_MESH_OSS='http://192.168.0.25/oss/'
 VITE_MESH_API='http://192.168.0.25/'
 VITE_CLOUD_API='http://192.168.0.25/'

+ 2 - 0
src/example/fuse/enter.ts

@@ -11,8 +11,10 @@ const SCENE_TYPE = {
   cloud: "cloud",
 } as const;
 
+console.log(import.meta.env.VITE_OSS_ROOT)
 const resourceURLS = {
   oss: import.meta.env.VITE_MESH_OSS,
+  ossRoot: import.meta.env.VITE_OSS_ROOT,
   [SCENE_TYPE.mesh]: import.meta.env.VITE_MESH_API,
   [SCENE_TYPE.cloud]: import.meta.env.VITE_CLOUD_API,
   [SCENE_TYPE.fuse]: import.meta.env.VITE_FUSE_API,

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

@@ -99,6 +99,9 @@ const getResourceLayers = (data: AIExposeData) => {
         box,
         taggings: data.taggings
           .filter((item) => {
+            console.log(item, item.position.z, box.bound, 
+              item.position.z > box.bound.z_min &&
+              item.position.z <= box.bound.z_max)
             return (
               item.position.z > box.bound.z_min &&
               item.position.z <= box.bound.z_max

+ 31 - 18
src/example/platform/platform-resource.ts

@@ -17,7 +17,7 @@ export type Scene = {
 
 export type SceneFloor = {
   name: string;
-  subgroup?: number,
+  subgroup?: number;
   geos: (Pos & { z: number })[][];
   thumb?: string;
   box?: {
@@ -41,7 +41,7 @@ export type Taging = {
   url: string;
   position: Pos & { z: number };
   size?: Size;
-  name?: string
+  name?: string;
   pixel?: boolean;
   subgroup?: string;
 };
@@ -53,14 +53,14 @@ export const SceneTypeNames = {
 };
 
 export const getSceneApi = async (type: string, url: string) => {
-  if (url[url.length - 1] === '/') {
-    url = url.substring(0, url.length - 1)
+  if (url[0] === "/") {
+    url = url.substring(1, url.length );
   }
-  let origin = window.platform.resourceURLS[type]
-  if (origin[origin.length - 1] !== '/') {
-    origin = origin + '/'
+  let origin = window.platform.resourceURLS[type];
+  if (origin[origin.length - 1] !== "/") {
+    origin = origin + "/";
   }
-  const uri = origin + url
+  const uri = origin + url;
   // try {
   //   uri = new URL(window.platform.resourceURLS[type]).toString();
   // } catch {
@@ -202,12 +202,22 @@ export const taggingGets = {
         .then((url) => fetch(url))
         .then((res) => res.json())
         .catch(() => []);
-
       signages.forEach((signage: any) => {
-        if (!validNum(signage.pos.x) || !validNum(signage.pos.y)) return;
-        return getSceneApi("oss", `${prev}/user/${signage.icon}.png`)
+        if (!validNum(signage.pos[0]) || !validNum(signage.pos[1])) return;
+        const getIcon =
+          signage.icon.indexOf("style-") === 0
+            ? getSceneApi('ossRoot', `/sdk/images/billboard/${signage.icon}.png`)
+            : getSceneApi('oss', `${prev}/user/${signage.icon}`);
+        return getIcon
           .then((url) => {
-            tags.push({ url, position: signage.pos });
+            tags.push({
+              url,
+              position: {
+                x: signage.pos[0],
+                y: signage.pos[1],
+                z: signage.pos[0],
+              },
+            });
           })
           .catch(() => {});
       });
@@ -225,21 +235,24 @@ export const taggingGets = {
           const subgroup = reg ? Number(reg[1]) : undefined;
           for (const shape of data.shapes) {
             const pos = {
-              x: ((shape.bbox[0] + shape.bbox[2]) / 2) / data.imageWidth,
-              y: ((shape.bbox[1] + shape.bbox[3]) / 2) / data.imageHeight,
+              x: (shape.bbox[0] + shape.bbox[2]) / 2 / data.imageWidth,
+              y: (shape.bbox[1] + shape.bbox[3]) / 2 / data.imageHeight,
               z: 0,
             };
             const size = {
               width: (shape.bbox[2] - shape.bbox[0]) / data.imageWidth,
               height: (shape.bbox[3] - shape.bbox[1]) / data.imageHeight,
             };
-            const icon = shape.category in aiIconMap ? (aiIconMap as any)[shape.category] : shape.category
-            let name = ''
+            const icon =
+              shape.category in aiIconMap
+                ? (aiIconMap as any)[shape.category]
+                : shape.category;
+            let name = "";
             for (const group of iconGroups) {
               for (const itemGroup of group.children) {
                 for (const item of itemGroup.children) {
                   if (item.icon === icon) {
-                    name = item.name
+                    name = item.name;
                   }
                 }
               }
@@ -247,7 +260,7 @@ export const taggingGets = {
             if (!name) return;
             tags.push({
               position: pos,
-              url: `./icons/${icon ? icon : 'circle'}.svg`,
+              url: `./icons/${icon ? icon : "circle"}.svg`,
               name,
               pixel: true,
               size,