From a2b9feb23e215f9b3fe797d244ce5400fff4b39e Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Thu, 17 Jun 2021 17:06:05 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/pyhmap
---
widgets/profileAnalysis/Widget.js | 373 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 373 insertions(+), 0 deletions(-)
diff --git a/widgets/profileAnalysis/Widget.js b/widgets/profileAnalysis/Widget.js
new file mode 100644
index 0000000..602ea9f
--- /dev/null
+++ b/widgets/profileAnalysis/Widget.js
@@ -0,0 +1,373 @@
+define([
+ 'dojo/_base/declare',
+ 'dojo/_base/lang',
+ 'dojo/_base/array',
+ 'dojo/_base/html',
+ 'dojo/topic',
+ 'jimu/BaseWidget',
+],
+ function (declare,
+ lang,
+ array,
+ html,
+ topic,
+ BaseWidget
+ ) {
+ return declare([BaseWidget], {
+ baseClass: 'jimu-widget-profileAnalysis',
+ name: 'profileAnalysis',
+ flag: false,
+ startup: function () {
+ var that = this;
+ var viewer = that.map;
+ var scene = viewer.scene;
+ var URL_CONFIG = {
+ BINGMAP: "//dev.virtualearth.net"
+ // , BING_MAP_KEY: "AkOyUpgDCoz063AWW1WfHnxp5222UBdxLOp1XvRv0tuebQnr2S7UcZkiLgME7gX0"
+ // , SCENE_BIMBUILDING: "http://www.supermapol.com/realspace/services/3D-BIMbuilding/rest/realspace"
+ // , SCENE_CBD: "http://www.supermapol.com/realspace/services/3D-CBDCache20200416/rest/realspace"
+ // , SCENE_CHONGQING_TX: "http://www.supermapol.com/realspace/services/3D-CQmodel_wireframe_2000/rest/realspace"
+ // , SCENE_CLIP: "http://www.supermapol.com/realspace/services/3D-clip_fengbian/rest/realspace"
+ // , SCENE_FEATUREVALUE: "http://www.supermapol.com/realspace/services/3D-featureValue_building9/rest/realspace/datas/%E4%B9%9D%E5%8F%B7@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
+ // , SCENE_GTC_BUILDIBG: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/building_udb@building/config"
+ // , SCENE_GTC_FLOOR9: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E6%8B%89%E4%BD%8E%E6%A5%BC%E5%B1%82@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
+ // , SCENE_GTC_GROUND: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E5%9C%B0%E9%9D%A2/config"
+ // , SCENE_GTC_HILL: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E5%B1%B1/config"
+ // , SCENE_GTC_LB9: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E6%8B%89%E4%BD%8E%E6%A5%BC%E6%9D%BF@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
+ // , SCENE_GTC_LWALL9: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E6%8B%89%E4%BD%8E%E5%A2%99@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
+ // , SCENE_GTC_LWINDOW9: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E6%8B%89%E4%BD%8E%E7%AA%97@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
+ // , SCENE_GTC_UINSIDE: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E5%86%85%E9%83%A8%E7%BB%93%E6%9E%84@%E5%AE%A4%E5%86%85/config"
+ // , SCENE_GTC_UNIT9: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E5%90%88%E5%B9%B6%E5%90%8E@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
+ // , SCENE_GTC_UOUTSIDE: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E5%A4%96%E9%83%A8%E7%BB%93%E6%9E%84@%E5%AE%A4%E5%86%85/config"
+ // , SCENE_GTC_UWINDOW: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/U%E5%9E%8B%E5%BB%BA%E7%AD%91%E7%AA%97@%E5%AE%A4%E5%86%85/config"
+ // , SCENE_GTC_WALL9: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E5%90%88%E5%B9%B6%E5%89%8D%E5%A2%99@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
+ // , SCENE_GTC_WINDOW9: "http://www.supermapol.com/realspace/services/3D-data_all/rest/realspace/datas/%E5%90%88%E5%B9%B6%E5%89%8D%E6%A5%BC%E6%9D%BF@%E4%B9%9D%E5%8F%B7%E6%A5%BC/config"
+ // , SCENE_HISTOGRAM: "http://www.supermapol.com/realspace/services/3D-Histogram/rest/realspace"
+ // , SCENE_JINJIANG: "http://www.supermapol.com/realspace/services/3D-jinjiang/rest/realspace"
+ // , SCENE_MODELUPDATE: "http://www.supermapol.com/realspace/services/3D-MoXingGengXin/rest/realspace"
+ // , SCENE_MOVINGLIGHT: "http://www.supermapol.com/realspace/services/3D-BIMMoXing/rest/realspace"
+ // , SCENE_NIAOCHAO: "http://www.supermapol.com/realspace/services/3D-OlympicGreen20200416/rest/realspace"
+ // , SCENE_OLYMPIC: "http://www.supermapol.com/realspace/services/3D-Olympic/rest/realspace"
+ // , SCENE_OLYMPIC_GREEN: "http://www.supermapol.com/realspace/services/3D-SampleCodeForFan20200420/rest/realspace"
+ // , SCENE_OLYMPIC_NIGHT: "http://www.supermapol.com/realspace/services/3D-OlympicGreenNight/rest/realspace"
+ // , SCENE_POINTCLOUD: "http://www.supermapol.com/realspace/services/3D-cloud/rest/realspace"
+ // , SCENE_POLYLINEGROW_BUINDINGS: "http://www.supermapol.com/realspace/services/3D-buildings1122/rest/realspace"
+ // , SCENE_RECT: "http://www.supermapol.com/realspace/services/3D-Text01/rest/realspace"
+ // , SCENE_SGNS: "http://www.supermapol.com/realspace/services/3D-SGNS/rest/realspace"
+ // , SCENE_SICHUAN: "http://www.supermapol.com/realspace/services/3D-dixingyingxiang/rest/realspace"
+ // , SCENE_SRSB: "http://www.supermapol.com/realspace/services/3D-srsb/rest/realspace"
+ // , SCENE_SUOFEIYA: "http://www.supermapol.com/realspace/services/3D-suofeiya_church/rest/realspace"
+ // , SCENE_TISHUJU: "http://www.supermapol.com/realspace/services/3D-tishuju/rest/realspace"
+ // , SCENE_VOLUME_NEAREST: "http://www.supermapol.com/realspace/services/3D-compare/rest/realspace"
+ // , SCENE_WIREFRAME: "http://www.supermapol.com/realspace/services/3D-wireFrame/rest/realspace"
+ // , SCENE_WebGLCBD: "http://www.supermapol.com/realspace/services/3D-CBDCache20200416/rest/realspace"
+ // , SCENE_XGPARK: "http://www.supermapol.com/realspace/services/3D-yanmofenxi/rest/realspace"
+ // , SCP_BIM: "https://www.supermapol.com/realspace/services/3D-S3MData/rest/realspace/datas/T8H_NoLod/config"
+ , SCP_CBD_BRIDGE: "http://www.supermapol.com/realspace/services/3D-CBDCache20200416/rest/realspace/datas/Ground_qiao@CBD/config"
+ , SCP_CBD_BUILD: "http://www.supermapol.com/realspace/services/3D-CBD/rest/realspace/datas/Building@CBD/config"
+ , SCP_CBD_GROUND1: "http://www.supermapol.com/realspace/services/3D-CBDCache20200416/rest/realspace/datas/Ground_1@CBD/config"
+ // , SCP_CBD_GROUND2: "http://www.supermapol.com/realspace/services/3D-WebGLCBD/rest/realspace/datas/Ground_2@%E6%96%B0CBD/config"
+ , SCP_CBD_LAKE: "http://www.supermapol.com/realspace/services/3D-CBDCache20200416/rest/realspace/datas/Lake@CBD/config"
+ , SCP_CBD_ROAD: "http://www.supermapol.com/realspace/services/3D-CBDCache20200416/rest/realspace/datas/Ground_Daolu@CBD/config"
+ , SCP_CBD_TREE: "http://www.supermapol.com/realspace/services/3D-CBDCache20200416/rest/realspace/datas/Tree@CBD/config"
+ // , SCP_FCFH_DATA: "http://www.supermapol.com/realspace/services/data-FCFH_Shangdong/rest/data"
+ // , SCP_FCFH_QX: "http://www.supermapol.com/realspace/services/3D-FCFH_Shangdong/rest/realspace/datas/config/config"
+ // , SCP_FCFH_VECTOR_EXTRUDE: "http://www.supermapol.com/realspace/services/3D-individualHouse/rest/realspace/datas/%E4%B8%93%E9%A2%98%E6%88%B7%E5%9E%8B%E9%9D%A2_%E6%8B%89%E4%BC%B8/config"
+ // , SCP_HISTOGRAM1: "http://www.supermapol.com/realspace/services/3D-Histogram/rest/realspace/datas/Point2D_3000_5000/config"
+ // , SCP_HISTOGRAM2: "http://www.supermapol.com/realspace/services/3D-Histogram/rest/realspace/datas/Point2D_10000_max/config"
+ // , SCP_HISTOGRAM3: "http://www.supermapol.com/realspace/services/3D-Histogram/rest/realspace/datas/Point2D_min_1000/config"
+ // , SCP_HISTOGRAM4: "http://www.supermapol.com/realspace/services/3D-Histogram/rest/realspace/datas/Point2D_5000_10000/config"
+ // , SCP_HISTOGRAM5: "http://www.supermapol.com/realspace/services/3D-Histogram/rest/realspace/datas/Point2D_1000_3000/config"
+ // , SCP_JINJIANG: "http://www.supermapol.com/realspace/services/3D-jinjiang/rest/realspace/datas/jinjiang/config"
+ // , SCP_NIAOCHAO: "http://www.supermapol.com/realspace/services/3D-niaocao_water/rest/realspace/datas/%E9%B8%9F%E5%B7%A2%E4%BA%94%E6%9C%9F/config"
+ // , SCP_NIAOCHAO_WATER: "http://www.supermapol.com/realspace/services/3D-Olympic/rest/realspace/datas/NewDataset@water-caijian/config"
+ // , SCP_OLYMPIC_BILLBOARD: "http://www.supermapol.com/realspace/services/3D-WebGLOlympicGreen/rest/realspace/datas/BillBoard@OlympicGreen/config"
+ // , SCP_OLYMPIC_BUILD: "http://www.supermapol.com/realspace/services/3D-WebGLOlympicGreen/rest/realspace/datas/Building@OlympicGreen/config"
+ // , SCP_OLYMPIC_GROUND: "http://www.supermapol.com/realspace/services/3D-WebGLOlympicGreen/rest/realspace/datas/Ground@OlympicGreen/config"
+ // , SCP_OLYMPIC_TREE: "http://www.supermapol.com/realspace/services/3D-WebGLOlympicGreen/rest/realspace/datas/Tree@OlympicGreen/config"
+ // , SCP_OLYMPIC_WATER: "http://www.supermapol.com/realspace/services/3D-WebGLOlympicGreen/rest/realspace/datas/Waters@OlympicGreen/config"
+ // , SCP_PIPELINE: "https://www.supermapol.com/realspace/services/3D-pipeline_s3m/rest/realspace/datas/NetWork@Pipe3D/config"
+ // , SCP_POINTCLOUD: "http://www.supermapol.com/realspace/services/3D-cloud/rest/realspace/datas/POINTCLOUD23/config"
+ // , SCP_SGNS: "http://www.supermapol.com/realspace/services/3D-SGNS/rest/realspace/datas/siguniang/config"
+ // , SCP_SRSB: "http://www.supermapol.com/realspace/services/3D-srsb/rest/realspace/datas/srsb/config"
+ // , SCP_SRSB_WATER: "http://www.supermapol.com/realspace/services/3D-srsb/rest/realspace/datas/%E6%B0%B4%E9%9D%A2@vector/config"
+ // , SCP_SUOFEIYA: "http://www.supermapol.com/realspace/services/3D-suofeiya_church/rest/realspace/datas/Config/config"
+ // , SCP_VECTOR_LINE: "http://www.supermapol.com/realspace/services/3D-China/rest/realspace/datas/Line/config"
+ // , SCP_VECTOR_POLYGON: "http://www.supermapol.com/realspace/services/3D-China/rest/realspace/datas/%E4%B8%93%E9%A2%98%E5%9B%BE/config"
+ // , SCP_VECTOR_TEXT: "http://www.supermapol.com/realspace/services/3D-China/rest/realspace/datas/text/config"
+ // , SCP_WORLD_COUNTRY_VECTOR: "http://www.supermapol.com/realspace/services/3D-Countries-World2/rest/realspace/datas/Countries_1@World/config"
+ // , SCP_WORLD_COUNTRY_VECTOR2: " http://www.supermapol.com/realspace/services/3D-ShiJieGuoJiaBianJie/rest/realspace"
+ // , SCP_XGPARK: "http://www.supermapol.com/realspace/services/3D-yanmofenxi/rest/realspace/datas/sci_park/config"
+ // , STK: "https://www.supermapol.com/realspace/services/3D-stk_terrain/rest/realspace/datas/info/data/path"
+ // , SUPERMAP_IMG_MEC: "http://www.supermapol.com/realspace/services/map-China400/rest/maps/China400"
+ // , SUPERMAP_IMG_WGS: "http://www.supermapol.com/realspace/services/map-World/rest/maps/World_Google"
+ // , SiChuan_IMG: "http://www.supermapol.com/realspace/services/3D-dixingyingxiang/rest/realspace/datas/MosaicResult"
+ // , SiChuan_TERRAIN: "http://www.supermapol.com/realspace/services/3D-dixingyingxiang/rest/realspace/datas/DatasetDEM"
+ // , TDT_IMG: "https://[subdomain].tianditu.com/img_w/wmts"
+ // , TDT_LABEL: "https://[subdomain].tianditu.com/cia_w/wmts"
+ // , TENSE_IMG0: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0300@%E6%88%BF%E5%B1%B1"
+ // , TENSE_IMG1: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0310@%E6%88%BF%E5%B1%B1"
+ // , TENSE_IMG2: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0330@%E6%88%BF%E5%B1%B1"
+ // , TENSE_IMG3: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0340@%E6%88%BF%E5%B1%B1"
+ // , TENSE_IMG4: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0350@%E6%88%BF%E5%B1%B1"
+ // , TENSE_IMG5: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0400@%E6%88%BF%E5%B1%B1"
+ // , TENSE_IMG6: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0410@%E6%88%BF%E5%B1%B1"
+ // , TENSE_IMG7: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0420@%E6%88%BF%E5%B1%B1"
+ // , TENSE_IMG8: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0430@%E6%88%BF%E5%B1%B1"
+ // , TENSE_IMG9: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0440@%E6%88%BF%E5%B1%B1"
+ // , TENSE_IMG10: "http://www.supermapol.com/realspace/services/3D-HuanJingJianCe-2/rest/realspace/datas/rs0450@%E6%88%BF%E5%B1%B1"
+ // , TOKEN_TIANDITU: "4a00a1dc5387b8ed8adba3374bd87e5e"
+ // , ZF_IMG: "http://www.supermapol.com/realspace/services/3D-dxyx_ios2/rest/realspace/datas/MosaicResult_2@IMAGE_1"
+ // , ZF_IMG2: "http://www.supermapol.com/realspace/services/3D-ZF_normal/rest/realspace/datas/image"
+ // , ZF_TERRAIN: "http://www.supermapol.com/realspace/services/3D-dxyx_ios2/rest/realspace/datas/DatasetDEM_1@sichuanTer"
+ // , ZF_TERRAIN2: "http://www.supermapol.com/realspace/services/3D-ZF_normal/rest/realspace/datas/srtm_54_07@zhufeng"
+
+ }
+ scene.shadowMap.darkness = 1.275; //设置第二重烘焙纹理的效果(明暗程度)
+ scene.skyAtmosphere.brightnessShift = 0.4; //修改大气的亮度
+ scene.debugShowFramesPerSecond = false;
+ scene.hdrEnabled = false;
+ scene.sun.show = false;
+ // 01设置环境光的强度-新处理CBD场景
+ scene.lightSource.ambientLightColor = new Cesium.Color(0.65, 0.65, 0.65, 1);
+ // 添加光源
+ var position1 = new Cesium.Cartesian3.fromDegrees(116.261209157595, 39.3042238956531, 480);
+ //光源方向点
+
+ var targetPosition1 = new Cesium.Cartesian3.fromDegrees(116.261209157595, 39.3042238956531, 430);
+ var dirLightOptions = {
+ targetPosition: targetPosition1,
+ color: new Cesium.Color(1.0, 1.0, 1.0, 1),
+ intensity: 0.55
+ };
+ directionalLight_1 = new Cesium.DirectionalLight(position1, dirLightOptions);
+ scene.addLightSource(directionalLight_1);
+ $("#toolbar").show();
+ $('#loadingbar').remove();
+ if (!scene.pickPositionSupported) {
+ alert('不支持深度纹理,剖面分析功能无法使用!');
+ }
+ //创建剖面分析对象
+ var profile = new Cesium.Profile(scene);
+
+ function createTooltip(frameDiv) {//抄录createTooltip函数
+
+ var tooltip = function (frameDiv) {
+
+ var div = document.createElement('DIV');
+ div.className = "twipsy right";
+
+ var arrow = document.createElement('DIV');
+ arrow.className = "twipsy-arrow";
+ div.appendChild(arrow);
+
+ var title = document.createElement('DIV');
+ title.className = "twipsy-inner";
+ div.appendChild(title);
+
+ this._div = div;
+ this._title = title;
+ this.message = '';
+
+ // add to frame div and display coordinates
+ frameDiv.appendChild(div);
+ var that = this;
+ div.onmousemove = function (evt) {
+ that.showAt({ x: evt.clientX, y: evt.clientY }, that.message);
+ };
+ };
+
+ tooltip.prototype.setVisible = function (visible) {
+ this._div.style.display = visible ? 'block' : 'none';
+ };
+
+ tooltip.prototype.showAt = function (position, message) {
+ if (position && message) {
+ this.setVisible(true);
+ this._title.innerHTML = message;
+ this._div.style.left = position.x + 10 + "px";
+ this._div.style.top = (position.y - this._div.clientHeight / 2) + "px";
+ this.message = message;
+ }
+ };
+
+ return new tooltip(frameDiv);
+ }
+
+ var tooltip = createTooltip(document.body);
+ var widget = viewer.cesiumWidget;
+ try {
+ //添加S3M图层 // 舍弃
+
+ // var ground1Promise = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_GROUND1, {
+ // name: 'ground1'
+ // });
+ // var buildPromise = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BUILD, {
+ // name: 'build'
+ // });
+ // var lakePromise = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_LAKE, {
+ // name: 'lake'
+ // });
+ // var treePromise = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_TREE, {
+ // name: 'tree'
+ // });
+ // var roadPromise = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_ROAD, {
+ // name: 'road'
+ // });
+ // var bridgePromise = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BRIDGE, {
+ // name: 'bridge'
+ // });
+ // var promiseSet = [ground1Promise, buildPromise, lakePromise, treePromise, roadPromise, bridgePromise];
+ // Cesium.when.all(promiseSet, function (layer) {
+ // scene.camera.setView({ //图层加载完成,设置相机位置
+ // destination: Cesium.Cartesian3.fromDegrees(116.4473, 39.9011, 127),
+ // orientation: {
+ // heading: 0.2732,
+ // pitch: -0.1583,
+ // roll: 0
+ // }
+ // });
+ // for (var i = 0; i < layer.length; i++) {
+ // layer[i].selectEnabled = false;
+ // }
+ // }, function (e) {
+ // if (widget._showRenderLoopErrors) {
+ // var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?';
+ // widget.showErrorPanel(title, undefined, e);
+ // }
+ // });
+ var handlerLine = new Cesium.DrawHandler(viewer, Cesium.DrawMode.Line);
+ handlerLine.activeEvt.addEventListener(function (isActive) {
+ if (isActive == true) {
+ viewer.enableCursorStyle = false;
+ viewer._element.style.cursor = '';
+ $('body').removeClass('drawCur').addClass('drawCur');
+ } else {
+ viewer.enableCursorStyle = true;
+ $('body').removeClass('drawCur');
+ }
+ });
+ handlerLine.movingEvt.addEventListener(function (windowPosition) {
+ if (handlerLine.isDrawing) {
+ tooltip.showAt(windowPosition, '<p>右键单击结束绘制</p>');
+ } else {
+ tooltip.showAt(windowPosition, '<p>点击绘制第一个点</p>');
+ }
+
+ });
+ var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
+
+ handlerLine.drawEvt.addEventListener(function (result) {
+ tooltip.setVisible(false);
+ var line = result.object;
+ var startPoint = line._positions[0];
+ var endPoint = line._positions[line._positions.length - 1];
+
+ var scartographic = Cesium.Cartographic.fromCartesian(startPoint);
+ var slongitude = Cesium.Math.toDegrees(scartographic.longitude);
+ var slatitude = Cesium.Math.toDegrees(scartographic.latitude);
+ var sheight = scartographic.height;
+
+ var ecartographic = Cesium.Cartographic.fromCartesian(endPoint);
+ var elongitude = Cesium.Math.toDegrees(ecartographic.longitude);
+ var elatitude = Cesium.Math.toDegrees(ecartographic.latitude);
+ var eheight = ecartographic.height;
+
+ //设置坡面分析的开始和结束位置
+ profile.startPoint = [slongitude, slatitude, sheight];
+ profile.endPoint = [elongitude, elatitude, eheight];
+
+ profile.extendHeight = 40;
+
+ //分析完毕的回调函数
+ profile.getBuffer(function (buffer) {
+
+ var canvas = document.getElementById("pro");
+ canvas.height = profile._textureHeight;
+ canvas.width = profile._textureWidth;
+ var ctx = canvas.getContext("2d");
+ var imgData = ctx.createImageData(profile._textureWidth, profile._textureHeight);
+ imgData.data.set(buffer);
+ //在canvas上绘制图片
+ ctx.putImageData(imgData, 0, 0);
+ $("#pro").width(600);
+ $("#pro").height(450);
+ });
+
+ profile.build();
+ });
+
+ document.getElementById("chooseViews").onclick = function () {
+ //先清除之前绘制的线
+ console.log('kais')
+ handlerLine.clear();
+ $("#pro").width(0);
+ $("#pro").height(0);
+ if (handlerLine.active) {
+ return;
+ } else {
+ handlerLine.activate();
+ //由于剖面分析只能绘制直线,此处绘制时单击两次就触发结束事件
+ handler.setInputAction(function (e) {
+ if (handlerLine.polyline._actualPositions.length == 2) {
+ var result = {};
+ result.object = handlerLine.polyline;
+ handlerLine.drawEvt.raiseEvent(result);
+ handlerLine.deactivate();
+ handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
+ }
+ }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
+ }
+
+ };
+ document.getElementById("clears").onclick = function () {
+ handlerLine.clear();
+ $("#pro").width(0);
+ $("#pro").height(0);
+ }
+
+ } catch (e) {
+ // if (scene.context.depthTexture) {
+ // swal("剖面分析", "该浏览器不支持深度纹理检测", "warning");
+ // }
+ console.log(e)
+ }
+
+ $('.jimu-widget-profileAnalysis').find(".closes").click(function () {
+ $(".jimu-widget-profileAnalysis").hide();
+ handlerLine.clear();
+ $("#pro").width(0);
+ $("#pro").height(0);
+ })
+
+ },
+
+ onOpen: function () {
+
+ },
+
+ onClose: function () {
+ //面板关闭的时候触发 (when this panel is closed trigger)
+ },
+
+ onMinimize: function () {
+ this.resize();
+ },
+
+ onMaximize: function () {
+ this.resize();
+ },
+
+ resize: function () {
+
+ },
+
+ destroy: function () {
+ //销毁的时候触发
+ //todo
+ //do something before this func
+ this.inherited(arguments);
+ }
+
+ });
+ });
--
Gitblit v1.9.3