|
|
|
@ -18,7 +18,7 @@ import { MaskLayerService } from 'src/app/mask-layer.service';
|
|
|
|
|
import * as ObjectID from 'bson-objectid'; |
|
|
|
|
import { AxMessageSystem } from 'src/app/working-area/model/axMessageSystem'; |
|
|
|
|
declare var AMap: any |
|
|
|
|
|
|
|
|
|
declare var html2canvas: any; |
|
|
|
|
declare global { |
|
|
|
|
interface Window { |
|
|
|
|
deleteMarker: any; |
|
|
|
@ -721,6 +721,34 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
takeScreenshot() { |
|
|
|
|
this.canvas.takeScreenshot(); |
|
|
|
|
} |
|
|
|
|
canvasImg |
|
|
|
|
takeScreenshotGis() { |
|
|
|
|
// console.log(666666, this.selectingSitePlan)
|
|
|
|
|
// 使用html2canvas插件,将数据源中的数据转换成画布。
|
|
|
|
|
html2canvas(document.querySelector("#planContainer"), { |
|
|
|
|
useCORS: true, // 【重要】开启跨域配置,
|
|
|
|
|
allowTaint: true,//允许跨域图片
|
|
|
|
|
taintTest: false,//是否在渲染前测试图片
|
|
|
|
|
onrendered: function (canvas) { |
|
|
|
|
var dataUrl = canvas.toDataURL("image/png"); |
|
|
|
|
} |
|
|
|
|
}).then(canvas => { |
|
|
|
|
// 修改生成的宽度
|
|
|
|
|
this.canvasImg = canvas.toDataURL("image/png"); |
|
|
|
|
// console.log(this.canvasImg)
|
|
|
|
|
}).then(() => { |
|
|
|
|
this.downloadFile(this.selectingSitePlan.name, this.canvasImg); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
downloadFile(filename, content) { |
|
|
|
|
var base64Img = content; |
|
|
|
|
var oA = document.createElement('a'); |
|
|
|
|
oA.href = base64Img; |
|
|
|
|
oA.download = filename; |
|
|
|
|
var event = document.createEvent('MouseEvents'); |
|
|
|
|
event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); |
|
|
|
|
oA.dispatchEvent(event); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
isMultiSelect: boolean = false; // 多选/单选 切换
|
|
|
|
|
changeMultiSelect(e) { this.canvas.setMulitSelect(this.isMultiSelect) } |
|
|
|
@ -1413,11 +1441,14 @@ 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, //初始化地图层级
|
|
|
|
|
WebGLParams: { |
|
|
|
|
preserveDrawingBuffer: true |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
if (this.selectingSitePlan.defaultCenter) { |
|
|
|
|
this.map.setZoom(this.selectingSitePlan.zoomLevel); //设置地图层级
|
|
|
|
@ -2552,14 +2583,14 @@ export class CollectionToolsPlanComponent implements OnInit {
|
|
|
|
|
}) //get
|
|
|
|
|
} else { //建筑时
|
|
|
|
|
console.log('走了2') |
|
|
|
|
console.log('allBuildings',this.allBuildings) |
|
|
|
|
console.log('paramsData',paramsData) |
|
|
|
|
console.log('allBuildings', this.allBuildings) |
|
|
|
|
console.log('paramsData', paramsData) |
|
|
|
|
this.beforeOneCheckedBuilding = this.allBuildings[paramsData.buildingIndex] |
|
|
|
|
let params = { buildingId: this.beforeOneCheckedBuilding.id } |
|
|
|
|
let fireData = this.getFireElements(this.beforeOneCheckedBuilding.buildingTypes[0].id || '') //获取建筑下 消防要素
|
|
|
|
|
let planData = this.getBuildingData(params) //获取 建筑 数据
|
|
|
|
|
this.http.get('/api/BuildingAreas', { params }).subscribe(data => { |
|
|
|
|
console.log('BuildingAreas',data) |
|
|
|
|
console.log('BuildingAreas', data) |
|
|
|
|
this.sitePlanData = data |
|
|
|
|
let index = this.sitePlanData.findIndex(item => { return item.id === paramsData.storeyId }) |
|
|
|
|
this.selectingSitePlan = this.sitePlanData[index] || {} |
|
|
|
|