| | |
| | | }) |
| | | state.labelLayer.addOverlay(divIcon) |
| | | } |
| | | }, |
| | | addLabelLayerIconMobelUse({ |
| | | state, |
| | | commit, |
| | | dispatch |
| | | }, val) { |
| | | const list = val.list |
| | | if (!state.labelLayer) { |
| | | state.labelLayer = new global.DC.HtmlLayer('labelLayer') |
| | | val.mviewer.addLayer(state.labelLayer); |
| | | state.myviewer = val.mviewer; |
| | | } |
| | | if (val.clear) { |
| | | // state.labelLayer.remove(); |
| | | state.labelLayer.clear() |
| | | } |
| | | if (val.add) { // 刷新列表 |
| | | state.addSignList = !state.addSignList |
| | | return |
| | | } |
| | | for (const i in list) { |
| | | const divIcon = new global.DC.DivIcon( |
| | | new global.DC.Position( |
| | | Number(list[i].jd), |
| | | Number(list[i].wd), |
| | | 0 |
| | | ), |
| | | ` |
| | | <div class="tag-entitys-box"> |
| | | <div class="tag-content"> |
| | | ${list[i].name} |
| | | </div> |
| | | <div class="tag-angle-content"> |
| | | <img src="https://map.hit.edu.cn/images/tarrow_xq.png"> |
| | | </div> |
| | | </div> |
| | | ` |
| | | ) |
| | | // 订阅事件 |
| | | divIcon.on(global.DC.MouseEventType.CLICK, (e) => { |
| | | // console.log(e); |
| | | // return; |
| | | // 定制化窗体 |
| | | const position = e.position |
| | | const lntLat = [e.overlay._position._lng, e.overlay._position._lat] |
| | | // console.log(position, lntLat, list[i], state.myviewer, "see") |
| | | new global.DC.DivForms(state.myviewer, { |
| | | domId: 'labelLayerid', |
| | | position: [ |
| | | global.DC.Transform.transformWGS84ToCartesian( |
| | | new global.DC.Position( |
| | | Number(lntLat[0]), |
| | | Number(lntLat[1]), |
| | | Number(0) |
| | | ) |
| | | ) |
| | | ] |
| | | }) |
| | | state.myviewer.camera.setView({ |
| | | // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州 |
| | | // fromDegrees()方法,将经纬度和高程转换为世界坐标 |
| | | destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees( |
| | | lntLat[0], |
| | | lntLat[1], |
| | | 400.0 |
| | | ), |
| | | orientation: { |
| | | // 指向 |
| | | heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0), |
| | | // 视角 |
| | | pitch: global.DC.Namespace.Cesium.Math.toRadians(-90), |
| | | roll: 0.0 |
| | | } |
| | | }) |
| | | commit('openLabelLayer', { |
| | | show: true, |
| | | data: list[i] |
| | | }) |
| | | }) |
| | | state.labelLayer.addOverlay(divIcon) |
| | | } |
| | | } |
| | | } |
| | | } |