var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import { SGraphyPolygonItem } from './newItems/SGraphyPolygonItem.js'; import { SGraphyScene } from "@sybotan-web/graphy"; /** * @name mainScene * @time 2019-07.07; * 添加所有item的场景到scene中 */ var mainScene = /** @class */ (function (_super) { __extends(mainScene, _super); /** * @param data 绘制空间地图得所有参数 */ function mainScene(data) { var _this_1 = _super.call(this) || this; _this_1._isShowSpace = true; // 是否显示空间; _this_1._isShowWallList = true; //是否展示墙体; _this_1._isShowEquipmentList = true; //是否展示设备; _this_1._isShowVrtualWallList = true; //是否展示虚拟墙 _this_1.data = data; _this_1.addAllItemList(data); return _this_1; } Object.defineProperty(mainScene.prototype, "isShowSpace", { // 设置是否显示空间 get: function () { return this._isShowSpace; }, set: function (b) { this._isShowSpace = b; }, enumerable: true, configurable: true }); Object.defineProperty(mainScene.prototype, "isShowWallList", { // 设置是否显示墙 get: function () { return this._isShowWallList; }, set: function (b) { this._isShowWallList = b; }, enumerable: true, configurable: true }); Object.defineProperty(mainScene.prototype, "isShowEquipmentList", { // 设置是否显示设备 get: function () { return this._isShowEquipmentList; }, set: function (b) { this._isShowEquipmentList = b; }, enumerable: true, configurable: true }); Object.defineProperty(mainScene.prototype, "isShowVrtualWallList", { // 设置是否显示虚拟墙 get: function () { return this._isShowVrtualWallList; }, set: function (b) { this._isShowVrtualWallList = b; }, enumerable: true, configurable: true }); // 以下是绘制方法 /** * 增添所有绘制item(地图); */ mainScene.prototype.addAllItemList = function (data) { var space = data.SpaceList; this.addSpaceList(space); //绘制空间 }; /** * 添加所有空间到scene 中 * @param space 空间list */ mainScene.prototype.addSpaceList = function (space) { if (space && space.length) { for (var i = 0; i < space.length; i++) { if (space[i].Paths[1] && space[i].Paths[1].length >= 2) { this.addItem(this.constructeItem({ parent: null, space: space[i] })); } } for (var i = 0; i < space.length; i++) { if (space[i].Paths[0] && space[i].Paths[0].length >= 2 && !space[i].Paths[1]) { this.addItem(this.constructeItem({ parent: null, space: space[i] })); } } } }; // 绘制墙体 mainScene.prototype.addWallList = function () { }; // 绘制设备 mainScene.prototype.addEquipmentList = function () { }; // 绘制柱体 mainScene.prototype.addColumnListList = function () { }; // 绘制虚拟墙 mainScene.prototype.addVrtualWallList = function () { }; /** * 产生item实例 */ mainScene.prototype.constructeItem = function (PolygonItemInterfaceData) { return new SGraphyPolygonItem(PolygonItemInterfaceData); }; // 鼠标交互类事件 // 点击 mainScene.prototype.click = function (_this, fn) { console.log('xxxxxxxxxxx', fn); this.root.children.forEach(function (item) { item.connect("click", _this, fn); }); }; // 双击 mainScene.prototype.dbclick = function (_this, fn) { this.root.children.forEach(function (item) { item.connect("doubleClick", _this, fn); }); }; // 按下 mainScene.prototype.mouseDown = function (_this, fn) { this.root.children.forEach(function (item) { item.connect("mouseDown", _this, fn); }); }; //移动 mainScene.prototype.mouseMove = function (_this, fn) { this.root.children.forEach(function (item) { item.connect("mouseMove", _this, fn); }); }; // 点解结束 mainScene.prototype.mouseUp = function (_this, fn) { this.root.children.forEach(function (item) { item.connect("mouseUp", _this, fn); }); }; return mainScene; }(SGraphyScene)); export default mainScene;