|
@@ -1,6 +1,6 @@
|
|
|
import { Pos, Size } from "@/utils/math";
|
|
|
import { extractConnectedSegments } from "@/utils/polygon";
|
|
|
-import { round, validNum } from "@/utils/shared";
|
|
|
+import { validNum } from "@/utils/shared";
|
|
|
import { aiIconMap, iconGroups } from "../constant";
|
|
|
import { Euler, Quaternion } from "three";
|
|
|
|
|
@@ -54,11 +54,11 @@ export const SceneTypeNames = {
|
|
|
[SCENE_TYPE.cloud]: "点云场景",
|
|
|
};
|
|
|
|
|
|
-export const getSceneApi = async (type: string, url: string) => {
|
|
|
+export const getSceneApi = async (type: string | undefined, url: string) => {
|
|
|
if (url[0] === "/") {
|
|
|
url = url.substring(1, url.length);
|
|
|
}
|
|
|
- let origin = window.platform.resourceURLS[type];
|
|
|
+ let origin = type ? window.platform.resourceURLS[type] : '';
|
|
|
if (origin[origin.length - 1] !== "/") {
|
|
|
origin = origin + "/";
|
|
|
}
|
|
@@ -207,13 +207,20 @@ export const taggingGets = {
|
|
|
|
|
|
const reqs = signages.map((signage: any) => {
|
|
|
if (!validNum(signage.pos[0]) || !validNum(signage.pos[2])) return;
|
|
|
+ console.error(signage)
|
|
|
const getIcon =
|
|
|
signage.icon.indexOf("style-") === 0
|
|
|
- ? getSceneApi(
|
|
|
- "ossRoot",
|
|
|
- `/sdk/images/billboard/${signage.icon}.png`
|
|
|
- )
|
|
|
+ ? getSceneApi(undefined, `/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 q = new Quaternion(...signage.qua)
|
|
|
+ const yRotate = new Euler().setFromQuaternion(q, 'XYZ').y + Math.PI
|
|
|
+
|
|
|
return getIcon
|
|
|
.then((url) => {
|
|
|
tags.push({
|
|
@@ -223,10 +230,10 @@ export const taggingGets = {
|
|
|
y: signage.pos[2],
|
|
|
z:
|
|
|
signage.pos[1] < 0
|
|
|
- ? (Math.ceil(signage.pos[1] * 10)) / 10
|
|
|
- : (Math.floor(signage.pos[1] * 10)) / 10,
|
|
|
+ ? Math.ceil(signage.pos[1] * 10) / 10
|
|
|
+ : Math.floor(signage.pos[1] * 10) / 10,
|
|
|
},
|
|
|
- rotate: 0,
|
|
|
+ rotate: yRotate,
|
|
|
size: {
|
|
|
width: signage.width * (signage.scaleRatio / 100),
|
|
|
height: signage.height * (signage.scaleRatio / 100),
|
|
@@ -246,7 +253,6 @@ export const taggingGets = {
|
|
|
.then((url) => fetch(url))
|
|
|
.then((res) => res.json())
|
|
|
.then((datas) => {
|
|
|
- datas = [datas[1]]
|
|
|
for (const data of datas) {
|
|
|
const reg = data.imagePath.match(/floor_(\d)\.png/);
|
|
|
const subgroup = reg ? Number(reg[1]) : undefined;
|
|
@@ -265,7 +271,6 @@ export const taggingGets = {
|
|
|
? (aiIconMap as any)[shape.category]
|
|
|
: shape.category;
|
|
|
let name = "";
|
|
|
- console.log(shape.category);
|
|
|
for (const group of iconGroups) {
|
|
|
for (const itemGroup of group.children) {
|
|
|
for (const item of itemGroup.children) {
|
|
@@ -285,7 +290,7 @@ export const taggingGets = {
|
|
|
subgroup,
|
|
|
} as any);
|
|
|
} else {
|
|
|
- console.error("找不到ai家具", name, pos);
|
|
|
+ console.error("找不到ai家具", icon, name, pos);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -294,7 +299,7 @@ export const taggingGets = {
|
|
|
console.error(e);
|
|
|
});
|
|
|
|
|
|
- console.log('tags', tags);
|
|
|
+ console.log("tags", tags);
|
|
|
return tags;
|
|
|
},
|
|
|
};
|