| | |
| | | squareOjb: [], |
| | | topTools(res) { |
| | | // this.clearTopTools(); |
| | | if (res.id == this.toolFlag) { |
| | | this.toolFlag = null; |
| | | return; |
| | | } |
| | | // if (res.id == this.toolFlag) { |
| | | // this.toolFlag = null; |
| | | // return; |
| | | // } |
| | | this.toolFlag = res.id; |
| | | switch (res.id) { |
| | | case "a2": //点漫游 |
| | |
| | | this.createSimpleGraphic("rectangle"); |
| | | break; |
| | | case "c6": //多边形 |
| | | this.createSimpleGraphic("polyhedron"); |
| | | this.createSimpleGraphic("polygon"); |
| | | break; |
| | | case "d2"://等高线分析 |
| | | break |
| | | case "d3"://坡度分析 |
| | | break |
| | | case "d4": //土方量计算 |
| | | this.Volumetric(); |
| | | break; |
| | | case "d5": //影像对比 |
| | | this.CurtainContrast(); |
| | | break; |
| | | case "e1"://快照 |
| | | this.snapshot(); |
| | | break; |
| | | case "g1": //坐标定位 |
| | | this.Coordposition(); |
| | | break; |
| | | } |
| | | }, |
| | | snapshot() { |
| | | let canvas = window.Viewer.scene.canvas; |
| | | let image = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream"); |
| | | let link = document.createElement("a"); |
| | | let blob = this.dataURLtoBlob(image); |
| | | let objurl = URL.createObjectURL(blob); |
| | | link.download = "scene.png"; |
| | | link.href = objurl; |
| | | link.click(); |
| | | |
| | | }, |
| | | dataURLtoBlob(dataurl) { |
| | | let arr = dataurl.split(','), |
| | | mime = arr[0].match(/:(.*?);/)[1], |
| | | bstr = atob(arr[1]), |
| | | n = bstr.length, |
| | | u8arr = new Uint8Array(n); |
| | | while (n--) { |
| | | u8arr[n] = bstr.charCodeAt(n); |
| | | } |
| | | return new Blob([u8arr], { type: mime }); |
| | | |
| | | }, |
| | | leftTools(res) { |
| | | this.clearLeftTools(res); |
| | | |
| | |
| | | this.squareOjb.push(e); |
| | | // earthCtrl.Creator.SimpleGraphic.clear(); |
| | | Viewer.entities.remove(entity); |
| | | debugger |
| | | |
| | | window.functionForJs({ |
| | | type: 'exportMap', |
| | | value: true |
| | |
| | | }, |
| | | // 创建图形 |
| | | createSimpleGraphic(type, scene) { |
| | | earthCtrl.Creator.createSimpleGraphic(type, {}, (entity) => { |
| | | |
| | | sgworld.Creator.createSimpleGraphic(type, {}, (entity) => { |
| | | if (scene === "square") { |
| | | this.createRectangle(entity); |
| | | } |
| | |
| | | }, |
| | | //平面面积 |
| | | planeDistance() { |
| | | earthCtrl.analysis.getPlaneArea(function (e) { }); |
| | | // earthCtrl.analysis.getPlaneArea(function (e) { }); |
| | | var colorAll = { |
| | | point: Cesium.Color.fromCssColorString("#ff0000"), |
| | | polyline: Cesium.Color.fromCssColorString("#ffff0050"), |
| | | polygon: Cesium.Color.fromCssColorString("#ffff0050"), |
| | | }; |
| | | sgworld.Analysis.planeArea(colorAll, () => { |
| | | }); |
| | | |
| | | }, |
| | | //表面距离 |
| | | surfaceDistance() { |
| | | earthCtrl.analysis.getDistanceHorizontal(function (e) { |
| | | console.info(e); |
| | | // earthCtrl.analysis.getDistanceHorizontal(function (e) { |
| | | // console.info(e); |
| | | // }); |
| | | var colorAll = { |
| | | point: Cesium.Color.fromCssColorString("#ff0000"), |
| | | polyline: Cesium.Color.fromCssColorString("#ffff0050"), |
| | | polygon: Cesium.Color.fromCssColorString("#ffff0050"), |
| | | }; |
| | | sgworld.Analysis.horizontalDistance(colorAll, () => { |
| | | }); |
| | | }, |
| | | //点漫游 |