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