Merge branch 'master' of http://192.168.0.105:10010/r/pyhmap
8 files modified
7 files added
| | |
| | | { |
| | | "name": "通视分析", |
| | | "uri": "widgets/throughSee/Widget" |
| | | }, |
| | | { |
| | | "name": "平面裁剪", |
| | | "uri": "widgets/clippingPlanes/Widget" |
| | | } |
| | | ], |
| | | "groups": [], |
| | |
| | | that[item.id] = scene.open(host + partOfUrl, undefined, { |
| | | autoSetView: false //不自动定位 |
| | | }); |
| | | console.log(222) |
| | | // console.log(222) |
| | | topic.publish('appendTilt', 'Layermanagement', item); |
| | | topic.publish('appendTiltS', 'spatialAnalysis', item); |
| | | topic.publish('addLayersLegends', 'legends', item); |
| | |
| | | destination: rectangle |
| | | }); |
| | | }); |
| | | console.log(444) |
| | | // console.log(444) |
| | | topic.publish('appendItem', 'Layermanagement', item, that[item.id]); |
| | | topic.publish('appendItemS', 'spatialAnalysis', item, that[item.id]); |
| | | topic.publish('addLayersLegends', 'legends', item); |
| | |
| | | that[obj.data.id] = scene.open(host + partOfUrl, undefined, { |
| | | autoSetView: false //不自动定位 |
| | | }); |
| | | console.log(333) |
| | | // console.log(333) |
| | | topic.publish('appendTilt', 'Layermanagement', obj.data); |
| | | topic.publish('appendTiltS', 'spatialAnalysis', obj.data); |
| | | topic.publish('addLayersLegends', 'legends', obj.data); |
| | |
| | | destination: rectangle |
| | | }); |
| | | }); |
| | | console.log(555) |
| | | // console.log(555) |
| | | topic.publish('appendItem', 'Layermanagement', obj.data, that[obj.data.id]); |
| | | topic.publish('appendItemS', 'spatialAnalysis', obj.data, that[obj.data.id]); |
| | | topic.publish('addLayersLegends', 'legends', obj.data); |
| New file |
| | |
| | | <div> |
| | | <div id='loadingbar' class="spinner"> |
| | | <div class="spinner-container container1"> |
| | | <div class="circle1"></div> |
| | | <div class="circle2"></div> |
| | | <div class="circle3"></div> |
| | | <div class="circle4"></div> |
| | | </div> |
| | | <div class="spinner-container container2"> |
| | | <div class="circle1"></div> |
| | | <div class="circle2"></div> |
| | | <div class="circle3"></div> |
| | | <div class="circle4"></div> |
| | | </div> |
| | | <div class="spinner-container container3"> |
| | | <div class="circle1"></div> |
| | | <div class="circle2"></div> |
| | | <div class="circle3"></div> |
| | | <div class="circle4"></div> |
| | | </div> |
| | | </div> |
| | | <div id="toolbarclippingPlanes" class="param-container tool-bar"> |
| | | <button type="button" id="polygonclippingPlanes" class="button black">绘制裁剪面</button> |
| | | <button type="button" id="clearclippingPlanes" class="button black">清除</button> |
| | | </div> |
| | | <i class="layui-icon closeOUR"> |
| | | ဆ |
| | | </i></span> |
| | | </div> |
| New file |
| | |
| | | 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-clippingPlanes', |
| | | name: 'clippingPlanes', |
| | | flag: false, |
| | | startup: function () { |
| | | var that = this; |
| | | topic.subscribe("beginclippingPlanes", lang.hitch(this, this.beginclippingPlanes)); |
| | | topic.subscribe("closesclippingPlanes", lang.hitch(this, this.closesclippingPlanes)); |
| | | // topic.publish('getbeginSlope', that.beginSlope); |
| | | $(`.${that.baseClass}`).find('.closeOUR').click(() => { |
| | | $(`.${that.baseClass}`).hide(); |
| | | that.closesclippingPlanes(); |
| | | }) |
| | | |
| | | |
| | | // that.beginclippingPlanes(); |
| | | |
| | | }, |
| | | beginclippingPlanes: function (promise) { |
| | | console.log(`${this.name}--kaishi`); |
| | | var that = this; |
| | | var viewer = that.map; |
| | | // viewer.imageryLayers.addImageryProvider(new Cesium.BingMapsImageryProvider({ |
| | | // url : 'https://dev.virtualearth.net', |
| | | // mapStyle : Cesium.BingMapsStyle.AERIAL, |
| | | // key : URL_CONFIG.BING_MAP_KEY |
| | | // })); |
| | | var scene = viewer.scene; |
| | | // try{ |
| | | //场景添加S3M图层服务 |
| | | that.isClearBut = true; |
| | | // that.promise = scene.open(window.MYURL_CONFIG.SCENE_BIMBUILDING); |
| | | // console.log(promise, 444444444444444) |
| | | that.promise = promise.src; |
| | | Cesium.when(that.promise, function (layers) { |
| | | // // 精准定位 |
| | | // scene.camera.setView({ |
| | | // destination: new Cesium.Cartesian3(-2180753.065987198, 4379023.266141494, 4092583.575045952), |
| | | // orientation: { |
| | | // heading: 4.0392222751147955, |
| | | // pitch: 0.010279641987852584, |
| | | // roll: 1.240962888005015e-11 |
| | | // } |
| | | // }); |
| | | // var name = scene.layers._layers._hash; |
| | | // for (var a in name) { |
| | | // name = a; |
| | | // } |
| | | // console.log(name) |
| | | var layer = scene.layers.find(promise.name); |
| | | // console.log(layer, 55555555555555) |
| | | if (layer == undefined) { |
| | | console.log('不支持') |
| | | window.layer.tips('该图层不支持平面裁剪!', '.SelectLayerTool', { |
| | | tips: [3, 'red'] |
| | | }); |
| | | if ($(".jimu-widget-clippingPlanes").is(":visible")) {//判断是否隐藏 |
| | | $(".jimu-widget-clippingPlanes").hide(); |
| | | topic.publish('closesclippingPlanes'); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | layer.selectEnabled = false; |
| | | // //设置被裁剪对象的颜色 |
| | | layer.clipLineColor = new Cesium.Color(1, 1, 1, 0); |
| | | that.BIMLayer = layer; |
| | | // if (!scene.pickPositionSupported) { |
| | | // alert('不支持深度纹理,无法拾取位置!'); |
| | | // } |
| | | // }, function (e) { |
| | | // if (widget._showRenderLoopErrors) { |
| | | // var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?'; |
| | | // widget.showErrorPanel(title, undefined, e); |
| | | // } |
| | | }); |
| | | // } |
| | | // catch(e){ |
| | | // if (widget._showRenderLoopErrors) { |
| | | // var title = '渲染时发生错误,已停止渲染。'; |
| | | // widget.showErrorPanel(title, undefined, e); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | var clampMode = Cesium.ClampMode.Space; |
| | | that.tooltip = window.MYcreateTooltip(document.body); |
| | | that.handlerPolygon = new Cesium.DrawHandler(viewer, Cesium.DrawMode.Polygon, clampMode); |
| | | var i = 0; |
| | | that.handlerPolygon.activeEvt.addEventListener(function (isActive) { |
| | | if (isActive == true) { |
| | | viewer.enableCursorStyle = false; |
| | | viewer._element.style.cursor = ''; |
| | | $('body').removeClass('drawCur').addClass('drawCur'); |
| | | that.isClearBut = false; |
| | | Usebody(); |
| | | i = 0; |
| | | } |
| | | else { |
| | | viewer.enableCursorStyle = true; |
| | | $('body').removeClass('drawCur'); |
| | | if (that.isClearBut == false) { |
| | | if (i < 3) { |
| | | that.tooltip.setVisible(false); |
| | | layer.tips('不足三个点请重新绘画!', '#polygonclippingPlanes', { |
| | | tips: [3, 'red'] |
| | | }); |
| | | } |
| | | } |
| | | Endbody(); |
| | | } |
| | | }); |
| | | that.handlerPolygon.movingEvt.addEventListener(function (windowPosition) { |
| | | // console.log(i) |
| | | if (that.handlerPolygon.isDrawing) { |
| | | that.tooltip.showAt(windowPosition, '<p>只需要设置三个点!</p>'); |
| | | } |
| | | else { |
| | | that.tooltip.showAt(windowPosition, '<p>点击绘制第一个点</p>'); |
| | | } |
| | | if (i == 3) { |
| | | that.tooltip.showAt(windowPosition, '<p>请点击右键!</p>'); |
| | | } |
| | | if (i > 3) { |
| | | that.tooltip.showAt(windowPosition, '<p>超过3个的点不生效!</p>'); |
| | | } |
| | | }); |
| | | that.handlerPolygon.drawEvt.addEventListener(function (result) { |
| | | |
| | | var positions = result.object.positions; |
| | | // console.log(that.handlerPolygon.polygon, 12434) |
| | | that.tooltip.setVisible(false); |
| | | that.handlerPolygon.polygon.show = false; |
| | | // 通过多边形的顶点设置裁剪面,裁剪方向为裁剪面的法线方向 |
| | | that.BIMLayer.setCustomClipPlane(positions[0], positions[1], positions[2]); |
| | | |
| | | }); |
| | | var Usebody = () => { |
| | | i = 0; |
| | | $('.cesium-widget').click(() => { |
| | | i++; |
| | | }) |
| | | } |
| | | var Endbody = () => { |
| | | i = 0; |
| | | $(".cesium-widget").unbind() |
| | | } |
| | | |
| | | $('#polygonclippingPlanes').click(function () { |
| | | that.handlerPolygon.activate(); |
| | | }); |
| | | |
| | | $('#clearclippingPlanes').click(function () { |
| | | that.isClearBut = true; |
| | | that.handlerPolygon.clear(); |
| | | that.isClearBut = false; |
| | | //清除裁剪结果 |
| | | that.BIMLayer.clearCustomClipBox(); |
| | | Endbody(); |
| | | // if () |
| | | |
| | | }); |
| | | $('#toolbarclippingPlanes').show(); |
| | | $('#loadingbar').remove(); |
| | | if (!scene.pickPositionSupported) { |
| | | alert('不支持深度拾取,无法进行鼠标交互绘制!'); |
| | | } |
| | | |
| | | }, |
| | | tooltip: '', |
| | | handlerPolygon: '', |
| | | BIMLayer: '', |
| | | isClearBut: '', |
| | | promise: '', |
| | | closesclippingPlanes: function (froms) { |
| | | console.log(`${this.name}--guanbi`); |
| | | var that = this; |
| | | |
| | | that.isClearBut = true; |
| | | if (that.handlerPolygon) { |
| | | that.handlerPolygon.clear(); |
| | | } |
| | | that.isClearBut = false; |
| | | //清除裁剪结果 |
| | | if (that.BIMLayer != '') { |
| | | that.BIMLayer.clearCustomClipBox(); |
| | | } |
| | | $(".cesium-widget").unbind(); |
| | | |
| | | // if (that.promise != '') { |
| | | // Cesium.when(that.promise, function (layer) { |
| | | // for (var i = 0; i < layer.length; i++) { |
| | | // that.map.scene.layers.remove(layer[i].name) |
| | | // } |
| | | // }) |
| | | // } |
| | | }, |
| | | onOpen: function () { |
| | | |
| | | }, |
| | | |
| | | onClose: function () { |
| | | //面板关闭的时候触发 (when this panel is closed trigger) |
| | | console.log('jies') |
| | | }, |
| | | |
| | | onMinimize: function () { |
| | | this.resize(); |
| | | }, |
| | | |
| | | onMaximize: function () { |
| | | this.resize(); |
| | | }, |
| | | |
| | | resize: function () { |
| | | |
| | | }, |
| | | |
| | | destroy: function () { |
| | | //销毁的时候触发 |
| | | //todo |
| | | //do something before this func |
| | | this.inherited(arguments); |
| | | } |
| | | |
| | | }); |
| | | }); |
| New file |
| | |
| | | .jimu-widget-clippingPlanes { |
| | | position: fixed !important; |
| | | top: 72px !important; |
| | | right: 388px !important; |
| | | width: 160px !important; |
| | | height: 40px !important; |
| | | background-color: rgb(255, 255, 255); |
| | | font-size: 14px; |
| | | color: rgb(0, 0, 0); |
| | | z-index: 12 !important; |
| | | border-radius: 10px; |
| | | display: none; |
| | | box-shadow: 0 0 8px #fff; |
| | | padding: 0px 5px !important; |
| | | line-height: 42.5px; |
| | | } |
| | | |
| | | .jimu-widget-clippingPlanes .closeOUR { |
| | | position: absolute; |
| | | right: 5px; |
| | | top: 0px; |
| | | font-size: 18px; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .jimu-widget-clippingPlanes .closeOUR:hover { |
| | | color: red; |
| | | } |
| | | |
| | | .jimu-widget-clippingPlanes button { |
| | | line-height: 30px; |
| | | /* width: 80px; */ |
| | | height: 30px; |
| | | font-size: 14px; |
| | | border-radius: 5px; |
| | | box-shadow: 2px 2px 15px -5px #378ef1; |
| | | border: 1px solid transparent; |
| | | background-color: #fff; |
| | | padding: 0 5px; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .jimu-widget-clippingPlanes button:hover { |
| | | box-shadow: 2px 2px 25px -5px #1679eb; |
| | | } |
| New file |
| | |
| | | { |
| | | "name": "clippingPlanes", |
| | | "2D": true, |
| | | "3D": true, |
| | | "platform": "HTML", |
| | | "version": "2.10", |
| | | "wabVersion": "2.10", |
| | | "author": "liuyg", |
| | | "description": "", |
| | | "copyright": "", |
| | | "license": "", |
| | | "properties": { |
| | | "hasConfig": false, |
| | | "inPanel": false, |
| | | "hasVersionManager": false |
| | | } |
| | | } |
| New file |
| | |
| | | define( |
| | | ({ |
| | | _widgetLabel: "clippingPlanes" |
| | | }) |
| | | ); |
| New file |
| | |
| | | define({ |
| | | root: ({ |
| | | _widgetLabel: "clippingPlanes" |
| | | }), |
| | | "es": 1, |
| | | "zh-cn": 1 |
| | | }); |
| New file |
| | |
| | | define( |
| | | ({ |
| | | _widgetLabel: "平面裁剪" |
| | | }) |
| | | ); |
| | |
| | | if (that.handlerPolygon.polyline) { |
| | | that.handlerPolygon.polyline.show = false; |
| | | } |
| | | that.handlerPolygon.deactivate(); |
| | | if (that.handlerPolygon.deactivate) { |
| | | that.handlerPolygon.deactivate(); |
| | | } |
| | | that.tooltip.setVisible(false); |
| | | }, |
| | | onOpen: function () { |
| | |
| | | }, |
| | | closesNull: function (froms) { |
| | | console.log(`${this.name}--guanbi`); |
| | | var that = this; |
| | | }, |
| | | onOpen: function () { |
| | | |
| | |
| | | line-height: 30px; |
| | | width: 80px; |
| | | height: 30px; |
| | | font-size: 16px; |
| | | font-size: 14px; |
| | | border-radius: 5px; |
| | | box-shadow: 2px 2px 15px -5px #378ef1; |
| | | border: 1px solid transparent; |
| | |
| | | name: '通视分析', |
| | | classs: 'throughSee-tool', |
| | | img: './images/addL/pdpx.png' |
| | | }, |
| | | {//平面裁剪 |
| | | name: '平面裁剪', |
| | | classs: 'clippingPlanes-tool', |
| | | img: './images/addL/pdpx.png' |
| | | } |
| | | ]; |
| | | |
| | |
| | | name: '通视分析', |
| | | classs: 'throughSee-tool', |
| | | img: './images/addL/pdpx.png' |
| | | }, |
| | | {//平面裁剪 |
| | | name: '平面裁剪', |
| | | classs: 'clippingPlanes-tool', |
| | | img: './images/addL/pdpx.png' |
| | | } |
| | | , |
| | | {//建造模型 |
| | |
| | | }) |
| | | |
| | | }, |
| | | promise: 'NODATA', |
| | | beginSpatialAnalysis: function (domHtmls) { |
| | | var that = this; |
| | | var domHtmls = domHtmls; |
| | |
| | | topic.publish('beginthroughSee', 'beginthroughSee'); |
| | | }) |
| | | |
| | | //平面裁剪 |
| | | $('.clippingPlanes-tool').click(function () { |
| | | that.closeOnceUse(); |
| | | // console.log(that.promise, 22222222222) |
| | | if (that.promise == 'NODATA') { |
| | | layer.tips('请选择三维倾斜数据中的图层支持!', '.SelectLayerTool', { |
| | | tips: [3, 'red'] |
| | | }); |
| | | } else { |
| | | $(".jimu-widget-clippingPlanes").show(); |
| | | topic.publish('beginclippingPlanes', that.promise); |
| | | } |
| | | }) |
| | | |
| | | $('.SelectLayerTool').click(() => { |
| | | $('#SelectLayerToolItem').toggle(); |
| | |
| | | this.liClick('默认:天地图影像', '默认:天地图影像'); |
| | | |
| | | }, |
| | | liClick: function (itemid, name) {//点击事件 |
| | | morenliClick: (itemid, name) => { |
| | | var dom = $('.SelectLayerTool'); |
| | | dom.empty(); |
| | | var str = `${name} <i class="layui-icon layui-icon-down layui-font-12"></i>` |
| | | dom.append(str); |
| | | // console.log('数据错误默认') |
| | | this.promise = 'NODATA'; |
| | | //关闭平面裁剪 |
| | | if ($(".jimu-widget-clippingPlanes").is(":visible")) {//判断是否隐藏 |
| | | $(".jimu-widget-clippingPlanes").hide(); |
| | | topic.publish('closesclippingPlanes'); |
| | | } |
| | | }, |
| | | liClick: function (itemid, name, ourdata = 1) {//点击事件 |
| | | var that = this; |
| | | var liList = $(`[itemid='${itemid}s']`); |
| | | // console.log(liList); |
| | | liList.click(() => { |
| | |
| | | dom.append(str); |
| | | dom.attr("title", name); |
| | | $('#SelectLayerToolItem').hide(); |
| | | // console.log(ourdata); |
| | | // 定位 |
| | | // console.log(name) |
| | | if (ourdata != 1) { |
| | | // console.log('data') |
| | | if (ourdata.lon) { |
| | | that.map.camera.flyTo({ |
| | | destination: Cesium.Cartesian3.fromDegrees(Number(ourdata.lon), Number(ourdata.lat), Number(ourdata.height * 50)) |
| | | }); |
| | | } |
| | | if (ourdata.src.indexOf('.openrealspace') != -1) { |
| | | // console.log('数据正确'); |
| | | //关闭平面裁剪 |
| | | if ($(".jimu-widget-clippingPlanes").is(":visible")) {//判断是否隐藏 |
| | | $(".jimu-widget-clippingPlanes").hide(); |
| | | topic.publish('closesclippingPlanes'); |
| | | } |
| | | that.promise = { |
| | | src: ourdata.src, |
| | | name: ourdata.serviceName |
| | | }; |
| | | |
| | | } else { |
| | | // console.log('数据错误'); |
| | | that.promise = 'NODATA'; |
| | | //关闭平面裁剪 |
| | | if ($(".jimu-widget-clippingPlanes").is(":visible")) {//判断是否隐藏 |
| | | $(".jimu-widget-clippingPlanes").hide(); |
| | | topic.publish('closesclippingPlanes'); |
| | | } |
| | | } |
| | | } else { |
| | | // console.log('数据错误没有data'); |
| | | that.promise = 'NODATA'; |
| | | //关闭平面裁剪 |
| | | if ($(".jimu-widget-clippingPlanes").is(":visible")) {//判断是否隐藏 |
| | | $(".jimu-widget-clippingPlanes").hide(); |
| | | topic.publish('closesclippingPlanes'); |
| | | } |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | appendItemS: function (item, obj, layer) { |
| | |
| | | |
| | | $("#SelectLayerToolItemTitle").append(liItem); |
| | | } |
| | | that.liClick(obj.id, obj.title); |
| | | that.liClick(obj.id, obj.title, obj); |
| | | } |
| | | }, |
| | | removeItemS: function (item, obj) { |
| | | console.log(obj, 'r1') |
| | | // console.log(obj, 'r1') |
| | | var that = this; |
| | | if (item == this.name) { |
| | | var liList = $("#SelectLayerToolItemTitle li"); |
| | | for (var i = 0; i < liList.length; i++) { |
| | | if ($(liList[i]).attr('itemid') && $(liList[i]).attr('itemid') == obj.id + 's') { |
| | | $(liList[i]).remove(); |
| | | var dom = $('.SelectLayerTool').attr("title"); |
| | | console.log(dom == obj.title, this.liClick) |
| | | // console.log(dom == obj.title, this.liClick) |
| | | if (dom == obj.title) { |
| | | this.liClick('默认:天地图影像', '默认:天地图影像'); |
| | | that.morenliClick('默认:天地图影像', '默认:天地图影像'); |
| | | that.promise = 'NODATA'; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | $("#SelectLayerToolItemTitle").append(liItem); |
| | | } |
| | | that.liClick(obj.id, obj.title); |
| | | that.liClick(obj.id, obj.title, obj); |
| | | } |
| | | }, |
| | | removeTiltS: function (item, obj) { |
| | | console.log(obj, 'r2') |
| | | // console.log(obj, 'r2') |
| | | // console.log('r2') |
| | | var that = this; |
| | | if (item == this.name) { |
| | | var liList = $("#SelectLayerToolItemTitle li"); |
| | | for (var i = 0; i < liList.length; i++) { |
| | |
| | | $(liList[i]).remove(); |
| | | var dom = $('.SelectLayerTool').attr("title"); |
| | | if (dom == obj.title) { |
| | | this.liClick('默认:天地图影像', '默认:天地图影像'); |
| | | that.morenliClick('默认:天地图影像', '默认:天地图影像'); |
| | | that.promise = 'NODATA'; |
| | | } |
| | | } |
| | | } |
| | |
| | | //关闭通视分析 |
| | | if ($(".jimu-widget-throughSee").is(":visible")) {//判断是否隐藏 |
| | | $(".jimu-widget-throughSee").hide(); |
| | | // topic.publish('closesthroughSee'); |
| | | topic.publish('closesthroughSee'); |
| | | } |
| | | //关闭平面裁剪 |
| | | if ($(".jimu-widget-clippingPlanes").is(":visible")) {//判断是否隐藏 |
| | | $(".jimu-widget-clippingPlanes").hide(); |
| | | topic.publish('closesclippingPlanes'); |
| | | } |
| | | |
| | | }, |
| | |
| | | var widget = viewer.cesiumWidget; |
| | | // try { |
| | | |
| | | var promise = scene.open(window.MYURL_CONFIG.SCENE_CBD); |
| | | Cesium.when.all(promise, function (layer) { |
| | | scene.camera.setView({ |
| | | destination: new Cesium.Cartesian3.fromDegrees(116.44621857300415, 39.899281526734555, 216.7793905027196), |
| | | orientation: { |
| | | heading: 0.41348036210986194, |
| | | pitch: -0.13636490404291735, |
| | | roll: 6.283185307179563 |
| | | } |
| | | }); |
| | | for (var i = 0; i < layer.length; i++) { |
| | | layer[i].selectEnabled = false; |
| | | } |
| | | // var promise = scene.open(window.MYURL_CONFIG.SCENE_CBD); |
| | | // Cesium.when.all(promise, function (layer) { |
| | | // scene.camera.setView({ |
| | | // destination: new Cesium.Cartesian3.fromDegrees(116.44621857300415, 39.899281526734555, 216.7793905027196), |
| | | // orientation: { |
| | | // heading: 0.41348036210986194, |
| | | // pitch: -0.13636490404291735, |
| | | // roll: 6.283185307179563 |
| | | // } |
| | | // }); |
| | | // for (var i = 0; i < layer.length; i++) { |
| | | // layer[i].selectEnabled = false; |
| | | // } |
| | | |
| | | sightline.build(); |
| | | }, function (e) { |
| | | if (widget._showRenderLoopErrors) { |
| | | var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?'; |
| | | widget.showErrorPanel(title, undefined, e); |
| | | } |
| | | }); |
| | | sightline.build(); |
| | | // }, function (e) { |
| | | // if (widget._showRenderLoopErrors) { |
| | | // var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?'; |
| | | // widget.showErrorPanel(title, undefined, e); |
| | | // } |
| | | // }); |
| | | // } catch (e) { |
| | | // if (widget._showRenderLoopErrors) { |
| | | // var title = '渲染时发生错误,已停止渲染。'; |
| | |
| | | var tf = false;//当前点击状态是否是 添加目标点 |
| | | |
| | | var num = 0;//添加的目标点的点号 |
| | | var couldRemove = false;//是否能移除目标点 |
| | | var tooltip = window.MYcreateTooltip(viewer._element) |
| | | that.couldRemove = false;//是否能移除目标点 |
| | | that.tooltip = window.MYcreateTooltip(viewer._element) |
| | | var handlerPoint = new Cesium.DrawHandler(viewer, Cesium.DrawMode.Point); |
| | | handlerPoint.drawEvt.addEventListener(function (result) { |
| | | //添加观察点 |
| | |
| | | |
| | | |
| | | |
| | | var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); |
| | | that.handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); |
| | | |
| | | document.getElementById("addViewPointthroughSee").onclick = function () { |
| | | if (tf == false) { |
| | |
| | | return; |
| | | } |
| | | viewer.entities.removeAll(); |
| | | if (couldRemove) { |
| | | if (that.couldRemove) { |
| | | sightline.removeAllTargetPoint(); |
| | | } |
| | | handlerPoint.activate(); |
| | | handler.setInputAction(function (evt) { |
| | | that.handler.setInputAction(function (evt) { |
| | | |
| | | //鼠标移动,更新最后一次添加的目标点的位置 |
| | | var position = scene.pickPosition(evt.endPosition); |
| | |
| | | $('body').removeClass('drawCur').addClass('drawCur'); |
| | | } |
| | | //鼠标移动事件,更新点 |
| | | handler.setInputAction(function (evt) { |
| | | tooltip.showAt(evt.endPosition, '<p>点击确定观察点</p>'); |
| | | that.handler.setInputAction(function (evt) { |
| | | that.tooltip.showAt(evt.endPosition, '<p>点击确定观察点</p>'); |
| | | }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); |
| | | //鼠标点击事件,添加点 |
| | | handler.setInputAction(function (e) { |
| | | that.handler.setInputAction(function (e) { |
| | | $('body').removeClass('drawCur'); |
| | | mv = true; |
| | | tooltip.setVisible(false); |
| | | handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE); |
| | | that.tooltip.setVisible(false); |
| | | that.handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | that.handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE); |
| | | }, Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | } else { |
| | | layer.tips('正在添加目标点,请先右键关闭', $('#addViewPointthroughSee'), { tips: [1, 'red'] }); |
| | |
| | | } |
| | | |
| | | //鼠标点击事件,添加点 |
| | | handler.setInputAction(function (e) { |
| | | that.handler.setInputAction(function (e) { |
| | | var position = scene.pickPosition(e.position); |
| | | addTarget(position); |
| | | }, Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | |
| | | //鼠标移动事件,更新点 |
| | | handler.setInputAction(function (evt) { |
| | | that.handler.setInputAction(function (evt) { |
| | | |
| | | //鼠标移动,更新最后一次添加的目标点的位置 |
| | | var position = scene.pickPosition(evt.endPosition); |
| | |
| | | name: "point0" |
| | | }); |
| | | } |
| | | tooltip.showAt(evt.endPosition, '<p>点击确定目标点右键结束</p>'); |
| | | that.tooltip.showAt(evt.endPosition, '<p>点击确定目标点右键结束</p>'); |
| | | }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); |
| | | |
| | | //鼠标右键事件,结束 |
| | | handler.setInputAction(function () { |
| | | that.handler.setInputAction(function () { |
| | | viewer.enableCursorStyle = true; |
| | | $('body').removeClass('drawCur'); |
| | | tooltip.setVisible(false); |
| | | handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE); |
| | | handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | that.tooltip.setVisible(false); |
| | | that.handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE); |
| | | that.handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | tf = false; |
| | | }, Cesium.ScreenSpaceEventType.RIGHT_CLICK); |
| | | } else { |
| | |
| | | mv = false; |
| | | tf = false; |
| | | handlerPoint.clear(); |
| | | that.tooltip.setVisible(false); |
| | | viewer.entities.removeAll(); |
| | | if (couldRemove) { |
| | | that.handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE); |
| | | if (that.couldRemove) { |
| | | sightline.removeAllTargetPoint(); |
| | | couldRemove = false; |
| | | that.couldRemove = false; |
| | | } |
| | | viewer.enableCursorStyle = true; |
| | | $('body').removeClass('drawCur'); |
| | | } else { |
| | | layer.tips('正在添加目标点,请先右键关闭', $('#addViewPointthroughSee'), { tips: [1, 'red'] }); |
| | | layer.tips('正在添加目标点,请先右键关闭', $('#clearthroughSee'), { tips: [1, 'red'] }); |
| | | |
| | | } |
| | | } |
| | |
| | | position: cartographic, |
| | | name: name |
| | | }); |
| | | couldRemove = true; |
| | | that.couldRemove = true; |
| | | } |
| | | } |
| | | |
| | |
| | | return [longitude, latitude, height]; |
| | | } |
| | | |
| | | that.promise = promise; |
| | | // that.promise = promise; |
| | | that.addViewFlag = addViewFlag; |
| | | that.addTargetFlag = addTargetFlag; |
| | | that.handlerPoint = handlerPoint; |
| | | that.sightline = sightline; |
| | | |
| | | }, |
| | | promise: '', |
| | | // promise: '', |
| | | addViewFlag: '', |
| | | addTargetFlag: '', |
| | | couldRemove: '', |
| | | sightline: '', |
| | | tooltip: '', |
| | | handler: '', |
| | | handlerPoint: '', |
| | | closesthroughSee: function (froms) { |
| | | console.log(`${this.name}--guanbi`); |
| | | that = this; |
| | | |
| | | Cesium.when.all(that.promise, function (layer) { |
| | | for (var i = 0; i < layer.length; i++) { |
| | | that.map.scene.layers.remove(layer[i].name) |
| | | } |
| | | }) |
| | | // Cesium.when.all(that.promise, function (layer) { |
| | | // for (var i = 0; i < layer.length; i++) { |
| | | // that.map.scene.layers.remove(layer[i].name) |
| | | // } |
| | | // }) |
| | | if (that.handler.removeInputAction) { |
| | | that.handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK); |
| | | that.handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE); |
| | | } |
| | | if (that.tooltip.setVisible) { |
| | | that.tooltip.setVisible(false); |
| | | } |
| | | if (that.handlerPoint.clear) { |
| | | that.handlerPoint.clear(); |
| | | } |
| | | that.addViewFlag = false; |
| | | that.addTargetFlag = false; |
| | | that.handlerPoint.clear(); |
| | | |
| | | that.map.entities.removeAll(); |
| | | if (couldRemove) { |
| | | sightline.removeAllTargetPoint(); |
| | | couldRemove = false; |
| | | if (that.couldRemove) { |
| | | that.sightline.removeAllTargetPoint(); |
| | | that.couldRemove = false; |
| | | } |
| | | that.map.enableCursorStyle = true; |
| | | $('body').removeClass('drawCur'); |
| | |
| | | color: rgb(0, 0, 0); |
| | | z-index: 12 !important; |
| | | border-radius: 10px; |
| | | /* display: none; */ |
| | | display: none; |
| | | box-shadow: 0 0 8px #fff; |
| | | padding: 0px 5px !important; |
| | | line-height: 41px; |