From f97fa69bc5e928793b119a74b5eb45af82fdbccd Mon Sep 17 00:00:00 2001 From: username <1105965053@qq.com> Date: Mon, 21 Sep 2020 09:36:54 +0800 Subject: [PATCH 1/4] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=20=E9=A2=84=E6=A1=88?= =?UTF-8?q?=E8=BE=85=E5=8A=A9=E9=A1=B5=E9=9D=A2=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan-assistance.component.html | 12 ++++++++++- .../plan-assistance.component.scss | 20 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/app/ui/plan-assistance/plan-assistance.component.html b/src/app/ui/plan-assistance/plan-assistance.component.html index 8c77164..5abcce6 100644 --- a/src/app/ui/plan-assistance/plan-assistance.component.html +++ b/src/app/ui/plan-assistance/plan-assistance.component.html @@ -1 +1,11 @@ - \ No newline at end of file +
+
+ +
+ + +
+ +
+ +
diff --git a/src/app/ui/plan-assistance/plan-assistance.component.scss b/src/app/ui/plan-assistance/plan-assistance.component.scss index e69de29..379ad01 100644 --- a/src/app/ui/plan-assistance/plan-assistance.component.scss +++ b/src/app/ui/plan-assistance/plan-assistance.component.scss @@ -0,0 +1,20 @@ +.content { + width: 100%; + height: 100%; + box-sizing: border-box; + padding: 1px; + overflow: hidden; + display: flex; +} + +//左侧菜单 +.left { + width: 300px; + height: 100%; + background-color: #000; +} + +//右侧工作区 +.center { + flex: 1; +} \ No newline at end of file From c4059d9e074faf25bea7963e49b140126bbc782c Mon Sep 17 00:00:00 2001 From: "DESKTOP-474NEJQ\\xzsjob" <359059686@qq.com> Date: Mon, 21 Sep 2020 10:49:42 +0800 Subject: [PATCH 2/4] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=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 | 49 ++++--- .../plan-assistance.component.ts | 41 ++++++ .../working-area/working-area.component.ts | 138 ++++++++++++++++-- 3 files changed, 191 insertions(+), 37 deletions(-) diff --git a/src/app/canvas-share-data.service.ts b/src/app/canvas-share-data.service.ts index a1aa7ca..0bcbbde 100644 --- a/src/app/canvas-share-data.service.ts +++ b/src/app/canvas-share-data.service.ts @@ -1,23 +1,14 @@ import { Injectable } from '@angular/core'; -import {ReplaySubject} from "rxjs"; -import { Observable } from "rxjs"; +import {ReplaySubject} from 'rxjs'; +import { Observable } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class CanvasShareDataService { + constructor() { } private _sendMessage: ReplaySubject = new ReplaySubject(1); GameMode: any; - /** * 向其他组件发送信息 * - * @param message 需要发送的信息 * @returns {Observavle} */ - public sendMessage(message: any){ - this._sendMessage.next(message); - } - public getMessage(): Observable { - return this._sendMessage.asObservable(); - } - constructor() { } - isChange = false; // 数据 是否改动 selectTemplateData: any; // 选择当前 模板数据 @@ -39,17 +30,6 @@ export class CanvasShareDataService { */ gameMode: GameMode = GameMode.BasicInformation; - // 处置节点 筛选出 匹配数据 匹配不到 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 - } - } - facilityAssetsName = new Map([ [ '消防水池', '消防水池'], [ '疏散楼梯', '疏散楼梯'], @@ -81,6 +61,26 @@ export class CanvasShareDataService { [ '消防管网', '消防管网'], [ 'DCS控制室', 'DCS控制室'] ]); + + /** * 向其他组件发送信息 * + * @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 + } + } /** * 获取单位毗邻信息 */ @@ -663,7 +663,8 @@ export class AssetData { */ export enum GameMode { BasicInformation, - Assignment + Assignment, + Demo } /** * 填充模式 diff --git a/src/app/ui/plan-assistance/plan-assistance.component.ts b/src/app/ui/plan-assistance/plan-assistance.component.ts index e0f413c..631f3c9 100644 --- a/src/app/ui/plan-assistance/plan-assistance.component.ts +++ b/src/app/ui/plan-assistance/plan-assistance.component.ts @@ -1366,6 +1366,47 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { } ]; + tempCarData = { + TemplateId: null, + FloorId: null, + Angle: 0, + Color: 0, + Enabled: true, + FillMode: 0, + FireElementId: 0, + FixedSize: true, + 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: 2 + }; ngOnInit(): void { } diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index a75b04b..03ad560 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -116,17 +116,17 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV const token = sessionStorage.getItem('token'); // 判断 是否登录状态 if (token) { // this.init.getAllLibrary() //获取素材库 - this.init.getAllBuildings() //获取所有建筑 - this.init.getAllFirePlan() //获取所有灾情 - this.init.getSitePlan() //调用父组件 初始化方法 + this.init.getAllBuildings(); // 获取所有建筑 + this.init.getAllFirePlan(); // 获取所有灾情 + this.init.getSitePlan(); // 调用父组件 初始化方法 } else { - this.token.login().then(res=>{ - this.init.params.companyId = sessionStorage.getItem('companyId') + this.token.login().then(res => { + this.init.params.companyId = sessionStorage.getItem('companyId'); // this.init.getAllLibrary() //获取素材库 - this.init.getAllBuildings() //获取所有建筑 - this.init.getAllFirePlan() //获取所有灾情 - this.init.getSitePlan() //调用父组件 初始化方法 - }) + this.init.getAllBuildings(); // 获取所有建筑 + this.init.getAllFirePlan(); // 获取所有灾情 + this.init.getSitePlan(); // 调用父组件 初始化方法 + }); } } // 是否登录 @@ -403,7 +403,102 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV const single = new SinglePointIcon(element, this); }); this.setNameVisible(false, GameMode.BasicInformation); - this.allowEdit = false; + this.allowEdit = true; + + + const tempData = { + TemplateId: null, + FloorId: null, + Angle: 0, + Color: 0, + Enabled: true, + FillMode: 0, + FireElementId: 0, + FixedSize: true, + 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: 2 + }; + const tempCar = new SinglePointIcon(tempData, this); + tempCar.setParent(this.app.stage); + tempCar.position.set(300, 66); + + const tempData2 = { + TemplateId: null, + FloorId: null, + Angle: 0, + Color: 0, + Enabled: true, + FillMode: 0, + FireElementId: 0, + FixedSize: true, + 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: 2 + }; + const tempCar2 = new SinglePointIcon(tempData2, this); + tempCar2.setParent(this.app.stage); + tempCar2.position.set(300, 148); + + this.cancelPaint(); + this.paintMode = PaintMode.connection; + this.previewSinglePointIcon.texture = PIXI.Texture.from('./assets/images/水罐消防车.png'); } /** * @@ -611,6 +706,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV // this.backgroundImage.removeChild(this.paintingIcon); // } // this.paintingIcon = new PolygonIcon(this.paintPoints, this); + break; + case PaintMode.connection: + break; } } else if (!event.currentTarget.dragging && this.selection.isMultiselection === true) { @@ -940,6 +1038,7 @@ enum PaintMode { polygonIcon, beginPainting, endPaint, + connection } /** * 单点图标 @@ -966,6 +1065,9 @@ 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: boolean; + constructor(public assetData: any, private workingArea: WorkingAreaComponent) { super(); this.workingArea.backgroundImage.addChild(this); @@ -985,10 +1087,10 @@ export class SinglePointIcon extends PIXI.Container { this.image.interactive = true; this.image .on('mousedown', event => { - console.log(this.assetData.Name); + console.log(this.assetData); event.stopPropagation(); this.workingArea.selection.selectOne(this); - if (this.workingArea.allowEdit) { + 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; @@ -1010,6 +1112,14 @@ export class SinglePointIcon extends PIXI.Container { }) .on('mousemove', event => { if (event.currentTarget.parent.dragging) { + // 如果拖动过程中发现父对象不是背景图 + if (this.parent !== this.workingArea.backgroundImage) { + this.setParent(this.workingArea.backgroundImage); + if (this.assetData.FixedSize) { + const scale = 1 / this.workingArea.backgroundImage.scale.x; + this.scale.set(scale); + } + } const newPosition = event.currentTarget.parent.data.getLocalPosition(event.currentTarget.parent.parent); event.currentTarget.parent.x = newPosition.x; event.currentTarget.parent.y = newPosition.y; @@ -1536,9 +1646,11 @@ export class PolygonIcon extends PIXI.Container { } } -export class Line extends PIXI.Container { +export class Conection extends PIXI.Container { } + + /** * 选择器 */ From 2d27fea032a9f5b3fbad8c0873684579527734a8 Mon Sep 17 00:00:00 2001 From: "DESKTOP-474NEJQ\\xzsjob" <359059686@qq.com> Date: Mon, 21 Sep 2020 11:08:01 +0800 Subject: [PATCH 3/4] =?UTF-8?q?[=E4=BF=AE=E6=AD=A3]=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=EF=BC=8C=E8=83=8C=E6=99=AF=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan-assistance.component.ts | 104 +++++++++--------- .../working-area/working-area.component.ts | 23 ++-- 2 files changed, 64 insertions(+), 63 deletions(-) diff --git a/src/app/ui/plan-assistance/plan-assistance.component.ts b/src/app/ui/plan-assistance/plan-assistance.component.ts index 631f3c9..e8e6fe6 100644 --- a/src/app/ui/plan-assistance/plan-assistance.component.ts +++ b/src/app/ui/plan-assistance/plan-assistance.component.ts @@ -22,7 +22,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048cae9d', @@ -49,7 +49,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048cae9e', @@ -76,7 +76,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048cae9f', @@ -103,7 +103,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caea0', @@ -130,7 +130,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caea1', @@ -157,7 +157,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caea2', @@ -184,7 +184,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caea3', @@ -211,7 +211,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caea4', @@ -238,7 +238,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caea5', @@ -265,7 +265,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caea6', @@ -292,7 +292,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caea7', @@ -319,7 +319,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caea8', @@ -346,7 +346,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caea9', @@ -373,7 +373,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeaa', @@ -400,7 +400,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeab', @@ -427,7 +427,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeac', @@ -454,7 +454,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caead', @@ -481,7 +481,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeae', @@ -508,7 +508,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeaf', @@ -535,7 +535,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeb0', @@ -562,7 +562,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeb1', @@ -589,7 +589,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeb2', @@ -616,7 +616,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeb3', @@ -643,7 +643,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeb4', @@ -670,7 +670,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeb5', @@ -697,7 +697,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeb6', @@ -724,7 +724,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeb7', @@ -751,7 +751,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeb8', @@ -778,7 +778,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeb9', @@ -805,7 +805,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeba', @@ -832,7 +832,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caebb', @@ -859,7 +859,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caebc', @@ -886,7 +886,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caebd', @@ -913,7 +913,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caebe', @@ -940,7 +940,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caebf', @@ -967,7 +967,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caec0', @@ -994,7 +994,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caec1', @@ -1021,7 +1021,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caec2', @@ -1048,7 +1048,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caec3', @@ -1075,7 +1075,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caec4', @@ -1102,7 +1102,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caec5', @@ -1129,7 +1129,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caec6', @@ -1156,7 +1156,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caec7', @@ -1183,7 +1183,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caec8', @@ -1210,7 +1210,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caec9', @@ -1237,7 +1237,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caeca', @@ -1264,7 +1264,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caecb', @@ -1291,7 +1291,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caecc', @@ -1318,7 +1318,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caecd', @@ -1345,7 +1345,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048caece', @@ -1374,7 +1374,7 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, + FixedSize: false, Height: 32, Width: 32, Id: '5f67f92238f13cd2048cae9d', @@ -1412,6 +1412,6 @@ export class PlanAssistanceComponent implements OnInit, AfterViewInit { } ngAfterViewInit(): void { - this.workingArea.loadDemoScene(this.demoData); + this.workingArea.loadDemoScene(this.demoData, 0.149); } } diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index 03ad560..e56d813 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -397,8 +397,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV /** * 加载测试界面 */ - public loadDemoScene(list: any[]) { + public loadDemoScene(list: any[], backgroundScale: number) { this.backgroundImage.texture = PIXI.Texture.from('./assets/images/demo.jpg'); + this.setBackgroundScale(backgroundScale); list.forEach(element => { const single = new SinglePointIcon(element, this); }); @@ -414,9 +415,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, - Height: 32, - Width: 32, + FixedSize: false, + Height: 45, + Width: 45, Id: '5f67f92238f13cd2048cae9d', ImageUrl: './assets/images/泡沫消防车.png', InteractiveMode: 0, @@ -425,7 +426,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV x: 1295, y: 1237 }, - Name: '泡沫消防车', + Name: '', PropertyInfos: [ { Enabled: true, @@ -433,7 +434,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV PhysicalUnit: '', PropertyName: '名称/编号', PropertyType: 0, - PropertyValue: '钦南区新兴消防', + PropertyValue: '', Required: false, RuleName: '', RuleValue: '', @@ -459,9 +460,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV Enabled: true, FillMode: 0, FireElementId: 0, - FixedSize: true, - Height: 32, - Width: 32, + FixedSize: false, + Height: 45, + Width: 45, Id: '5f67f92238f13cd2048cae9d', ImageUrl: './assets/images/水罐消防车.png', InteractiveMode: 0, @@ -470,7 +471,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV x: 1295, y: 1237 }, - Name: '水罐消防车', + Name: '', PropertyInfos: [ { Enabled: true, @@ -478,7 +479,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV PhysicalUnit: '', PropertyName: '名称/编号', PropertyType: 0, - PropertyValue: '钦南区新兴消防', + PropertyValue: '', Required: false, RuleName: '', RuleValue: '', From 02f7801f2dfc4517e5aaa35dc3ff39b66d95799a Mon Sep 17 00:00:00 2001 From: "DESKTOP-474NEJQ\\xzsjob" <359059686@qq.com> Date: Mon, 21 Sep 2020 11:30:54 +0800 Subject: [PATCH 4/4] =?UTF-8?q?[=E4=BF=AE=E6=AD=A3]=20=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E5=A4=A7=E5=B0=8F=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../working-area/working-area.component.ts | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/app/working-area/working-area.component.ts b/src/app/working-area/working-area.component.ts index e56d813..79a0531 100644 --- a/src/app/working-area/working-area.component.ts +++ b/src/app/working-area/working-area.component.ts @@ -263,13 +263,16 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV if (item.assetData.FixedSize) { const data = 1 / scale; item.scale.set(data); + } else { + const data = 1 / scale; + item.text.scale.set(data); } } else if (item instanceof MultipointIcon) { const data = 1 / scale; - item.text.scale.set(scale); + item.text.scale.set(data); } else if (item instanceof PolygonIcon) { const data = 1 / scale; - item.text.scale.set(scale); + item.text.scale.set(data); } }); }); @@ -448,9 +451,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV IsFromBuilding: false, GameMode: 2 }; - const tempCar = new SinglePointIcon(tempData, this); + const tempCar = new Car(tempData, this); tempCar.setParent(this.app.stage); - tempCar.position.set(300, 66); + tempCar.position.set(25, 25); const tempData2 = { TemplateId: null, @@ -493,14 +496,15 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV IsFromBuilding: false, GameMode: 2 }; - const tempCar2 = new SinglePointIcon(tempData2, this); + const tempCar2 = new Car(tempData2, this); tempCar2.setParent(this.app.stage); - tempCar2.position.set(300, 148); + tempCar2.position.set(25, 50); this.cancelPaint(); this.paintMode = PaintMode.connection; this.previewSinglePointIcon.texture = PIXI.Texture.from('./assets/images/水罐消防车.png'); } + /** * * @param id 图标ID @@ -785,7 +789,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV */ public destroyBackgroundImage(): void { this.app.stage.removeChild(this.backgroundImage); - this.removeAllListeners('backgroundScale'); + // this.removeAllListeners('backgroundScale'); } /** * 设置背景图缩放 @@ -1062,7 +1066,7 @@ export class SinglePointIcon extends PIXI.Container { wordWrapWidth: 100, }); - private text = new PIXI.Text(this.assetData.Name + public text = new PIXI.Text(this.assetData.Name + '\r\n' + this.assetData.PropertyInfos?.find(item => item.PropertyName === '名称/编号')?.PropertyValue, this.style); private image = PIXI.Sprite.from(this.assetData.ImageUrl); @@ -1646,7 +1650,9 @@ export class PolygonIcon extends PIXI.Container { this.polygonGraphics.endFill(); } } +export class Car extends SinglePointIcon { +} export class Conection extends PIXI.Container { }