chenjingyu 4 years ago
parent
commit
99f35f90bd
  1. 4
      angular.json
  2. 2
      src/app/data-collection/fire-force/fire-force.component.scss
  3. 2
      src/app/data-collection/linkage-forces/linkage-forces.component.scss
  4. 5
      src/app/data-collection/linkage-forces/linkage-forces.component.ts
  5. 2
      src/app/data-collection/water-collection/water-collection.component.scss
  6. 6
      src/app/gis-management/basic-info/basic-info.component.scss
  7. 4
      src/app/gis-management/gis-labeling/shareUrl.scss
  8. 112
      src/app/ui/collection-tools-building/collection-tools.component.html
  9. 205
      src/app/ui/collection-tools-building/collection-tools.component.ts
  10. 117
      src/app/ui/collection-tools-plan/collection-tools.component.html
  11. 207
      src/app/ui/collection-tools-plan/collection-tools.component.ts
  12. 115
      src/app/ui/collection-tools/collection-tools.component.html
  13. 212
      src/app/ui/collection-tools/collection-tools.component.ts
  14. 112
      src/app/working-area/model/axGrid.ts
  15. 13
      src/app/working-area/model/axSelection.ts
  16. 10
      src/app/working-area/model/axShape.ts
  17. 21
      src/app/working-area/working-area.component.ts
  18. BIN
      src/assets/font/SourceHanSansCN-Regular.otf
  19. 9
      src/styles.scss

4
angular.json

@ -64,8 +64,8 @@
"budgets": [ "budgets": [
{ {
"type": "initial", "type": "initial",
"maximumWarning": "6mb", "maximumWarning": "8mb",
"maximumError": "6mb" "maximumError": "8mb"
}, },
{ {
"type": "anyComponentStyle", "type": "anyComponentStyle",

2
src/app/data-collection/fire-force/fire-force.component.scss

@ -6,7 +6,7 @@
box-sizing: border-box; box-sizing: border-box;
padding: 10px; padding: 10px;
font-size: 16px; font-size: 16px;
font-family: Source Han Sans CN; // font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
color: #000000; color: #000000;
} }

2
src/app/data-collection/linkage-forces/linkage-forces.component.scss

@ -6,7 +6,7 @@
box-sizing: border-box; box-sizing: border-box;
padding: 10px; padding: 10px;
font-size: 16px; font-size: 16px;
font-family: Source Han Sans CN; // font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
color: #000000; color: #000000;
} }

5
src/app/data-collection/linkage-forces/linkage-forces.component.ts

@ -168,7 +168,7 @@ export class LinkageForcesComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.getAllFireForce() this.getAllFireForce()
window.onload = () => { setTimeout(() => {
var mySwiper = new Swiper('.swiper-container', { var mySwiper = new Swiper('.swiper-container', {
slidesPerView: 10,//每页显示的个数 slidesPerView: 10,//每页显示的个数
slidesPerGroup: 3,//点击一次需要跳多少次 slidesPerGroup: 3,//点击一次需要跳多少次
@ -178,9 +178,6 @@ export class LinkageForcesComponent implements OnInit {
prevEl: '.swiper-button-prev', prevEl: '.swiper-button-prev',
}, },
}) })
}
setTimeout(() => {
this.createMap() this.createMap()
}, 0); }, 0);
} }

2
src/app/data-collection/water-collection/water-collection.component.scss

@ -6,7 +6,7 @@
box-sizing: border-box; box-sizing: border-box;
padding: 10px; padding: 10px;
font-size: 16px; font-size: 16px;
font-family: Source Han Sans CN; // font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
color: #000000; color: #000000;
} }

6
src/app/gis-management/basic-info/basic-info.component.scss

@ -18,7 +18,7 @@ table { text-align: center; border-collapse: collapse; padding:2px;}
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow-y: auto; overflow-y: auto;
font-family: Source Han Sans CN; // font-family: Source Han Sans CN;
color: #333333; color: #333333;
padding: 10px; padding: 10px;
box-sizing: border-box; box-sizing: border-box;
@ -31,7 +31,7 @@ table { text-align: center; border-collapse: collapse; padding:2px;}
p{ p{
height: 14px; height: 14px;
font-size: 14px; font-size: 14px;
font-family: Source Han Sans CN; // font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
line-height: 14px; line-height: 14px;
color: #333333; color: #333333;
@ -54,7 +54,7 @@ table { text-align: center; border-collapse: collapse; padding:2px;}
p{ p{
height: 14px; height: 14px;
font-size: 14px; font-size: 14px;
font-family: Source Han Sans CN; // font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
line-height: 14px; line-height: 14px;
color: #333333; color: #333333;

4
src/app/gis-management/gis-labeling/shareUrl.scss

@ -8,7 +8,7 @@
position: relative; position: relative;
.name{ .name{
font-size: 20px; font-size: 20px;
font-family: Source Han Sans CN; // font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
color: #FFFFFF; color: #FFFFFF;
} }
@ -37,7 +37,7 @@
line-height: 36px; line-height: 36px;
background: #EEF1F5; background: #EEF1F5;
font-size: 16px; font-size: 16px;
font-family: Source Han Sans CN; // font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
color: #333333; color: #333333;
opacity: 0.4; opacity: 0.4;

112
src/app/ui/collection-tools-building/collection-tools.component.html

@ -24,7 +24,7 @@
<span class="rightSave"> <span class="rightSave">
<!-- <mat-icon title="查看/编辑模式" (click)="lookpat()" *ngIf="isEditPattern">tv</mat-icon> <!-- <mat-icon title="查看/编辑模式" (click)="lookpat()" *ngIf="isEditPattern">tv</mat-icon>
<mat-icon title="查看/编辑模式" (click)="editpat()" *ngIf="!isEditPattern && isediticon">create</mat-icon> --> <mat-icon title="查看/编辑模式" (click)="editpat()" *ngIf="!isEditPattern && isediticon">create</mat-icon> -->
<label title="保存" (click)="saveSite()"><mat-icon>description</mat-icon>保存</label> <label title="保存" (click)="saveSite()" *ngIf="isEditPattern"><mat-icon>description</mat-icon>保存</label>
</span> </span>
</div> </div>
@ -174,7 +174,7 @@
</div> </div>
</div> </div>
<!-- 平面图属性 --> <!-- 平面图属性 -->
<div class="siteproperty" style="user-select: none" *ngIf="isShowProperty && isShowAttribute"> <div class="siteproperty" style="user-select: none" *ngIf="isShowProperty && isShowAttribute && !isMultipleAsset">
<p>面积(平方米)</p> <p>面积(平方米)</p>
<div class="siteproperty_size">{{canvasData.selectStorey.area}}</div> <div class="siteproperty_size">{{canvasData.selectStorey.area}}</div>
<p>详情</p> <p>详情</p>
@ -183,7 +183,7 @@
</div> </div>
</div> </div>
<!-- 素材属性 --> <!-- 素材属性 -->
<div class="assetsproperty" style="user-select: none" *ngIf="isShowProperty && !isShowAttribute"> <div class="assetsproperty" style="user-select: none" *ngIf="isShowProperty && !isShowAttribute && !isMultipleAsset">
<h3 style="text-align: center;font-weight: 900;">{{assetName}}</h3> <h3 style="text-align: center;font-weight: 900;">{{assetName}}</h3>
<div *ngIf="canvasAssetObj.InteractiveMode == 0"> <div *ngIf="canvasAssetObj.InteractiveMode == 0">
@ -315,8 +315,112 @@
</select> </select>
</div> </div>
</div> </div>
</div>
</div>
<!-- 框选多个素材属性 -->
<div class="assetsproperty" style="user-select: none" *ngIf="isShowProperty && isMultipleAsset">
<div *ngIf="multipleAsset.InteractiveMode == 0">
<p>宽度(像素)</p>
<input type="number" class="biginput" [(ngModel)]="multipleAsset.Width" (input)="multipleAssetWidthInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<p>高度(像素)</p>
<input type="number" class="biginput" [(ngModel)]="multipleAsset.Height" (input)="multipleAssetHeightInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<p>角度</p>
<div style="width: 100%;display: flex;vertical-align: top;height: 22px;">
<input type="number" class="smallinput" [(ngModel)]="multipleAsset.Angle"
oninput="if(value>360)value=360;if(value<0)value=0;" (input)="multipleAssetAngleInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<mat-slider color="primary" min="0" max="360" step="1" style="bottom: 12px;left: 2px;width: 70%;"
[(ngModel)]="multipleAsset.Angle" (change)="multipleAssetAngleInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)"></mat-slider>
</div>
</div>
<!-- 如果是多点连线 -->
<div *ngIf="multipleAsset.InteractiveMode == 1 || multipleAsset.InteractiveMode == 3">
<p>厚度</p>
<div style="width: 100%;display: flex;vertical-align: top;height: 22px;">
<input type="number" class="smallinput" [(ngModel)]="multipleAsset.Thickness"
oninput="if(value>999)value=999;if(value<0)value=0;" (input)="multipleAssetThicknessInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<mat-slider color="primary" min="0" max="999" step="1" style="bottom: 12px;left: 2px;width: 70%;"
[(ngModel)]="multipleAsset.Thickness" (change)="multipleAssetThicknessInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)"></mat-slider>
</div>
</div>
<div class="colorBigDiv" *ngIf="multipleAsset.FillMode == 0">
<div class="colorBigTemplateDiv">
<span>颜色</span>
<div class="colorTemplateDiv" [style]="{'background-color':selectedcolor}">
</div>
</div>
<div class="colorDiv" *ngIf="isEditPattern && pattern && firstMultipleAssetData.assetData.GameMode == 0">
<ul>
<li (click)="multipleAssetSelectcolor(item,key)" class="colorLi" *ngFor="let item of colors,let key=index" [style]="{'background-color':item}"></li>
</ul>
</div>
<span style="color: #9c9fa5;font-size: 14px;">透明度</span>
<mat-slider color="primary" min="0" max="100%" step="1" style="left: 1px; width: 55%;min-width: 90px;"
[(ngModel)]="colorDivSliderValue" (change)="multipleColorDivSliderChange()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)"></mat-slider>
<span style="color: #9c9fa5;font-size: 12px;">{{colorDivSliderValue}}%</span>
</div>
<div *ngFor="let item of multipleAsset.PropertyInfos;index as key ">
<!-- 单行文本 -->
<div *ngIf="item.PropertyType == 0">
<p>{{item.PropertyName}}<span style="font-size: 14px;" *ngIf="item.PhysicalUnit">({{item.PhysicalUnit}})</span></p>
<input type="text" class="biginput" [name]="item.PropertyName" [(ngModel)]="item.PropertyValue" (input)="multipleAssetInputChange(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
</div>
<!-- 多行文本 -->
<div *ngIf="item.PropertyType == 1">
<p>{{item.PropertyName}}<span style="font-size: 14px;" *ngIf="item.PhysicalUnit">({{item.PhysicalUnit}})</span></p>
<textarea class="textarea" name="" id="" [(ngModel)]="item.PropertyValue" (input)="multipleAssetInputChange(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)"></textarea>
</div>
<!-- 数值 -->
<div *ngIf="item.PropertyType == 2">
<p>{{item.PropertyName}}<span style="font-size: 14px;" *ngIf="item.PhysicalUnit">({{item.PhysicalUnit}})</span></p>
<input type="number" class="biginput" [(ngModel)]="item.PropertyValue" (input)="multipleAssetInputChange(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
</div>
<!-- 方向 -->
<!-- <div *ngIf="item.PropertyType == 5 " class="selectDiv">
<p style="display: inline-block;">{{item.PropertyName}}</p>
<select [(ngModel)]="item.PropertyValue" (change)="direction(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<option value ="0" [selected]="item.PropertyValue =='0'"></option>
<option value ="1" [selected]="item.PropertyValue =='1'">西</option>
<option value ="2" [selected]="item.PropertyValue =='2'"></option>
<option value ="3" [selected]="item.PropertyValue =='3'"></option>
<option value ="4" [selected]="item.PropertyValue =='4'">东南</option>
<option value ="5" [selected]="item.PropertyValue =='5'">西南</option>
<option value ="6" [selected]="item.PropertyValue =='6'">东北</option>
<option value ="7" [selected]="item.PropertyValue =='7'">西北</option>
</select>
</div> -->
<!-- 布尔值 是1或否0 -->
<div *ngIf="item.PropertyType == 6">
<p>{{item.PropertyName}}</p>
<input value='1' [(ngModel)]="item.PropertyValue" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)" class="input" type="radio" name="radio" (click)="multipleAssetRadioChange(item,'1')"><span></span>
<input value='0' [(ngModel)]="item.PropertyValue" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)" class="input" type="radio" name="radio" (click)="multipleAssetRadioChange(item,'0')"><span></span>
</div>
<!-- 供给区域 -->
<div *ngIf="item.PropertyType == 7" class="selectDiv">
<p style="display: inline-block;">{{item.PropertyName}}</p>
<select [(ngModel)]="item.PropertyValue" (change)="multipleSupplyArea(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<option value ="0">全部</option>
<option value ="1">高区</option>
<option value ="2">中区</option>
<option value ="3">低区</option>
<option value ="4">高中区</option>
<option value ="5">高低区</option>
<option value ="6">中低区</option>
</select>
</div>
<!-- 供给类型 -->
<div *ngIf="item.PropertyType == 8" class="selectDiv">
<p style="display: inline-block;">{{item.PropertyName}}</p>
<select [(ngModel)]="item.PropertyValue" (change)="multipleSupplyArea(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<option value ="0">消火栓</option>
<option value ="1">喷淋</option>
<option value ="2">水幕</option>
<option value ="3">泡沫</option>
<option value ="4">消防</option>
</select>
</div>
</div>
</div>
</div> </div>
<!-- 消防要素 --> <!-- 消防要素 -->
<div id="firecategories" class="firecategories" style="height: 50%;"> <div id="firecategories" class="firecategories" style="height: 50%;">

205
src/app/ui/collection-tools-building/collection-tools.component.ts

@ -17,7 +17,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service'; import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service';
import { MaskLayerService } from 'src/app/mask-layer.service'; import { MaskLayerService } from 'src/app/mask-layer.service';
import * as ObjectID from 'bson-objectid'; import * as ObjectID from 'bson-objectid';
import { AxMessageSystem } from 'src/app/working-area/model/axMessageSystem';
@Component({ @Component({
selector: 'app-collection-tools-building', selector: 'app-collection-tools-building',
templateUrl: './collection-tools.component.html', templateUrl: './collection-tools.component.html',
@ -83,9 +83,11 @@ export class CollectionToolsBuildingComponent implements OnInit {
setTimeout(() => { setTimeout(() => {
obj.PropertyInfos.forEach(item => { obj.PropertyInfos.forEach(item => {
if(item.PropertyType == 4){ if(item.PropertyType == 4){
this.gallery = new Viewer(document.getElementById('viewerjs'),{ if(document.getElementById('viewerjs')){
url: 'data-original' this.gallery = new Viewer(document.getElementById('viewerjs'),{
}); url: 'data-original'
});
}
} }
}) })
}, 0); }, 0);
@ -607,23 +609,79 @@ export class CollectionToolsBuildingComponent implements OnInit {
this.canvasData.isChange = true this.canvasData.isChange = true
} }
isSixShow = true
isSixbtn = true //控制想定作业编辑按钮
isediticon = true //控制查看编辑模式的编辑模式小笔按钮 isediticon = true //控制查看编辑模式的编辑模式小笔按钮
ngOnInit(): void {
if(this.router.url.indexOf("keyUnit/viewunitinfo") != -1 || this.router.url.indexOf("keyUnit/editplaninfo")!= -1){
this.isSixbtn = false
}
if(!this.isSixbtn && sessionStorage.getItem("six") == "edit"){ isMultipleAsset:boolean = false//框选多个素材属性显隐
this.isSixShow = true multipleAsset:any = {
} Width:null,
if(!this.isSixbtn && sessionStorage.getItem("six") == "look"){ Height:null,
Angle:null,
Thickness:null,
Color:null,
PropertyInfos:[]
}//多个素材共同属性
multipleAssetData:any//当前多选的素材
firstMultipleAssetData:any//当前多选的第一个素材
ngOnInit(): void {
let _this = this
AxMessageSystem.addListener('selectionChanged', ()=>{
if(this.canvas.selection.size() == 1){//如果是单选
this.isMultipleAsset = false
// console.log('单选',this.canvas.selection.first().assetData)
this.setAssetsProperty(this.canvas.selection.first().assetData)
}else if(this.canvas.selection.size()){
// console.log('多选')
this.isShowProperty = true
this.multipleAssetData = this.canvas.selection.all()
this.firstMultipleAssetData = this.canvas.selection.first()
this.multipleAsset = {
Width:null,
Height:null,
Angle:null,
Thickness:null,
Color:null,
PropertyInfos:[]
}
this.isMultipleAsset = true
let firstAssetData = this.canvas.selection.first().assetData;//拿出第一个素材作为例子与其他素材进行对比
let InteractiveMode = firstAssetData.InteractiveMode //素材连接方式
let isInteractiveMode = this.canvas.selection.all().every(item => item.assetData.InteractiveMode === InteractiveMode)
if(isInteractiveMode){
this.multipleAsset.InteractiveMode = InteractiveMode
}
let isFillMode = this.canvas.selection.all().every(item => item.assetData.FillMode === 0) //素材填充方式都为0
if(isFillMode){
this.multipleAsset.FillMode = 0
}
this.canvas.selection.first().assetData.PropertyInfos.forEach(i => {
let index = 0
this.canvas.selection.all().forEach(item => {
item.assetData.PropertyInfos.forEach(element => {
if(element.PropertyName == i.PropertyName && element.PropertyType == i.PropertyType && element.PropertyType != 3 && element.PropertyType != 4){
index++
if(index == this.canvas.selection.size()){
let newElement = JSON.parse(JSON.stringify(element))
newElement.PropertyValue = ''
this.multipleAsset.PropertyInfos.push(newElement)
}
}
});
})
})
}else if(this.canvas.selection.size() == 0){
this.isShowProperty = false
}
}, this)
if(this.router.url.indexOf("keyUnit/viewunitinfo") != -1){ //查看模式
this.isEditPattern = false this.isEditPattern = false
this.isediticon = false this.isediticon = false
this.canvasData.gameMode = GameMode.Assignment
} else if (this.router.url.indexOf("keyUnit/editplaninfo")!= -1) { //编辑模式
this.canvasData.gameMode = GameMode.BasicInformation
} }
//gis模块平面图 //gis模块平面图
if(this.router.url.indexOf("gis") != -1 && sessionStorage.getItem("gisplan") == "look"){ if(this.router.url.indexOf("gis") != -1 && sessionStorage.getItem("gisplan") == "look"){
this.isEditPattern = false this.isEditPattern = false
@ -641,30 +699,121 @@ export class CollectionToolsBuildingComponent implements OnInit {
event.preventDefault(); event.preventDefault();
}; };
}) })
this.canvasData.getMessage().subscribe((message: any)=>{ this.canvasData.getMessage().subscribe((message: any)=>{
if(message == "send a message"){ if(message == "send a message"){
this.refurbishTreeData() this.refurbishTreeData()
} }
}) })
} }
//多选宽度共同改变
multipleAssetWidthInput(){
this.multipleAssetData.forEach(item=>{
item.assetData.Width = this.multipleAsset.Width
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选高度共同改变
multipleAssetHeightInput(){
this.multipleAssetData.forEach(item=>{
item.assetData.Height = this.multipleAsset.Height
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选角度共同改变
multipleAssetAngleInput(){
this.multipleAssetData.forEach(item=>{
item.assetData.Angle = this.multipleAsset.Angle
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选厚度共同改变
multipleAssetThicknessInput(){
this.multipleAssetData.forEach(item=>{
item.assetData.Thickness = this.multipleAsset.Thickness
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选颜色共同改变
multipleSelectedcolor:any
multipleAssetSelectcolor(item,key){
//在当前透明度基础上改变颜色
this.multipleSelectedcolor = item
this.multipleAssetData.forEach(item=>{
item.assetData.Color = this.multipleSelectedcolor
this.canvasData.isChange = true
this.canvas.refreshIcon(item.assetData.Id)
})
}
//多选颜色滑竿改变
multipleColorDivSliderChange(){
let colorOpacity = Math.round(255 * this.colorDivSliderValue * 0.01)
//根据滑竿值改变16进制颜色后两位
function replacepos(text,start,stop,replacetext){
let mystr = text.substring(0,stop-1)+replacetext+text.substring(stop+1);
return mystr;
}
this.multipleAssetData.forEach(item=>{
this.multipleSelectedcolor = replacepos(this.multipleSelectedcolor,7,8,colorOpacity.toString(16))
item.assetData.Color = this.multipleSelectedcolor
this.canvasData.isChange = true
this.canvas.refreshIcon(item.assetData.Id)
})
}
//多选状态动态属性素材input框值改变
multipleAssetInputChange(i,e){
e.stopPropagation()
this.multipleAssetData.forEach(item=>{
// console.log(item)
item.assetData.PropertyInfos.forEach(element => {
if(element.PropertyName == i.PropertyName){
element.PropertyValue = i.PropertyValue
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
}
})
})
}
//多选状态动态属性素材radio框值改变
multipleAssetRadioChange(i,value){
// e.stopPropagation()
this.multipleAssetData.forEach(item=>{
// console.log(item)
item.assetData.PropertyInfos.forEach(element => {
if(element.PropertyName == i.PropertyName){
element.PropertyValue = value
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
}
})
})
}
//多选状态动态属性素材下拉框值改变
multipleSupplyArea(i,e){
e.stopPropagation()
this.multipleAssetData.forEach(item=>{
// console.log(item)
item.assetData.PropertyInfos.forEach(element => {
if(element.PropertyName == i.PropertyName){
element.PropertyValue = i.PropertyValue
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
}
})
})
}
ngAfterViewInit(): void { ngAfterViewInit(): void {
//gis模块平面图 //不是gis模块平面图
if(this.router.url.indexOf("gis") == -1) { if(this.router.url.indexOf("gis") == -1) {
this.getAllBuildings(true) //获取所有建筑 this.getAllBuildings(true) //获取所有建筑
} }
// 监听canvas组件选中素材事件
this.canvas.on("select",obj=>{
//选中素材属性注入函数
this.setAssetsProperty(obj.assetData)
})
// 监听canvas组件取消选中素材事件
this.canvas.on("deselect",obj=>{
this.isShowProperty = false
})
//监听数据变化后 //监听数据变化后
this.canvas.on('canvasDataChanged',()=>{ this.canvas.on('canvasDataChanged',()=>{
// 收到数据表示共享数据发生变化 // 收到数据表示共享数据发生变化

117
src/app/ui/collection-tools-plan/collection-tools.component.html

@ -24,7 +24,7 @@
<span class="rightSave"> <span class="rightSave">
<!-- <mat-icon title="查看/编辑模式" (click)="lookpat()" *ngIf="isEditPattern">tv</mat-icon> <!-- <mat-icon title="查看/编辑模式" (click)="lookpat()" *ngIf="isEditPattern">tv</mat-icon>
<mat-icon title="查看/编辑模式" (click)="editpat()" *ngIf="!isEditPattern && isediticon">create</mat-icon> --> <mat-icon title="查看/编辑模式" (click)="editpat()" *ngIf="!isEditPattern && isediticon">create</mat-icon> -->
<label title="保存" (click)="saveSite()"><mat-icon>description</mat-icon>保存</label> <label title="保存" (click)="saveSite()" *ngIf="isEditPattern"><mat-icon>description</mat-icon>保存</label>
</span> </span>
</div> </div>
@ -153,7 +153,7 @@
<div [ngClass]="{'forbidden': !isEditPattern}" id="property" class="property" style="height: 100%;background-color: white;"> <div [ngClass]="{'forbidden': !isEditPattern}" id="property" class="property" style="height: 100%;background-color: white;">
<div class="rightTitle">属性</div> <div class="rightTitle">属性</div>
<!-- 平面图属性 --> <!-- 平面图属性 -->
<div class="siteproperty" style="user-select: none" *ngIf="isShowProperty && isShowAttribute"> <div class="siteproperty" style="user-select: none" *ngIf="isShowProperty && isShowAttribute && !isMultipleAsset">
<p>面积(平方米)</p> <p>面积(平方米)</p>
<div class="siteproperty_size">{{canvasData.selectStorey.area}}</div> <div class="siteproperty_size">{{canvasData.selectStorey.area}}</div>
<p>详情</p> <p>详情</p>
@ -162,14 +162,14 @@
</div> </div>
</div> </div>
<!-- 素材属性 --> <!-- 素材属性 -->
<div class="assetsproperty" style="user-select: none" *ngIf="isShowProperty && !isShowAttribute"> <div class="assetsproperty" style="user-select: none" *ngIf="isShowProperty && !isShowAttribute && !isMultipleAsset">
<h3 style="text-align: center;font-weight: 900;">{{assetName}}</h3> <h3 style="text-align: center;font-weight: 900;">{{assetName}}</h3>
<div *ngIf="canvasAssetObj.InteractiveMode == 0"> <div *ngIf="canvasAssetObj.InteractiveMode == 0">
<p>宽度(像素)</p> <p>宽度(像素)</p>
<input type="text" class="biginput" [(ngModel)]="assetWidth" (input)="assetWidthIunput()" [disabled]="!isEditPattern || (canvasAssetObj.GameMode == 0 && !pattern)"> <input type="number" class="biginput" [(ngModel)]="assetWidth" (input)="assetWidthIunput()" [disabled]="!isEditPattern || (canvasAssetObj.GameMode == 0 && !pattern)">
<p>高度(像素)</p> <p>高度(像素)</p>
<input type="text" class="biginput" [(ngModel)]="assetHeight" (input)="assetHeightIunput()" [disabled]="!isEditPattern || (canvasAssetObj.GameMode == 0 && !pattern)"> <input type="number" class="biginput" [(ngModel)]="assetHeight" (input)="assetHeightIunput()" [disabled]="!isEditPattern || (canvasAssetObj.GameMode == 0 && !pattern)">
<p>角度</p> <p>角度</p>
<div style="width: 100%;display: flex;vertical-align: top;height: 22px;"> <div style="width: 100%;display: flex;vertical-align: top;height: 22px;">
<input type="number" class="smallinput" [(ngModel)]="sliderValue" <input type="number" class="smallinput" [(ngModel)]="sliderValue"
@ -191,7 +191,7 @@
<p style="margin-top: 4px;margin-bottom: 0px;">是否高亮</p> <p style="margin-top: 4px;margin-bottom: 0px;">是否高亮</p>
<div> <div>
<input class="input" [(ngModel)]="isHighLight" type="checkbox" [disabled]="!isEditPattern || (canvasAssetObj.GameMode == 0 && !pattern)"> <input (change)="assetHighLightIunput()" class="input" [(ngModel)]="isHighLight" type="checkbox" [disabled]="!isEditPattern || (canvasAssetObj.GameMode == 0 && !pattern)">
<span style="font-size: 14px;">选中高亮</span> <span style="font-size: 14px;">选中高亮</span>
</div> </div>
<div class="colorBigDiv" *ngIf="canvasAssetObj.FillMode == 0"> <div class="colorBigDiv" *ngIf="canvasAssetObj.FillMode == 0">
@ -295,7 +295,110 @@
</div> </div>
</div> </div>
</div> </div>
<!-- 框选多个素材属性 -->
<div class="assetsproperty" style="user-select: none" *ngIf="isShowProperty && isMultipleAsset">
<div *ngIf="multipleAsset.InteractiveMode == 0">
<p>宽度(像素)</p>
<input type="number" class="biginput" [(ngModel)]="multipleAsset.Width" (input)="multipleAssetWidthInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<p>高度(像素)</p>
<input type="number" class="biginput" [(ngModel)]="multipleAsset.Height" (input)="multipleAssetHeightInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<p>角度</p>
<div style="width: 100%;display: flex;vertical-align: top;height: 22px;">
<input type="number" class="smallinput" [(ngModel)]="multipleAsset.Angle"
oninput="if(value>360)value=360;if(value<0)value=0;" (input)="multipleAssetAngleInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<mat-slider color="primary" min="0" max="360" step="1" style="bottom: 12px;left: 2px;width: 70%;"
[(ngModel)]="multipleAsset.Angle" (change)="multipleAssetAngleInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)"></mat-slider>
</div>
</div>
<!-- 如果是多点连线 -->
<div *ngIf="multipleAsset.InteractiveMode == 1 || multipleAsset.InteractiveMode == 3">
<p>厚度</p>
<div style="width: 100%;display: flex;vertical-align: top;height: 22px;">
<input type="number" class="smallinput" [(ngModel)]="multipleAsset.Thickness"
oninput="if(value>999)value=999;if(value<0)value=0;" (input)="multipleAssetThicknessInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<mat-slider color="primary" min="0" max="999" step="1" style="bottom: 12px;left: 2px;width: 70%;"
[(ngModel)]="multipleAsset.Thickness" (change)="multipleAssetThicknessInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)"></mat-slider>
</div>
</div>
<div class="colorBigDiv" *ngIf="multipleAsset.FillMode == 0">
<div class="colorBigTemplateDiv">
<span>颜色</span>
<div class="colorTemplateDiv" [style]="{'background-color':selectedcolor}">
</div>
</div>
<div class="colorDiv" *ngIf="isEditPattern && pattern && firstMultipleAssetData.assetData.GameMode == 0">
<ul>
<li (click)="multipleAssetSelectcolor(item,key)" class="colorLi" *ngFor="let item of colors,let key=index" [style]="{'background-color':item}"></li>
</ul>
</div>
<span style="color: #9c9fa5;font-size: 14px;">透明度</span>
<mat-slider color="primary" min="0" max="100%" step="1" style="left: 1px; width: 55%;min-width: 90px;"
[(ngModel)]="colorDivSliderValue" (change)="multipleColorDivSliderChange()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)"></mat-slider>
<span style="color: #9c9fa5;font-size: 12px;">{{colorDivSliderValue}}%</span>
</div>
<div *ngFor="let item of multipleAsset.PropertyInfos;index as key ">
<!-- 单行文本 -->
<div *ngIf="item.PropertyType == 0">
<p>{{item.PropertyName}}<span style="font-size: 14px;" *ngIf="item.PhysicalUnit">({{item.PhysicalUnit}})</span></p>
<input type="text" class="biginput" [name]="item.PropertyName" [(ngModel)]="item.PropertyValue" (input)="multipleAssetInputChange(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
</div>
<!-- 多行文本 -->
<div *ngIf="item.PropertyType == 1">
<p>{{item.PropertyName}}<span style="font-size: 14px;" *ngIf="item.PhysicalUnit">({{item.PhysicalUnit}})</span></p>
<textarea class="textarea" name="" id="" [(ngModel)]="item.PropertyValue" (input)="multipleAssetInputChange(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)"></textarea>
</div>
<!-- 数值 -->
<div *ngIf="item.PropertyType == 2">
<p>{{item.PropertyName}}<span style="font-size: 14px;" *ngIf="item.PhysicalUnit">({{item.PhysicalUnit}})</span></p>
<input type="number" class="biginput" [(ngModel)]="item.PropertyValue" (input)="multipleAssetInputChange(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
</div>
<!-- 方向 -->
<!-- <div *ngIf="item.PropertyType == 5 " class="selectDiv">
<p style="display: inline-block;">{{item.PropertyName}}</p>
<select [(ngModel)]="item.PropertyValue" (change)="direction(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<option value ="0" [selected]="item.PropertyValue =='0'"></option>
<option value ="1" [selected]="item.PropertyValue =='1'">西</option>
<option value ="2" [selected]="item.PropertyValue =='2'"></option>
<option value ="3" [selected]="item.PropertyValue =='3'"></option>
<option value ="4" [selected]="item.PropertyValue =='4'">东南</option>
<option value ="5" [selected]="item.PropertyValue =='5'">西南</option>
<option value ="6" [selected]="item.PropertyValue =='6'">东北</option>
<option value ="7" [selected]="item.PropertyValue =='7'">西北</option>
</select>
</div> -->
<!-- 布尔值 是1或否0 -->
<div *ngIf="item.PropertyType == 6">
<p>{{item.PropertyName}}</p>
<input value='1' [(ngModel)]="item.PropertyValue" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)" class="input" type="radio" name="radio" (click)="multipleAssetRadioChange(item,'1')"><span></span>
<input value='0' [(ngModel)]="item.PropertyValue" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)" class="input" type="radio" name="radio" (click)="multipleAssetRadioChange(item,'0')"><span></span>
</div>
<!-- 供给区域 -->
<div *ngIf="item.PropertyType == 7" class="selectDiv">
<p style="display: inline-block;">{{item.PropertyName}}</p>
<select [(ngModel)]="item.PropertyValue" (change)="multipleSupplyArea(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<option value ="0">全部</option>
<option value ="1">高区</option>
<option value ="2">中区</option>
<option value ="3">低区</option>
<option value ="4">高中区</option>
<option value ="5">高低区</option>
<option value ="6">中低区</option>
</select>
</div>
<!-- 供给类型 -->
<div *ngIf="item.PropertyType == 8" class="selectDiv">
<p style="display: inline-block;">{{item.PropertyName}}</p>
<select [(ngModel)]="item.PropertyValue" (change)="multipleSupplyArea(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<option value ="0">消火栓</option>
<option value ="1">喷淋</option>
<option value ="2">水幕</option>
<option value ="3">泡沫</option>
<option value ="4">消防</option>
</select>
</div>
</div>
</div>
</div> </div>
</div> </div>

207
src/app/ui/collection-tools-plan/collection-tools.component.ts

@ -17,7 +17,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service'; import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service';
import { MaskLayerService } from 'src/app/mask-layer.service'; import { MaskLayerService } from 'src/app/mask-layer.service';
import * as ObjectID from 'bson-objectid'; import * as ObjectID from 'bson-objectid';
import { AxMessageSystem } from 'src/app/working-area/model/axMessageSystem';
@Component({ @Component({
selector: 'app-collection-tools-plan', selector: 'app-collection-tools-plan',
templateUrl: './collection-tools.component.html', templateUrl: './collection-tools.component.html',
@ -83,9 +83,11 @@ export class CollectionToolsPlanComponent implements OnInit {
setTimeout(() => { setTimeout(() => {
obj.PropertyInfos.forEach(item => { obj.PropertyInfos.forEach(item => {
if(item.PropertyType == 4){ if(item.PropertyType == 4){
this.gallery = new Viewer(document.getElementById('viewerjs'),{ if(document.getElementById('viewerjs')){
url: 'data-original' this.gallery = new Viewer(document.getElementById('viewerjs'),{
}); url: 'data-original'
});
}
} }
}) })
}, 0); }, 0);
@ -408,7 +410,10 @@ export class CollectionToolsPlanComponent implements OnInit {
//素材是否高亮改变----->本地操作行为 //素材是否高亮改变----->本地操作行为
assetHighLightIunput(){ assetHighLightIunput(){
// console.log(this.isHighLight,this.canvasAssetObj)
// let arr = []
// arr.push(this.canvasAssetObj.Id)
// this.canvas.setHighlight(arr)
} }
//动态属性素材input框值改变 //动态属性素材input框值改变
@ -607,22 +612,79 @@ export class CollectionToolsPlanComponent implements OnInit {
this.canvasData.isChange = true this.canvasData.isChange = true
} }
isSixShow = true
isSixbtn = true //控制想定作业编辑按钮
isediticon = true //控制查看编辑模式的编辑模式小笔按钮 isediticon = true //控制查看编辑模式的编辑模式小笔按钮
ngOnInit(): void {
if(this.router.url.indexOf("keyUnit/viewunitinfo") != -1 || this.router.url.indexOf("keyUnit/editplaninfo")!= -1){ isMultipleAsset:boolean = false//框选多个素材属性显隐
this.isSixbtn = false multipleAsset:any = {
} Width:null,
Height:null,
Angle:null,
Thickness:null,
Color:null,
PropertyInfos:[]
}//多个素材共同属性
multipleAssetData:any//当前多选的素材
firstMultipleAssetData:any//当前多选的第一个素材
ngOnInit(): void {
let _this = this
AxMessageSystem.addListener('selectionChanged', ()=>{
if(this.canvas.selection.size() == 1){//如果是单选
this.isMultipleAsset = false
// console.log('单选',this.canvas.selection.first().assetData)
this.setAssetsProperty(this.canvas.selection.first().assetData)
}else if(this.canvas.selection.size()){
// console.log('多选')
this.isShowProperty = true
this.multipleAssetData = this.canvas.selection.all()
this.firstMultipleAssetData = this.canvas.selection.first()
this.multipleAsset = {
Width:null,
Height:null,
Angle:null,
Thickness:null,
Color:null,
PropertyInfos:[]
}
this.isMultipleAsset = true
let firstAssetData = this.canvas.selection.first().assetData;//拿出第一个素材作为例子与其他素材进行对比
let InteractiveMode = firstAssetData.InteractiveMode //素材连接方式
let isInteractiveMode = this.canvas.selection.all().every(item => item.assetData.InteractiveMode === InteractiveMode)
if(isInteractiveMode){
this.multipleAsset.InteractiveMode = InteractiveMode
}
let isFillMode = this.canvas.selection.all().every(item => item.assetData.FillMode === 0) //素材填充方式都为0
if(isFillMode){
this.multipleAsset.FillMode = 0
}
this.canvas.selection.first().assetData.PropertyInfos.forEach(i => {
let index = 0
this.canvas.selection.all().forEach(item => {
item.assetData.PropertyInfos.forEach(element => {
if(element.PropertyName == i.PropertyName && element.PropertyType == i.PropertyType && element.PropertyType != 3 && element.PropertyType != 4){
index++
if(index == this.canvas.selection.size()){
let newElement = JSON.parse(JSON.stringify(element))
newElement.PropertyValue = ''
this.multipleAsset.PropertyInfos.push(newElement)
}
}
});
})
})
// console.log(666,_this.multipleAsset.PropertyInfos)
}else if(this.canvas.selection.size() == 0){
this.isShowProperty = false
}
}, this)
if(!this.isSixbtn && sessionStorage.getItem("six") == "edit"){ if(this.router.url.indexOf("keyUnit/viewunitinfo") != -1){ //查看模式
this.isSixShow = true
}
if(!this.isSixbtn && sessionStorage.getItem("six") == "look"){
this.isEditPattern = false this.isEditPattern = false
this.isediticon = false this.isediticon = false
this.canvasData.gameMode = GameMode.Assignment
} else if (this.router.url.indexOf("keyUnit/editplaninfo")!= -1) { //编辑模式
this.canvasData.gameMode = GameMode.BasicInformation
} }
//gis模块平面图 //gis模块平面图
if(this.router.url.indexOf("gis") != -1 && sessionStorage.getItem("gisplan") == "look"){ if(this.router.url.indexOf("gis") != -1 && sessionStorage.getItem("gisplan") == "look"){
this.isEditPattern = false this.isEditPattern = false
@ -647,23 +709,114 @@ export class CollectionToolsPlanComponent implements OnInit {
} }
}) })
} }
//多选宽度共同改变
multipleAssetWidthInput(){
this.multipleAssetData.forEach(item=>{
item.assetData.Width = this.multipleAsset.Width
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选高度共同改变
multipleAssetHeightInput(){
this.multipleAssetData.forEach(item=>{
item.assetData.Height = this.multipleAsset.Height
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选角度共同改变
multipleAssetAngleInput(){
this.multipleAssetData.forEach(item=>{
item.assetData.Angle = this.multipleAsset.Angle
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选厚度共同改变
multipleAssetThicknessInput(){
this.multipleAssetData.forEach(item=>{
item.assetData.Thickness = this.multipleAsset.Thickness
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选颜色共同改变
multipleSelectedcolor:any
multipleAssetSelectcolor(item,key){
//在当前透明度基础上改变颜色
this.multipleSelectedcolor = item
this.multipleAssetData.forEach(item=>{
item.assetData.Color = this.multipleSelectedcolor
this.canvasData.isChange = true
this.canvas.refreshIcon(item.assetData.Id)
})
}
//多选颜色滑竿改变
multipleColorDivSliderChange(){
let colorOpacity = Math.round(255 * this.colorDivSliderValue * 0.01)
//根据滑竿值改变16进制颜色后两位
function replacepos(text,start,stop,replacetext){
let mystr = text.substring(0,stop-1)+replacetext+text.substring(stop+1);
return mystr;
}
this.multipleAssetData.forEach(item=>{
this.multipleSelectedcolor = replacepos(this.multipleSelectedcolor,7,8,colorOpacity.toString(16))
item.assetData.Color = this.multipleSelectedcolor
this.canvasData.isChange = true
this.canvas.refreshIcon(item.assetData.Id)
})
}
//多选状态动态属性素材input框值改变
multipleAssetInputChange(i,e){
e.stopPropagation()
this.multipleAssetData.forEach(item=>{
// console.log(item)
item.assetData.PropertyInfos.forEach(element => {
if(element.PropertyName == i.PropertyName){
element.PropertyValue = i.PropertyValue
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
}
})
})
}
//多选状态动态属性素材radio框值改变
multipleAssetRadioChange(i,value){
// e.stopPropagation()
this.multipleAssetData.forEach(item=>{
// console.log(item)
item.assetData.PropertyInfos.forEach(element => {
if(element.PropertyName == i.PropertyName){
element.PropertyValue = value
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
}
})
})
}
//多选状态动态属性素材下拉框值改变
multipleSupplyArea(i,e){
e.stopPropagation()
this.multipleAssetData.forEach(item=>{
// console.log(item)
item.assetData.PropertyInfos.forEach(element => {
if(element.PropertyName == i.PropertyName){
element.PropertyValue = i.PropertyValue
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
}
})
})
}
ngAfterViewInit(): void { ngAfterViewInit(): void {
//gis模块平面图 //不是gis模块平面图
if(this.router.url.indexOf("gis") == -1) { if(this.router.url.indexOf("gis") == -1) {
this.getSitePlan() this.getSitePlan()
} }
// 监听canvas组件选中素材事件
this.canvas.on("select",obj=>{
//选中素材属性注入函数
this.setAssetsProperty(obj.assetData)
})
// 监听canvas组件取消选中素材事件
this.canvas.on("deselect",obj=>{
this.isShowProperty = false
})
//监听数据变化后 //监听数据变化后
this.canvas.on('canvasDataChanged',()=>{ this.canvas.on('canvasDataChanged',()=>{
// 收到数据表示共享数据发生变化 // 收到数据表示共享数据发生变化

115
src/app/ui/collection-tools/collection-tools.component.html

@ -58,7 +58,7 @@
<option value ="6">东北</option> <option value ="6">东北</option>
<option value ="7">西北</option> <option value ="7">西北</option>
</select> </select>
<label title="保存" (click)="saveSite()" class="rightSave"><mat-icon>description</mat-icon>保存</label> <label title="保存" (click)="saveSite()" class="rightSave" *ngIf="isEditPattern"><mat-icon>description</mat-icon>保存</label>
</div> </div>
</div> </div>
@ -227,7 +227,7 @@
</div> </div>
</div> </div>
<!-- 平面图属性 --> <!-- 平面图属性 -->
<div class="siteproperty" style="user-select: none" *ngIf="isShowProperty && isShowAttribute"> <div class="siteproperty" style="user-select: none" *ngIf="isShowProperty && isShowAttribute && !isMultipleAsset">
<p>面积(平方米)</p> <p>面积(平方米)</p>
<div class="siteproperty_size">{{canvasData.selectStorey.area}}</div> <div class="siteproperty_size">{{canvasData.selectStorey.area}}</div>
<p>详情</p> <p>详情</p>
@ -236,14 +236,14 @@
</div> </div>
</div> </div>
<!-- 素材属性 --> <!-- 素材属性 -->
<div class="assetsproperty" style="user-select: none" *ngIf="isShowProperty && !isShowAttribute"> <div class="assetsproperty" style="user-select: none" *ngIf="isShowProperty && !isShowAttribute && !isMultipleAsset">
<h3 style="text-align: center;font-weight: 900;">{{assetName}}</h3> <h3 style="text-align: center;font-weight: 900;">{{assetName}}</h3>
<div *ngIf="canvasAssetObj.InteractiveMode == 0"> <div *ngIf="canvasAssetObj.InteractiveMode == 0">
<p>宽度(像素)</p> <p>宽度(像素)</p>
<input type="text" class="biginput" [(ngModel)]="assetWidth" (input)="assetWidthIunput()" [disabled]="!isEditPattern || (canvasAssetObj.GameMode == 0 && !pattern)"> <input type="number" class="biginput" [(ngModel)]="assetWidth" (input)="assetWidthIunput()" [disabled]="!isEditPattern || (canvasAssetObj.GameMode == 0 && !pattern)">
<p>高度(像素)</p> <p>高度(像素)</p>
<input type="text" class="biginput" [(ngModel)]="assetHeight" (input)="assetHeightIunput()" [disabled]="!isEditPattern || (canvasAssetObj.GameMode == 0 && !pattern)"> <input type="number" class="biginput" [(ngModel)]="assetHeight" (input)="assetHeightIunput()" [disabled]="!isEditPattern || (canvasAssetObj.GameMode == 0 && !pattern)">
<p>角度</p> <p>角度</p>
<div style="width: 100%;display: flex;vertical-align: top;height: 22px;"> <div style="width: 100%;display: flex;vertical-align: top;height: 22px;">
<input type="number" class="smallinput" [(ngModel)]="sliderValue" <input type="number" class="smallinput" [(ngModel)]="sliderValue"
@ -369,7 +369,110 @@
</div> </div>
</div> </div>
</div> </div>
<!-- 框选多个素材属性 -->
<div class="assetsproperty" style="user-select: none" *ngIf="isShowProperty && isMultipleAsset">
<div *ngIf="multipleAsset.InteractiveMode == 0">
<p>宽度(像素)</p>
<input type="number" class="biginput" [(ngModel)]="multipleAsset.Width" (input)="multipleAssetWidthInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<p>高度(像素)</p>
<input type="number" class="biginput" [(ngModel)]="multipleAsset.Height" (input)="multipleAssetHeightInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<p>角度</p>
<div style="width: 100%;display: flex;vertical-align: top;height: 22px;">
<input type="number" class="smallinput" [(ngModel)]="multipleAsset.Angle"
oninput="if(value>360)value=360;if(value<0)value=0;" (input)="multipleAssetAngleInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<mat-slider color="primary" min="0" max="360" step="1" style="bottom: 12px;left: 2px;width: 70%;"
[(ngModel)]="multipleAsset.Angle" (change)="multipleAssetAngleInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)"></mat-slider>
</div>
</div>
<!-- 如果是多点连线 -->
<div *ngIf="multipleAsset.InteractiveMode == 1 || multipleAsset.InteractiveMode == 3">
<p>厚度</p>
<div style="width: 100%;display: flex;vertical-align: top;height: 22px;">
<input type="number" class="smallinput" [(ngModel)]="multipleAsset.Thickness"
oninput="if(value>999)value=999;if(value<0)value=0;" (input)="multipleAssetThicknessInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<mat-slider color="primary" min="0" max="999" step="1" style="bottom: 12px;left: 2px;width: 70%;"
[(ngModel)]="multipleAsset.Thickness" (change)="multipleAssetThicknessInput()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)"></mat-slider>
</div>
</div>
<div class="colorBigDiv" *ngIf="multipleAsset.FillMode == 0">
<div class="colorBigTemplateDiv">
<span>颜色</span>
<div class="colorTemplateDiv" [style]="{'background-color':selectedcolor}">
</div>
</div>
<div class="colorDiv" *ngIf="isEditPattern && pattern && firstMultipleAssetData.assetData.GameMode == 0">
<ul>
<li (click)="multipleAssetSelectcolor(item,key)" class="colorLi" *ngFor="let item of colors,let key=index" [style]="{'background-color':item}"></li>
</ul>
</div>
<span style="color: #9c9fa5;font-size: 14px;">透明度</span>
<mat-slider color="primary" min="0" max="100%" step="1" style="left: 1px; width: 55%;min-width: 90px;"
[(ngModel)]="colorDivSliderValue" (change)="multipleColorDivSliderChange()" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)"></mat-slider>
<span style="color: #9c9fa5;font-size: 12px;">{{colorDivSliderValue}}%</span>
</div>
<div *ngFor="let item of multipleAsset.PropertyInfos;index as key ">
<!-- 单行文本 -->
<div *ngIf="item.PropertyType == 0">
<p>{{item.PropertyName}}<span style="font-size: 14px;" *ngIf="item.PhysicalUnit">({{item.PhysicalUnit}})</span></p>
<input type="text" class="biginput" [name]="item.PropertyName" [(ngModel)]="item.PropertyValue" (input)="multipleAssetInputChange(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
</div>
<!-- 多行文本 -->
<div *ngIf="item.PropertyType == 1">
<p>{{item.PropertyName}}<span style="font-size: 14px;" *ngIf="item.PhysicalUnit">({{item.PhysicalUnit}})</span></p>
<textarea class="textarea" name="" id="" [(ngModel)]="item.PropertyValue" (input)="multipleAssetInputChange(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)"></textarea>
</div>
<!-- 数值 -->
<div *ngIf="item.PropertyType == 2">
<p>{{item.PropertyName}}<span style="font-size: 14px;" *ngIf="item.PhysicalUnit">({{item.PhysicalUnit}})</span></p>
<input type="number" class="biginput" [(ngModel)]="item.PropertyValue" (input)="multipleAssetInputChange(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
</div>
<!-- 方向 -->
<!-- <div *ngIf="item.PropertyType == 5 " class="selectDiv">
<p style="display: inline-block;">{{item.PropertyName}}</p>
<select [(ngModel)]="item.PropertyValue" (change)="direction(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<option value ="0" [selected]="item.PropertyValue =='0'"></option>
<option value ="1" [selected]="item.PropertyValue =='1'">西</option>
<option value ="2" [selected]="item.PropertyValue =='2'"></option>
<option value ="3" [selected]="item.PropertyValue =='3'"></option>
<option value ="4" [selected]="item.PropertyValue =='4'">东南</option>
<option value ="5" [selected]="item.PropertyValue =='5'">西南</option>
<option value ="6" [selected]="item.PropertyValue =='6'">东北</option>
<option value ="7" [selected]="item.PropertyValue =='7'">西北</option>
</select>
</div> -->
<!-- 布尔值 是1或否0 -->
<div *ngIf="item.PropertyType == 6">
<p>{{item.PropertyName}}</p>
<input value='1' [(ngModel)]="item.PropertyValue" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)" class="input" type="radio" name="radio" (click)="multipleAssetRadioChange(item,'1')"><span></span>
<input value='0' [(ngModel)]="item.PropertyValue" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)" class="input" type="radio" name="radio" (click)="multipleAssetRadioChange(item,'0')"><span></span>
</div>
<!-- 供给区域 -->
<div *ngIf="item.PropertyType == 7" class="selectDiv">
<p style="display: inline-block;">{{item.PropertyName}}</p>
<select [(ngModel)]="item.PropertyValue" (change)="multipleSupplyArea(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<option value ="0">全部</option>
<option value ="1">高区</option>
<option value ="2">中区</option>
<option value ="3">低区</option>
<option value ="4">高中区</option>
<option value ="5">高低区</option>
<option value ="6">中低区</option>
</select>
</div>
<!-- 供给类型 -->
<div *ngIf="item.PropertyType == 8" class="selectDiv">
<p style="display: inline-block;">{{item.PropertyName}}</p>
<select [(ngModel)]="item.PropertyValue" (change)="multipleSupplyArea(item,$event)" [disabled]="!isEditPattern || (firstMultipleAssetData.assetData.GameMode == 0 && !pattern)">
<option value ="0">消火栓</option>
<option value ="1">喷淋</option>
<option value ="2">水幕</option>
<option value ="3">泡沫</option>
<option value ="4">消防</option>
</select>
</div>
</div>
</div>
</div> </div>
<!-- 消防要素 --> <!-- 消防要素 -->
<div id="firecategories" class="firecategories" style="height: 50%;background-color: white;"> <div id="firecategories" class="firecategories" style="height: 50%;background-color: white;">

212
src/app/ui/collection-tools/collection-tools.component.ts

@ -16,7 +16,7 @@ import { GameMode } from 'src/app/working-area/model/gameMode';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { MaskLayerService } from 'src/app/mask-layer.service'; import { MaskLayerService } from 'src/app/mask-layer.service';
import * as ObjectID from 'bson-objectid'; import * as ObjectID from 'bson-objectid';
import { AxMessageSystem } from 'src/app/working-area/model/axMessageSystem';
@Component({ @Component({
selector: 'app-collection-tools', selector: 'app-collection-tools',
templateUrl: './collection-tools.component.html', templateUrl: './collection-tools.component.html',
@ -82,9 +82,11 @@ export class CollectionToolsComponent implements OnInit {
setTimeout(() => { setTimeout(() => {
obj.PropertyInfos.forEach(item => { obj.PropertyInfos.forEach(item => {
if(item.PropertyType == 4){ if(item.PropertyType == 4){
this.gallery = new Viewer(document.getElementById('viewerjs'),{ if(document.getElementById('viewerjs')){
url: 'data-original' this.gallery = new Viewer(document.getElementById('viewerjs'),{
}); url: 'data-original'
});
}
} }
}) })
}, 0); }, 0);
@ -619,28 +621,74 @@ export class CollectionToolsComponent implements OnInit {
this.canvasData.isChange = true this.canvasData.isChange = true
} }
isMultipleAsset:boolean = false//框选多个素材属性显隐
multipleAsset:any = {
Width:null,
Height:null,
Angle:null,
Thickness:null,
Color:null,
PropertyInfos:[]
}//多个素材共同属性
multipleAssetData:any//当前多选的素材
firstMultipleAssetData:any//当前多选的第一个素材
ngOnInit(): void {
isSixShow = true let _this = this
isSixbtn = true //控制想定作业编辑按钮 AxMessageSystem.addListener('selectionChanged', ()=>{
isxxx = true //控制查看编辑模式的编辑模式按钮 if(this.canvas.selection.size() == 1){//如果是单选
this.isMultipleAsset = false
// console.log('单选',this.canvas.selection.first().assetData)
this.setAssetsProperty(this.canvas.selection.first().assetData)
}else if(this.canvas.selection.size()){
// console.log('多选')
this.isShowProperty = true
this.multipleAssetData = this.canvas.selection.all()
this.firstMultipleAssetData = this.canvas.selection.first()
this.multipleAsset = {
Width:null,
Height:null,
Angle:null,
Thickness:null,
Color:null,
PropertyInfos:[]
}
this.isMultipleAsset = true
let firstAssetData = this.canvas.selection.first().assetData;//拿出第一个素材作为例子与其他素材进行对比
let InteractiveMode = firstAssetData.InteractiveMode //素材连接方式
let isInteractiveMode = this.canvas.selection.all().every(item => item.assetData.InteractiveMode === InteractiveMode)
if(isInteractiveMode){
this.multipleAsset.InteractiveMode = InteractiveMode
}
let isFillMode = this.canvas.selection.all().every(item => item.assetData.FillMode === 0) //素材填充方式都为0
if(isFillMode){
this.multipleAsset.FillMode = 0
}
this.canvas.selection.first().assetData.PropertyInfos.forEach(i => {
let index = 0
this.canvas.selection.all().forEach(item => {
item.assetData.PropertyInfos.forEach(element => {
if(element.PropertyName == i.PropertyName && element.PropertyType == i.PropertyType && element.PropertyType != 3 && element.PropertyType != 4){
index++
if(index == this.canvas.selection.size()){
let newElement = JSON.parse(JSON.stringify(element))
newElement.PropertyValue = ''
this.multipleAsset.PropertyInfos.push(newElement)
}
}
});
})
})
}else if(this.canvas.selection.size() == 0){
this.isShowProperty = false
}
}, this)
ngOnInit(): void {
this.canvasData.gameMode = GameMode.Assignment this.canvasData.gameMode = GameMode.Assignment
if(this.router.url.indexOf("keyUnit/viewunitinfoplan") == -1 && this.router.url.indexOf("keyUnit/viewunitinfo") != -1 || this.router.url.indexOf("keyUnit/editplaninfo")!= -1){ if (sessionStorage.getItem('editable') == "0") { //查看模式
this.isSixbtn = false
}
if(!this.isSixbtn && sessionStorage.getItem("six") == "edit"){
this.isSixShow = true
}
if(!this.isSixbtn && sessionStorage.getItem("six") == "look"){
this.isEditPattern = false this.isEditPattern = false
this.isxxx = false } else {
}
if (sessionStorage.getItem('editable') == "0") {
this.isEditPattern = false
this.isxxx = false
} }
this.getAllLibrary('plan') //获取素材库 this.getAllLibrary('plan') //获取素材库
@ -655,28 +703,115 @@ export class CollectionToolsComponent implements OnInit {
event.preventDefault(); event.preventDefault();
}; };
}) })
this.canvasData.getMessage().subscribe((message: any)=>{ this.canvasData.getMessage().subscribe((message: any)=>{
if(message == "send a message"){ if(message == "send a message"){
this.refurbishTreeData() this.refurbishTreeData()
} }
}) })
}
}
//多选宽度共同改变
multipleAssetWidthInput(){
this.multipleAssetData.forEach(item=>{
item.assetData.Width = this.multipleAsset.Width
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选高度共同改变
multipleAssetHeightInput(){
this.multipleAssetData.forEach(item=>{
item.assetData.Height = this.multipleAsset.Height
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选角度共同改变
multipleAssetAngleInput(){
this.multipleAssetData.forEach(item=>{
item.assetData.Angle = this.multipleAsset.Angle
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选厚度共同改变
multipleAssetThicknessInput(){
this.multipleAssetData.forEach(item=>{
item.assetData.Thickness = this.multipleAsset.Thickness
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选颜色共同改变
multipleSelectedcolor:any
multipleAssetSelectcolor(item,key){
//在当前透明度基础上改变颜色
this.multipleSelectedcolor = item
this.multipleAssetData.forEach(item=>{
item.assetData.Color = this.multipleSelectedcolor
this.canvasData.isChange = true
this.canvas.refreshIcon(item.assetData.Id)
})
}
//多选颜色滑竿改变
multipleColorDivSliderChange(){
let colorOpacity = Math.round(255 * this.colorDivSliderValue * 0.01)
//根据滑竿值改变16进制颜色后两位
function replacepos(text,start,stop,replacetext){
let mystr = text.substring(0,stop-1)+replacetext+text.substring(stop+1);
return mystr;
}
this.multipleAssetData.forEach(item=>{
this.multipleSelectedcolor = replacepos(this.multipleSelectedcolor,7,8,colorOpacity.toString(16))
item.assetData.Color = this.multipleSelectedcolor
this.canvasData.isChange = true
this.canvas.refreshIcon(item.assetData.Id)
})
}
//多选状态动态属性素材input框值改变
multipleAssetInputChange(i,e){
e.stopPropagation()
this.multipleAssetData.forEach(item=>{
item.assetData.PropertyInfos.forEach(element => {
if(element.PropertyName == i.PropertyName){
element.PropertyValue = i.PropertyValue
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
}
})
})
}
//多选状态动态属性素材radio框值改变
multipleAssetRadioChange(i,value){
// e.stopPropagation()
this.multipleAssetData.forEach(item=>{
item.assetData.PropertyInfos.forEach(element => {
if(element.PropertyName == i.PropertyName){
element.PropertyValue = value
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
}
})
})
}
//多选状态动态属性素材下拉框值改变
multipleSupplyArea(i,e){
e.stopPropagation()
this.multipleAssetData.forEach(item=>{
item.assetData.PropertyInfos.forEach(element => {
if(element.PropertyName == i.PropertyName){
element.PropertyValue = i.PropertyValue
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
}
})
})
}
ngAfterViewInit(): void { ngAfterViewInit(): void {
this.getSitePlan() this.getSitePlan()
// 监听canvas组件选中素材事件
this.canvas.on("select",obj=>{
//选中素材属性注入函数
this.setAssetsProperty(obj.assetData)
})
// 监听canvas组件取消选中素材事件
this.canvas.on("deselect",obj=>{
this.isShowProperty = false
})
//监听数据变化后 //监听数据变化后
this.canvas.on('canvasDataChanged',()=>{ this.canvas.on('canvasDataChanged',()=>{
// 收到数据表示共享数据发生变化 // 收到数据表示共享数据发生变化
@ -687,7 +822,14 @@ export class CollectionToolsComponent implements OnInit {
copyAssetData:any //存储用于复制的素材 copyAssetData:any //存储用于复制的素材
//复制素材 //复制素材
copyAsset(){ copyAsset(){
this.canvas.copy() if(this.canvas.selection.allowEdit()){//如果当前选中素材可以编辑
this.canvas.copy()
}else{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('当前选中素材不可复制','确定',config);
}
} }
//粘贴素材 //粘贴素材
pasteAsset(){ pasteAsset(){
@ -2280,7 +2422,7 @@ export class CollectionToolsComponent implements OnInit {
if(selectPanelPoint.Data){ if(selectPanelPoint.Data){
for(let key in selectPanelPoint.Data.Stock){ //筛选数据 没有匹配全部放入到 其他 数组 for(let key in selectPanelPoint.Data.Stock){ //筛选数据 没有匹配全部放入到 其他 数组
let noMatch = this.allFireElements.find( every=> every.id===selectPanelPoint.Data.Stock[key].FireElementId ) let noMatch = this.allFireElements.find( every=> every.id===selectPanelPoint.Data.Stock[key].FireElementId )
if (!noMatch) { if (!noMatch && selectPanelPoint.Data.Stock[key].Id != "图例") {
this.allFireElements[this.allFireElements.length-1].children.push(selectPanelPoint.Data.Stock[key]) this.allFireElements[this.allFireElements.length-1].children.push(selectPanelPoint.Data.Stock[key])
} }
} }

112
src/app/working-area/model/axGrid.ts

@ -8,58 +8,38 @@ const DEFAULT_LINE_STYLE = {
native: true, native: true,
}; };
/**
* @description
* @extends PIXI.Graphics
*/
export class AxGrid extends PIXI.Graphics { export class AxGrid extends PIXI.Graphics {
private _cellSize: number; private _cellSize: number;
private _correctedWidth: number; private _correctedWidth: number;
private _gridWidth: number; private _gridWidth: number;
private _useCorrectedWidth: boolean; private _useCorrectedWidth: boolean;
private _drawBoundaries: any; private _drawBoundaries: any;
private _amtLines: any; private _amtLines: any;
/**
* @param {number} cellSize 默认值:网格边长的平方根
*/
set cellSize(cellSize) { set cellSize(cellSize) {
this._cellSize = cellSize || Math.sqrt(this._correctedWidth); this._cellSize = cellSize || Math.sqrt(this._correctedWidth);
} }
get cellSize() { get cellSize() {
return this._cellSize; return this._cellSize;
} }
/**
* 线
*/
get amtLines() { get amtLines() {
return Math.floor(this.gridWidth / this.cellSize); return Math.floor(this.gridWidth / this.cellSize);
} }
/**
* ' width '
*/
get originalWidth() { get originalWidth() {
return this._gridWidth; return this._gridWidth;
} }
/** /**
* *
*
*/ */
get correctedWidth() { get correctedWidth() {
return this._correctedWidth; return this._correctedWidth;
} }
get useCorrectedWidth() { get useCorrectedWidth() {
return this._useCorrectedWidth; return this._useCorrectedWidth;
} }
/** /**
* *
* @returns {{ x1: number, y1: number, x2: number, y2: number}}
* (**x1**)(**y1**)(**x2**)(**y2**)
*/ */
get bounds() { get bounds() {
return { return {
@ -78,50 +58,11 @@ export class AxGrid extends PIXI.Graphics {
return this._drawBoundaries; return this._drawBoundaries;
} }
/**
*
* ' cellSize '
* ' width '
*/
get gridWidth() { get gridWidth() {
if (!this.useCorrectedWidth) { return this._gridWidth; } if (!this.useCorrectedWidth) { return this._gridWidth; }
return Math.abs(this.cellSize - Math.sqrt(this._correctedWidth)) <= 1e-6 ? this._correctedWidth : this._gridWidth; return Math.abs(this.cellSize - Math.sqrt(this._correctedWidth)) <= 1e-6 ? this._correctedWidth : this._gridWidth;
} }
/**
*
* @param {number} width number. Required.
*
* The target sidelength of the grid. It is best for `width` to be a perfect square (i.e., 2, 4, 9, 16, 25, etc.). If
* not and the parameter `useCorrectedWidth` is set to **false**, then the grid will use a corrected width,
* which is the smallest perfect square greater than `width`.
*
* @param {number} cellSize number, null. Optional, default: square root of corrected width
*
* The size of each cell in the grid.
* If the value is **null**, the grid will use the default value.
*
* @param {{ width: number, color: number, alpha: number, alignment: number, native: boolean }}. Object. Optional.
*
* default:
* **{
* width: 1,
* color: 0xffffff,
* alpha: 1,
* alignment: 0.5,
* native: true
* }**
*
* Configuration for the line style on the object. See documentation on `PIXI.Graphics` for more on the `LineStyle` class.
*
* @param {boolean} useCorrectedWidth boolean. Optional. default: **true**
* If **true**, the grid will use the smallest perfect square greater than `width`.
* Otherwise, the grid will use the exact value given by `width`.
*
* @param {boolean} drawBoundaries boolean. Optional. default: **true**
* If **true**, the grid will draw its boundaries.
* Otherwise, the grid will not draw its boundaries. Mouse pointer detection is not affected.
*/
constructor( constructor(
width, width,
cellSize= null, cellSize= null,
@ -151,12 +92,9 @@ export class AxGrid extends PIXI.Graphics {
lConfig.alignment, lConfig.alignment,
lConfig.native lConfig.native
); );
// handle mouse move
this.interactive = true; this.interactive = true;
this.on('mousemove', (evt) => { this.on('mousemove', (evt) => {
const mouseCoords = evt.data.getLocalPosition(evt.currentTarget.parent); const mouseCoords = evt.data.getLocalPosition(evt.currentTarget.parent);
// 检查鼠标是否在此网格的范围内。如果不是,那就什么都不做。
if ( if (
mouseCoords.x >= this.bounds.x1 && mouseCoords.x >= this.bounds.x1 &&
mouseCoords.x <= this.bounds.x2 && mouseCoords.x <= this.bounds.x2 &&
@ -192,11 +130,6 @@ export class AxGrid extends PIXI.Graphics {
/** /**
* *
*
* @param {boolean} retainLineStyle true
*
* **true**线
* ' PIXI '
*/ */
clearGrid(retainLineStyle = true) { clearGrid(retainLineStyle = true) {
const { width, alignment, color, alpha, native } = this.line; const { width, alignment, color, alpha, native } = this.line;
@ -207,14 +140,10 @@ export class AxGrid extends PIXI.Graphics {
return this; return this;
} }
/** /**
* Transforms global coordinates to grid coordinates. *
* @param {number} x * @param x x
* The global X coordinate. * @param y y
*
* @param {number} y
* The global Y coordinate.
*/ */
getCellCoordinates(x, y) { getCellCoordinates(x, y) {
return { return {
@ -222,22 +151,15 @@ export class AxGrid extends PIXI.Graphics {
y: Math.floor((y - this.bounds.y1) / this.cellSize), y: Math.floor((y - this.bounds.y1) / this.cellSize),
}; };
} }
/** /**
* mousemove事件后触发的回调 *
* * @param evt
* @param {PIXI.InteractionData} evt * @param gridCoords
* 'PIXI.InteractionData '
*
* @param {{x: number, y: number}} gridCoords
*
*/ */
onMousemove(evt, gridCoords) { onMousemove(evt, gridCoords) {
} }
// 默认宽度
// 计算修正后的宽度。如果`useCorrectedWidth`构造函数参数设置为**false**,
// 然后,它简单地保持“width”的给定值作为修正后的宽度。
_correctWidth() { _correctWidth() {
if (!this._useCorrectedWidth) { if (!this._useCorrectedWidth) {
this._correctedWidth = this._gridWidth; this._correctedWidth = this._gridWidth;
@ -245,9 +167,7 @@ export class AxGrid extends PIXI.Graphics {
this._correctedWidth = Math.ceil(Math.sqrt(this._gridWidth)) ** 2; this._correctedWidth = Math.ceil(Math.sqrt(this._gridWidth)) ** 2;
} }
// 自定义宽度
// 计算修正后的宽度。如果`useCorrectedWidth`构造函数参数设置为**false**,
// 然后,它简单地保持“width”的给定值作为修正后的宽度。
correctWidth(width: number) { correctWidth(width: number) {
if (!this._useCorrectedWidth) { if (!this._useCorrectedWidth) {
this._correctedWidth = width; this._correctedWidth = width;

13
src/app/working-area/model/axSelection.ts

@ -1,3 +1,5 @@
import { allowedNodeEnvironmentFlags } from "process";
/** /**
* *
*/ */
@ -17,6 +19,17 @@ export class AxSelection {
public has(obj: any): boolean { public has(obj: any): boolean {
return this.objects.has(obj); return this.objects.has(obj);
} }
// 是否所有选择对象都允许编辑
public allowEdit(): boolean {
let allowEdit = true;
for (const item of this.objects) {
if (!item.allowEdit) {
allowEdit = false;
break;
}
}
return allowEdit;
}
// 获得所有对象 // 获得所有对象
public all() { public all() {
return [...this.objects]; return [...this.objects];

10
src/app/working-area/model/axShape.ts

@ -10,10 +10,8 @@ export class AxShape extends Graphics {
assetData: any; assetData: any;
pointTexture: PIXI.Texture = PIXI.Texture.from('assets/images/handle-main.png'); pointTexture: PIXI.Texture = PIXI.Texture.from('assets/images/handle-main.png');
workingArea: WorkingAreaComponent; workingArea: WorkingAreaComponent;
// 可以被移动的 // 允许选择
moveable = true; allowSelect = true;
// 可以被选中的
selectable = true;
// 允许编辑 // 允许编辑
allowEdit = true; allowEdit = true;
// 是否显示名称 // 是否显示名称
@ -38,10 +36,10 @@ export class AxShape extends Graphics {
this this
.on('pointerdown', event => { .on('pointerdown', event => {
event.stopPropagation(); event.stopPropagation();
if (this.selectable) { if (this.allowSelect) {
this.workingArea.select(this); this.workingArea.select(this);
} }
if (this.moveable) { if (this.allowEdit) {
this.mouseDragging = true; this.mouseDragging = true;
this.mousePosition = new PIXI.Point(event.data.global.x, event.data.global.y); this.mousePosition = new PIXI.Point(event.data.global.x, event.data.global.y);
} }

21
src/app/working-area/working-area.component.ts

@ -453,7 +453,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
*/ */
public refreshIcon(id: string): void { public refreshIcon(id: string): void {
const icon = this.backgroundImage.children.find(item => item.name === id); const icon = this.backgroundImage.children.find(item => item.name === id);
console.log(icon); // console.log(icon);
if (icon instanceof AxImageShape) { if (icon instanceof AxImageShape) {
icon.refresh(); icon.refresh();
} else if (icon instanceof MultipointIcon) { } else if (icon instanceof MultipointIcon) {
@ -490,21 +490,26 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
switch (floorData[key].InteractiveMode) { switch (floorData[key].InteractiveMode) {
case 0: case 0:
const singleIcon = new AxImageShape(floorData[key], this); const singleIcon = new AxImageShape(floorData[key], this);
singleIcon.moveable = this.allowEdit && this.canvasData.gameMode === singleIcon.assetData.GameMode; singleIcon.allowEdit = this.allowEdit && this.canvasData.gameMode === singleIcon.assetData.GameMode;
break; break;
case 1: case 1:
const icon = new MultipointIcon(floorData[key], this); const icon = new MultipointIcon(floorData[key], this);
icon.allowEdit = this.allowEdit && this.canvasData.gameMode === icon.assetData.GameMode;
break; break;
case 2: case 2:
const polygonIcon = new PolygonIcon(floorData[key], this); const polygonIcon = new PolygonIcon(floorData[key], this);
polygonIcon.allowEdit = this.allowEdit && this.canvasData.gameMode === polygonIcon.assetData.GameMode;
break; break;
case 3: case 3:
if (floorData[key].Name === '水带') { if (floorData[key].Name === '水带') {
const distance = new AxArrowConnector(floorData[key], this, false, true); const waterLine = new AxArrowConnector(floorData[key], this, false, true);
waterLine.allowEdit = this.allowEdit && this.canvasData.gameMode === waterLine.assetData.GameMode;
} else if (floorData[key].Name === '距离') { } else if (floorData[key].Name === '距离') {
const distance = new AxArrowConnector(floorData[key], this, true, true); const distance = new AxArrowConnector(floorData[key], this, true, true);
distance.allowEdit = this.allowEdit && this.canvasData.gameMode === distance.assetData.GameMode;
} else if (floorData[key].Name === '普通墙' || floorData[key].Name === '承重墙') { } else if (floorData[key].Name === '普通墙' || floorData[key].Name === '承重墙') {
const wall = new AxArrowConnector(floorData[key], this, false, false); const wall = new AxArrowConnector(floorData[key], this, false, false);
wall.allowEdit = this.allowEdit && this.canvasData.gameMode === wall.assetData.GameMode;
} }
break; break;
} }
@ -522,22 +527,24 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
switch (nodeData[key][tempKey].InteractiveMode) { switch (nodeData[key][tempKey].InteractiveMode) {
case 0: case 0:
const singleIcon = new AxImageShape(nodeData[key][tempKey], this); const singleIcon = new AxImageShape(nodeData[key][tempKey], this);
singleIcon.moveable = this.allowEdit && this.canvasData.gameMode === singleIcon.assetData.GameMode; singleIcon.allowEdit = this.allowEdit && this.canvasData.gameMode === singleIcon.assetData.GameMode;
break; break;
case 1: case 1:
const icon = new MultipointIcon(nodeData[key][tempKey], this); const icon = new MultipointIcon(nodeData[key][tempKey], this);
break; icon.allowEdit = this.allowEdit && this.canvasData.gameMode === icon.assetData.GameMode;
break;
case 2: case 2:
const polygonIcon = new PolygonIcon(nodeData[key][tempKey], this); const polygonIcon = new PolygonIcon(nodeData[key][tempKey], this);
polygonIcon.allowEdit = this.allowEdit && this.canvasData.gameMode === polygonIcon.assetData.GameMode;
break; break;
case 3: case 3:
const pipeline = new AxArrowConnector(nodeData[key][tempKey], this, false, true); const pipeline = new AxArrowConnector(nodeData[key][tempKey], this, false, true);
pipeline.allowEdit = this.allowEdit && this.canvasData.gameMode === pipeline.assetData.GameMode;
break; break;
} }
}); });
}); });
} }
// this.emit('backgroundScale', this.backgroundImage.scale.x);
} }
/** /**
* *

BIN
src/assets/font/SourceHanSansCN-Regular.otf

Binary file not shown.

9
src/styles.scss

@ -1,12 +1,19 @@
@import './app/theme.scss'; @import './app/theme.scss';
@import "./app/ngZorroTree.css"; /* 引入组件样式 */ @import "./app/ngZorroTree.css"; /* 引入组件样式 */
@font-face
{
font-family: Regular;
src: url('./assets/font/SourceHanSansCN-Regular.otf'),
}
html,body{ html,body{
width: 100%; width: 100%;
height:100%; height:100%;
margin:0 auto; margin:0 auto;
padding:0; padding:0;
overflow: hidden; overflow: hidden;
font-family: Regular
} }
ul,ol,dl,li,dt,dd,p,form,input,h1,h2,h3,h4,h5,h6,section,article,aside,header,footer,nav,figure,time,mark,main,canvas{ ul,ol,dl,li,dt,dd,p,form,input,h1,h2,h3,h4,h5,h6,section,article,aside,header,footer,nav,figure,time,mark,main,canvas{
margin:0; margin:0;
@ -112,7 +119,7 @@ table td.mat-footer-cell:last-of-type{
border-radius: 4px; border-radius: 4px;
margin: 0 5px; margin: 0 5px;
font-size: 14px; font-size: 14px;
font-family: Source Han Sans CN; // font-family: Source Han Sans CN;
font-weight: 400; font-weight: 400;
line-height: 36px; line-height: 36px;
color: #0080FF; color: #0080FF;

Loading…
Cancel
Save