chenjingyu 4 years ago
parent
commit
b876bbc962
  1. 2
      proxy.config.json
  2. 19
      src/app/canvas-share-data.service.ts
  3. 59
      src/app/gis-management/gis-labeling/gis-labeling.component.ts
  4. 10
      src/app/key-unit/basicinfo-look/basicinfo.component.ts
  5. 9
      src/app/key-unit/basicinfo/basicinfo.component.html
  6. 25
      src/app/key-unit/basicinfo/basicinfo.component.scss
  7. 85
      src/app/key-unit/basicinfo/basicinfo.component.ts
  8. 4
      src/app/key-unit/key-unit-management/key-unit-management.component.html
  9. 2
      src/app/navigation/navigation.component.html
  10. 4
      src/app/navigation/navigation.component.scss
  11. 2
      src/app/pages/login/login.component.scss
  12. 3
      src/app/plan-audit/plan-pass/plan-pass.component.html
  13. 4
      src/app/tabbar/tabbar.component.ts
  14. 5
      src/app/ui/collection-tools-plan/collection-tools.component.html
  15. 2
      src/app/ui/collection-tools-plan/collection-tools.component.scss
  16. 574
      src/app/ui/collection-tools-plan/collection-tools.component.ts
  17. 5
      src/app/ui/collection-tools/collection-tools.component.html
  18. 2
      src/app/ui/collection-tools/collection-tools.component.scss
  19. 539
      src/app/ui/collection-tools/collection-tools.component.ts
  20. 106
      src/app/ui/unittype/unittype.component.html
  21. 62
      src/app/working-area/model/PropertyInfo.ts
  22. 405
      src/app/working-area/model/axArrowConnector.ts
  23. 443
      src/app/working-area/model/axImageShape.ts
  24. 27
      src/app/working-area/model/axPreviewImageShape.ts
  25. 80
      src/app/working-area/model/axShape.ts
  26. 68
      src/app/working-area/model/legend.ts
  27. 109
      src/app/working-area/model/multipointIcon.ts
  28. 25
      src/app/working-area/model/paintModel.ts
  29. 57
      src/app/working-area/model/pipeline.ts
  30. 124
      src/app/working-area/model/polygonIcon.ts
  31. 108
      src/app/working-area/model/putCarArea.ts
  32. 249
      src/app/working-area/model/singlePointIcon.ts
  33. 734
      src/app/working-area/working-area.component.ts
  34. BIN
      src/assets/images/h130.png

2
proxy.config.json

@ -1,6 +1,6 @@
{
"/api": {
"target": "http://121.37.20.190:8000",
"target": "http://39.106.78.171:8000",
"secure": false,
"changeOrigin": true
}

19
src/app/canvas-share-data.service.ts

@ -82,6 +82,23 @@ export class CanvasShareDataService {
return returnData;
}
}
/**
*
*/
public updateBuildingData() {
Object.keys(this.originaleveryStoreyData.data).forEach((key) => {
this.originalcompanyBuildingData.data[key] = this.originaleveryStoreyData.data[key];
});
}
/**
*
*/
public deleteBuildingDataByCurrentFloorData():void {
Object.keys(this.originaleveryStoreyData.data).forEach((key) => {
// 删除建筑数据
delete this.originalcompanyBuildingData.data[key];
});
}
/**
*
*/
@ -666,7 +683,7 @@ export class AssetData {
/// <summary>
/// 是否来自建筑
/// </summary>
public IsFromBuilding: boolean;
public IsFromBuilding: boolean;
/// <summary>
/// 渲染方式。
/// </summary>

59
src/app/gis-management/gis-labeling/gis-labeling.component.ts

@ -166,7 +166,7 @@ export class GisLabelingComponent implements OnInit {
config.duration = 3000
this.snackBar.open('请切换2D模式使用此功能','确定',config);
}else{
console.log('提交',this.selectedUnit)
// console.log('提交',this.selectedUnit)
this.circle.setRadius(Number(this.unitAreaDefault))
this.circle.setCenter(this.markers[0]._position)
this.circle.setMap(this.map)
@ -185,7 +185,7 @@ export class GisLabelingComponent implements OnInit {
Distance : Distance,
BuildingTypeIdList : this.selectedUnitList.length != 0 ? this.selectedUnitList : ['123']
}
console.log(666,paramsdata)
// console.log(666,paramsdata)
this.http.get("/api/Companies",{params:paramsdata}).subscribe((data:any) => {
data.items.forEach((i,index) => {
if(i.id == this.selectedUnit.id){
@ -280,7 +280,7 @@ export class GisLabelingComponent implements OnInit {
text: text,
});
labelMarker.on('click', (e)=>{
console.log(item)
// console.log(item)
let markerContent =
`<div style="font-size: 14px" id="gispopupbox">
<div style="color: #0080FF;"><span style="margin-left:8px">${item.name}</span><label style="font-size: 12px; color: #999; margin-left: 10px">${item.address}</label> </div>
@ -448,7 +448,7 @@ export class GisLabelingComponent implements OnInit {
this.keyUnitForm.controls.areaUnit.setValue('0')
this.map.remove(this.circle)
this.clearUnitMarker()//取消显示单位markers
console.log('取消')
// console.log('取消')
}
//取消显示水源
@ -458,7 +458,7 @@ export class GisLabelingComponent implements OnInit {
this.watertForm.reset()
this.watertForm.controls.areaWater.setValue('0')
this.map.remove(this.circleofwater)
console.log('取消')
// console.log('取消')
}
//右上角点击每一个title
@ -553,6 +553,7 @@ export class GisLabelingComponent implements OnInit {
layers:[layer], //当只想显示标准图层时layers属性可缺省,
});
that.map.setCity('上海市');
AMap.plugin(["AMap.RangingTool", "AMap.MouseTool"],function () {
that.mouseTool=new AMap.MouseTool(that.map);
/* that.measureDistance = new AMap.RangingTool(that.map, rulerOptions); //
@ -792,6 +793,9 @@ export class GisLabelingComponent implements OnInit {
this.leftDivState = false
this.showLeftDiv = false
this.isShowRouteGIS = true
// console.log(1,e)
this.routeEnd = e.name
this.endCoordinate = new AMap.LngLat(e.location.x, e.location.y)
}
//全景漫游
@ -864,9 +868,19 @@ export class GisLabelingComponent implements OnInit {
var autoComplete = new AMap.Autocomplete(autoOptions);
autoComplete.search(keywords, function(status, result) {
if (result && result.tips && result.tips.length) { //搜索到数据时
that._ngZone.run(()=>{ e == 0 ? that.routeStartList = result.tips : that.routeEndList = result.tips });
that._ngZone.run(()=>{
if(e == 0){
that.routeStartList = result.tips
that.startCoordinate = new AMap.LngLat(result.tips[0].location.lng, result.tips[0].location.lat)
// console.log(666,result)
}else{
that.routeEndList = result.tips
that.endCoordinate = new AMap.LngLat(result.tips[0].location.lng, result.tips[0].location.lat)
}
});
}
})
})
@ -880,9 +894,11 @@ export class GisLabelingComponent implements OnInit {
if (e==0) {
this.routeStart = null
this.routeStartList = []
this.startCoordinate = null
} else {
this.routeEnd = null
this.routeEndList = []
this.endCoordinate = null
}
}
@ -892,9 +908,11 @@ export class GisLabelingComponent implements OnInit {
this.routeStartList = []
this.routeEnd = null
this.routeEndList = []
this.startCoordinate = null
this.endCoordinate = null
this.routeGIS? this.routeGIS.clear() : null
this.routes = { distance: 0, time: 0, steps: [], }
console.log(this.selectedUnit)
// console.log(this.selectedUnit)
this.map.setZoomAndCenter(13,[this.selectedUnit.location.x,this.selectedUnit.location.y]); //设置地图中心点
}
@ -905,9 +923,16 @@ export class GisLabelingComponent implements OnInit {
this.routeEnd = data
this.routeStartList = []
this.routeEndList = []
let data2 = this.startCoordinate
this.startCoordinate = this.endCoordinate
this.endCoordinate = data2
}
routes:any = { distance: 0, time: 0, steps: [], };//导航查询结果 路线规划
startCoordinate:any//开始坐标
endCoordinate:any//结束坐标
//导航查询
queryGISRoute () {
//构造路线导航类
@ -917,8 +942,10 @@ export class GisLabelingComponent implements OnInit {
this.routeGIS = new AMap.Driving({
map: this.map,
});
// console.log(1,this.startCoordinate)
// console.log(2,this.endCoordinate)
// 根据起终点名称规划驾车导航路线
this.routeGIS.search([{keyword: this.routeStart},{keyword: this.routeEnd}],
this.routeGIS.search(this.startCoordinate,this.endCoordinate,
function(status, result) {
if (status === 'complete') {
that.routes = result.routes[0]
@ -938,7 +965,7 @@ export class GisLabelingComponent implements OnInit {
policy: e==true? AMap.DrivingPolicy.LEAST_TIME : AMap.DrivingPolicy.REAL_TRAFFIC
});
// 根据起终点名称规划驾车导航路线
this.routeGIS.search([{keyword: this.routeStart},{keyword: this.routeEnd}],
this.routeGIS.search(this.startCoordinate,this.endCoordinate,
function(status, result) {
if (status === 'complete') {
that.routes = result.routes[0]
@ -1051,7 +1078,7 @@ export class LookPlanDialog {
ngOnInit() {
console.log(this.data)
// console.log(this.data)
this.getAllPlans()
}
//关闭弹窗
@ -1073,7 +1100,7 @@ export class LookPlanDialog {
}
this.http.get("/api/PlanComponents",{params:paramsData}).subscribe((data:any)=>{
this.allPlanComponents = data.items
console.log(this.allPlanComponents)
// console.log(this.allPlanComponents)
})
}
//查看预案
@ -1117,7 +1144,7 @@ export class LookPlanDialog {
dialogRef.afterClosed().subscribe(
data=>{
if(data){
console.log(123,data)
// console.log(123,data)
this.downloadFileName = data.fileName
this.download = data
this.downloadFile()
@ -1217,7 +1244,7 @@ export class DownloadFile {
selectedFileData : any
ngOnInit(): void {
console.log(this.data)
// console.log(this.data)
this.name = this.data.name
this.fileUrls = this.data.attachmentUrls
this.fileUrls.forEach(item=>{
@ -1241,7 +1268,7 @@ export class DownloadFile {
//点击想要下载的文件
addurl(item,key){
console.log(item,key)
// console.log(item,key)
this.selectedFileIndex = key
this.selectedFileData = item
}

10
src/app/key-unit/basicinfo-look/basicinfo.component.ts

@ -383,7 +383,7 @@ export class BasicinfoLookComponent implements OnInit {
data[0].buildtype = n.name
data[0].tongyong = true
data[0].index = x.index
if(data[0].buildtype == "石油化工类"){
if(data[0].buildtype == "石油化工类" || data[0].buildtype.indexOf("化工") != -1 ){
data[0].tongyong = false
data[0].isshiyou = true
this.deviceinfodata = data[0].buildingBasicGroups[1].propertyInfos //存储装置信息的初始数据,需要转换成datasource形式
@ -545,7 +545,7 @@ export class BasicinfoLookComponent implements OnInit {
data[0].tongyong = true
data[0].index = index
if(data[0].buildtype == "石油化工"){
if(data[0].buildtype.indexOf("储罐") != -1 || data[0].buildtype.indexOf("化工") != -1 ){
data[0].tongyong = false
data[0].isshiyou = true
let noemptydeviceArr = data[0].buildingBasicGroups[1].propertyInfos
@ -804,7 +804,7 @@ export class BasicinfoLookComponent implements OnInit {
data[0].username = n.name
data[0].tongyong = true
data[0].index = this.houses.length //////////////////
if(data[0].buildtype == "石油化工"){
if(data[0].buildtype.indexOf("储罐") != -1 || data[0].buildtype.indexOf("化工") != -1 ){
data[0].tongyong = false
data[0].isshiyou = true //如果是石油化工则启用石油化工的模板
this.deviceinfodata = data[0].buildingBasicGroups[1].propertyInfos //存储装置信息表格的初始数据,需要转换成datasource形式
@ -1360,7 +1360,7 @@ export class BasicinfoLookComponent implements OnInit {
}
if(item.buildtype != "石油化工类" && item.buildtype != "地铁类"){
if(item.buildtype.indexOf("储罐") == -1 && item.buildtype != "地铁类" && item.buildtype.indexOf("化工") == -1 ){
// console.log(this.houses[key])
// console.log(value)
this.houses[key].buildingBasicGroups[0].propertyInfos.forEach(item => {
@ -1411,7 +1411,7 @@ export class BasicinfoLookComponent implements OnInit {
})
}
}
if(item.buildtype == "石油化工"){
if(item.buildtype.indexOf("储罐") != -1 || item.buildtype.indexOf("化工") != -1 ){
// console.log(888,item)
let bodyObj = _.cloneDeep(item)
delete bodyObj.name

9
src/app/key-unit/basicinfo/basicinfo.component.html

@ -144,6 +144,15 @@
<mat-icon style="width: 22px;height: 22px;font-size: 22px;">place</mat-icon> 位置
</div>
</div>
<div class="gistopbox hidden" [ngClass]="{'show': isGisTopBoxTwo}">
<div class="inputBox">
<span>位置: </span>
<input name="position" [(ngModel)]="searchTitle" id="tipinput" class="positionInput" type="text" autocomplete="off">
</div>
<div class="setPosition" (click)="search()">
搜索
</div>
</div>
</div>
</div>
</form>

25
src/app/key-unit/basicinfo/basicinfo.component.scss

@ -86,7 +86,6 @@
}
.gistopbox{
position: absolute;
box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
border-radius: 4px;
left: 5%;
@ -125,9 +124,31 @@
align-items: center;
justify-content: center;
}
.inputBox{
width: 63%;
display: flex;
align-items: center;
.positionInput{
border: 0;
border-radius: 6px;
width: 90%;
height: 34px;
background: #F2F2F2;
margin-left: 8px;
box-sizing: border-box;
padding-left: 10px;
}
}
}
.hidden{
opacity: 0;
z-index: -1;
}
.show{
opacity: 1;
z-index: 1;
}
}
}

85
src/app/key-unit/basicinfo/basicinfo.component.ts

@ -104,6 +104,7 @@ export class BasicinfoComponent implements OnInit {
markerPosition:any = {x: 0, y: 0}//单位坐标
map:any //地图实例
isGisTopBox:boolean = false//点击位置按钮
isGisTopBoxTwo:boolean = false//点击位置按钮
oldPositionMarker:any //旧位置marker实例
newPositionMarker:any //新位置marker实例
@ -121,13 +122,48 @@ export class BasicinfoComponent implements OnInit {
' <img src="/assets/images/oldposition.png">' +
'</div>'
//初始化地图
searchTitle:any//搜索内容
placeSearch:any//地址搜索类
search(){
this.placeSearch.search(this.searchTitle, (status, result) => {
// 搜索成功时,result即是对应的匹配数据
if(result.info == "OK"){
this.newPositionMarker.setPosition([result.poiList.pois[0].location.lng,result.poiList.pois[0].location.lat])
this.markerPosition2 = {x: result.poiList.pois[0].location.lng, y: result.poiList.pois[0].location.lat}
this.map.setCenter([result.poiList.pois[0].location.lng,result.poiList.pois[0].location.lat]); //设置地图中心点
}else{
alert('查询不到输入地址信息')
}
})
}
labelGis(){
this.map = new AMap.Map('container', {
zoom:12
})
this.map.on('complete', () => {
this.isGisTopBox = true
});
//输入提示
var autoOptions = {
input: "tipinput"
};
AMap.plugin(['AMap.PlaceSearch','AMap.AutoComplete'], ()=>{
var auto = new AMap.AutoComplete(autoOptions);
this.placeSearch = new AMap.PlaceSearch(); //构造地点查询类
auto.on("select", (e)=>{
console.log(e)
console.log( this.newPositionMarker)
this.newPositionMarker.setPosition([e.poi.location.lng,e.poi.location.lat])
this.markerPosition2 = {x: e.poi.location.lng, y: e.poi.location.lat}
this.map.setCenter([e.poi.location.lng,e.poi.location.lat]); //设置地图中心点
});//注册监听,当选中某条记录时会触发
});
if(this.isMapLabel){//如果已经标注单位坐标
console.log('已标注单位位置')
this.map.setCenter([this.unitinfo.location.x,this.unitinfo.location.y]);
@ -143,9 +179,15 @@ export class BasicinfoComponent implements OnInit {
this.map.setCity('上海市');
}
}
markerPosition2
//点击位置按钮
setPosition(){
this.isGisTopBox = false
this.isGisTopBoxTwo = true
if(this.isMapLabel){//如果已经标注单位坐标
console.log('已标注单位位置')
@ -165,36 +207,38 @@ export class BasicinfoComponent implements OnInit {
this.map.add(this.newPositionMarker);
let markerPosition
if(this.markerPosition.x && this.markerPosition.x != 0){
markerPosition = {x: this.markerPosition.x,y: this.markerPosition.y}
this.markerPosition2 = {x: this.markerPosition.x,y: this.markerPosition.y}
}else{
markerPosition = {x: this.map.getCenter().lng,y: this.map.getCenter().lat} //获取当前地图中心位置
this.markerPosition2 = {x: this.map.getCenter().lng,y: this.map.getCenter().lat} //获取当前地图中心位置
}
this.newPositionMarker.on('dragend', (e)=>{
markerPosition = {x: e.lnglat.lng, y: e.lnglat.lat}
this.markerPosition2 = {x: e.lnglat.lng, y: e.lnglat.lat}
})
//点击确定
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'click',(event)=>{
this.map.clearMap();
this.isGisTopBox = true
this.isGisTopBoxTwo = false
this.newPositionMarker = new AMap.Marker({
position: [markerPosition.x,markerPosition.y],
position: [this.markerPosition2.x,this.markerPosition2.y],
content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18)
});
this.markerPosition = markerPosition
this.markerPosition = this.markerPosition2
this.map.add(this.newPositionMarker);
})
//点击取消
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionClose'),'click',(event)=>{
this.isGisTopBox = true
this.isGisTopBoxTwo = false
this.map.clearMap();
this.newPositionMarker = new AMap.Marker({
position: [this.markerPosition.x,this.markerPosition.y],
content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18)
});
this.map.setCenter([this.markerPosition.x,this.markerPosition.y]); //设置地图中心点
this.map.add(this.newPositionMarker);
})
@ -219,19 +263,20 @@ export class BasicinfoComponent implements OnInit {
});
this.map.add(this.newPositionMarker);
let markerPosition
// let markerPosition
if(this.markerPosition.x && this.markerPosition.x != 0){
markerPosition = {x: this.markerPosition.x,y: this.markerPosition.y}
this.markerPosition2 = {x: this.markerPosition.x,y: this.markerPosition.y}
}else{
markerPosition = {x: this.map.getCenter().lng,y: this.map.getCenter().lat} //获取当前地图中心位置
this.markerPosition2 = {x: this.map.getCenter().lng,y: this.map.getCenter().lat} //获取当前地图中心位置
}
this.newPositionMarker.on('dragend', (e)=>{
markerPosition = {x: e.lnglat.lng, y: e.lnglat.lat}
this.markerPosition2 = {x: e.lnglat.lng, y: e.lnglat.lat}
})
//点击确定
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'click',(event)=>{
this.isGisTopBox = true
this.markerPosition = markerPosition
this.isGisTopBoxTwo = false
this.markerPosition = this.markerPosition2
this.map.clearMap();
this.newPositionMarker = new AMap.Marker({
position: [this.markerPosition.x,this.markerPosition.y],
@ -243,19 +288,19 @@ export class BasicinfoComponent implements OnInit {
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionClose'),'click',(event)=>{
this.map.clearMap();
this.isGisTopBox = true
this.isGisTopBoxTwo = false
if(this.markerPosition.x && this.markerPosition.x != 0){//说明之前标过点
this.newPositionMarker = new AMap.Marker({
position: [this.markerPosition.x,this.markerPosition.y],
content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18)
});
this.map.setCenter([this.markerPosition.x,this.markerPosition.y]); //设置地图中心点
this.map.add(this.newPositionMarker);
}
})//取消
}
}
//获得所有单位类型
@ -278,7 +323,9 @@ export class BasicinfoComponent implements OnInit {
}else{//未标注
_this.isMapLabel = false
}
this.labelGis()
})
}
)
@ -422,7 +469,7 @@ export class BasicinfoComponent implements OnInit {
data[0].buildtype = n.name
data[0].tongyong = true
data[0].index = x.index
if(data[0].buildtype == "石油化工类"){
if(data[0].buildtype.indexOf('化工') != -1 || data[0].buildtype.indexOf('储罐') != -1){
data[0].tongyong = false
data[0].isshiyou = true
this.deviceinfodata = data[0].buildingBasicGroups[1].propertyInfos //存储装置信息的初始数据,需要转换成datasource形式
@ -584,7 +631,7 @@ export class BasicinfoComponent implements OnInit {
data[0].tongyong = true
data[0].index = index
if(data[0].buildtype == "石油化工类"){
if(data[0].buildtype.indexOf('化工') != -1 || data[0].buildtype.indexOf('储罐') != -1){
data[0].tongyong = false
data[0].isshiyou = true
let noemptydeviceArr = data[0].buildingBasicGroups[1].propertyInfos
@ -843,7 +890,7 @@ export class BasicinfoComponent implements OnInit {
data[0].username = n.name
data[0].tongyong = true
data[0].index = this.houses.length //////////////////
if(data[0].buildtype == "石油化工类"){
if(data[0].buildtype.indexOf('化工') != -1 || data[0].buildtype.indexOf('储罐') != -1){
data[0].tongyong = false
data[0].isshiyou = true //如果是石油化工则启用石油化工的模板
this.deviceinfodata = data[0].buildingBasicGroups[1].propertyInfos //存储装置信息表格的初始数据,需要转换成datasource形式
@ -1172,7 +1219,7 @@ export class BasicinfoComponent implements OnInit {
if(invalid){
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
config.duration = 3000
this.snackBar.open('请填写必填项','确定',config);
}else{
sessionStorage.setItem('buildingTypeId',value.unittype)
@ -1423,7 +1470,7 @@ export class BasicinfoComponent implements OnInit {
}
if(item.buildtype != "石油化工类" && item.buildtype != "地铁类"){
if(item.buildtype.indexOf('化工') == -1 && item.buildtype != "地铁类" && item.buildtype.indexOf('储罐') == -1){
// console.log(this.houses[key])
// console.log(value)
this.houses[key].buildingBasicGroups[0].propertyInfos.forEach(item => {
@ -1475,7 +1522,7 @@ export class BasicinfoComponent implements OnInit {
})
}
}
if(item.buildtype == "石油化工类"){
if(item.buildtype.indexOf('化工') != -1 || item.buildtype.indexOf('储罐') != -1){
// console.log(888,item)
let bodyObj = _.cloneDeep(item)
delete bodyObj.name

4
src/app/key-unit/key-unit-management/key-unit-management.component.html

@ -15,7 +15,7 @@
<mat-form-field class="example-full-width">
<input (click)="stopclose($event)" readonly matInput placeholder="请选择消防救援站" autocomplete="off" [(ngModel)]="js" name="js" (focus)="openorganizationbox()">
</mat-form-field>
<mat-checkbox style="margin-left: 6px;" [(ngModel)]="jscheck" name="jscheck">包含下级</mat-checkbox>
<mat-checkbox color="primary" style="margin-left: 6px;" [(ngModel)]="jscheck" name="jscheck">包含下级</mat-checkbox>
<div class="organizationbox" *ngIf="isorganizationbox">
<div (click)="closediv()" class="closediv"><mat-icon>clear</mat-icon></div>
<mat-tree [dataSource]="dataSource" [treeControl]="treeControl">
@ -94,7 +94,7 @@
<th mat-header-cell *matHeaderCellDef>
</th>
<td mat-cell *matCellDef="let element">
<mat-checkbox (change)="checkChange($event,element)"></mat-checkbox>
<mat-checkbox color="primary" (change)="checkChange($event,element)"></mat-checkbox>
</td>
</ng-container>
<ng-container matColumnDef="Follow">

2
src/app/navigation/navigation.component.html

@ -2,7 +2,7 @@
<mat-sidenav-container class="example-container" autosize [class.myapp-dark-theme]="darktheme">
<mat-sidenav #drawer class="example-sidenav" mode="side" opened="true" color="primary" style="overflow-x: hidden;">
<div class="biglogobox">
<img src="../../assets/images/biglogo.png" alt="">
<img src="../../assets/images/h130.png" alt="">
</div>
<div class="navbox">
<mat-accordion multi>

4
src/app/navigation/navigation.component.scss

@ -58,7 +58,7 @@ mat-sidenav{
.navbox{
position: absolute;
left: 0px;
top: 153px;
top: 150px;
right: -18px;
bottom: 0px;
overflow-y: scroll;
@ -85,7 +85,7 @@ mat-sidenav{
.biglogobox{
width: 250px;
background-color: #42a5f5;
padding-top: 15px;
padding-top: 12px;
display: block;
text-align: center;
line-height:40px;

2
src/app/pages/login/login.component.scss

@ -12,7 +12,7 @@
-moz-background-size:100% 100%;
.text {
padding-top: 3%;
margin-left: 8%;
margin-left: 6%;
width: 53%;
}
}

3
src/app/plan-audit/plan-pass/plan-pass.component.html

@ -1,3 +1,4 @@
<mat-accordion>
<mat-expansion-panel disabled>
<mat-expansion-panel-header>
@ -28,7 +29,7 @@
</mat-expansion-panel>
</mat-accordion>
<div class="planBody" style="width: 100%;height: 90%;padding: 10px;box-sizing: border-box;overflow-y: auto;">
<div class="planBody" style="width: 100%;height: 100%;padding: 10px;box-sizing: border-box;overflow-y: auto;">
<div class="table" style="width: 100%;" *ngIf="planType==0">
<table mat-table [dataSource]="allFile">

4
src/app/tabbar/tabbar.component.ts

@ -77,7 +77,9 @@ export class TabbarComponent implements OnInit {
USCI : this.route.snapshot.queryParams.usci
}
this.http.get('/api/Companies',{params:params}).subscribe((data:any) => {
this.companyIntegrityScore = data.items[0].companyIntegrityScore
this.companyIntegrityScore ?
this.companyIntegrityScore = data.items[0].companyIntegrityScore :
null
// console.log(data)
})
}

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

@ -41,7 +41,7 @@
</div>
<span style="position: absolute;right: 60px;cursor: pointer;">
<mat-icon title="查看/编辑模式" (click)="lookpat()" *ngIf="isEditPattern">tv</mat-icon>
<mat-icon title="查看/编辑模式" (click)="editpat()" *ngIf="!isEditPattern && isxxx">create</mat-icon>
<mat-icon title="查看/编辑模式" (click)="editpat()" *ngIf="!isEditPattern && isediticon">create</mat-icon>
<mat-icon *ngIf="isEditPattern " style="margin-left: 12px;" title="保存" (click)="saveSite()">description</mat-icon>
</span>
</div>
@ -135,8 +135,7 @@
</div>
<div [hidden]="!togglePlane" >
<div class="sitePlanContent" *ngFor="let item of sitePlanData;let key = index" [ngClass]="{'isRefugeStorey':item.isRefugeStorey==true,'selectSitePlan': selectSitePlanIndex==key}" (click)='selectSitePlan(item,key)'>
<mat-icon *ngIf="!item.imageUrl" class="matIcons">broken_image</mat-icon>
<label class="overflowText">{{item.name}}</label>
<label class="overflowText" style="display:inline-block; max-width: 160px;"><mat-icon *ngIf="!item.imageUrl" class="matIcons">broken_image</mat-icon>{{item.name}}</label>
<a href="javascript:;" class="fireForce" *ngIf="isEditPattern && !pattern">
<img src="../../../assets/images/fire.png" *ngIf="item.fire && item.fire==2">
<img src="../../../assets/images/noFire.png" *ngIf="item.fire && item.fire==1">

2
src/app/ui/collection-tools-plan/collection-tools.component.scss

@ -4,7 +4,7 @@
}
.content {
width: 100%;
height: 93%;
height: 100%;
overflow: hidden;
box-sizing: border-box;
padding: 1px;

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

@ -149,10 +149,6 @@ export class CollectionToolsPlanComponent implements OnInit {
}
pattern:boolean = true//默认为基本信息编辑
yyy(){
console.log(this.canvasData.selectPanelPoint)
}
//基本信息编辑模式
baseInfo(){
if (!this.pattern) {
@ -223,14 +219,11 @@ export class CollectionToolsPlanComponent implements OnInit {
targetNodeData.forEach(i => {
idArr.push(i.id)
})
console.log(6666666666666,event);
if(this.pos == 0 && event.node.origin.children.length == 1){
console.log("移入,没有兄弟")
let key = event.dragNode.key
orders[key] = 0
parentId = event.node.key
}else{
console.log("移入,多个兄弟")
let array = []
targetNodeData.forEach(item => {
if(item.id != event.dragNode.key){ //将拖动项先移除掉
@ -238,13 +231,10 @@ export class CollectionToolsPlanComponent implements OnInit {
}
})
if(event.dragNode.isEnd[event.dragNode.isEnd.length - 1]){ //如果移入到最后一个
console.log("最后")
array.push(event.dragNode.origin)
}else if(event.dragNode.isStart[event.dragNode.isStart.length - 1]){//如果移入到第一个
console.log("第一")
array.unshift(event.dragNode.origin)
}else{//如果移入中间位置
console.log("中间")
array.splice(event.node.origin.order, 0, event.dragNode.origin)
}
array.forEach((item,key) => {
@ -580,6 +570,13 @@ export class CollectionToolsPlanComponent implements OnInit {
this.gallery.update()
}, 0);
//将上传的input框显示出来
this.isImgNumCss = true;
//清除图片缓存
if((<HTMLInputElement>document.getElementById('inputimg'))){
(<HTMLInputElement>document.getElementById('inputimg')).value = null //清空input框缓存
}
this.canvasData.isChange = true
}
}
@ -614,11 +611,9 @@ export class CollectionToolsPlanComponent implements OnInit {
isSixShow = true
isSixbtn = true //控制想定作业编辑按钮
isxxx = true //控制查看编辑模式的编辑模式按钮
isediticon = true //控制查看编辑模式的编辑模式小笔按钮
ngOnInit(): void {
console.log(this.route,2,this.router.url)
if(this.router.url.indexOf("keyUnit/viewunitinfo") != -1 || this.router.url.indexOf("keyUnit/editplaninfo")!= -1){
this.isSixbtn = false
}
@ -628,17 +623,22 @@ export class CollectionToolsPlanComponent implements OnInit {
}
if(!this.isSixbtn && sessionStorage.getItem("six") == "look"){
this.isEditPattern = false
this.isxxx = false
this.isediticon = false
}
//gis模块平面图
if(this.router.url.indexOf("gis") != -1 && sessionStorage.getItem("gisplan") == "look"){
this.isEditPattern = false
this.isediticon = false
this.canvasData.gameMode = GameMode.Assignment
} else {
this.getAllLibrary() //获取素材库
this.getAllBuildings() //获取所有建筑
}
this.getAllLibrary() //获取素材库
this.getAllBuildings() //获取所有建筑
// this.getAllFirePlan() //获取当前单位灾情
let that = this
window.setTimeout(()=>{
document.getElementById("functionalDomainContent").oncontextmenu = function (event) {
that.canvas.cancelPaint()
// that.canvas.cancelPaint()
that.selectImageIndex = -1
event.preventDefault();
};
@ -654,7 +654,10 @@ export class CollectionToolsPlanComponent implements OnInit {
ngAfterViewInit(): void {
this.getSitePlan()
//gis模块平面图
if(this.router.url.indexOf("gis") == -1) {
this.getSitePlan()
}
// 监听canvas组件选中素材事件
this.canvas.on("select",obj=>{
//选中素材属性注入函数
@ -723,268 +726,276 @@ export class CollectionToolsPlanComponent implements OnInit {
//保存平面图
saveNum :any = []
saveSite(){
console.log(this.beforeOneCheckedBuilding)
this.saveNum = []
let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData));
SitePlanData.data = JSON.stringify(SitePlanData.data)
let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData));
CompanyData.data = JSON.stringify(CompanyData.data)
let object = this.canvasData.originalcompanyBuildingData.data
let adjoinArr = [] //毗邻数组
if(this.pattern){//如果是基本信息编辑模式
for (const key in object) {
if (object[key].Name == "毗邻") {//如果是相同楼层,则筛选出毗邻
object[key].PropertyInfos.forEach(element => {
if(element.PropertyName == "方向"){
adjoinArr.push(element.PropertyValue)
}
});
if (this.selectingSitePlan && this.selectingSitePlan.id) {
this.saveNum = []
let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData));
SitePlanData.data = JSON.stringify(SitePlanData.data)
let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData));
CompanyData.data = JSON.stringify(CompanyData.data)
let object = this.canvasData.originalcompanyBuildingData.data
let adjoinArr = [] //毗邻数组
if(this.pattern){//如果是基本信息编辑模式
for (const key in object) {
if (object[key].Name == "毗邻") {//如果是相同楼层,则筛选出毗邻
object[key].PropertyInfos.forEach(element => {
if(element.PropertyName == "方向"){
adjoinArr.push(element.PropertyValue)
}
});
}
}
}
if((new Set(adjoinArr)).size != adjoinArr.length){
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存失败,毗邻存在相同方向','确定',config);
return false
}else{
//如果是单位 总平面图
if(this.checkedBuildingIndex==-1){
//保存平面图数据
this.http.post("/api/SitePlanData",SitePlanData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
if((new Set(adjoinArr)).size != adjoinArr.length){
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存失败,毗邻存在相同方向','确定',config);
return false
}else{
//如果是单位 总平面图
if(this.checkedBuildingIndex==-1){
//保存平面图数据
this.http.post("/api/SitePlanData",SitePlanData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('平面图数据保存失败','确定',config);
})
//保存建筑数据
this.http.post("/api/CompanyData",CompanyData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('平面图数据保存失败','确定',config);
})
//保存建筑数据
this.http.post("/api/CompanyData",CompanyData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位数据保存失败','确定',config);
})
//批量保存单位毗邻
let CompanyAdjoins = this.canvasData.getCompanyAdjoinInfo()
this.http.post("/api/CompanyAdjoins/Batch",CompanyAdjoins,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('单位数据保存失败','确定',config);
})
//批量保存单位毗邻
let CompanyAdjoins = this.canvasData.getCompanyAdjoinInfo()
this.http.post("/api/CompanyAdjoins/Batch",CompanyAdjoins,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位毗邻保存失败','确定',config);
})
//批量保存单位重点部位
let CompanyImportantLocations = this.canvasData.getCompanyImportantLocations()
this.http.post("/api/CompanyImportantLocations/Batch",CompanyImportantLocations,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('单位毗邻保存失败','确定',config);
})
//批量保存单位重点部位
let CompanyImportantLocations = this.canvasData.getCompanyImportantLocations()
this.http.post("/api/CompanyImportantLocations/Batch",CompanyImportantLocations,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位重点部位保存失败','确定',config);
})
//批量保存单位消防设施素材
let CompanyFacilityAssets = this.canvasData.getAllCompanyFacilityAssetInfo()
this.http.post("/api/CompanyFacilityAssets/Batch",CompanyFacilityAssets,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('单位重点部位保存失败','确定',config);
})
//批量保存单位消防设施素材
let CompanyFacilityAssets = this.canvasData.getAllCompanyFacilityAssetInfo()
this.http.post("/api/CompanyFacilityAssets/Batch",CompanyFacilityAssets,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位消防设施素材保存失败','确定',config);
})
}else{ //如果是建筑
//建筑平面图数据
this.http.post("/api/BuildingAreaData",SitePlanData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('单位消防设施素材保存失败','确定',config);
})
}else{ //如果是建筑
//建筑平面图数据
this.http.post("/api/BuildingAreaData",SitePlanData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('平面图数据保存失败','确定',config);
})
//建筑数据
this.http.post("/api/BuildingData",CompanyData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('平面图数据保存失败','确定',config);
})
//建筑数据
this.http.post("/api/BuildingData",CompanyData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位数据保存失败','确定',config);
})
//批量保存建筑毗邻
let buildingAdjoins = this.canvasData.getBuildingAdjoinInfo()
this.http.post(`/api/BuildingAdjoins/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingAdjoins).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('单位数据保存失败','确定',config);
})
//批量保存建筑毗邻
let buildingAdjoins = this.canvasData.getBuildingAdjoinInfo()
this.http.post(`/api/BuildingAdjoins/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingAdjoins).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑毗邻保存失败','确定',config);
})
//批量保存建筑重点部位
let buildingImportantLocations = this.canvasData.getBuildingImportantLocations()
this.http.post(`/api/BuildingImportantLocations/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingImportantLocations).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('建筑毗邻保存失败','确定',config);
})
//批量保存建筑重点部位
let buildingImportantLocations = this.canvasData.getBuildingImportantLocations()
this.http.post(`/api/BuildingImportantLocations/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingImportantLocations).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑重点部位保存失败','确定',config);
})
//批量保存建筑消防设施素材
let buildingFacilityAssets = this.canvasData.getAllBuildingFacilityAssetInfo()
this.http.post(`/api/BuildingFacilityAssets/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingFacilityAssets).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('建筑重点部位保存失败','确定',config);
})
//批量保存建筑消防设施素材
let buildingFacilityAssets = this.canvasData.getAllBuildingFacilityAssetInfo()
this.http.post(`/api/BuildingFacilityAssets/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingFacilityAssets).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑消防设施素材保存失败','确定',config);
})
this.canvasData.isChange = true
this.snackBar.open('建筑消防设施素材保存失败','确定',config);
})
}
}
}else{//如果是想定作业编辑模式
const dialogRef = this.dialog.open(saveOneDialogPlan, {
data: {allDisposalNode: this.canvasData.allDisposalNode,
selectedBuildingData:this.beforeOneCheckedBuilding,
selectedSiteData:this.selectingSitePlan,
siteOrbuilding:this.checkedBuildingIndex,
disasterId: this.allFirePlan[0].id || ''
}
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
});
}
}else{//如果是想定作业编辑模式
const dialogRef = this.dialog.open(saveOneDialogPlan, {
data: {allDisposalNode: this.canvasData.allDisposalNode,
selectedBuildingData:this.beforeOneCheckedBuilding,
selectedSiteData:this.selectingSitePlan,
siteOrbuilding:this.checkedBuildingIndex,
disasterId: this.allFirePlan[0].id || ''
}
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
});
} else { //if
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('暂无楼层数据','确定',config);
}
}
@ -1033,14 +1044,40 @@ export class CollectionToolsPlanComponent implements OnInit {
//选择建筑
checkedBuilding(item,index){
if (this.checkedBuildingIndex!=index) {
this.beforeOneCheckedBuilding = item
this.checkedBuildingIndex = index
if (index==-1) { //总平面图数据
this.getSitePlan()
} else { //建筑楼层/区域数据
this.getBuildingSitePlan(item)
}
}
if (this.canvasData.isChange) { //true 数据被改动
let isTrue = confirm('是否保存当前编辑数据')
if (isTrue) { //先保存数据 在切换
let isSuccess = this.saveSite()//true的时候 先保存数据
if (isSuccess != false) {
this.beforeOneCheckedBuilding = item
this.checkedBuildingIndex = index
if (index==-1) { //总平面图数据
this.getSitePlan()
} else { //建筑楼层/区域数据
this.getBuildingSitePlan(item)
}
}
} else {
this.beforeOneCheckedBuilding = item
this.checkedBuildingIndex = index
if (index==-1) { //总平面图数据
this.getSitePlan()
} else { //建筑楼层/区域数据
this.getBuildingSitePlan(item)
}
}
} else { //flase 数据未被改动
this.beforeOneCheckedBuilding = item
this.checkedBuildingIndex = index
if (index==-1) { //总平面图数据
this.getSitePlan()
} else { //建筑楼层/区域数据
this.getBuildingSitePlan(item)
}
} //if
} //if
}
//编辑建筑
@ -1206,8 +1243,23 @@ export class CollectionToolsPlanComponent implements OnInit {
     }
const nodes = this.treeControl.dataNodes;
const expandNodes = [];
nodes.forEach((item) => {
if(item.expandable && this.treeControl.isExpanded(item)){
expandNodes.push(item.id);
}
});
this.dataSource.data = [...this.dataSource.data]
this.treeControl.expandAll()
let newNodes = this.treeControl.dataNodes;
newNodes = newNodes.filter(n => {
return expandNodes.indexOf(n.id) >= 0;
});
newNodes.forEach(item => {
this.treeControl.expand(item);
});
//canvas上的素材显隐
let iconVisibleArr:any = []
@ -1456,8 +1508,11 @@ export class CollectionToolsPlanComponent implements OnInit {
this.canvasData.selectStorey = item //服务中 存一份数据
if (this.checkedBuildingIndex==-1) { //总平面图时
this.getSitePlanStorey(item) //获取 平面图 楼层数据
this.getSitePlanCompanyData()
} else { //楼层/区域时
this.getBuildingStorey(item) //获取 建筑 楼层数据
let params = { buildingId: this.beforeOneCheckedBuilding.id }
this.getBuildingData(params)
}
}
@ -1632,6 +1687,7 @@ export class CollectionToolsPlanComponent implements OnInit {
this.selectingSitePlan = this.sitePlanData[0] || {}
this.canvasData.selectStorey = this.sitePlanData[0] || {} //服务中 存一份数据
this.selectSitePlanIndex = 0
this.canvasData.isChange = false
if (isCompany===-1) {
this.http.post("/api/CompanyData",newData).subscribe(data => {})
this.getSitePlanStorey(this.selectingSitePlan) //获取 平面图 楼层数据
@ -1779,7 +1835,7 @@ export class CollectionToolsPlanComponent implements OnInit {
});
this.allLibrary = data
this.selectImageIndex = -1
this.canvas.cancelPaint()
// this.canvas.cancelPaint()
})
}

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

@ -135,8 +135,7 @@
</div>
<div [hidden]="!togglePlane" >
<div class="sitePlanContent" *ngFor="let item of sitePlanData;let key = index" [ngClass]="{'isRefugeStorey':item.isRefugeStorey==true,'selectSitePlan': selectSitePlanIndex==key}" (click)='selectSitePlan(item,key)'>
<mat-icon *ngIf="!item.imageUrl" class="matIcons">broken_image</mat-icon>
<label class="overflowText">{{item.name}}</label>
<label class="overflowText" style="display:inline-block; max-width: 160px;"><mat-icon *ngIf="!item.imageUrl" class="matIcons">broken_image</mat-icon>{{item.name}}</label>
<a href="javascript:;" class="fireForce" *ngIf="isEditPattern && !pattern">
<img src="../../../assets/images/fire.png" *ngIf="item.fire && item.fire==2">
<img src="../../../assets/images/noFire.png" *ngIf="item.fire && item.fire==1">
@ -218,7 +217,7 @@
<ng-template #nzTreeTemplate let-node let-origin="origin">
<div id="terrNodePublic" (click)='selectanelPoint(node.origin)' [ngClass]="{'selectanelPoint': selectDisposalNode==node.origin.id}">
<label title="{{node.title}}" class="overflowText textNode">{{node.title}}</label>
<div class="planIconDiv" *ngIf="isEditPattern">
<div class="scoreDiv" *ngIf="isEditPattern">
<mat-icon *ngIf="!node.origin.sitePlanId && !node.origin.buildingAreaId" (click)='editPanelPoint($event,node)'>edit</mat-icon>
<mat-icon *ngIf="node.level===0" (click)='addPanelPoint($event,node.origin,null)'>add</mat-icon>
<mat-icon *ngIf="!node.origin.sitePlanId && !node.origin.buildingAreaId" (click)='copyPanelPoint($event,node,treeData)'>library_books</mat-icon>

2
src/app/ui/collection-tools/collection-tools.component.scss

@ -4,7 +4,7 @@
}
.content {
width: 100%;
height: 93%;
height: 100%;
overflow: hidden;
box-sizing: border-box;
padding: 1px;

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

@ -587,6 +587,13 @@ export class CollectionToolsComponent implements OnInit {
this.gallery.update()
}, 0);
//将上传的input框显示出来
this.isImgNumCss = true;
//清除图片缓存
if((<HTMLInputElement>document.getElementById('inputimg'))){
(<HTMLInputElement>document.getElementById('inputimg')).value = null //清空input框缓存
}
this.canvasData.isChange = true
}
}
@ -649,7 +656,7 @@ export class CollectionToolsComponent implements OnInit {
let that = this
window.setTimeout(()=>{
document.getElementById("functionalDomainContent").oncontextmenu = function (event) {
that.canvas.cancelPaint()
// that.canvas.cancelPaint()
that.selectImageIndex = -1
event.preventDefault();
};
@ -736,268 +743,275 @@ export class CollectionToolsComponent implements OnInit {
//保存平面图
saveNum :any = []
saveSite(){
console.log(this.beforeOneCheckedBuilding)
this.saveNum = []
let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData));
SitePlanData.data = JSON.stringify(SitePlanData.data)
let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData));
CompanyData.data = JSON.stringify(CompanyData.data)
let object = this.canvasData.originalcompanyBuildingData.data
let adjoinArr = [] //毗邻数组
if(this.pattern){//如果是基本信息编辑模式
for (const key in object) {
if (object[key].Name == "毗邻") {//如果是相同楼层,则筛选出毗邻
object[key].PropertyInfos.forEach(element => {
if(element.PropertyName == "方向"){
adjoinArr.push(element.PropertyValue)
}
});
if (this.selectingSitePlan && this.selectingSitePlan.id) {
this.saveNum = []
let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData));
SitePlanData.data = JSON.stringify(SitePlanData.data)
let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData));
CompanyData.data = JSON.stringify(CompanyData.data)
let object = this.canvasData.originalcompanyBuildingData.data
let adjoinArr = [] //毗邻数组
if(this.pattern){//如果是基本信息编辑模式
for (const key in object) {
if (object[key].Name == "毗邻") {//如果是相同楼层,则筛选出毗邻
object[key].PropertyInfos.forEach(element => {
if(element.PropertyName == "方向"){
adjoinArr.push(element.PropertyValue)
}
});
}
}
}
if((new Set(adjoinArr)).size != adjoinArr.length){
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存失败,毗邻存在相同方向','确定',config);
return false
}else{
//如果是单位 总平面图
if(this.checkedBuildingIndex==-1){
//保存平面图数据
this.http.post("/api/SitePlanData",SitePlanData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
if((new Set(adjoinArr)).size != adjoinArr.length){
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存失败,毗邻存在相同方向','确定',config);
return false
}else{
//如果是单位 总平面图
if(this.checkedBuildingIndex==-1){
//保存平面图数据
this.http.post("/api/SitePlanData",SitePlanData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('平面图数据保存失败','确定',config);
})
//保存建筑数据
this.http.post("/api/CompanyData",CompanyData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('平面图数据保存失败','确定',config);
})
//保存建筑数据
this.http.post("/api/CompanyData",CompanyData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位数据保存失败','确定',config);
})
//批量保存单位毗邻
let CompanyAdjoins = this.canvasData.getCompanyAdjoinInfo()
this.http.post("/api/CompanyAdjoins/Batch",CompanyAdjoins,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('单位数据保存失败','确定',config);
})
//批量保存单位毗邻
let CompanyAdjoins = this.canvasData.getCompanyAdjoinInfo()
this.http.post("/api/CompanyAdjoins/Batch",CompanyAdjoins,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位毗邻保存失败','确定',config);
})
//批量保存单位重点部位
let CompanyImportantLocations = this.canvasData.getCompanyImportantLocations()
this.http.post("/api/CompanyImportantLocations/Batch",CompanyImportantLocations,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('单位毗邻保存失败','确定',config);
})
//批量保存单位重点部位
let CompanyImportantLocations = this.canvasData.getCompanyImportantLocations()
this.http.post("/api/CompanyImportantLocations/Batch",CompanyImportantLocations,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位重点部位保存失败','确定',config);
})
//批量保存单位消防设施素材
let CompanyFacilityAssets = this.canvasData.getAllCompanyFacilityAssetInfo()
this.http.post("/api/CompanyFacilityAssets/Batch",CompanyFacilityAssets,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('单位重点部位保存失败','确定',config);
})
//批量保存单位消防设施素材
let CompanyFacilityAssets = this.canvasData.getAllCompanyFacilityAssetInfo()
this.http.post("/api/CompanyFacilityAssets/Batch",CompanyFacilityAssets,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位消防设施素材保存失败','确定',config);
})
}else{ //如果是建筑
//建筑平面图数据
this.http.post("/api/BuildingAreaData",SitePlanData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('单位消防设施素材保存失败','确定',config);
})
}else{ //如果是建筑
//建筑平面图数据
this.http.post("/api/BuildingAreaData",SitePlanData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('平面图数据保存失败','确定',config);
})
//建筑数据
this.http.post("/api/BuildingData",CompanyData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('平面图数据保存失败','确定',config);
})
//建筑数据
this.http.post("/api/BuildingData",CompanyData,{
params:{
companyId:this.params.companyId
}
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位数据保存失败','确定',config);
})
//批量保存建筑毗邻
let buildingAdjoins = this.canvasData.getBuildingAdjoinInfo()
this.http.post(`/api/BuildingAdjoins/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingAdjoins).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('单位数据保存失败','确定',config);
})
//批量保存建筑毗邻
let buildingAdjoins = this.canvasData.getBuildingAdjoinInfo()
this.http.post(`/api/BuildingAdjoins/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingAdjoins).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑毗邻保存失败','确定',config);
})
//批量保存建筑重点部位
let buildingImportantLocations = this.canvasData.getBuildingImportantLocations()
this.http.post(`/api/BuildingImportantLocations/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingImportantLocations).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('建筑毗邻保存失败','确定',config);
})
//批量保存建筑重点部位
let buildingImportantLocations = this.canvasData.getBuildingImportantLocations()
this.http.post(`/api/BuildingImportantLocations/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingImportantLocations).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑重点部位保存失败','确定',config);
})
//批量保存建筑消防设施素材
let buildingFacilityAssets = this.canvasData.getAllBuildingFacilityAssetInfo()
this.http.post(`/api/BuildingFacilityAssets/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingFacilityAssets).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
this.canvasData.isChange = true
this.snackBar.open('建筑重点部位保存失败','确定',config);
})
//批量保存建筑消防设施素材
let buildingFacilityAssets = this.canvasData.getAllBuildingFacilityAssetInfo()
this.http.post(`/api/BuildingFacilityAssets/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingFacilityAssets).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
}
},err=>{
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑消防设施素材保存失败','确定',config);
})
this.canvasData.isChange = true
this.snackBar.open('建筑消防设施素材保存失败','确定',config);
})
}
}
}else{//如果是想定作业编辑模式
const dialogRef = this.dialog.open(saveOneDialog, {
data: {allDisposalNode: this.canvasData.allDisposalNode,
selectedBuildingData:this.beforeOneCheckedBuilding,
selectedSiteData:this.selectingSitePlan,
siteOrbuilding:this.checkedBuildingIndex,
disasterId: this.allFirePlan[0].id || ''
}
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
});
}
}else{//如果是想定作业编辑模式
const dialogRef = this.dialog.open(saveOneDialog, {
data: {allDisposalNode: this.canvasData.allDisposalNode,
selectedBuildingData:this.beforeOneCheckedBuilding,
selectedSiteData:this.selectingSitePlan,
siteOrbuilding:this.checkedBuildingIndex,
disasterId: this.allFirePlan[0].id || ''
}
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
});
} else { //if
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('暂无楼层数据','确定',config);
}
}
@ -1046,14 +1060,40 @@ export class CollectionToolsComponent implements OnInit {
//选择建筑
checkedBuilding(item,index){
if (this.checkedBuildingIndex!=index) {
this.beforeOneCheckedBuilding = item
this.checkedBuildingIndex = index
if (index==-1) { //总平面图数据
this.getSitePlan()
} else { //建筑楼层/区域数据
this.getBuildingSitePlan(item)
}
}
if (this.canvasData.isChange) { //true 数据被改动
let isTrue = confirm('是否保存当前编辑数据')
if (isTrue) { //先保存数据 在切换
let isSuccess = this.saveSite()//true的时候 先保存数据
if (isSuccess != false) {
this.beforeOneCheckedBuilding = item
this.checkedBuildingIndex = index
if (index==-1) { //总平面图数据
this.getSitePlan()
} else { //建筑楼层/区域数据
this.getBuildingSitePlan(item)
}
}
} else {
this.beforeOneCheckedBuilding = item
this.checkedBuildingIndex = index
if (index==-1) { //总平面图数据
this.getSitePlan()
} else { //建筑楼层/区域数据
this.getBuildingSitePlan(item)
}
}
} else { //flase 数据未被改动
this.beforeOneCheckedBuilding = item
this.checkedBuildingIndex = index
if (index==-1) { //总平面图数据
this.getSitePlan()
} else { //建筑楼层/区域数据
this.getBuildingSitePlan(item)
}
} //if
} //if
}
//编辑建筑
@ -1219,8 +1259,23 @@ export class CollectionToolsComponent implements OnInit {
     }
const nodes = this.treeControl.dataNodes;
const expandNodes = [];
nodes.forEach((item) => {
if(item.expandable && this.treeControl.isExpanded(item)){
expandNodes.push(item.id);
}
});
this.dataSource.data = [...this.dataSource.data]
this.treeControl.expandAll()
let newNodes = this.treeControl.dataNodes;
newNodes = newNodes.filter(n => {
return expandNodes.indexOf(n.id) >= 0;
});
newNodes.forEach(item => {
this.treeControl.expand(item);
});
//canvas上的素材显隐
let iconVisibleArr:any = []
@ -1468,8 +1523,11 @@ export class CollectionToolsComponent implements OnInit {
this.canvasData.selectStorey = item //服务中 存一份数据
if (this.checkedBuildingIndex==-1) { //总平面图时
this.getSitePlanStorey(item) //获取 平面图 楼层数据
this.getSitePlanCompanyData()
} else { //楼层/区域时
this.getBuildingStorey(item) //获取 建筑 楼层数据
let params = { buildingId: this.beforeOneCheckedBuilding.id }
this.getBuildingData(params)
}
}
@ -1644,6 +1702,7 @@ export class CollectionToolsComponent implements OnInit {
this.selectingSitePlan = this.sitePlanData[0] || {}
this.canvasData.selectStorey = this.sitePlanData[0] || {} //服务中 存一份数据
this.selectSitePlanIndex = 0
this.canvasData.isChange = false
if (isCompany===-1) {
this.http.post("/api/CompanyData",newData).subscribe(data => {})
this.getSitePlanStorey(this.selectingSitePlan) //获取 平面图 楼层数据
@ -1791,7 +1850,7 @@ export class CollectionToolsComponent implements OnInit {
});
this.allLibrary = data
this.selectImageIndex = -1
this.canvas.cancelPaint()
// this.canvas.cancelPaint()
})
}

106
src/app/ui/unittype/unittype.component.html

@ -1,55 +1,57 @@
<div class="unittypeHeader">
<div style="width: 100%;height: 100%;overflow-y: auto;">
<div class="unittypeHeader">
<button mat-raised-button color="primary" (click)='open()' class="left">创建单位</button>
</div>
</div>
<div>
<table mat-table [dataSource]="dataSource"class="mat-elevation-z8">
<ng-container matColumnDef="company">
<th mat-header-cell *matHeaderCellDef>单位类型</th>
<td mat-cell *matCellDef="let element">{{element.name}}</td>
</ng-container>
<ng-container matColumnDef="template">
<th mat-header-cell *matHeaderCellDef>单位信息模板</th>
<td mat-cell *matCellDef="let element">{{element.basicCategoryName}}</td>
</ng-container>
<ng-container matColumnDef="fireControl">
<th mat-header-cell *matHeaderCellDef>消防要素模板</th>
<td mat-cell *matCellDef="let element">{{element.fireCategoryName}}</td>
</ng-container>
<ng-container matColumnDef="facilityCategory">
<th mat-header-cell *matHeaderCellDef>消防设施模板</th>
<td mat-cell *matCellDef="let element">{{element.facilityCategoryName}}</td>
</ng-container>
<ng-container matColumnDef="operation">
<th mat-header-cell *matHeaderCellDef>操作</th>
<td mat-cell *matCellDef="let element">
<div >
<table mat-table [dataSource]="dataSource"class="mat-elevation-z8">
<button mat-raised-button color="primary" class="marginLeft" (click)='edit(element)'>
编辑
</button>
<button mat-raised-button color="primary" *ngIf=!element.enabled
(click)='enabled(element)' class="marginLeft">
启用
</button>
<button mat-raised-button color="warn" *ngIf=element.enabled
(click)='prohibit(element)'class="marginLeft">
禁用
</button>
<button mat-raised-button color="warn" (click)='delete(element.id)'class="marginLeft">
删除
</button>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
</div>
<ng-container matColumnDef="company">
<th mat-header-cell *matHeaderCellDef>单位类型</th>
<td mat-cell *matCellDef="let element">{{element.name}}</td>
</ng-container>
<ng-container matColumnDef="template">
<th mat-header-cell *matHeaderCellDef>单位信息模板</th>
<td mat-cell *matCellDef="let element">{{element.basicCategoryName}}</td>
</ng-container>
<ng-container matColumnDef="fireControl">
<th mat-header-cell *matHeaderCellDef>消防要素模板</th>
<td mat-cell *matCellDef="let element">{{element.fireCategoryName}}</td>
</ng-container>
<ng-container matColumnDef="facilityCategory">
<th mat-header-cell *matHeaderCellDef>消防设施模板</th>
<td mat-cell *matCellDef="let element">{{element.facilityCategoryName}}</td>
</ng-container>
<ng-container matColumnDef="operation">
<th mat-header-cell *matHeaderCellDef>操作</th>
<td mat-cell *matCellDef="let element">
<button mat-raised-button color="primary" class="marginLeft" (click)='edit(element)'>
编辑
</button>
<button mat-raised-button color="primary" *ngIf=!element.enabled
(click)='enabled(element)' class="marginLeft">
启用
</button>
<button mat-raised-button color="warn" *ngIf=element.enabled
(click)='prohibit(element)'class="marginLeft">
禁用
</button>
<button mat-raised-button color="warn" (click)='delete(element.id)'class="marginLeft">
删除
</button>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
</div>
</div>

62
src/app/working-area/model/PropertyInfo.ts

@ -0,0 +1,62 @@
/**
*
*/
export class PropertyInfo {
constructor(instanceData: any) {
this.Tag = instanceData.tag;
this.Order = instanceData.order;
this.Enabled = instanceData.enabled;
this.Visible = instanceData.visible;
this.Required = instanceData.required;
this.RuleName = instanceData.ruleName;
this.RuleValue = instanceData.ruleValue;
this.PhysicalUnit = instanceData.physicalUnit;
this.PropertyName = instanceData.propertyName;
this.PropertyType = instanceData.propertyType;
this.PropertyValue = instanceData.propertyValue;
}
/**
* ,
*/
public Tag: string;
/**
*
*/
public Order: number;
/**
*
*/
public Enabled: boolean;
/**
*
*/
public Visible: boolean;
/**
*
*/
public Required: boolean;
/**
*
*/
public RuleName: string;
/**
*
*/
public RuleValue: string;
/**
*
*/
public PhysicalUnit: string;
/**
*
*/
public PropertyName: string;
/**
*
*/
public PropertyType: number;
/**
*
*/
public PropertyValue: string;
}

405
src/app/working-area/model/axArrowConnector.ts

@ -0,0 +1,405 @@
import { WorkingAreaComponent } from '../working-area.component';
import * as PIXI from 'pixi.js';
import { AxShape } from './axShape';
import { Sprite } from 'pixi.js';
/**
*
*/
export class AxArrowConnector extends AxShape {
pointTexture: PIXI.Texture = PIXI.Texture.from('assets/images/handle-main.png')
pointSprites: Array<Sprite> = new Array<Sprite>();
line: PIXI.Graphics;
text: PIXI.Text;
style = new PIXI.TextStyle({
fontFamily: 'Arial',
fontSize: 18,
fontStyle: 'normal',
fontWeight: 'bold',
fill: ['#000000'],
stroke: '#ffffff',
strokeThickness: 3,
dropShadow: true,
dropShadowColor: '#000000',
dropShadowBlur: 3,
dropShadowAngle: Math.PI / 6,
dropShadowDistance: 1,
wordWrap: false,
wordWrapWidth: 100,
});
pts: PIXI.Point[];
markerStart = true;// 是否绘制起始箭头
markerEnd = true;// 是否绘制结束箭头
constructor(assetData: any, workingArea: WorkingAreaComponent,markerStart: boolean,markerEnd:boolean) {
super(assetData, workingArea);
this.markerStart = markerStart;
this.markerEnd = markerEnd;
this.name = assetData.Id;
this.text = new PIXI.Text(this.assetData.Name
+ '\r\n'
+ this.assetData.PropertyInfos?.find((item: { PropertyName: string; }) =>
item.PropertyName === '名称/编号')?.PropertyValue, this.style);
this.line = new PIXI.Graphics();
this.addChild(this.text);
this.addChild(this.line);
this.workingArea.backgroundImage.addChild(this);
this.refresh();
this.drawPoints();
this.sortableChildren = true;
this.text.zIndex = this.children.length;
}
public drawPoints() {
this.assetData.MultiPoint.forEach(element => {
var point = new Sprite(this.pointTexture);
point.position = element;
point.anchor.set(0.5);
this.pointSprites.push(point);
this.addChild(point);
});
this.pointSprites.forEach((value, index, array) => {
value.interactive = true;
value.on('mousedown', event => {
event.stopPropagation();
if (this.workingArea.allowEdit && this.assetData.GameMode === this.workingArea.canvasData.gameMode) {
event.currentTarget.data = event.data;
event.currentTarget.alpha = 0.5;
event.currentTarget.dragging = true;
}
})
.on('mouseup', event => {
if (event.currentTarget.dragging) {
event.currentTarget.alpha = 1;
event.currentTarget.dragging = false;
event.currentTarget.data = null;
}
})
.on('mouseupoutside', event => {
if (event.currentTarget.dragging) {
event.currentTarget.alpha = 1;
event.currentTarget.dragging = false;
event.currentTarget.data = null;
}
})
.on('mousemove', event => {
if (event.currentTarget.dragging) {
const newPosition = event.currentTarget.data.getLocalPosition(event.currentTarget.parent);
event.currentTarget.x = newPosition.x;
event.currentTarget.y = newPosition.y;
this.assetData.MultiPoint[index].x = newPosition.x;
this.assetData.MultiPoint[index].y = newPosition.y;
this.workingArea.canvasData.isChange = true;
this.refresh();
}
})
.on('rightclick', event => {
});
})
this.setPointsVisible(false);
}
/**
*
* @param b true/false
*/
public setPointsVisible(b:boolean) {
this.pointSprites.forEach(item => {
item.visible = b;
})
}
/**
*
*/
public refresh(): void {
const c = this.line;
const pts = this.assetData.MultiPoint;
if (pts.length < 2) {
return;
}
this.text.position = pts[0];
this.text.anchor.set(0.5, 1);
this.text.text = this.assetData.Name
+ '\r\n'
+ this.assetData.PropertyInfos?.find(item => item.PropertyName === '名称/编号')?.PropertyValue;
const strokeWidth = 1;
const startWidth = 30 + strokeWidth;
const endWidth = 30 + strokeWidth;
const edgeWidth = this.assetData.Thickness === 0 ? 10 : this.assetData.Thickness; // 宽度
const openEnded = false;
const spacing = (openEnded) ? 0 : 0 + strokeWidth / 2;
const startSize = 30 + strokeWidth;
const endSize = 30 + strokeWidth;
const isRounded = true;
const lineColor = 0x000000;
const fillColor: number = this.assetData.Color.substring(0, 7).replace('#', '0x');;
const pe = pts[pts.length - 1];
let i0 = 1;
while (i0 < pts.length - 1 && pts[i0].x === pts[0].x && pts[i0].y === pts[0].y) {
i0++;
}
const dx = pts[i0].x - pts[0].x;
const dy = pts[i0].y - pts[0].y;
const dist = Math.sqrt(dx * dx + dy * dy);
if (dist === 0) {
return;
}
let nx = dx / dist;
let nx1 = nx;
let nx2 = nx;
let ny = dy / dist;
let ny2 = ny;
let ny1 = ny;
let orthx = edgeWidth * ny;
let orthy = -edgeWidth * nx;
const fns = [];
// if (isRounded) {
// // c.setLineJoin('round');
// c.lineTextureStyle({ join: PIXI.LINE_JOIN.ROUND });
// } else if (pts.length > 2) {
// // Only mitre if there are waypoints
// // c.setMiterLimit(1.42);
// c.lineTextureStyle({ miterLimit: 1.42 });
// }
// c.lineStyle(1, 0x000000, 1);
c.clear();
c.lineTextureStyle({ width: 1, color: lineColor, join: PIXI.LINE_JOIN.ROUND });
const startNx = nx;
const startNy = ny;
if (!openEnded) {
c.beginFill(fillColor);
}
if (this.markerStart && !openEnded) {
this.paintMarker(c, pts[0].x, pts[0].y, nx, ny, startSize, startWidth, edgeWidth, spacing, true);
} else {
const outStartX = pts[0].x + orthx / 2 + spacing * nx;
const outStartY = pts[0].y + orthy / 2 + spacing * ny;
const inEndX = pts[0].x - orthx / 2 + spacing * nx;
const inEndY = pts[0].y - orthy / 2 + spacing * ny;
if (openEnded) {
c.moveTo(outStartX, outStartY);
fns.push( () => {
c.lineTo(inEndX, inEndY);
});
} else {
c.moveTo(inEndX, inEndY);
c.lineTo(outStartX, outStartY);
}
}
let dx1 = 0;
let dy1 = 0;
let dist1 = 0;
for (let i = 0; i < pts.length - 2; i++) {
const pos = this.relativeCcw(pts[i].x, pts[i].y, pts[i + 1].x, pts[i + 1].y, pts[i + 2].x, pts[i + 2].y);
dx1 = pts[i + 2].x - pts[i + 1].x;
dy1 = pts[i + 2].y - pts[i + 1].y;
dist1 = Math.sqrt(dx1 * dx1 + dy1 * dy1);
if (dist1 !== 0) {
nx1 = dx1 / dist1;
ny1 = dy1 / dist1;
const tmp1 = nx * nx1 + ny * ny1;
const tmp = Math.max(Math.sqrt((tmp1 + 1) / 2), 0.04);
nx2 = (nx + nx1);
ny2 = (ny + ny1);
const dist2 = Math.sqrt(nx2 * nx2 + ny2 * ny2);
if (dist2 !== 0) {
nx2 = nx2 / dist2;
ny2 = ny2 / dist2;
const strokeWidthFactor = Math.max(tmp, Math.min(1 / 200 + 0.04, 0.35));
const angleFactor = (pos !== 0 && isRounded) ? Math.max(0.1, strokeWidthFactor) : Math.max(tmp, 0.06);
const outX = pts[i + 1].x + ny2 * edgeWidth / 2 / angleFactor;
const outY = pts[i + 1].y - nx2 * edgeWidth / 2 / angleFactor;
const inX = pts[i + 1].x - ny2 * edgeWidth / 2 / angleFactor;
const inY = pts[i + 1].y + nx2 * edgeWidth / 2 / angleFactor;
if (pos === 0 || !isRounded) {
c.lineTo(outX, outY);
((x, y) => {
fns.push(() => {
c.lineTo(x, y);
});
})(inX, inY);
} else if (pos === -1) {
const c1x = inX + ny * edgeWidth;
const c1y = inY - nx * edgeWidth;
const c2x = inX + ny1 * edgeWidth;
const c2y = inY - nx1 * edgeWidth;
c.lineTo(c1x, c1y);
if (isRounded) {
c.quadraticCurveTo(outX, outY, c2x, c2y); // 圆角
} else {
c.lineTo(outX, outY);
}
((x, y) => {
fns.push(() => {
c.lineTo(x, y);
});
})(inX, inY);
} else {
c.lineTo(outX, outY);
((x, y) => {
const c1x = outX - ny * edgeWidth;
const c1y = outY + nx * edgeWidth;
const c2x = outX - ny1 * edgeWidth;
const c2y = outY + nx1 * edgeWidth;
fns.push(() => {
if (isRounded) {
c.quadraticCurveTo(x, y, c1x, c1y);
} else {
c.lineTo(x, y);
}
});
fns.push(() => {
c.lineTo(c2x, c2y);
});
})(inX, inY);
}
nx = nx1;
ny = ny1;
}
}
}
orthx = edgeWidth * ny1;
orthy = - edgeWidth * nx1;
if (this.markerEnd && !openEnded) {
this.paintMarker(c, pe.x, pe.y, -nx, -ny, endSize, endWidth, edgeWidth, spacing, false);
} else {
c.lineTo(pe.x - spacing * nx1 + orthx / 2, pe.y - spacing * ny1 + orthy / 2);
const inStartX = pe.x - spacing * nx1 - orthx / 2;
const inStartY = pe.y - spacing * ny1 - orthy / 2;
if (!openEnded) {
c.lineTo(inStartX, inStartY);
} else {
c.moveTo(inStartX, inStartY);
fns.splice(0, 0, () => {
c.moveTo(inStartX, inStartY);
});
}
}
for (let i = fns.length - 1; i >= 0; i--) {
fns[i]();
}
if (openEnded)
{
c.closePath();
}
else
{
c.closePath();
c.endFill();
}
// c.setShadow(false);
// c.setMiterLimit(4);
// if (isRounded)
// {
// c.setLineJoin('flat');
// }
// if (pts.length > 2)
// {
// c.setMiterLimit(4);
// if (markerStart && !openEnded)
// {
// c.begin();
// this.paintMarker(c, pts[0].x, pts[0].y, startNx, startNy, startSize, startWidth, edgeWidth, spacing, true);
// c.stroke();
// c.end();
// }
// if (markerEnd && !openEnded)
// {
// c.begin();
// this.paintMarker(c, pe.x, pe.y, -nx, -ny, endSize, endWidth, edgeWidth, spacing, true);
// c.stroke();
// c.end();
// }
// }
}
paintMarker(c: PIXI.Graphics, ptX: number, ptY: number, nx: number, ny: number,
size: number, arrowWidth: number, edgeWidth: number, spacing: number, initialMove: boolean) {
const widthArrowRatio = edgeWidth / arrowWidth;
const orthx = edgeWidth * ny / 2;
const orthy = -edgeWidth * nx / 2;
const spaceX = (spacing + size) * nx;
const spaceY = (spacing + size) * ny;
if (initialMove) {
c.moveTo(ptX - orthx + spaceX, ptY - orthy + spaceY);
} else {
c.lineTo(ptX - orthx + spaceX, ptY - orthy + spaceY);
}
c.lineTo(ptX - orthx / widthArrowRatio + spaceX, ptY - orthy / widthArrowRatio + spaceY);
c.lineTo(ptX + spacing * nx, ptY + spacing * ny);
c.lineTo(ptX + orthx / widthArrowRatio + spaceX, ptY + orthy / widthArrowRatio + spaceY);
c.lineTo(ptX + orthx + spaceX, ptY + orthy + spaceY);
}
relativeCcw(x1: number, y1: number, x2: number, y2: number, px: number, py: number) {
x2 -= x1;
y2 -= y1;
px -= x1;
py -= y1;
let ccw = px * y2 - py * x2;
if (ccw === 0.0) {
ccw = px * x2 + py * y2;
if (ccw > 0.0) {
px -= x2;
py -= y2;
ccw = px * x2 + py * y2;
if (ccw < 0.0) {
ccw = 0.0;
}
}
}
return (ccw < 0.0) ? -1 : ((ccw > 0.0) ? 1 : 0);
}
redraw(): void{
this.pointSprites.forEach(item => {
item.destroy();
})
this.pointSprites.splice(0, this.pointSprites.length);
this.refresh();
this.drawPoints();
}
}

443
src/app/working-area/model/axImageShape.ts

@ -0,0 +1,443 @@
import { WorkingAreaComponent } from '../working-area.component';
import * as ObjectID from 'bson-objectid';
import { GameMode } from './gameMode';
import { PaintMode } from './paintModel';
import * as PIXI from 'pixi.js';
import { PropertyInfo } from './PropertyInfo';
import { AxShape } from './axShape';
import { Sprite } from 'pixi.js';
import { AxArrowConnector } from './axArrowConnector';
/**
*
* AxImageShape
*/
export class AxImageShape extends AxShape {
style = new PIXI.TextStyle({
fontFamily: 'Arial',
fontSize: 18,
fontStyle: 'normal',
fontWeight: 'bold',
fill: ['#000000'],
stroke: '#ffffff',
strokeThickness: 3,
dropShadow: true,
dropShadowColor: '#000000',
dropShadowBlur: 3,
dropShadowAngle: Math.PI / 6,
dropShadowDistance: 1,
wordWrap: false,
wordWrapWidth: 100,
});
text = new PIXI.Text(this.assetData.Name
+ '\r\n'
+ this.assetData.PropertyInfos?.find(item => item.PropertyName === '名称/编号')?.PropertyValue, this.style);
/**
*
*/
image: PIXI.Sprite;
selectionBox = new PIXI.Graphics();
connectPointTexture = PIXI.Texture.from('assets/images/handle-secondary.png');
connectPoint: Sprite;
// 可移动的
// 可选中的
// up: PIXI.Sprite;
// down: PIXI.Sprite;
// left: PIXI.Sprite;
// right: PIXI.Sprite;
// upLeft: PIXI.Sprite;
// upRight: PIXI.Sprite;
// downLeft: PIXI.Sprite;
// downRight: PIXI.Sprite;
constructor(assetData: any, workingArea: WorkingAreaComponent) {
super(assetData, workingArea);
this.x = this.assetData.Point.x;
this.y = this.assetData.Point.y;
this.name = this.assetData.Id;
this.image = PIXI.Sprite.from(this.assetData.ImageUrl);
this.image.angle = this.assetData.Angle;
this.image.x = 0;
this.image.y = 0;
this.image.width = this.assetData.Width;
this.image.height = this.assetData.Height;
this.image.alpha = 1;
this.image.anchor.set(0.5);
// this.image.interactive = true;
// this.image.buttonMode = true;
// this.image
// .on('mousedown', event => {
// event.stopPropagation();
// this.workingArea.selection.selectOne(this);
// // this.paintingPipeline(this.x, this.y);
// // 如果链接对象不为空,禁止移动
// if (this.workingArea.allowEdit && this.assetData.GameMode === this.workingArea.canvasData.gameMode) {
// event.currentTarget.parent.data = event.data;
// event.currentTarget.parent.alpha = 0.5;
// event.currentTarget.parent.dragging = true;
// }
// })
// .on('mouseup', event => {
// if (event.currentTarget.parent.dragging) {
// event.currentTarget.parent.alpha = 1;
// event.currentTarget.parent.dragging = false;
// event.currentTarget.parent.data = null;
// }
// })
// .on('mouseupoutside', event => {
// if (event.currentTarget.parent.dragging) {
// event.currentTarget.parent.alpha = 1;
// event.currentTarget.parent.dragging = false;
// event.currentTarget.parent.data = null;
// }
// })
// .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;
// this.assetData.Point = new PIXI.Point(this.x, this.y);
// this.workingArea.canvasData.isChange = true;
// }
// })
// .on('rightclick', event => {
// })
// .on('mouseover', event => {
// event.stopPropagation();
// if (this.workingArea.previewImage !== null
// && this.workingArea.getPaintMode() === PaintMode.singlePointIcon) {
// this.workingArea.previewImage.visible = false;
// }
// // if (this.assetData.CanConnect) {
// // this.setSelectionBox(true, this.image);
// // }
// })
// .on('mouseout', event => {
// event.stopPropagation();
// if (this.workingArea.previewImage !== null
// && this.workingArea.getPaintMode() === PaintMode.singlePointIcon) {
// this.workingArea.previewImage.visible = true;
// }
// // if (this.assetData.CanConnect) {
// // this.setSelectionBox(false);
// // }
// });
this.text.x = this.image.x;
this.text.y = this.image.y - this.image.height / 2;
this.text.anchor.set(0.5, 1);
if (this.assetData.GameMode === 2) {
this.text.visible = false;
}
this.addChild(this.text);
this.addChild(this.image);
this.addChild(this.selectionBox);
if (this.assetData.CanConnect) {
// connectPoint
this.connectPoint = new PIXI.Sprite(this.connectPointTexture);
this.connectPoint.anchor.set(0.5);
this.connectPoint.x = this.image.x;
this.connectPoint.y = this.image.y;
this.addChild(this.connectPoint);
this.connectPoint.interactive = true;
this.connectPoint
.on('mousedown', event => {
event.stopPropagation();
this.paintingPipeline(this.x, this.y);
})
.on('mouseover', event => {
this.setSelectionBox(true, this.connectPoint);
})
.on('mouseout', event => {
this.setSelectionBox(false);
});
// // up
// this.up = new PIXI.Sprite(this.selectedPointTexture);
// this.up.anchor.set(0.5);
// this.up.x = this.image.x;
// this.up.y = this.image.y - (this.image.height / 2);
// this.addChild(this.up);
// this.up.interactive = true;
// this.up
// .on('mousedown', event => {
// event.stopPropagation();
// const pt = this.toGlobal(new PIXI.Point(this.up.x, this.up.y));
// const pt2 = this.workingArea.backgroundImage.toLocal(pt);
// this.paintingPipeline(pt2.x, pt2.y);
// })
// .on('mouseover', event => {
// this.setSelectionBox(true, this.up);
// })
// .on('mouseout', event => {
// this.setSelectionBox(false);
// });
// // down
// this.down = new PIXI.Sprite(this.selectedPointTexture);
// this.down.anchor.set(0.5);
// this.down.x = this.image.x;
// this.down.y = this.image.y + (this.image.height / 2);
// this.addChild(this.down);
// this.down.interactive = true;
// this.down
// .on('mousedown', event => {
// event.stopPropagation();
// const pt = this.toGlobal(new PIXI.Point(this.down.x, this.down.y));
// const pt2 = this.workingArea.backgroundImage.toLocal(pt);
// this.paintingPipeline(pt2.x, pt2.y);
// })
// .on('mouseover', event => {
// this.setSelectionBox(true, this.down);
// })
// .on('mouseout', event => {
// this.setSelectionBox(false);
// });
// // left
// this.left = new PIXI.Sprite(this.selectedPointTexture);
// this.left.anchor.set(0.5);
// this.left.x = this.image.x - (this.image.width / 2);
// this.left.y = this.image.y;
// this.addChild(this.left);
// this.left.interactive = true;
// this.left
// .on('mousedown', event => {
// event.stopPropagation();
// const pt = this.toGlobal(new PIXI.Point(this.left.x, this.left.y));
// const pt2 = this.workingArea.backgroundImage.toLocal(pt);
// this.paintingPipeline(pt2.x, pt2.y);
// })
// .on('mouseover', event => {
// this.setSelectionBox(true, this.left);
// })
// .on('mouseout', event => {
// this.setSelectionBox(false);
// });
// // right
// this.right = new PIXI.Sprite(this.selectedPointTexture);
// this.right.anchor.set(0.5);
// this.right.x = this.image.x + (this.image.width / 2);
// this.right.y = this.image.y;
// this.addChild(this.right);
// this.right.interactive = true;
// this.right
// .on('mousedown', event => {
// event.stopPropagation();
// const pt = this.toGlobal(new PIXI.Point(this.right.x, this.right.y));
// const pt2 = this.workingArea.backgroundImage.toLocal(pt);
// this.paintingPipeline(pt2.x, pt2.y);
// })
// .on('mouseover', event => {
// this.setSelectionBox(true, this.right);
// })
// .on('mouseout', event => {
// this.setSelectionBox(false);
// });
// // up-left
// this.upLeft = new PIXI.Sprite(this.selectedPointTexture);
// this.upLeft.anchor.set(0.5);
// this.upLeft.x = this.image.x - (this.image.width / 2);
// this.upLeft.y = this.image.y - (this.image.height / 2);
// this.addChild(this.upLeft);
// this.upLeft.interactive = true;
// this.upLeft
// .on('mousedown', event => {
// event.stopPropagation();
// const pt = this.toGlobal(new PIXI.Point(this.upLeft.x, this.upLeft.y));
// const pt2 = this.workingArea.backgroundImage.toLocal(pt);
// this.paintingPipeline(pt2.x, pt2.y);
// })
// .on('mouseover', event => {
// this.setSelectionBox(true, this.upLeft);
// })
// .on('mouseout', event => {
// this.setSelectionBox(false);
// });
// // up-right
// this.upRight = new PIXI.Sprite(this.selectedPointTexture);
// this.upRight.anchor.set(0.5);
// this.upRight.x = this.image.x + (this.image.width / 2);
// this.upRight.y = this.image.y - (this.image.height / 2);
// this.addChild(this.upRight);
// this.upRight.interactive = true;
// this.upRight
// .on('mousedown', event => {
// event.stopPropagation();
// const pt = this.toGlobal(new PIXI.Point(this.upRight.x, this.upRight.y));
// const pt2 = this.workingArea.backgroundImage.toLocal(pt);
// this.paintingPipeline(pt2.x, pt2.y);
// })
// .on('mouseover', event => {
// this.setSelectionBox(true, this.upRight);
// })
// .on('mouseout', event => {
// this.setSelectionBox(false);
// });
// // down-left
// this.downLeft = new PIXI.Sprite(this.selectedPointTexture);
// this.downLeft.anchor.set(0.5);
// this.downLeft.x = this.image.x - (this.image.width / 2);
// this.downLeft.y = this.image.y + (this.image.height / 2);
// this.addChild(this.downLeft);
// this.downLeft.interactive = true;
// this.downLeft
// .on('mousedown', event => {
// event.stopPropagation();
// const pt = this.toGlobal(new PIXI.Point(this.downLeft.x, this.downLeft.y));
// const pt2 = this.workingArea.backgroundImage.toLocal(pt);
// this.paintingPipeline(pt2.x, pt2.y);
// })
// .on('mouseover', event => {
// this.setSelectionBox(true, this.downLeft);
// })
// .on('mouseout', event => {
// this.setSelectionBox(false);
// });
// // down-right
// this.downRight = new PIXI.Sprite(this.selectedPointTexture);
// this.downRight.anchor.set(0.5);
// this.downRight.x = this.image.x + (this.image.width / 2);
// this.downRight.y = this.image.y + (this.image.height / 2);
// this.addChild(this.downRight);
// this.downRight.interactive = true;
// this.downRight
// .on('mousedown', event => {
// event.stopPropagation();
// const pt = this.toGlobal(new PIXI.Point(this.downRight.x, this.downRight.y));
// const pt2 = this.workingArea.backgroundImage.toLocal(pt);
// this.paintingPipeline(pt2.x, pt2.y);
// })
// .on('mouseover', event => {
// this.setSelectionBox(true, this.downRight);
// })
// .on('mouseout', event => {
// this.setSelectionBox(false);
// });
this.showConnectionPoint(false);
}
}
// 设置选择框
public setSelectionBox(b: boolean, sprite?: PIXI.Sprite) {
if (b) {
this.selectionBox.lineStyle(2, 0x00EB00, 1);
this.selectionBox.position = sprite.position;
this.selectionBox.drawRect(- sprite.width / 2, - sprite.height / 2, sprite.width, sprite.height);
// const p0 = new PIXI.Point(- sprite.width / 2, - sprite.height / 2);
// const pe = new PIXI.Point(sprite.width / 2, sprite.height / 2);
// const pw = new PIXI.Point(p0.x + sprite.width, p0.y);
// const ph = new PIXI.Point(p0.x, p0.y + sprite.height);
// this.drawDashedLine(this.selectionBox, p0, pw, 0x1234ff);
// this.drawDashedLine(this.selectionBox, p0, ph, 0x1234ff);
// this.drawDashedLine(this.selectionBox, pe, pw, 0x1234ff);
// this.drawDashedLine(this.selectionBox, pe, ph, 0x1234ff);
} else {
this.selectionBox.clear();
}
}
// 设置名称
public setNameVisible(value: boolean, mode: GameMode) {
if (this.assetData.GameMode === mode) {
this.text.visible = value;
}
}
// 显示连接点
public showConnectionPoint(b: boolean) {
this.connectPoint.visible = b;
// this.up.visible = b;
// this.down.visible = b;
// this.left.visible = b;
// this.right.visible = b;
// this.upLeft.visible = b;
// this.downLeft.visible = b;
// this.upRight.visible = b;
// this.downRight.visible = b;
}
paintingPipeline(x: number, y: number) {
if (this.assetData.CanConnect) {
if (this.workingArea.getPaintMode() === PaintMode.Pipeline) {
if (this.workingArea.paintingShape === null) {
this.workingArea.previewLineSegment.visible = true;
this.workingArea.currentClickPoint.position =
new PIXI.Point(this.workingArea.circleShadow.x, this.workingArea.circleShadow.y);
this.workingArea.paintPoints.push(new PIXI.Point(x, y));
const json = JSON.parse(JSON.stringify(this.workingArea.canvasData.selectTemplateData.propertyInfos));
const list = [];
json.forEach(element => {
const property = new PropertyInfo(element);
list.push(property);
});
const tempData = {
TemplateId: this.workingArea.canvasData.selectTemplateData.id,
CanConnect: this.workingArea.canvasData.selectTemplateData.canConnect,
Pipelines: new Array(),
FloorId: this.workingArea.canvasData.selectStorey.id,
Angle: this.workingArea.canvasData.selectTemplateData.angle,
Color: this.workingArea.canvasData.selectTemplateData.color,
Enabled: this.workingArea.canvasData.selectTemplateData.enabled,
FillMode: this.workingArea.canvasData.selectTemplateData.fillMode,
FireElementId: this.workingArea.canvasData.selectTemplateData.fireElementId,
FixedSize: this.workingArea.canvasData.selectTemplateData.fixedSize,
Height : 32,
Width : 32,
Id: ObjectID.default.generate(),
ImageUrl: this.workingArea.canvasData.selectTemplateData.imageUrl,
InteractiveMode: this.workingArea.canvasData.selectTemplateData.interactiveMode,
MultiPoint : JSON.parse(JSON.stringify(this.workingArea.paintPoints)),
Point: new PIXI.Point(0, 0),
Name : this.workingArea.canvasData.selectTemplateData.name,
PropertyInfos: list,
Border : this.workingArea.canvasData.selectTemplateData.border,
DrawMode : this.workingArea.canvasData.selectTemplateData.drawMode,
Thickness : this.workingArea.canvasData.selectTemplateData.thickness,
IsFromBuilding : this.workingArea.canvasData.selectTemplateData.isFromBuilding,
GameMode: this.workingArea.canvasData.gameMode,
LinkedObjects: new Array(this.assetData.Id),
};
this.workingArea.paintingShape = new AxArrowConnector(tempData, this.workingArea,false,true);
this.assetData.Pipelines.push(this.workingArea.paintingShape.assetData.Id);
this.workingArea.emit('createIcon', this.workingArea.paintingShape);
} else {
this.workingArea.previewLineSegment.visible = false;
this.workingArea.currentClickPoint.position =
new PIXI.Point(this.workingArea.circleShadow.x, this.workingArea.circleShadow.y);
this.workingArea.paintPoints.push(new PIXI.Point(x, y));
this.workingArea.paintingShape.assetData.MultiPoint =
JSON.parse(JSON.stringify(this.workingArea.paintPoints));
this.workingArea.paintingShape.assetData.LinkedObjects.push(this.assetData.Id);
this.assetData.Pipelines.push(this.workingArea.paintingShape.assetData.Id);
this.workingArea.paintingShape.redraw();
this.workingArea.initPipelineData();
}
}
}
}
// 刷新
public refresh() {
if (this.assetData.CanConnect) {
}
this.image.width = this.assetData.Width;
this.image.height = this.assetData.Height;
this.image.angle = this.assetData.Angle;
this.text.text = this.assetData.Name
+ '\r\n'
+ this.assetData.PropertyInfos?.find(item => item.PropertyName === '名称/编号')?.PropertyValue;
this.text.x = this.image.x;
this.text.y = this.image.y - this.image.height / 2;
}
}

27
src/app/working-area/model/axPreviewImageShape.ts

@ -0,0 +1,27 @@
import { Sprite, Texture } from 'pixi.js';
import { WorkingAreaComponent } from '../working-area.component';
import { AxShape } from './axShape';
export class AxPreviewImageShape extends AxShape {
image: Sprite = null;
/**
*
*/
constructor(workingArea: WorkingAreaComponent) {
super(null, workingArea);
this.image = new Sprite();
this.image.width = 32;
this.image.height = 32;
this.image.anchor.set(0.5);
this.interactive = false;
this.scale.set(1 / this.workingArea.backgroundImage.scale.x);
this.addChild(this.image);
}
/**
*
* @param url
*/
setImageUrl(url: string) {
this.image.texture = Texture.from(url);
}
}

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

@ -0,0 +1,80 @@
import { Constructor } from '@angular/material/core/common-behaviors/constructor';
import * as PIXI from 'pixi.js';
import { Point, Rectangle, Graphics, Container } from 'pixi.js';
import { WorkingAreaComponent } from '../working-area.component';
/**
*
*/
export class AxShape extends Container {
assetData: any;
workingArea: WorkingAreaComponent;
// 可以被移动的
moveable = true;
// 可以被选中的
selectable = true;
constructor(assetData: any, workingArea: WorkingAreaComponent) {
super();
this.assetData = assetData;
this.workingArea = workingArea;
this.workingArea.backgroundImage.addChild(this);
this.interactive = true;
this.buttonMode = true;
this.on('mousedown', event => {
console.log(this.assetData);
event.stopPropagation();
if (this.selectable) {
this.workingArea.selection.selectOne(this);
}
if (this.moveable) {
event.currentTarget.data = event.data;
event.currentTarget.alpha = 0.5;
event.currentTarget.dragging = true;
event.currentTarget.dragPoint = event.data.getLocalPosition(event.currentTarget.parent);
event.currentTarget.dragPoint.x -= event.currentTarget.x;
event.currentTarget.dragPoint.y -= event.currentTarget.y;
}
})
.on('mouseup', event => {
if (event.currentTarget.dragging) {
event.currentTarget.alpha = 1;
event.currentTarget.dragging = false;
event.currentTarget.data = null;
}
})
.on('mouseupoutside', event => {
if (event.currentTarget.dragging) {
event.currentTarget.alpha = 1;
event.currentTarget.dragging = false;
event.currentTarget.data = null;
}
})
.on('mousemove', event => {
if (event.currentTarget.dragging) {
const newPosition = event.currentTarget.data.getLocalPosition(event.currentTarget.parent);
event.currentTarget.x = newPosition.x - event.currentTarget.dragPoint.x;
event.currentTarget.y = newPosition.y - event.currentTarget.dragPoint.y;
this.assetData.Point = new PIXI.Point(this.x, this.y);
this.workingArea.canvasData.isChange = true;
}
})
.on('rightclick', event => {
})
.on('mouseover', event => {
event.stopPropagation();
})
.on('mouseout', event => {
event.stopPropagation();
});
}
redraw(): void {
}
refresh(): void{
}
}

68
src/app/working-area/model/legend.ts

@ -0,0 +1,68 @@
import { Graphics, Sprite, Text } from "pixi.js";
import { WorkingAreaComponent } from "../working-area.component";
import { AxArrowConnector } from "./axArrowConnector";
import { AxImageShape } from "./axImageShape";
import { AxShape } from "./axShape";
import { MultipointIcon } from "./multipointIcon";
import { PolygonIcon } from "./polygonIcon";
export class Legend extends AxShape{
background: Graphics = null;
data:Map<string,string> = new Map<string,string>()
/**
*
*/
constructor(workingArea: WorkingAreaComponent) {
super(null, workingArea);
this.draw();
}
getData() {
this.workingArea.backgroundImage.children.forEach(item => {
if (item instanceof AxImageShape|| item instanceof AxArrowConnector || item instanceof PolygonIcon || item instanceof MultipointIcon) {
if (!this.data.has(item.assetData.Name)) {
this.data[item.assetData.Name] = item.assetData.ImageUrl;
}
}
})
}
draw() {
this.getData();
this.background = new Graphics();
this.background.lineStyle(1, 0xff0000);
this.background.beginFill(0xffffff);
this.background.drawRect(0, 0, 200, 300);
this.background.endFill();
this.background.x = -(this.parent.width/2/ this.parent.scale.x);
this.background.y = -(this.parent.height/2/ this.parent.scale.x);
this.addChild(this.background);
var showName: Text = new Text('图例');
showName.x = 0;
showName.y = 0;
this.background.addChild(showName);
var showDescrption: Text = new Text('说明')
showDescrption.x = 100;
showDescrption.y = 0;
this.background.addChild(showDescrption);
let index = 1;
this.data.forEach((value, key) => {
var image: Sprite = Sprite.from(value);
image.width = 32;
image.height = 32;
image.x = 0;
image.y = index * 32;
this.background.addChild(image);
var description = new Text(key);
description.x = 100;
description.y = index * 32;
this.background.addChild(description);
index++;
})
}
redraw() {
this.background.destroy();
this.draw();
}
}

109
src/app/working-area/model/multipointIcon.ts

@ -1,11 +1,12 @@
import { WorkingAreaComponent } from '../working-area.component';
import { GameMode } from './gameMode';
import * as PIXI from 'pixi.js';
import { AxShape } from './axShape';
/**
* 线
*/
export class MultipointIcon extends PIXI.Container {
export class MultipointIcon extends AxShape {
public pointsData: PIXI.Point[];
public pointsGraphics: PIXI.Graphics[] = [];
public iconsTilingSprite: PIXI.TilingSprite[] = [];
@ -34,8 +35,8 @@ export class MultipointIcon extends PIXI.Container {
* @param texture
* @param points
*/
constructor(public assetData: any, private workingArea: WorkingAreaComponent) {
super();
constructor(assetData: any,workingArea: WorkingAreaComponent) {
super(assetData,workingArea);
this.name = this.assetData.Id;
this.pointsData = this.assetData.MultiPoint;
this.x = this.assetData.Point.x;
@ -56,7 +57,7 @@ export class MultipointIcon extends PIXI.Container {
icon.x = pointA.x;
icon.y = pointA.y;
icon.angle = angle;
icon.height = this.assetData.Thickness === 0 ? 32 : this.assetData.Thickness;
// icon.height = this.assetData.Thickness === 0 ? 32 : this.assetData.Thickness;
this.iconsTilingSprite.push(icon);
this.addChild(icon);
if (i === 0) {
@ -165,9 +166,6 @@ export class MultipointIcon extends PIXI.Container {
}
})
.on('rightclick', event => {
})
.on('mouseover', event => {
});
});
// // 缩放
@ -176,49 +174,50 @@ export class MultipointIcon extends PIXI.Container {
// this.text.scale.set(scale);
// });
// 添加选中事件
this.iconsTilingSprite.forEach((item, index, array) => {
item.interactive = true;
item.on('mousedown', event => {
event.stopPropagation();
this.workingArea.selection.selectOne(this);
if (this.workingArea.allowEdit && this.assetData.GameMode === this.workingArea.canvasData.gameMode) {
event.currentTarget.parent.data = event.data;
event.currentTarget.parent.alpha = 0.5;
event.currentTarget.parent.dragging = true;
event.currentTarget.parent.dragPoint = event.data.getLocalPosition(event.currentTarget.parent.parent);
event.currentTarget.parent.dragPoint.x -= event.currentTarget.parent.x;
event.currentTarget.parent.dragPoint.y -= event.currentTarget.parent.y;
}
})
.on('mouseup', event => {
if (event.currentTarget.parent.dragging) {
event.currentTarget.parent.alpha = 1;
event.currentTarget.parent.dragging = false;
event.currentTarget.parent.data = null;
}
})
.on('mouseupoutside', event => {
if (event.currentTarget.parent.dragging) {
event.currentTarget.parent.alpha = 1;
event.currentTarget.parent.dragging = false;
event.currentTarget.parent.data = null;
}
})
.on('mousemove', event => {
if (event.currentTarget.parent.dragging) {
const newPosition = event.currentTarget.parent.data.getLocalPosition(event.currentTarget.parent.parent);
event.currentTarget.parent.x = newPosition.x - event.currentTarget.parent.dragPoint.x;
event.currentTarget.parent.y = newPosition.y - event.currentTarget.parent.dragPoint.y;
this.assetData.Point = new PIXI.Point(this.x, this.y);
this.workingArea.canvasData.isChange = true;
}
})
.on('rightclick', event => {
});
});
// this.iconsTilingSprite.forEach((item, index, array) => {
// item.interactive = true;
// item.buttonMode = true;
// item.on('mousedown', event => {
// event.stopPropagation();
// this.workingArea.selection.selectOne(this);
// if (this.workingArea.allowEdit && this.assetData.GameMode === this.workingArea.canvasData.gameMode) {
// event.currentTarget.parent.data = event.data;
// event.currentTarget.parent.alpha = 0.5;
// event.currentTarget.parent.dragging = true;
// event.currentTarget.parent.dragPoint = event.data.getLocalPosition(event.currentTarget.parent.parent);
// event.currentTarget.parent.dragPoint.x -= event.currentTarget.parent.x;
// event.currentTarget.parent.dragPoint.y -= event.currentTarget.parent.y;
// }
// })
// .on('mouseup', event => {
// if (event.currentTarget.parent.dragging) {
// event.currentTarget.parent.alpha = 1;
// event.currentTarget.parent.dragging = false;
// event.currentTarget.parent.data = null;
// }
// })
// .on('mouseupoutside', event => {
// if (event.currentTarget.parent.dragging) {
// event.currentTarget.parent.alpha = 1;
// event.currentTarget.parent.dragging = false;
// event.currentTarget.parent.data = null;
// }
// })
// .on('mousemove', event => {
// if (event.currentTarget.parent.dragging) {
// const newPosition = event.currentTarget.parent.data.getLocalPosition(event.currentTarget.parent.parent);
// event.currentTarget.parent.x = newPosition.x - event.currentTarget.parent.dragPoint.x;
// event.currentTarget.parent.y = newPosition.y - event.currentTarget.parent.dragPoint.y;
// this.assetData.Point = new PIXI.Point(this.x, this.y);
// this.workingArea.canvasData.isChange = true;
// }
// })
// .on('rightclick', event => {
// });
// });
}
/**
*
@ -237,12 +236,12 @@ export class MultipointIcon extends PIXI.Container {
}
// 刷新数据
public refresh() {
console.log(this.assetData);
this.iconsTilingSprite.forEach(element => {
element.height = this.assetData.Thickness === 0 ? 32 : this.assetData.Thickness;
});
// console.log(this.assetData);
// this.iconsTilingSprite.forEach(element => {
// element.height = this.assetData.Thickness === 0 ? 32 : this.assetData.Thickness;
// });
this.text.text = this.assetData.Name
+ '\r\n'
+ this.assetData.PropertyInfos.find(item => item.PropertyName === '名称/编号')?.PropertyValue;
}
}
}

25
src/app/working-area/model/paintModel.ts

@ -2,11 +2,32 @@
*
*/
export enum PaintMode {
/**
*
*/
singlePointIcon,
/**
* 线
*/
lineIcon,
/**
*
*/
polygonIcon,
endPaint,
/**
*
*/
Pipeline,
/**
*
*/
endPaint,
/**
*
*/
Arrows,
Car
/**
*
*/
Car,
}

57
src/app/working-area/model/pipeline.ts

@ -1,57 +0,0 @@
import { WorkingAreaComponent } from '../working-area.component';
import * as PIXI from 'pixi.js';
/**
* 线
*/
export class Pipeline extends PIXI.Container {
public line: PIXI.Graphics = new PIXI.Graphics();
constructor(public assetData: any, private workingArea: WorkingAreaComponent) {
super();
this.name = this.assetData.Id;
this.x = this.assetData.Point.x;
this.y = this.assetData.Point.y;
this.workingArea.backgroundImage.addChild(this);
this.addChild(this.line);
// 画线图标
this.refresh();
this.interactive = true;
this.on('mousedown', event => {
console.log(this.assetData);
event.stopPropagation();
this.workingArea.selection.selectOne(this);
});
}
/**
*
*/
public refresh() {
this.line.clear();
this.line.lineStyle(5, 0x0000ff, 1);
for (let i = 0, count = this.assetData.MultiPoint.length; i < count; i++) {
const pointA = this.assetData.MultiPoint[i];
if (i === 0) {
this.line.moveTo(pointA.x, pointA.y);
} else {
this.line.lineTo(pointA.x, pointA.y);
if (i === count - 1) {
const pointB = this.assetData.MultiPoint[i - 1];
const angle = Math.atan2((pointA.y - pointB.y), (pointA.x - pointB.x)) * (180 / Math.PI) + 90;
this.line.beginFill(0x0000ff);
this.line.drawStar(pointA.x, pointA.y, 3, 5, 0, (Math.PI / 180 * angle));
} else {
this.line.drawCircle(pointA.x, pointA.y, 5);
}
}
}
this.line.endFill();
// if (this.assetData.MultiPoint.length >= 2) {
// const pointA = this.assetData.MultiPoint[this.assetData.MultiPoint.length - 2];
// const pointB = this.assetData.MultiPoint[this.assetData.MultiPoint.length - 1];
// const angle = Math.atan2((pointB.y - pointA.y), (pointB.x - pointA.x)) * (180 / Math.PI) + 90;
// this.beginFill(0x0000ff);
// this.drawStar(pointB.x, pointB.y, 3, 5, 0, (Math.PI / 180 * angle));
// this.endFill();
// }
}
}

124
src/app/working-area/model/polygonIcon.ts

@ -1,11 +1,13 @@
import { WorkingAreaComponent } from '../working-area.component';
import { GameMode } from './gameMode';
import * as PIXI from 'pixi.js';
import { PaintMode } from './paintModel';
import { AxShape } from './axShape';
/**
*
*/
export class PolygonIcon extends PIXI.Container {
export class PolygonIcon extends AxShape {
public pointsData: PIXI.Point[];
public pointsGraphics: PIXI.Graphics[] = [];
public polygonGraphics: PIXI.Graphics = new PIXI.Graphics();
@ -34,8 +36,8 @@ export class PolygonIcon extends PIXI.Container {
*
* @param points
*/
constructor(public assetData: any, private workingArea: WorkingAreaComponent) {
super();
constructor(assetData: any,workingArea: WorkingAreaComponent) {
super(assetData,workingArea);
this.name = this.assetData.Id;
this.x = this.assetData.Point.x;
this.y = this.assetData.Point.y;
@ -76,6 +78,7 @@ export class PolygonIcon extends PIXI.Container {
// 添加圆点事件
this.pointsGraphics.forEach((item, index, array) => {
item.interactive = true;
item.buttonMode = true;
item.zIndex = 1;
item.on('mousedown', event => {
event.stopPropagation();
@ -123,56 +126,79 @@ export class PolygonIcon extends PIXI.Container {
}
})
.on('rightclick', event => {
});
});
// 添加选中事件
this.polygonGraphics.interactive = true;
this.polygonGraphics
.on('mousedown', event => {
}) .on('mouseover', event => {
event.stopPropagation();
this.workingArea.selection.selectOne(this);
if (this.workingArea.allowEdit && this.assetData.GameMode === this.workingArea.canvasData.gameMode) {
event.currentTarget.parent.data = event.data;
event.currentTarget.parent.alpha = 0.5;
event.currentTarget.parent.dragging = true;
event.currentTarget.parent.dragPoint = event.data.getLocalPosition(event.currentTarget.parent.parent);
event.currentTarget.parent.dragPoint.x -= event.currentTarget.parent.x;
event.currentTarget.parent.dragPoint.y -= event.currentTarget.parent.y;
}
})
.on('mouseup', event => {
if (event.currentTarget.parent.dragging) {
event.currentTarget.parent.alpha = 1;
event.currentTarget.parent.dragging = false;
event.currentTarget.parent.data = null;
}
})
.on('mouseupoutside', event => {
if (event.currentTarget.parent.dragging) {
event.currentTarget.parent.alpha = 1;
event.currentTarget.parent.dragging = false;
event.currentTarget.parent.data = null;
if (this.workingArea.previewImage !== null
&& this.workingArea.getPaintMode() === PaintMode.singlePointIcon) {
this.workingArea.previewImage.visible = false;
}
})
.on('mousemove', event => {
if (event.currentTarget.parent.dragging) {
const newPosition = event.currentTarget.parent.data.getLocalPosition(event.currentTarget.parent.parent);
event.currentTarget.parent.x = newPosition.x - event.currentTarget.parent.dragPoint.x;
event.currentTarget.parent.y = newPosition.y - event.currentTarget.parent.dragPoint.y;
this.assetData.Point = new PIXI.Point(this.x, this.y);
this.workingArea.canvasData.isChange = true;
.on('mouseout', event => {
event.stopPropagation();
if (this.workingArea.previewImage !== null
&& this.workingArea.getPaintMode() === PaintMode.singlePointIcon) {
this.workingArea.previewImage.visible = true;
}
})
.on('rightclick', event => {
// this.workingArea.selection.deselectAll();
});
// // 缩放
// this.workingArea.on('backgroundScale', data => {
// const scale = 1 / data;
// this.text.scale.set(scale);
// });
});
// // 添加选中事件
// this.polygonGraphics.interactive = true;
// this.polygonGraphics.buttonMode = true;
// this.polygonGraphics
// .on('mousedown', event => {
// event.stopPropagation();
// this.workingArea.selection.selectOne(this);
// if (this.workingArea.allowEdit && this.assetData.GameMode === this.workingArea.canvasData.gameMode) {
// event.currentTarget.parent.data = event.data;
// event.currentTarget.parent.alpha = 0.5;
// event.currentTarget.parent.dragging = true;
// event.currentTarget.parent.dragPoint = event.data.getLocalPosition(event.currentTarget.parent.parent);
// event.currentTarget.parent.dragPoint.x -= event.currentTarget.parent.x;
// event.currentTarget.parent.dragPoint.y -= event.currentTarget.parent.y;
// }
// })
// .on('mouseup', event => {
// if (event.currentTarget.parent.dragging) {
// event.currentTarget.parent.alpha = 1;
// event.currentTarget.parent.dragging = false;
// event.currentTarget.parent.data = null;
// }
// })
// .on('mouseupoutside', event => {
// if (event.currentTarget.parent.dragging) {
// event.currentTarget.parent.alpha = 1;
// event.currentTarget.parent.dragging = false;
// event.currentTarget.parent.data = null;
// }
// })
// .on('mousemove', event => {
// if (event.currentTarget.parent.dragging) {
// const newPosition = event.currentTarget.parent.data.getLocalPosition(event.currentTarget.parent.parent);
// event.currentTarget.parent.x = newPosition.x - event.currentTarget.parent.dragPoint.x;
// event.currentTarget.parent.y = newPosition.y - event.currentTarget.parent.dragPoint.y;
// this.assetData.Point = new PIXI.Point(this.x, this.y);
// this.workingArea.canvasData.isChange = true;
// }
// })
// .on('rightclick', event => {
// // this.workingArea.selection.deselectAll();
// })
// .on('mouseover', event => {
// event.stopPropagation();
// if (this.workingArea.previewImage !== null
// && this.workingArea.getPaintMode() === PaintMode.singlePointIcon) {
// this.workingArea.previewImage.visible = false;
// }
// })
// .on('mouseout', event => {
// event.stopPropagation();
// if (this.workingArea.previewImage !== null
// && this.workingArea.getPaintMode() === PaintMode.singlePointIcon) {
// this.workingArea.previewImage.visible = true;
// }
// });
}
/**
*
@ -241,4 +267,4 @@ export class PolygonIcon extends PIXI.Container {
this.polygonGraphics.drawPolygon(this.getPoints());
this.polygonGraphics.endFill();
}
}
}

108
src/app/working-area/model/putCarArea.ts

@ -1,59 +1,59 @@
import { OldFilmFilter } from 'pixi-filters';
import { WorkingAreaComponent } from '../working-area.component';
import { PaintMode } from './paintModel';
import { SinglePointIcon } from './singlePointIcon';
import * as PIXI from 'pixi.js';
// import { OldFilmFilter } from 'pixi-filters';
// import { WorkingAreaComponent } from '../working-area.component';
// import { PaintMode } from './paintModel';
// import { SinglePointIcon } from './axImageShape';
// import * as PIXI from 'pixi.js';
/**
*
*/
export class PutCarArea extends PIXI.Container {
public polygonGraphics: PIXI.Graphics = new PIXI.Graphics();
constructor(public assetData: any, private workingArea: WorkingAreaComponent) {
super();
this.name = this.assetData.Id;
this.x = this.assetData.Point.x;
this.y = this.assetData.Point.y;
this.workingArea.backgroundImage.addChild(this);
this.sortableChildren = true;
// /**
// * 汽车放置区域
// */
// export class PutCarArea extends PIXI.Container {
// public polygonGraphics: PIXI.Graphics = new PIXI.Graphics();
// constructor(public assetData: any, private workingArea: WorkingAreaComponent) {
// super();
// this.name = this.assetData.Id;
// this.x = this.assetData.Point.x;
// this.y = this.assetData.Point.y;
// this.workingArea.backgroundImage.addChild(this);
// this.sortableChildren = true;
// 填充多边形
// // 填充多边形
const color: number = this.assetData.Color.substring(0, 7).replace('#', '0x');
const angle: number = parseInt(this.assetData.Color.substring(7), 16) / 255;
this.polygonGraphics.beginFill(color, angle);
this.polygonGraphics.drawPolygon(this.assetData.MultiPoint);
this.polygonGraphics.endFill();
this.addChild(this.polygonGraphics);
// 添加选中事件
this.polygonGraphics.interactive = true;
this.polygonGraphics
.on('pointerdown', (event) => {
if (this.workingArea.getPaintMode() === PaintMode.Car) {
this.workingArea.selectCar.Point =
new PIXI.Point(this.workingArea.previewSinglePointIcon.x, this.workingArea.previewSinglePointIcon.y);
this.workingArea.selectCar.Angle = this.assetData.Direction;
const car = new SinglePointIcon(this.workingArea.selectCar, this.workingArea);
this.workingArea.setPaintMode(PaintMode.endPaint);
}
})
.on('pointerup', (event) => {
// const color: number = this.assetData.Color.substring(0, 7).replace('#', '0x');
// const angle: number = parseInt(this.assetData.Color.substring(7), 16) / 255;
// this.polygonGraphics.beginFill(color, angle);
// this.polygonGraphics.drawPolygon(this.assetData.MultiPoint);
// this.polygonGraphics.endFill();
// this.addChild(this.polygonGraphics);
// // 添加选中事件
// this.polygonGraphics.interactive = true;
// this.polygonGraphics
// .on('pointerdown', (event) => {
// if (this.workingArea.getPaintMode() === PaintMode.Car) {
// this.workingArea.selectCar.Point =
// new PIXI.Point(this.workingArea.previewSinglePointIcon.x, this.workingArea.previewSinglePointIcon.y);
// this.workingArea.selectCar.Angle = this.assetData.Direction;
// const car = new SinglePointIcon(this.workingArea.selectCar, this.workingArea);
// this.workingArea.setPaintMode(PaintMode.endPaint);
// }
// })
// .on('pointerup', (event) => {
})
.on('pointerupoutside', (event) => {
// })
// .on('pointerupoutside', (event) => {
})
.on('pointerover', (event) => {
this.workingArea.previewSinglePointIcon.filters = null;
this.workingArea.previewSinglePointIcon.zIndex = this.zIndex + 1;
// 设置车辆方向
this.workingArea.previewSinglePointIcon.angle = this.assetData.Direction;
console.log(this.assetData.Name);
})
.on('pointerout', (event) => {
this.workingArea.previewSinglePointIcon.filters = [
new OldFilmFilter()
];
});
}
}
// })
// .on('pointerover', (event) => {
// this.workingArea.previewSinglePointIcon.filters = null;
// this.workingArea.previewSinglePointIcon.zIndex = this.zIndex + 1;
// // 设置车辆方向
// this.workingArea.previewSinglePointIcon.angle = this.assetData.Direction;
// console.log(this.assetData.Name);
// })
// .on('pointerout', (event) => {
// this.workingArea.previewSinglePointIcon.filters = [
// new OldFilmFilter()
// ];
// });
// }
// }

249
src/app/working-area/model/singlePointIcon.ts

@ -1,249 +0,0 @@
import { WorkingAreaComponent } from '../working-area.component';
import * as ObjectID from 'bson-objectid';
import { GameMode } from './gameMode';
import { Pipeline } from './pipeline';
import { PaintMode } from './paintModel';
import * as PIXI from 'pixi.js';
import { throwMatDialogContentAlreadyAttachedError } from '@angular/material/dialog';
/**
*
*/
export class SinglePointIcon extends PIXI.Container {
style = new PIXI.TextStyle({
fontFamily: 'Arial',
fontSize: 18,
fontStyle: 'normal',
fontWeight: 'bold',
fill: ['#000000'],
stroke: '#ffffff',
strokeThickness: 3,
dropShadow: true,
dropShadowColor: '#000000',
dropShadowBlur: 3,
dropShadowAngle: Math.PI / 6,
dropShadowDistance: 1,
wordWrap: false,
wordWrapWidth: 100,
});
public text = new PIXI.Text(this.assetData.Name
+ '\r\n'
+ this.assetData.PropertyInfos?.find(item => item.PropertyName === '名称/编号')?.PropertyValue, this.style);
/**
*
*/
public selectedPointTexture = PIXI.Texture.from('assets/images/handle-main.png');
private image = PIXI.Sprite.from(this.assetData.ImageUrl);
public graphics = new PIXI.Graphics();
public connectionPoint = new PIXI.Graphics();
// 显示连接点
public showConnectionPoint = false;
constructor(public assetData: any, private workingArea: WorkingAreaComponent) {
super();
this.workingArea.backgroundImage.addChild(this);
this.x = this.assetData.Point.x;
this.y = this.assetData.Point.y;
this.name = this.assetData.Id;
this.image.angle = this.assetData.Angle;
this.image.x = 0;
this.image.y = 0;
this.image.width = this.assetData.Width;
this.image.height = this.assetData.Height;
this.image.alpha = 1;
this.image.anchor.set(0.5);
this.image.interactive = true;
this.image
.on('mousedown', event => {
event.stopPropagation();
this.workingArea.selection.selectOne(this);
if (this.assetData.CanConnection && this.parent === this.workingArea.backgroundImage) {
if (this.workingArea.getPaintMode() === PaintMode.Pipeline) {
if (this.workingArea.paintingPipeline === null) {
this.workingArea.previewLineSegment.visible = true;
this.workingArea.currentClickPoint.position =
new PIXI.Point(this.workingArea.circleShadow.x, this.workingArea.circleShadow.y);
this.workingArea.paintPoints.push(new PIXI.Point(this.position.x, this.position.y));
const tempData = {
Id: ObjectID.default.generate(),
MultiPoint: JSON.parse(JSON.stringify(this.workingArea.paintPoints)),
Point: new PIXI.Point(0, 0),
Name: '管线',
LinkedObjects: [],
};
this.workingArea.paintingPipeline = new Pipeline(tempData, this.workingArea);
this.workingArea.paintingPipeline.assetData.LinkedObjects.push(this);
this.assetData.Pipelines.push(this.workingArea.paintingPipeline);
} else {
this.workingArea.previewLineSegment.visible = false;
this.workingArea.currentClickPoint.position =
new PIXI.Point(this.workingArea.circleShadow.x, this.workingArea.circleShadow.y);
this.workingArea.paintPoints.push(new PIXI.Point(this.position.x, this.position.y));
this.workingArea.paintingPipeline.assetData.MultiPoint =
JSON.parse(JSON.stringify(this.workingArea.paintPoints));
this.workingArea.paintingPipeline.assetData.LinkedObjects.push(this);
this.assetData.Pipelines.push(this.workingArea.paintingPipeline);
this.workingArea.paintingPipeline.refresh();
this.workingArea.paintingPipelineFinish();
}
}
}
// 如果链接对象不为空,禁止移动
if (this.workingArea.allowEdit && this.assetData.GameMode === this.workingArea.canvasData.gameMode) {
event.currentTarget.parent.data = event.data;
event.currentTarget.parent.alpha = 0.5;
event.currentTarget.parent.dragging = true;
}
})
.on('mouseup', event => {
if (event.currentTarget.parent.dragging) {
event.currentTarget.parent.alpha = 1;
event.currentTarget.parent.dragging = false;
event.currentTarget.parent.data = null;
}
})
.on('mouseupoutside', event => {
if (event.currentTarget.parent.dragging) {
event.currentTarget.parent.alpha = 1;
event.currentTarget.parent.dragging = false;
event.currentTarget.parent.data = null;
}
})
.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;
this.assetData.Point = new PIXI.Point(this.x, this.y);
this.workingArea.canvasData.isChange = true;
}
})
.on('rightclick', event => {
})
.on('mouseover', event => {
// this.connectionPoint.visible = true;
this.setSelectionBox(true);
})
.on('mouseout', event => {
// this.connectionPoint.visible = false;
this.setSelectionBox(false);
});
this.text.x = this.image.x;
this.text.y = this.image.y - this.image.height / 2;
this.text.anchor.set(0.5, 1);
if (this.assetData.GameMode === 2) {
this.text.visible = false;
}
this.connectionPoint.beginFill();
this.connectionPoint.drawCircle(0, 0, 5);
this.connectionPoint.endFill();
this.connectionPoint.visible = true;
this.connectionPoint.interactive = true;
this.connectionPoint
.on('mouseover', event => {
console.log('b');
this.graphics.lineStyle(2, 0x00EB00, 1);
this.graphics.drawRect(- this.connectionPoint.width / 2, - this.connectionPoint.width / 2,
this.connectionPoint.width, this.connectionPoint.width);
})
.on('mouseout', event => {
this.graphics.clear();
});
this.addChild(this.text);
this.addChild(this.image);
this.addChild(this.graphics);
// this.addChild(this.connectionPoint);
// // up
// const up = new PIXI.Sprite(this.selectedPointTexture);
// up.anchor.set(0.5);
// up.x = this.image.x;
// up.y = this.image.y - (this.image.height / 2);
// this.addChild(up);
// // up-left
// const upLeft = new PIXI.Sprite(this.selectedPointTexture);
// upLeft.anchor.set(0.5);
// upLeft.x = this.image.x - (this.image.width / 2);
// upLeft.y = this.image.y - (this.image.height / 2);
// this.addChild(upLeft);
// // up-right
// const upRight = new PIXI.Sprite(this.selectedPointTexture);
// upRight.anchor.set(0.5);
// upRight.x = this.image.x + (this.image.width / 2);
// upRight.y = this.image.y - (this.image.height / 2);
// this.addChild(upRight);
// // down
// const down = new PIXI.Sprite(this.selectedPointTexture);
// down.anchor.set(0.5);
// down.x = this.image.x;
// down.y = this.image.y + (this.image.height / 2);
// this.addChild(down);
// // down-left
// const downLeft = new PIXI.Sprite(this.selectedPointTexture);
// downLeft.anchor.set(0.5);
// downLeft.x = this.image.x - (this.image.width / 2);
// downLeft.y = this.image.y + (this.image.height / 2);
// this.addChild(downLeft);
// // down-right
// const downRight = new PIXI.Sprite(this.selectedPointTexture);
// downRight.anchor.set(0.5);
// downRight.x = this.image.x + (this.image.width / 2);
// downRight.y = this.image.y + (this.image.height / 2);
// this.addChild(downRight);
// // left
// const left = new PIXI.Sprite(this.selectedPointTexture);
// left.anchor.set(0.5);
// left.x = this.image.x - (this.image.width / 2);
// left.y = this.image.y;
// this.addChild(left);
// // right
// const right = new PIXI.Sprite(this.selectedPointTexture);
// right.anchor.set(0.5);
// right.x = this.image.x + (this.image.width / 2);
// right.y = this.image.y;
// this.addChild(right);
}
// 设置选择框
public setSelectionBox(b: boolean) {
if (b) {
this.graphics.lineStyle(2, 0x00EB00, 1);
this.graphics.drawRect(- this.image.width / 2, - this.image.height / 2, this.image.width, this.image.height);
} else {
this.graphics.clear();
}
}
// 设置名称
public setNameVisible(value: boolean, mode: GameMode) {
if (this.assetData.GameMode === mode) {
this.text.visible = value;
}
}
// 刷新
public refresh() {
this.image.width = this.assetData.Width;
this.image.height = this.assetData.Height;
this.image.angle = this.assetData.Angle;
this.text.text = this.assetData.Name
+ '\r\n'
+ this.assetData.PropertyInfos?.find(item => item.PropertyName === '名称/编号')?.PropertyValue;
this.text.x = this.image.x;
this.text.y = this.image.y - this.image.height / 2;
}
}

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

File diff suppressed because it is too large Load Diff

BIN
src/assets/images/h130.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Loading…
Cancel
Save