|
@@ -56,10 +56,12 @@ export class FloorScene extends SGraphyScene {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this._isShowSpace = v;
|
|
this._isShowSpace = v;
|
|
- this.spaceList.map((t: SpaceItem) => {
|
|
|
|
- t.visible = this._isShowSpace;
|
|
|
|
- return t;
|
|
|
|
- });
|
|
|
|
|
|
+ this.spaceList.map(
|
|
|
|
+ (t: SpaceItem): SpaceItem => {
|
|
|
|
+ t.visible = this._isShowSpace;
|
|
|
|
+ return t;
|
|
|
|
+ }
|
|
|
|
+ );
|
|
} // Set isShowSpace
|
|
} // Set isShowSpace
|
|
|
|
|
|
/** 是否显示柱子 */
|
|
/** 是否显示柱子 */
|
|
@@ -72,10 +74,12 @@ export class FloorScene extends SGraphyScene {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this._isShowColumn = v;
|
|
this._isShowColumn = v;
|
|
- this.columnList.map((t: ColumnItem) => {
|
|
|
|
- t.visible = this._isShowColumn;
|
|
|
|
- return t;
|
|
|
|
- });
|
|
|
|
|
|
+ this.columnList.map(
|
|
|
|
+ (t: ColumnItem): ColumnItem => {
|
|
|
|
+ t.visible = this._isShowColumn;
|
|
|
|
+ return t;
|
|
|
|
+ }
|
|
|
|
+ );
|
|
} // Set isShowColumn
|
|
} // Set isShowColumn
|
|
|
|
|
|
/** 是否展示墙体 */
|
|
/** 是否展示墙体 */
|
|
@@ -88,10 +92,12 @@ export class FloorScene extends SGraphyScene {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this._isShowWall = v;
|
|
this._isShowWall = v;
|
|
- this.wallList.map((t: WallItem) => {
|
|
|
|
- t.visible = this._isShowWall;
|
|
|
|
- return t;
|
|
|
|
- });
|
|
|
|
|
|
+ this.wallList.map(
|
|
|
|
+ (t: WallItem): WallItem => {
|
|
|
|
+ t.visible = this._isShowWall;
|
|
|
|
+ return t;
|
|
|
|
+ }
|
|
|
|
+ );
|
|
} // Set isShowWall
|
|
} // Set isShowWall
|
|
|
|
|
|
/** 是否展示虚拟墙 */
|
|
/** 是否展示虚拟墙 */
|
|
@@ -104,10 +110,12 @@ export class FloorScene extends SGraphyScene {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this._isShowVirtualWall = v;
|
|
this._isShowVirtualWall = v;
|
|
- this.virtualWallList.map((t: VirtualWallItem) => {
|
|
|
|
- t.visible = this._isShowVirtualWall;
|
|
|
|
- return t;
|
|
|
|
- });
|
|
|
|
|
|
+ this.virtualWallList.map(
|
|
|
|
+ (t: VirtualWallItem): VirtualWallItem => {
|
|
|
|
+ t.visible = this._isShowVirtualWall;
|
|
|
|
+ return t;
|
|
|
|
+ }
|
|
|
|
+ );
|
|
} // Set isShowVirtualWall
|
|
} // Set isShowVirtualWall
|
|
|
|
|
|
/** 是否展示门 */
|
|
/** 是否展示门 */
|
|
@@ -120,10 +128,12 @@ export class FloorScene extends SGraphyScene {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this._isShowDoor = v;
|
|
this._isShowDoor = v;
|
|
- this.doorList.map((t: DoorItem) => {
|
|
|
|
- t.visible = this._isShowDoor;
|
|
|
|
- return t;
|
|
|
|
- });
|
|
|
|
|
|
+ this.doorList.map(
|
|
|
|
+ (t: DoorItem): DoorItem => {
|
|
|
|
+ t.visible = this._isShowDoor;
|
|
|
|
+ return t;
|
|
|
|
+ }
|
|
|
|
+ );
|
|
} // Set isShowDoor
|
|
} // Set isShowDoor
|
|
|
|
|
|
/** 是否展示窗户 */
|
|
/** 是否展示窗户 */
|
|
@@ -136,10 +146,12 @@ export class FloorScene extends SGraphyScene {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this._isShowWindow = v;
|
|
this._isShowWindow = v;
|
|
- this.casementList.map((t: WindowItem) => {
|
|
|
|
- t.visible = this._isShowWindow;
|
|
|
|
- return t;
|
|
|
|
- });
|
|
|
|
|
|
+ this.casementList.map(
|
|
|
|
+ (t: WindowItem): WindowItem => {
|
|
|
|
+ t.visible = this._isShowWindow;
|
|
|
|
+ return t;
|
|
|
|
+ }
|
|
|
|
+ );
|
|
} // Set isShowWindow
|
|
} // Set isShowWindow
|
|
|
|
|
|
/** 空间是否可选 */
|
|
/** 空间是否可选 */
|
|
@@ -152,10 +164,12 @@ export class FloorScene extends SGraphyScene {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this._isSpaceSelectable = v;
|
|
this._isSpaceSelectable = v;
|
|
- this.spaceList.map((t: SpaceItem) => {
|
|
|
|
- t.selectable = this._isSpaceSelectable;
|
|
|
|
- return t;
|
|
|
|
- });
|
|
|
|
|
|
+ this.spaceList.map(
|
|
|
|
+ (t: SpaceItem): SpaceItem => {
|
|
|
|
+ t.selectable = this._isSpaceSelectable;
|
|
|
|
+ return t;
|
|
|
|
+ }
|
|
|
|
+ );
|
|
} // Set isSpaceSelectable
|
|
} // Set isSpaceSelectable
|
|
|
|
|
|
/** 墙list */
|
|
/** 墙list */
|
|
@@ -184,9 +198,9 @@ export class FloorScene extends SGraphyScene {
|
|
*
|
|
*
|
|
* @param url 请求数据文件路径
|
|
* @param url 请求数据文件路径
|
|
*/
|
|
*/
|
|
- loadUrl(url: string) {
|
|
|
|
|
|
+ loadUrl(url: string): Promise<void> {
|
|
let that = this;
|
|
let that = this;
|
|
- return new Promise((relove, reject) => {
|
|
|
|
|
|
+ return new Promise((resolve, reject): void => {
|
|
Axios({
|
|
Axios({
|
|
method: "get",
|
|
method: "get",
|
|
url: url,
|
|
url: url,
|
|
@@ -198,7 +212,7 @@ export class FloorScene extends SGraphyScene {
|
|
this.unzip(blob)
|
|
this.unzip(blob)
|
|
.then((jsonData: any) => {
|
|
.then((jsonData: any) => {
|
|
that.addBaseMapItem(jsonData);
|
|
that.addBaseMapItem(jsonData);
|
|
- relove(jsonData);
|
|
|
|
|
|
+ resolve(jsonData);
|
|
})
|
|
})
|
|
.catch((error: any) => {
|
|
.catch((error: any) => {
|
|
console.log(error);
|
|
console.log(error);
|
|
@@ -273,34 +287,34 @@ export class FloorScene extends SGraphyScene {
|
|
*
|
|
*
|
|
* @param data itemList对象
|
|
* @param data itemList对象
|
|
*/
|
|
*/
|
|
- private addBaseMapItem(data: FloorData) {
|
|
|
|
|
|
+ private addBaseMapItem(data: FloorData): void {
|
|
if (data.Walls) {
|
|
if (data.Walls) {
|
|
- data.Walls.map((t: Wall) => {
|
|
|
|
|
|
+ data.Walls.forEach((t: Wall): void => {
|
|
this.addWall(t);
|
|
this.addWall(t);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
if (data.Columns) {
|
|
if (data.Columns) {
|
|
- data.Columns.map((t: Column) => {
|
|
|
|
|
|
+ data.Columns.forEach((t: Column): void => {
|
|
this.addColumn(t);
|
|
this.addColumn(t);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
if (data.Windows) {
|
|
if (data.Windows) {
|
|
- data.Windows.map((t: Casement) => {
|
|
|
|
|
|
+ data.Windows.forEach((t: Casement): void => {
|
|
this.addCasement(t);
|
|
this.addCasement(t);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
if (data.VirtualWalls) {
|
|
if (data.VirtualWalls) {
|
|
- data.VirtualWalls.map((t: VirtualWall) => {
|
|
|
|
|
|
+ data.VirtualWalls.forEach((t: VirtualWall): void => {
|
|
this.addVirtualWall(t);
|
|
this.addVirtualWall(t);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
if (data.Doors) {
|
|
if (data.Doors) {
|
|
- data.Doors.map((t: Door) => {
|
|
|
|
|
|
+ data.Doors.forEach((t: Door): void => {
|
|
this.addDoor(t);
|
|
this.addDoor(t);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
if (data.Spaces) {
|
|
if (data.Spaces) {
|
|
- data.Spaces.map((t: Space) => {
|
|
|
|
|
|
+ data.Spaces.forEach((t: Space): void => {
|
|
this.addSpace(t);
|
|
this.addSpace(t);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -358,7 +372,7 @@ export class FloorScene extends SGraphyScene {
|
|
/**
|
|
/**
|
|
* 添加门到scene 中
|
|
* 添加门到scene 中
|
|
*
|
|
*
|
|
- * @param doors 门item
|
|
|
|
|
|
+ * @param door
|
|
*/
|
|
*/
|
|
addDoor(door: Door): void {
|
|
addDoor(door: Door): void {
|
|
let item = new DoorItem(null, door);
|
|
let item = new DoorItem(null, door);
|
|
@@ -370,7 +384,7 @@ export class FloorScene extends SGraphyScene {
|
|
/**
|
|
/**
|
|
* 添加窗户到scene 中
|
|
* 添加窗户到scene 中
|
|
*
|
|
*
|
|
- * @param windows 窗户item
|
|
|
|
|
|
+ * @param casement
|
|
*/
|
|
*/
|
|
addCasement(casement: Casement): void {
|
|
addCasement(casement: Casement): void {
|
|
let item = new WindowItem(null, casement);
|
|
let item = new WindowItem(null, casement);
|
|
@@ -386,7 +400,7 @@ export class FloorScene extends SGraphyScene {
|
|
*/
|
|
*/
|
|
private unzipBase64(b64Data: any) {
|
|
private unzipBase64(b64Data: any) {
|
|
let strData = atob(b64Data);
|
|
let strData = atob(b64Data);
|
|
- let charData = strData.split("").map(function(x) {
|
|
|
|
|
|
+ let charData = strData.split("").map(x => {
|
|
return x.charCodeAt(0);
|
|
return x.charCodeAt(0);
|
|
});
|
|
});
|
|
let binData = new Uint8Array(charData);
|
|
let binData = new Uint8Array(charData);
|
|
@@ -412,7 +426,7 @@ export class FloorScene extends SGraphyScene {
|
|
*/
|
|
*/
|
|
getSelectedSpaces(): SpaceItem[] {
|
|
getSelectedSpaces(): SpaceItem[] {
|
|
let arr: SpaceItem[] = [];
|
|
let arr: SpaceItem[] = [];
|
|
- this.spaceList.map(sp => {
|
|
|
|
|
|
+ this.spaceList.forEach((sp): void => {
|
|
if (sp.selected) {
|
|
if (sp.selected) {
|
|
arr.push(sp);
|
|
arr.push(sp);
|
|
}
|
|
}
|
|
@@ -425,9 +439,11 @@ export class FloorScene extends SGraphyScene {
|
|
*
|
|
*
|
|
*/
|
|
*/
|
|
clearSelectedSpaces(): void {
|
|
clearSelectedSpaces(): void {
|
|
- this.spaceList.map(sp => {
|
|
|
|
- sp.selected = false;
|
|
|
|
- return sp;
|
|
|
|
- });
|
|
|
|
|
|
+ this.spaceList.map(
|
|
|
|
+ (sp): SpaceItem => {
|
|
|
|
+ sp.selected = false;
|
|
|
|
+ return sp;
|
|
|
|
+ }
|
|
|
|
+ );
|
|
} // Function clearSelectedSpaces()
|
|
} // Function clearSelectedSpaces()
|
|
} // Class FloorScene
|
|
} // Class FloorScene
|