Browse Source

[完善]平面图引入gis完善

zhuzhou
邵佳豪 4 years ago
parent
commit
30781da4cf
  1. 112
      src/app/ui/collection-tools-plan/collection-tools.component.ts
  2. 4
      src/app/ui/collection-tools-plan/leftFunctionalDomain.ts
  3. 6
      src/app/working-area/working-area.component.ts

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

@ -231,17 +231,17 @@ export class CollectionToolsPlanComponent implements OnInit {
assetWidthIunput() {
this.canvasAssetObj.Width = this.assetWidth
this.canvasData.isChange = true
if(!this.isGis){
if (!this.isGis) {
this.canvas.refreshIcon(this.canvasAssetObj.Id)
}
}
//素材高度输入框改变
assetHeightIunput() {
this.canvasAssetObj.Height = this.assetHeight
this.canvasData.isChange = true
if(!this.isGis){
if (!this.isGis) {
this.canvas.refreshIcon(this.canvasAssetObj.Id)
}
}
@ -250,7 +250,7 @@ export class CollectionToolsPlanComponent implements OnInit {
assetAngleIunput() {
this.canvasAssetObj.Angle = this.sliderValue
this.canvasData.isChange = true
if(!this.isGis){
if (!this.isGis) {
this.canvas.refreshIcon(this.canvasAssetObj.Id)
}
}
@ -259,7 +259,7 @@ export class CollectionToolsPlanComponent implements OnInit {
assetThicknessIunput() {
this.canvasAssetObj.Thickness = this.sliderValueThickness
this.canvasData.isChange = true
if(!this.isGis){
if (!this.isGis) {
this.canvas.refreshIcon(this.canvasAssetObj.Id)
}
}
@ -286,7 +286,7 @@ export class CollectionToolsPlanComponent implements OnInit {
}
this.canvasAssetObj.PropertyInfos[index].PropertyValue = e.target.value
this.canvasData.isChange = true
if(!this.isGis){
if (!this.isGis) {
this.canvas.refreshIcon(this.canvasAssetObj.Id)
}
}
@ -308,7 +308,7 @@ export class CollectionToolsPlanComponent implements OnInit {
this.selectedcolor = item + this.selectedcolor.substring(this.selectedcolor.length - 2)
this.canvasAssetObj.Color = this.selectedcolor
this.canvasData.isChange = true
if(!this.isGis){
if (!this.isGis) {
this.canvas.refreshIcon(this.canvasAssetObj.Id)
}
}
@ -324,7 +324,7 @@ export class CollectionToolsPlanComponent implements OnInit {
this.selectedcolor = replacepos(this.selectedcolor, 7, 8, colorOpacity.toString(16))
this.canvasAssetObj.Color = this.selectedcolor
this.canvasData.isChange = true
if(!this.isGis){
if (!this.isGis) {
this.canvas.refreshIcon(this.canvasAssetObj.Id)
}
}
@ -789,7 +789,6 @@ export class CollectionToolsPlanComponent implements OnInit {
});
}
}
if ((new Set(adjoinArr)).size != adjoinArr.length) {
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
@ -800,6 +799,21 @@ export class CollectionToolsPlanComponent implements OnInit {
} else {
//如果是单位 总平面图
if (this.checkedBuildingIndex == -1) {
if(this.isGis){
let data = JSON.parse(JSON.stringify(this.selectingSitePlan))
data.zoomLevel = this.map.getZoom(),
data.defaultCenter = {x:this.map.getCenter().lng,y:this.map.getCenter().lat}
delete data.userId
delete data.userName
delete data.sitePlanDataInfo
console.log('gisselectingSitePlan',this.selectingSitePlan)
this.http.put(`/api/SitePlans/${this.selectingSitePlan.id}`,data).subscribe(data=>{
console.log('保存中心点成功')
})
}
//保存平面图数据
this.http.post("/api/SitePlanData", SitePlanData, {
params: {
@ -1391,12 +1405,20 @@ export class CollectionToolsPlanComponent implements OnInit {
}
map: any
toLoadGis() {
console.log(666666,this.selectingSitePlan)
console.log(666666, this.selectingSitePlan)
this.map = new AMap.Map('planContainer', {
viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D',
zoom: 11, //初始化地图层级
});
this.map.setCity('上海市');
if(this.selectingSitePlan.defaultCenter){
console.log('设置了吗')
this.map.setZoom(this.selectingSitePlan.zoomLevel); //设置地图层级
this.map.setCenter([this.selectingSitePlan.defaultCenter.x, this.selectingSitePlan.defaultCenter.y])
}else{
this.map.setCity('上海市');
}
this.map.on('click', (e) => {
this.showInfoClick(e)
});
@ -1405,18 +1427,18 @@ export class CollectionToolsPlanComponent implements OnInit {
if (Object.prototype.hasOwnProperty.call(this.canvasData.originaleveryStoreyData.data, key)) {
const element = this.canvasData.originaleveryStoreyData.data[key];
let editable = sessionStorage.getItem('editable')
let markerContent
if(editable == '1') {
let markerContent
if (editable == '1') {
markerContent = '' +
'<div class="custom-content-marker" id="xxxx">' +
`<img src="${element.ImageUrl}">` +
`<div class="close-btn" onclick='deleteMarker()'>X</div>` +
'</div>';
}else{
'<div class="custom-content-marker" id="xxxx">' +
`<img src="${element.ImageUrl}">` +
`<div class="close-btn" onclick='deleteMarker()'>X</div>` +
'</div>';
} else {
markerContent = '' +
'<div class="custom-content-marker" id="xxxx">' +
`<img src="${element.ImageUrl}">` +
'</div>';
'<div class="custom-content-marker" id="xxxx">' +
`<img src="${element.ImageUrl}">` +
'</div>';
}
// 将 icon 传入 marker
@ -1690,7 +1712,7 @@ export class CollectionToolsPlanComponent implements OnInit {
isBuilding: this.checkedBuildingIndex == -1 ? false : true,
Panel: this.beforeOneCheckedBuilding,
buildingData: e,
isGis:this.isGis
isGis: this.isGis
}
let dialogRef = this.dialog.open(editPlaneFigureComponentPlan, { disableClose: true, hasBackdrop: false, position: { left: '150px', top: '200px' }, data });
dialogRef.keydownEvents().subscribe(data => {
@ -1895,13 +1917,13 @@ export class CollectionToolsPlanComponent implements OnInit {
//保存建筑数据
let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData));
CompanyData.data = JSON.stringify(CompanyData.data)
this.http.post("/api/CompanyData", CompanyData, {params: {companyId: this.params.companyId}}).subscribe(data => {
this.http.post("/api/CompanyData", CompanyData, { params: { companyId: this.params.companyId } }).subscribe(data => {
list.push(1)
if (list.length === 4) { this.updateCurrentFloor() }
})
//批量保存单位毗邻
let CompanyAdjoins = this.canvasData.getCompanyAdjoinInfo()
this.http.post("/api/CompanyAdjoins/Batch", CompanyAdjoins, {params:{companyId: this.params.companyId}}).subscribe(data => {
this.http.post("/api/CompanyAdjoins/Batch", CompanyAdjoins, { params: { companyId: this.params.companyId } }).subscribe(data => {
list.push(1)
if (list.length === 4) { this.updateCurrentFloor() }
}, err => {
@ -1916,13 +1938,13 @@ export class CollectionToolsPlanComponent implements OnInit {
})
//批量保存单位重点部位
let CompanyImportantLocations = this.canvasData.getCompanyImportantLocations()
this.http.post("/api/CompanyImportantLocations/Batch", CompanyImportantLocations, {params:{companyId: this.params.companyId}}).subscribe(data => {
this.http.post("/api/CompanyImportantLocations/Batch", CompanyImportantLocations, { params: { companyId: this.params.companyId } }).subscribe(data => {
list.push(1)
if (list.length === 4) { this.updateCurrentFloor() }
})
//批量保存单位消防设施素材
let CompanyFacilityAssets = this.canvasData.getAllCompanyFacilityAssetInfo()
this.http.post("/api/CompanyFacilityAssets/Batch", CompanyFacilityAssets, {params: {companyId: this.params.companyId}}).subscribe(data => {
this.http.post("/api/CompanyFacilityAssets/Batch", CompanyFacilityAssets, { params: { companyId: this.params.companyId } }).subscribe(data => {
list.push(1)
if (list.length === 4) { this.updateCurrentFloor() }
})
@ -1951,7 +1973,7 @@ export class CollectionToolsPlanComponent implements OnInit {
//建筑数据
let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData));
CompanyData.data = JSON.stringify(CompanyData.data)
this.http.post("/api/BuildingData", CompanyData, {params: { companyId: this.params.companyId}}).subscribe(data => {
this.http.post("/api/BuildingData", CompanyData, { params: { companyId: this.params.companyId } }).subscribe(data => {
list.push(1)
if (list.length === 4) { this.updateCurrentFloor() }
})
@ -1995,15 +2017,15 @@ export class CollectionToolsPlanComponent implements OnInit {
let planData = this.getSitePlanCompanyData() //获取 单位 数据
this.http.get('/api/SitePlans', { params: this.params }).subscribe(data => {
this.sitePlanData = data
this.selectingSitePlan = this.sitePlanData[this.sitePlanData.length-1] || {}
this.canvasData.selectStorey = this.sitePlanData[this.sitePlanData.length-1] || {} //服务中 存一份数据
this.selectSitePlanIndex = this.sitePlanData.length-1
this.selectingSitePlan = this.sitePlanData[this.sitePlanData.length - 1] || {}
this.canvasData.selectStorey = this.sitePlanData[this.sitePlanData.length - 1] || {} //服务中 存一份数据
this.selectSitePlanIndex = this.sitePlanData.length - 1
Promise.all([fireData, planData]).then((res) => {
this.getSitePlanStorey(this.selectingSitePlan) //获取 平面图 楼层数据
this.maskLayerService.sendMessage(false)
})
}) //重新加载 新楼层
} else { //楼层/区域
let params = { buildingId: this.beforeOneCheckedBuilding.id }
@ -2011,10 +2033,10 @@ export class CollectionToolsPlanComponent implements OnInit {
let planData = this.getBuildingData(params) //获取 建筑 数据
this.http.get('/api/BuildingAreas', { params }).subscribe(data => {
this.sitePlanData = data
this.selectingSitePlan = this.sitePlanData[this.sitePlanData.length-1] || {}
this.canvasData.selectStorey = this.sitePlanData[this.sitePlanData.length-1] || {} //服务中 存一份数据
this.selectSitePlanIndex = this.sitePlanData.length-1
this.selectingSitePlan = this.sitePlanData[this.sitePlanData.length - 1] || {}
this.canvasData.selectStorey = this.sitePlanData[this.sitePlanData.length - 1] || {} //服务中 存一份数据
this.selectSitePlanIndex = this.sitePlanData.length - 1
Promise.all([fireData, planData]).then((res) => {
this.getBuildingStorey(this.selectingSitePlan) //获取 建筑 楼层数据
this.maskLayerService.sendMessage(false)
@ -2031,13 +2053,13 @@ export class CollectionToolsPlanComponent implements OnInit {
let fileSize = file.size || null //上传文件的总大小
let maxSize = 5 * 1024 * 1024 //5MB一个分片
let tenSize = 10 * 1024 * 1024 //10MB限制
    if (file && file.name.toLowerCase().indexOf('png') == -1 && file.name.toLowerCase().indexOf('jpg') == -1 && file.name.toLowerCase().indexOf('jpeg') == -1) {
      const config = new MatSnackBarConfig();
      config.verticalPosition = 'top';
      config.duration = 3000
      this.snackBar.open('请上传图片后缀为png,jpg,jpeg的文件', '确定', config);
      return
   }
if (file && file.name.toLowerCase().indexOf('png') == -1 && file.name.toLowerCase().indexOf('jpg') == -1 && file.name.toLowerCase().indexOf('jpeg') == -1) {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请上传图片后缀为png,jpg,jpeg的文件', '确定', config);
return
}
if (file && fileSize <= maxSize) { //上传文件<=5MB时
let formData = new FormData()
@ -2174,7 +2196,7 @@ export class CollectionToolsPlanComponent implements OnInit {
selectImg(item, items, index) {
//如果是gis
this.selectLibrary = item.name
this.selectImage = JSON.parse(JSON.stringify(items))
this.selectImage = JSON.parse(JSON.stringify(items))
// console.log('选中图片',this.selectImage)
this.selectImageIndex = index
if (this.isGis) {
@ -2244,7 +2266,7 @@ export class CollectionToolsPlanComponent implements OnInit {
//将marker点添加
this.planDataMarkers.push(startMarker)
this.map.add(startMarker);
}

4
src/app/ui/collection-tools-plan/leftFunctionalDomain.ts

@ -292,7 +292,9 @@ export class editPlaneFigureComponentPlan implements OnInit {
details:e.details,
enabled: this.data.buildingData.enabled,
modifiedTime: new Date(),
isGis: this.data.isGis
isGis: this.data.isGis,
zoomLevel:this.data.buildingData.zoomLevel,
defaultCenter:this.data.buildingData.defaultCenter
}
this.http.put(`/api/SitePlans/${this.data.buildingData.id}`,data).subscribe(data=>{
this.dialogRef.close('总平面图');

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

@ -641,9 +641,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
*
*/
public resetCanvas() {
console.log(this.init)
this.app.renderer.resize(this.content.nativeElement.clientWidth, this.content.nativeElement.clientHeight);
if(!this.init.isGis){
this.app.renderer.resize(this.content.nativeElement.clientWidth, this.content.nativeElement.clientHeight);
}
}
/**
*

Loading…
Cancel
Save