|
@@ -0,0 +1,100 @@
|
|
|
+class MainPanel {
|
|
|
+ constructor(app) {
|
|
|
+ this.app = app;
|
|
|
+ this.panels_znyg = [];
|
|
|
+ this.panels_znjk = [];
|
|
|
+ this.panels_znef = [];
|
|
|
+ this.toolBar = null;
|
|
|
+ this.toolImgs = {};
|
|
|
+ this.isExpandBuilding = false;
|
|
|
+ this.createToolsPanel();
|
|
|
+ this.building = this.app.buildings[0];
|
|
|
+ }
|
|
|
+ // 创建工具面板
|
|
|
+ createToolsPanel() {
|
|
|
+ var that = this;
|
|
|
+
|
|
|
+ // this.toolBar = THING.widget.ToolBar({ width: '12%', media: true,captionPos:'hover',opacity:0.5});
|
|
|
+ this.toolBar = THING.widget.Banner({ column: 'left', width: '20px', media: true, captionPos: 'hover', opacity: 0.8 });
|
|
|
+ this.toolBar.data = { znsx: false, enterBuilding: false, expandBuilding: false, deviceShow: false, electricalFire: false };
|
|
|
+ this.toolBar.setPosition({ right: 0, top: 60 });
|
|
|
+ this.toolImgs.img3 = this.toolBar.addImageBoolean(this.toolBar.data, 'enterBuilding').name('进入建筑').imgUrl(baseURL + 'ySWsxA.png');
|
|
|
+ this.toolImgs.img4 = this.toolBar.addImageBoolean(this.toolBar.data, 'expandBuilding').name('楼层展开').imgUrl(baseURL + 'ySWr2d.png');
|
|
|
+ this.toolImgs.img6 = this.toolBar.addImageBoolean(this.toolBar.data, 'deviceShow').name('建筑透视').imgUrl(baseURL + 'ySWD8H.png');
|
|
|
+ this.toolImgs.img3.on('change', function (boolValue) { that.onChangeImageButton('enterBuilding', boolValue); });
|
|
|
+ this.toolImgs.img4.on('change', function (boolValue) { that.onChangeImageButton('expandBuilding', boolValue); });
|
|
|
+ this.toolImgs.img6.on('change', function (boolValue) { that.onChangeImageButton('deviceShow', boolValue); });
|
|
|
+
|
|
|
+ }
|
|
|
+ // 处理工具条按钮
|
|
|
+ onChangeImageButton(key, boolValue) {
|
|
|
+ var that = this;
|
|
|
+ if (key == "enterBuilding") { // 进入建筑/室外
|
|
|
+ this.goinBuild(boolValue);
|
|
|
+
|
|
|
+ } else if (key == "deviceShow") {//展示全部设备隐藏楼层\
|
|
|
+ var devicList = [];
|
|
|
+ var build = app.buildings[0]
|
|
|
+ var opacity = build.style.opacity;// 0 为全透明 ,1 为不透明
|
|
|
+ build.style.opacity = (opacity > 0.8) ? 0.1 : 1.0;
|
|
|
+ var deviceArray = app.query('["userData/物体类型"="烟感"]');
|
|
|
+ devicList.push(deviceArray)
|
|
|
+ if (boolValue) {
|
|
|
+ flash(devicList);
|
|
|
+ this.goinBuild(boolValue);
|
|
|
+ // updateData();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ reset(devicList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (key == "expandBuilding") { // 楼层横向展开
|
|
|
+ this.app.level.change(app.buildings[0]); // 进入建筑
|
|
|
+ if (boolValue) {
|
|
|
+ this.building.expandFloors({
|
|
|
+ 'time': 1000,
|
|
|
+ 'length': 4,
|
|
|
+ 'horzMode': false,
|
|
|
+ 'hideRoof': true,
|
|
|
+ 'complete': function () {
|
|
|
+
|
|
|
+ that.isExpandBuilding = true;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.building.unexpandFloors({
|
|
|
+ 'time': 500,
|
|
|
+ 'complete': function () { that.isExpandBuilding = false; }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 展开的楼层收回去
|
|
|
+ resetExpand() {
|
|
|
+ var that = this;
|
|
|
+ if (this.isExpandBuilding) {
|
|
|
+ this.toolBar.data.expandBuilding = false;
|
|
|
+ this.building.unexpandFloors({
|
|
|
+ 'time': 500,
|
|
|
+ 'complete': function () { that.isExpandBuilding = false; }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ goinBuild(boolValue) {
|
|
|
+ delMydiv();
|
|
|
+ this.resetExpand();
|
|
|
+ var name = boolValue ? '返回室外' : '进入建筑';
|
|
|
+ this.toolImgs.img3.name(name);
|
|
|
+ if (boolValue) {
|
|
|
+ removeMark();
|
|
|
+ this.app.level.change(app.buildings[0]);
|
|
|
+ var domDiv = document.getElementById('bottomBackground');
|
|
|
+ if (domDiv) {
|
|
|
+ domDiv.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.app.level.change(app.root.campuses[0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|