From 94e9cd9c5943e91d5db0f0431994e8e260181c65 Mon Sep 17 00:00:00 2001 From: "DESKTOP-474NEJQ\\xzsjob" <359059686@qq.com> Date: Tue, 22 Sep 2020 15:10:24 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=20=20=E7=AE=A1?= =?UTF-8?q?=E7=BA=BF=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/canvas-share-data.service.ts | 66 ++-- .../plan-assistance.component.ts | 285 ++++++++++++------ .../working-area/working-area.component.ts | 20 +- 3 files changed, 250 insertions(+), 121 deletions(-) diff --git a/src/app/canvas-share-data.service.ts b/src/app/canvas-share-data.service.ts index f8097f2..0563578 100644 --- a/src/app/canvas-share-data.service.ts +++ b/src/app/canvas-share-data.service.ts @@ -6,7 +6,7 @@ import { Observable } from 'rxjs'; }) export class CanvasShareDataService { constructor() { } - private _sendMessage: ReplaySubject = new ReplaySubject(1); + private _sendMessage: ReplaySubject = new ReplaySubject(1); GameMode: any; isChange = false; // 数据 是否改动 @@ -19,16 +19,16 @@ export class CanvasShareDataService { originaleveryStoreyData: any; // 总平面图/楼层/区域 楼层数据 // 总平面图/建筑 楼层 - //处置 节点 - allDisposalNode:any = []; //所有 处置节点 - allNodeMarkers:any; //灾情 标签信息 - selectPanelPoint:any = {disposalNodeId:''}; //选择当前 数据节点 - selectPanelPointBaseData:any = {description: '', notes: '',weather: '',airTemperature: '',windDirection: '',windScale: ''}; //当前 数据节点 所对应的 天气,详情 数据节点 - //处置 节点 + // 处置 节点 + allDisposalNode: any = []; // 所有 处置节点 + allNodeMarkers: any; // 灾情 标签信息 + selectPanelPoint: any = {disposalNodeId: ''}; // 选择当前 数据节点 + selectPanelPointBaseData: any = {description: '', notes: '', weather: '', airTemperature: '', windDirection: '', windScale: ''}; // 当前 数据节点 所对应的 天气,详情 数据节点 + // 处置 节点 - //预案赋能 选择 车辆 - selectCar:any = {Id: '', WaterYield: '', Foam: '', PeopleNum: '', Tonnage: '', Assignment: '', LinkCar: '', WaterOccupy: ''} - //预案赋能 选择 车辆 + // 预案赋能 选择 车辆 + selectCar: any = {Id: '', WaterYield: '', Foam: '', PeopleNum: '', Tonnage: '', Assignment: '', LinkCar: '', WaterOccupy: ''}; + // 预案赋能 选择 车辆 /** * 游戏模式 @@ -67,23 +67,39 @@ export class CanvasShareDataService { [ 'DCS控制室', 'DCS控制室'] ]); - /** * 向其他组件发送信息 * - * @param message 需要发送的信息 * @returns {Observavle} */ - public sendMessage(message: any){ - this._sendMessage.next(message); - } - public getMessage(): Observable { - return this._sendMessage.asObservable(); - } + public getLinkCar(car: any) { + if (car.assetData.Type === 1) { + car.assetData.Pipelines.forEach(pipeline => { + const icon = pipeline.assetData.LinkedObjects.find((i: this) => i !== this); + console.log(icon.assetData.Type); + if (icon.assetData.Type === 0) { + car.assetData.WaterOccupy.push(icon.assetData.Name); + } else if (icon.assetData.Type === 1) { + car.assetData.LinkCar.push(icon.assetData.Name); + } + }); + } + } + /** + * 向其他组件发送信息 * + * @param message 需要发送的信息 + * @returns {Observavle} + */ + public sendMessage(message: any) { + this._sendMessage.next(message); + } + public getMessage(): Observable { + return this._sendMessage.asObservable(); + } // 处置节点 筛选出 匹配数据 匹配不到 return undefined - findDisposalNode (parentId:string=null, name:string=null) { - if (parentId && name) { //匹配 父id, name - let returnData = this.allDisposalNode.find(item=>{ return item.parentId === parentId && item.name === name }) - return returnData - } else { //匹配 id - let returnData = this.allDisposalNode.find(item=>{ return item.id === parentId }) - return returnData + findDisposalNode(parentId: string= null, name: string= null) { + if (parentId && name) { // 匹配 父id, name + const returnData = this.allDisposalNode.find(item => item.parentId === parentId && item.name === name); + return returnData; + } else { // 匹配 id + const returnData = this.allDisposalNode.find(item => item.id === parentId); + return returnData; } } /** diff --git a/src/app/ui/plan-assistance/plan-assistance.component.ts b/src/app/ui/plan-assistance/plan-assistance.component.ts index 58791b3..4a7cf84 100644 --- a/src/app/ui/plan-assistance/plan-assistance.component.ts +++ b/src/app/ui/plan-assistance/plan-assistance.component.ts @@ -20,6 +20,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f670ceae03abe3856d87d3e', Name: '消防泵房', Angle: 0, + Pipelines: [], + Type: 0, Color: '80', Point: { x: 538.0725371265185, @@ -115,6 +117,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f670dd3e03abe3856d87d3f', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: -854.3835678799273, @@ -254,6 +258,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6711f5e03abe3856d87d43', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: -539.9645631808662, @@ -354,6 +360,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f67128ae03abe3856d87d44', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: -563.1123674185176, @@ -495,6 +503,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671330e03abe3856d87d45', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: -51.57937113008251, @@ -636,6 +646,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671341e03abe3856d87d47', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 299.11560093170795, @@ -777,6 +789,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671357e03abe3856d87d49', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 500.9012712134421, @@ -918,6 +932,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f67136fe03abe3856d87d4a', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 88.60901628649833, @@ -1059,6 +1075,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671382e03abe3856d87d4b', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1089.647824545333, @@ -1200,6 +1218,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671396e03abe3856d87d4c', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 916.5868780327887, @@ -1341,6 +1361,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6713afe03abe3856d87d4d', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1267.7987988964815, @@ -1482,6 +1504,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6713c0e03abe3856d87d4e', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1507.3371984219418, @@ -1623,6 +1647,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671412e03abe3856d87d4f', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 2114.4400960509874, @@ -1764,6 +1790,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671425e03abe3856d87d50', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1936.2891216998387, @@ -1905,6 +1933,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671434e03abe3856d87d51', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1656.3375905766052, @@ -2046,6 +2076,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671441e03abe3856d87d52', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1155.818186447188, @@ -2187,6 +2219,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f67144de03abe3856d87d53', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 2915.2711426580545, @@ -2328,6 +2362,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f67145be03abe3856d87d54', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 2913.5744667118533, @@ -2469,6 +2505,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f67146ee03abe3856d87d55', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 2096.1298123494207, @@ -2610,6 +2648,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671481e03abe3856d87d56', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1901.6453605180648, @@ -2751,6 +2791,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f67148be03abe3856d87d57', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1354.5242652562279, @@ -2892,6 +2934,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6714ade03abe3856d87d58', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1160.7655915494565, @@ -3033,6 +3077,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6714bde03abe3856d87d59', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 993.7723947424533, @@ -3174,6 +3220,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6714c5e03abe3856d87d5a', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 577.8951065403974, @@ -3315,6 +3363,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6714d4e03abe3856d87d5b', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 126.55162198821722, @@ -3456,6 +3506,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6714ebe03abe3856d87d5c', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: -179.95583881318612, @@ -3597,6 +3649,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6714ffe03abe3856d87d5d', Name: '地上消火栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: -435.1702143376199, @@ -3738,6 +3792,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f67158fe03abe3856d87d5e', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: -5.796097596718141, @@ -3840,6 +3896,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f67165ce03abe3856d87d5f', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 462.9058952959447, @@ -3942,6 +4000,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671670e03abe3856d87d60', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1155.2026113881834, @@ -4044,6 +4104,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f67167ee03abe3856d87d61', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1218.8312292956107, @@ -4146,6 +4208,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671690e03abe3856d87d62', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1561.5581030242533, @@ -4248,6 +4312,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f67169de03abe3856d87d63', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1046.7447399550688, @@ -4350,6 +4416,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6716bce03abe3856d87d64', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 2115.4162998093598, @@ -4452,6 +4520,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6716c9e03abe3856d87d65', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 2915.112338509526, @@ -4554,6 +4624,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6716e0e03abe3856d87d66', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1988.5158013887126, @@ -4656,6 +4728,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6716f6e03abe3856d87d67', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 2975.3868020413206, @@ -4758,6 +4832,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671701e03abe3856d87d68', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1703.0254066222362, @@ -4860,6 +4936,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671717e03abe3856d87d69', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 2092.983870088383, @@ -4962,6 +5040,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671730e03abe3856d87d6a', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1951.9378727440935, @@ -5064,6 +5144,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f67173be03abe3856d87d6b', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1408.1271940944434, @@ -5166,6 +5248,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671744e03abe3856d87d6c', Name: '泡沫栓', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1160.4571509862274, @@ -5268,6 +5352,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671767e03abe3856d87d6d', Name: '固定水炮', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: -592.1952057948927, @@ -5355,6 +5441,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671842e03abe3856d87d6e', Name: '固定水炮', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: -97.79605019753274, @@ -5444,6 +5532,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671853e03abe3856d87d6f', Name: '固定水炮', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1150.6880828651256, @@ -5533,6 +5623,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671863e03abe3856d87d70', Name: '固定水炮', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1152.4040527919356, @@ -5622,6 +5714,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6718dbe03abe3856d87d71', Name: '固定水炮', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1456.632463331941, @@ -5711,6 +5805,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6718ece03abe3856d87d72', Name: '固定水炮', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 2115.794019501953, @@ -5800,6 +5896,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6718fce03abe3856d87d73', Name: '固定水炮', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 2918.6189917603, @@ -5889,6 +5987,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f67190ce03abe3856d87d74', Name: '固定水炮', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1887.6227115969486, @@ -5978,6 +6078,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671916e03abe3856d87d75', Name: '固定水炮', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1609.5189625658177, @@ -6067,6 +6169,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671945e03abe3856d87d76', Name: '固定水炮', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 2095.5215915504127, @@ -6156,6 +6260,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671954e03abe3856d87d77', Name: '固定水炮', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1851.9430767861622, @@ -6245,6 +6351,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f67195de03abe3856d87d78', Name: '固定水炮', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1286.183169018807, @@ -6334,6 +6442,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f671978e03abe3856d87d79', Name: '固定水炮', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: 1159.3027504423208, @@ -6423,6 +6533,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f67198ce03abe3856d87d7a', Name: '固定水炮', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: -32.3318372843471, @@ -6512,6 +6624,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Id: '5f6719a4e03abe3856d87d7b', Name: '固定水炮', Angle: 0, + Pipelines: [], + Type: 0, Color: '#066eed80', Point: { x: -276.2867550650558, @@ -6598,62 +6712,21 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { InteractiveMode: 0 } ]; - - tempCarData = { - TemplateId: null, - FloorId: null, - Angle: 0, - Color: 0, - Enabled: true, - FillMode: 0, - FireElementId: 0, - FixedSize: false, - CanConnection: true, - ConnectionObjs: [], - Height: 32, - Width: 32, - Id: '5f67f92238f13cd2048cae9d', - ImageUrl: './assets/images/泡沫消防车.png', - InteractiveMode: 0, - MultiPoint: null, - Point: { - x: 1295, - y: 1237 - }, - Name: '泡沫消防车', - PropertyInfos: [ - { - Enabled: true, - Order: 0, - PhysicalUnit: '', - PropertyName: '名称/编号', - PropertyType: 0, - PropertyValue: '钦南区新兴消防', - Required: false, - RuleName: '', - RuleValue: '', - Tag: '', - Visible: true - } - ], - Border: null, - DrawMode: null, - Thickness: 0, - IsFromBuilding: false, - GameMode: 0 - }; - // 所有车辆信息 allCarsData = [ { TemplateId: null, FloorId: null, Angle: 0, + Pipelines: [], + Type: 1, Color: 0, Enabled: true, FillMode: 0, FireElementId: 0, FixedSize: false, + CanConnection: true, + ConnectionObjs: [], Height: 32, Width: 32, Id: ObjectID.default.generate(), @@ -6672,8 +6745,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { PeopleNum: 6, // 载人数 Tonnage: '10t', // 吨位 Assignment: '供液', // 执行任务 - LinkCar: '', // 连接车辆 - WaterOccupy: '', // 水源占用 + LinkCar: [], // 连接车辆 + WaterOccupy: [], // 水源占用 PropertyInfos: [ { Enabled: true, @@ -6699,11 +6772,15 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { TemplateId: null, FloorId: null, Angle: 0, + Pipelines: [], + Type: 1, Color: 0, Enabled: true, FillMode: 0, FireElementId: 0, FixedSize: false, + CanConnection: true, + ConnectionObjs: [], Height: 32, Width: 32, Id: ObjectID.default.generate(), @@ -6722,8 +6799,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { PeopleNum: 6, // 载人数 Tonnage: '12t', // 吨位 Assignment: '灭火', // 执行任务 - LinkCar: '', // 连接车辆 - WaterOccupy: '', // 水源占用 + LinkCar: [], // 连接车辆 + WaterOccupy: [], // 水源占用 PropertyInfos: [ { Enabled: true, @@ -6749,11 +6826,15 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { TemplateId: null, FloorId: null, Angle: 0, + Pipelines: [], + Type: 1, Color: 0, Enabled: true, FillMode: 0, FireElementId: 0, FixedSize: false, + CanConnection: true, + ConnectionObjs: [], Height: 32, Width: 32, Id: ObjectID.default.generate(), @@ -6772,8 +6853,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { PeopleNum: 6, // 载人数 Tonnage: '6t', // 吨位 Assignment: '灭火', // 执行任务 - LinkCar: '', // 连接车辆 - WaterOccupy: '', // 水源占用 + LinkCar: [], // 连接车辆 + WaterOccupy: [], // 水源占用 PropertyInfos: [ { Enabled: true, @@ -6799,11 +6880,15 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { TemplateId: null, FloorId: null, Angle: 0, + Pipelines: [], + Type: 1, Color: 0, Enabled: true, FillMode: 0, FireElementId: 0, FixedSize: false, + CanConnection: true, + ConnectionObjs: [], Height: 32, Width: 32, Id: ObjectID.default.generate(), @@ -6822,8 +6907,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { PeopleNum: 6, // 载人数 Tonnage: '20t', // 吨位 Assignment: '灭火', // 执行任务 - LinkCar: '', // 连接车辆 - WaterOccupy: '', // 水源占用 + LinkCar: [], // 连接车辆 + WaterOccupy: [], // 水源占用 PropertyInfos: [ { Enabled: true, @@ -6849,11 +6934,15 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { TemplateId: null, FloorId: null, Angle: 0, + Pipelines: [], + Type: 1, Color: 0, Enabled: true, FillMode: 0, FireElementId: 0, FixedSize: false, + CanConnection: true, + ConnectionObjs: [], Height: 32, Width: 32, Id: ObjectID.default.generate(), @@ -6872,8 +6961,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { PeopleNum: 6, // 载人数 Tonnage: '14t', // 吨位 Assignment: '冷却', // 执行任务 - LinkCar: '', // 连接车辆 - WaterOccupy: '', // 水源占用 + LinkCar: [], // 连接车辆 + WaterOccupy: [], // 水源占用 PropertyInfos: [ { Enabled: true, @@ -6899,11 +6988,15 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { TemplateId: null, FloorId: null, Angle: 0, + Pipelines: [], + Type: 1, Color: 0, Enabled: true, FillMode: 0, FireElementId: 0, FixedSize: false, + CanConnection: true, + ConnectionObjs: [], Height: 32, Width: 32, Id: ObjectID.default.generate(), @@ -6922,8 +7015,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { PeopleNum: 6, // 载人数 Tonnage: '8t', // 吨位 Assignment: '冷却', // 执行任务 - LinkCar: '', // 连接车辆 - WaterOccupy: '', // 水源占用 + LinkCar: [], // 连接车辆 + WaterOccupy: [], // 水源占用 PropertyInfos: [ { Enabled: true, @@ -6949,11 +7042,15 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { TemplateId: null, FloorId: null, Angle: 0, + Pipelines: [], + Type: 1, Color: 0, Enabled: true, FillMode: 0, FireElementId: 0, FixedSize: false, + CanConnection: true, + ConnectionObjs: [], Height: 32, Width: 32, Id: ObjectID.default.generate(), @@ -6972,8 +7069,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { PeopleNum: 8, // 载人数 Tonnage: '5t', // 吨位 Assignment: '堵截', // 执行任务 - LinkCar: '', // 连接车辆 - WaterOccupy: '', // 水源占用 + LinkCar: [], // 连接车辆 + WaterOccupy: [], // 水源占用 PropertyInfos: [ { Enabled: true, @@ -6999,11 +7096,15 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { TemplateId: null, FloorId: null, Angle: 0, + Pipelines: [], + Type: 1, Color: 0, Enabled: true, FillMode: 0, FireElementId: 0, FixedSize: false, + CanConnection: true, + ConnectionObjs: [], Height: 32, Width: 32, Id: ObjectID.default.generate(), @@ -7022,8 +7123,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { PeopleNum: 4, // 载人数 Tonnage: '18t', // 吨位 Assignment: '灭火', // 执行任务 - LinkCar: '', // 连接车辆 - WaterOccupy: '', // 水源占用 + LinkCar: [], // 连接车辆 + WaterOccupy: [], // 水源占用 PropertyInfos: [ { Enabled: true, @@ -7049,11 +7150,15 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { TemplateId: null, FloorId: null, Angle: 0, + Pipelines: [], + Type: 1, Color: 0, Enabled: true, FillMode: 0, FireElementId: 0, FixedSize: false, + CanConnection: true, + ConnectionObjs: [], Height: 32, Width: 32, Id: ObjectID.default.generate(), @@ -7072,8 +7177,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { PeopleNum: 6, // 载人数 Tonnage: '8t', // 吨位 Assignment: '供液', // 执行任务 - LinkCar: '', // 连接车辆 - WaterOccupy: '', // 水源占用 + LinkCar: [], // 连接车辆 + WaterOccupy: [], // 水源占用 PropertyInfos: [ { Enabled: true, @@ -7099,11 +7204,15 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { TemplateId: null, FloorId: null, Angle: 0, + Pipelines: [], + Type: 1, Color: 0, Enabled: true, FillMode: 0, FireElementId: 0, FixedSize: false, + CanConnection: true, + ConnectionObjs: [], Height: 32, Width: 32, Id: ObjectID.default.generate(), @@ -7122,8 +7231,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { PeopleNum: 6, // 载人数 Tonnage: '7t', // 吨位 Assignment: '供液', // 执行任务 - LinkCar: '', // 连接车辆 - WaterOccupy: '', // 水源占用 + LinkCar: [], // 连接车辆 + WaterOccupy: [], // 水源占用 PropertyInfos: [ { Enabled: true, @@ -7149,11 +7258,15 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { TemplateId: null, FloorId: null, Angle: 0, + Pipelines: [], + Type: 1, Color: 0, Enabled: true, FillMode: 0, FireElementId: 0, FixedSize: false, + CanConnection: true, + ConnectionObjs: [], Height: 32, Width: 32, Id: ObjectID.default.generate(), @@ -7172,8 +7285,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { PeopleNum: 6, // 载人数 Tonnage: '5t', // 吨位 Assignment: '供液', // 执行任务 - LinkCar: '', // 连接车辆 - WaterOccupy: '', // 水源占用 + LinkCar: [], // 连接车辆 + WaterOccupy: [], // 水源占用 PropertyInfos: [ { Enabled: true, @@ -7199,11 +7312,15 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { TemplateId: null, FloorId: null, Angle: 0, + Pipelines: [], + Type: 1, Color: 0, Enabled: true, FillMode: 0, FireElementId: 0, FixedSize: false, + CanConnection: true, + ConnectionObjs: [], Height: 32, Width: 32, Id: ObjectID.default.generate(), @@ -7222,8 +7339,8 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { PeopleNum: 4, // 载人数 Tonnage: '20t', // 吨位 Assignment: '灭火', // 执行任务 - LinkCar: '', // 连接车辆 - WaterOccupy: '', // 水源占用 + LinkCar: [], // 连接车辆 + WaterOccupy: [], // 水源占用 PropertyInfos: [ { Enabled: true, @@ -7250,7 +7367,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { bottomIsShow = false; // 底部车辆信息是否展示 rightIsShow = true; // 右侧楼层是否展示 rightSayIsShow = false; // 右侧语音是否展示 - selectCarID:string = ''; // 选中车辆 样式 + selectCarID = ''; // 选中车辆 样式 ngOnInit(): void { const that = this; @@ -7267,18 +7384,18 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { this.dataInit(); // 监听canvas组件选中素材事件 - this.workingArea.on("select",obj=>{ - //选中素材属性注入函数 - if (obj && obj.assetData && obj.assetData.ReachTime!=undefined) { - this.canvasData.selectCar = obj.assetData - this.selectCarID = JSON.parse(JSON.stringify( obj.assetData.Id || '' )) - this.bottomIsShow = true + this.workingArea.on('select', obj => { + // 选中素材属性注入函数 + if (obj && obj.assetData && obj.assetData.ReachTime != undefined) { + this.canvasData.selectCar = obj.assetData; + this.selectCarID = JSON.parse(JSON.stringify( obj.assetData.Id || '' )); + this.bottomIsShow = true; } - }) + }); // 监听canvas组件取消选中素材事件 - this.workingArea.on("deselect",obj=>{ + this.workingArea.on('deselect', obj => { this.bottomIsShow = false; - this.selectCarID = '' + this.selectCarID = ''; }); } @@ -7304,12 +7421,12 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { } } - //选择 车辆 - selectCar (e,isSelect:boolean = true) { + // 选择 车辆 + selectCar(e, isSelect: boolean = true) { if (e.ReachTime == 0) { - let list = [] - list.push(e.Id) - isSelect? this.workingArea.setHighlight(list) : null + const list = []; + list.push(e.Id); + isSelect ? this.workingArea.setHighlight(list) : null; } else if (e.ReachTime && e.ReachTime != 0) { const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 32b7d4e..75af60f 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -251,7 +251,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV // this.createEnterPaintEndButton(); // this.backgroundImage.addChild(this.paintingLine); this.on('select', obj => { - console.log('选择了' + obj); if (this.allowEdit) { if (obj instanceof MultipointIcon) { obj.setPointVisiable(true); @@ -1163,12 +1162,6 @@ export class SinglePointIcon extends PIXI.Container { + '\r\n' + this.assetData.PropertyInfos?.find(item => item.PropertyName === '名称/编号')?.PropertyValue, this.style); private image = PIXI.Sprite.from(this.assetData.ImageUrl); - // 是否可以被链接 - canConnection = false; - // 链接对象 - connectionObjs: any[] = []; - // 链接的管线 - pipelines: any[] = []; constructor(public assetData: any, private workingArea: WorkingAreaComponent) { super(); @@ -1177,8 +1170,6 @@ export class SinglePointIcon extends PIXI.Container { this.y = this.assetData.Point.y; this.name = this.assetData.Id; - this.canConnection = this.assetData.CanConnection === undefined ? false : this.assetData.CanConnection; - this.image.angle = this.assetData.Angle; this.image.x = 0; @@ -1191,10 +1182,10 @@ export class SinglePointIcon extends PIXI.Container { this.image.interactive = true; this.image .on('mousedown', event => { - console.log(this.assetData); + console.log(this.assetData.Pipelines); event.stopPropagation(); this.workingArea.selection.selectOne(this); - if (this.canConnection && this.parent === this.workingArea.backgroundImage) { + if (this.assetData.CanConnection && this.parent === this.workingArea.backgroundImage) { if (this.workingArea.paintMode === PaintMode.Pipeline) { if (this.workingArea.paintingPipeline === null) { this.workingArea.previewLineSegment.visible = true; @@ -1206,21 +1197,26 @@ export class SinglePointIcon extends PIXI.Container { MultiPoint: JSON.parse(JSON.stringify(this.workingArea.paintPoints)), Point: new PIXI.Point(0, 0), Name: '管线', + LinkedObjects: [], }; this.workingArea.paintingPipeline = new Pipeline(tempData, this.workingArea); + this.workingArea.paintingPipeline.assetData.LinkedObjects.push(this); + this.assetData.Pipelines.push(this.workingArea.paintingPipeline); } else { this.workingArea.previewLineSegment.visible = false; this.workingArea.currentClickPoint.position = new PIXI.Point(this.workingArea.circleShadow.x, this.workingArea.circleShadow.y); this.workingArea.paintPoints.push(new PIXI.Point(this.position.x, this.position.y)); this.workingArea.paintingPipeline.assetData.MultiPoint = JSON.parse(JSON.stringify(this.workingArea.paintPoints)); + this.workingArea.paintingPipeline.assetData.LinkedObjects.push(this); + this.assetData.Pipelines.push(this.workingArea.paintingPipeline); this.workingArea.paintingPipeline.refresh(); this.workingArea.paintingPipelineFinish(); } } } // 如果链接对象不为空,禁止移动 - if ((this.workingArea.allowEdit || this.assetData.GameMode === 2) && this.connectionObjs.length === 0) { + if ((this.workingArea.allowEdit || this.assetData.GameMode === 2) ) { event.currentTarget.parent.data = event.data; event.currentTarget.parent.alpha = 0.5; event.currentTarget.parent.dragging = true; From 771eec85546f95996d1a86f4358d472a347127ba Mon Sep 17 00:00:00 2001 From: "DESKTOP-474NEJQ\\xzsjob" <359059686@qq.com> Date: Tue, 22 Sep 2020 15:17:50 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=20=20=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E9=93=BE=E6=8E=A5=E8=BD=A6=E8=BE=86/=E6=B0=B4?= =?UTF-8?q?=E6=BA=90=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/canvas-share-data.service.ts | 29 ++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/app/canvas-share-data.service.ts b/src/app/canvas-share-data.service.ts index 0563578..34a2e75 100644 --- a/src/app/canvas-share-data.service.ts +++ b/src/app/canvas-share-data.service.ts @@ -67,18 +67,27 @@ export class CanvasShareDataService { [ 'DCS控制室', 'DCS控制室'] ]); - public getLinkCar(car: any) { - if (car.assetData.Type === 1) { - car.assetData.Pipelines.forEach(pipeline => { - const icon = pipeline.assetData.LinkedObjects.find((i: this) => i !== this); - console.log(icon.assetData.Type); - if (icon.assetData.Type === 0) { - car.assetData.WaterOccupy.push(icon.assetData.Name); - } else if (icon.assetData.Type === 1) { - car.assetData.LinkCar.push(icon.assetData.Name); + + public getLinkCar(car: any): any[] { + const linkCar = []; + car.assetData.Pipelines.forEach(pipeline => { + const icon = pipeline.assetData.LinkedObjects.find(i => i.assetData !== car); + if (icon.assetData.Type === 1) { + linkCar.push(icon.assetData.Name); } }); - } + return linkCar; + } + + public getWaterOccupy(car: any): any[] { + const waterOccupy = []; + car.assetData.Pipelines.forEach(pipeline => { + const icon = pipeline.assetData.LinkedObjects.find(i => i.assetData !== car); + if (icon.assetData.Type === 0) { + car.assetData.WaterOccupy.push(icon.assetData.Name); + } + }); + return waterOccupy; } /** * 向其他组件发送信息 * From ee41941ad234b13688f6747220a0c6b62eab0b72 Mon Sep 17 00:00:00 2001 From: "DESKTOP-474NEJQ\\xzsjob" <359059686@qq.com> Date: Tue, 22 Sep 2020 15:20:14 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/canvas-share-data.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/canvas-share-data.service.ts b/src/app/canvas-share-data.service.ts index 34a2e75..52f72dd 100644 --- a/src/app/canvas-share-data.service.ts +++ b/src/app/canvas-share-data.service.ts @@ -68,7 +68,7 @@ export class CanvasShareDataService { ]); - public getLinkCar(car: any): any[] { + public getLinkCarName(car: any): any[] { const linkCar = []; car.assetData.Pipelines.forEach(pipeline => { const icon = pipeline.assetData.LinkedObjects.find(i => i.assetData !== car); @@ -79,7 +79,7 @@ export class CanvasShareDataService { return linkCar; } - public getWaterOccupy(car: any): any[] { + public getWaterOccupyName(car: any): any[] { const waterOccupy = []; car.assetData.Pipelines.forEach(pipeline => { const icon = pipeline.assetData.LinkedObjects.find(i => i.assetData !== car);