工具
This commit is contained in:
@ -30,6 +30,7 @@ let halfIntervalContourColor = '#64b6d9'
|
||||
let supplementaryContourShow = false
|
||||
let supplementaryContourWidth = 1.0
|
||||
let supplementaryContourColor = '#d084d1'
|
||||
let paramData = {}
|
||||
|
||||
|
||||
activeHeightElm = document.createElement('div')
|
||||
@ -72,6 +73,55 @@ function accordingToCameraHeight() {
|
||||
// console.log(cameraHeight)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function startDraw(sdk, showData) {
|
||||
show = showData
|
||||
|
||||
Object.keys(paramData).forEach(item => {
|
||||
material.uniforms[item] = paramData[item]
|
||||
})
|
||||
|
||||
if (show) {
|
||||
let height = sdk.viewer.camera.positionCartographic.height
|
||||
if (height > 16360) {
|
||||
let cartographic = sdk.viewer.camera.positionCartographic
|
||||
let options = {
|
||||
position: {
|
||||
lng: Cesium.Math.toDegrees(cartographic.longitude),
|
||||
lat: Cesium.Math.toDegrees(cartographic.latitude),
|
||||
alt: 16360,
|
||||
},
|
||||
}
|
||||
flyTo(sdk, options, 0.5)
|
||||
}
|
||||
showContour(sdk)
|
||||
} else {
|
||||
hideContour(sdk)
|
||||
}
|
||||
}
|
||||
function reset() {
|
||||
// if (handler) {
|
||||
// handler.destroy()
|
||||
// }
|
||||
secondaryLinesCount = 19
|
||||
// show = true
|
||||
equalHeightDistance = 10
|
||||
activeColor = '#ffd000'
|
||||
indexContourShow = true
|
||||
indexContourWidth = 2.5
|
||||
indexContourColor = '#43cf7c'
|
||||
intermediateContourShow = true
|
||||
intermediateContourWidth = 1.8
|
||||
intermediateContourColor = '#ff0000'
|
||||
halfIntervalContourShow = false
|
||||
halfIntervalContourWidth = 1.0
|
||||
halfIntervalContourColor = '#64b6d9'
|
||||
supplementaryContourShow = false
|
||||
supplementaryContourWidth = 1.0
|
||||
supplementaryContourColor = '#d084d1'
|
||||
|
||||
|
||||
}
|
||||
async function dialog(sdk) {
|
||||
_sdk = sdk
|
||||
@ -106,44 +156,44 @@ async function dialog(sdk) {
|
||||
sdk.viewer.scene.postRender.addEventListener(accordingToCameraHeight)
|
||||
|
||||
// 显示
|
||||
let showBtn = contentElm.getElementsByClassName('show')[0]
|
||||
showBtn.checked = show
|
||||
if (showBtn.checked) {
|
||||
let height = sdk.viewer.camera.positionCartographic.height
|
||||
if (height > 16360) {
|
||||
let cartographic = sdk.viewer.camera.positionCartographic
|
||||
let options = {
|
||||
position: {
|
||||
lng: Cesium.Math.toDegrees(cartographic.longitude),
|
||||
lat: Cesium.Math.toDegrees(cartographic.latitude),
|
||||
alt: 16360,
|
||||
},
|
||||
}
|
||||
flyTo(sdk, options, 0.5)
|
||||
}
|
||||
showContour(sdk)
|
||||
}
|
||||
showBtn.addEventListener('change', (e) => {
|
||||
if (e.target.checked) {
|
||||
show = true
|
||||
let height = sdk.viewer.camera.positionCartographic.height
|
||||
if (height > 16360) {
|
||||
let cartographic = sdk.viewer.camera.positionCartographic
|
||||
let options = {
|
||||
position: {
|
||||
lng: Cesium.Math.toDegrees(cartographic.longitude),
|
||||
lat: Cesium.Math.toDegrees(cartographic.latitude),
|
||||
alt: 16360,
|
||||
},
|
||||
}
|
||||
flyTo(sdk, options, 0.5)
|
||||
}
|
||||
showContour(sdk)
|
||||
} else {
|
||||
show = false
|
||||
hideContour(sdk)
|
||||
}
|
||||
})
|
||||
// let showBtn = contentElm.getElementsByClassName('show')[0]
|
||||
// showBtn.checked = show
|
||||
// if (showBtn.checked) {
|
||||
// let height = sdk.viewer.camera.positionCartographic.height
|
||||
// if (height > 16360) {
|
||||
// let cartographic = sdk.viewer.camera.positionCartographic
|
||||
// let options = {
|
||||
// position: {
|
||||
// lng: Cesium.Math.toDegrees(cartographic.longitude),
|
||||
// lat: Cesium.Math.toDegrees(cartographic.latitude),
|
||||
// alt: 16360,
|
||||
// },
|
||||
// }
|
||||
// flyTo(sdk, options, 0.5)
|
||||
// }
|
||||
// showContour(sdk)
|
||||
// }
|
||||
// showBtn.addEventListener('change', (e) => {
|
||||
// if (e.target.checked) {
|
||||
// show = true
|
||||
// let height = sdk.viewer.camera.positionCartographic.height
|
||||
// if (height > 16360) {
|
||||
// let cartographic = sdk.viewer.camera.positionCartographic
|
||||
// let options = {
|
||||
// position: {
|
||||
// lng: Cesium.Math.toDegrees(cartographic.longitude),
|
||||
// lat: Cesium.Math.toDegrees(cartographic.latitude),
|
||||
// alt: 16360,
|
||||
// },
|
||||
// }
|
||||
// flyTo(sdk, options, 0.5)
|
||||
// }
|
||||
// showContour(sdk)
|
||||
// } else {
|
||||
// show = false
|
||||
// hideContour(sdk)
|
||||
// }
|
||||
// })
|
||||
// 等高距
|
||||
let equalHeightDistanceInput = contentElm.getElementsByClassName('equal-height-distance')[0]
|
||||
equalHeightDistanceInput.value = equalHeightDistance
|
||||
@ -152,7 +202,8 @@ async function dialog(sdk) {
|
||||
equalHeightDistance = value
|
||||
equalHeightDistanceInput.value = value
|
||||
if (material) {
|
||||
material.uniforms.spacing = equalHeightDistance * 5
|
||||
// material.uniforms.spacing = equalHeightDistance * 5
|
||||
paramData.spacing = equalHeightDistance * 5
|
||||
}
|
||||
})
|
||||
|
||||
@ -188,13 +239,15 @@ async function dialog(sdk) {
|
||||
sure: color => {
|
||||
activeColor = color
|
||||
if (material) {
|
||||
material.uniforms.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
||||
// material.uniforms.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
||||
paramData.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
||||
}
|
||||
},
|
||||
clear: () => {
|
||||
activeColor = 'rgba(255,255,255,1)'
|
||||
if (material) {
|
||||
material.uniforms.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
||||
// material.uniforms.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
||||
paramData.activeColor = Cesium.Color.fromCssColorString(activeColor)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -205,7 +258,8 @@ async function dialog(sdk) {
|
||||
indexContourSwitch.addEventListener('change', (e) => {
|
||||
indexContourShow = e.target.checked
|
||||
if (material) {
|
||||
material.uniforms.indexContourShow = indexContourShow
|
||||
// material.uniforms.indexContourShow = indexContourShow
|
||||
paramData.indexContourShow = indexContourShow
|
||||
}
|
||||
})
|
||||
// 计曲线颜色
|
||||
@ -219,13 +273,15 @@ async function dialog(sdk) {
|
||||
sure: color => {
|
||||
indexContourColor = color
|
||||
if (material) {
|
||||
material.uniforms.indexContourColor = Cesium.Color.fromCssColorString(indexContourColor)
|
||||
// material.uniforms.indexContourColor = Cesium.Color.fromCssColorString(indexContourColor)
|
||||
paramData.indexContourColor = Cesium.Color.fromCssColorString(indexContourColor)
|
||||
}
|
||||
},
|
||||
clear: () => {
|
||||
indexContourColor = 'rgba(255,255,255,1)'
|
||||
if (material) {
|
||||
material.uniforms.indexContourColor = Cesium.Color.fromCssColorString(indexContourColor)
|
||||
// material.uniforms.indexContourColor = Cesium.Color.fromCssColorString(indexContourColor)
|
||||
paramData.indexContourColor = Cesium.Color.fromCssColorString(indexContourColor)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -237,7 +293,8 @@ async function dialog(sdk) {
|
||||
indexContourWidth = value
|
||||
indexContourWidthInput.value = value
|
||||
if (material) {
|
||||
material.uniforms.indexContourWidth = indexContourWidth
|
||||
// material.uniforms.indexContourWidth = indexContourWidth
|
||||
paramData.indexContourWidth = indexContourWidth
|
||||
}
|
||||
})
|
||||
|
||||
@ -247,7 +304,8 @@ async function dialog(sdk) {
|
||||
intermediateContourSwitch.addEventListener('change', (e) => {
|
||||
intermediateContourShow = e.target.checked
|
||||
if (material) {
|
||||
material.uniforms.intermediateContourShow = intermediateContourShow
|
||||
// material.uniforms.intermediateContourShow = intermediateContourShow
|
||||
paramData.intermediateContourShow = intermediateContourShow
|
||||
}
|
||||
})
|
||||
// 首曲线颜色
|
||||
@ -261,13 +319,15 @@ async function dialog(sdk) {
|
||||
sure: color => {
|
||||
intermediateContourColor = color
|
||||
if (material) {
|
||||
material.uniforms.intermediateContourColor = Cesium.Color.fromCssColorString(intermediateContourColor)
|
||||
// material.uniforms.intermediateContourColor = Cesium.Color.fromCssColorString(intermediateContourColor)
|
||||
paramData.intermediateContourColor = Cesium.Color.fromCssColorString(intermediateContourColor)
|
||||
}
|
||||
},
|
||||
clear: () => {
|
||||
intermediateContourColor = 'rgba(255,255,255,1)'
|
||||
if (material) {
|
||||
material.uniforms.intermediateContourColor = Cesium.Color.fromCssColorString(intermediateContourColor)
|
||||
// material.uniforms.intermediateContourColor = Cesium.Color.fromCssColorString(intermediateContourColor)
|
||||
paramData.intermediateContourColor = Cesium.Color.fromCssColorString(intermediateContourColor)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -279,7 +339,8 @@ async function dialog(sdk) {
|
||||
intermediateContourWidth = value
|
||||
intermediateContourWidthInput.value = value
|
||||
if (material) {
|
||||
material.uniforms.intermediateContourWidth = intermediateContourWidth
|
||||
// material.uniforms.intermediateContourWidth = intermediateContourWidth
|
||||
paramData.intermediateContourWidth = intermediateContourWidth
|
||||
}
|
||||
})
|
||||
|
||||
@ -289,7 +350,8 @@ async function dialog(sdk) {
|
||||
halfIntervalContourSwitch.addEventListener('change', (e) => {
|
||||
halfIntervalContourShow = e.target.checked
|
||||
if (material) {
|
||||
material.uniforms.halfIntervalContourShow = halfIntervalContourShow
|
||||
// material.uniforms.halfIntervalContourShow = halfIntervalContourShow
|
||||
paramData.halfIntervalContourShow = halfIntervalContourShow
|
||||
}
|
||||
})
|
||||
// 间曲线颜色
|
||||
@ -303,13 +365,15 @@ async function dialog(sdk) {
|
||||
sure: color => {
|
||||
halfIntervalContourColor = color
|
||||
if (material) {
|
||||
material.uniforms.halfIntervalContourColor = Cesium.Color.fromCssColorString(halfIntervalContourColor)
|
||||
// material.uniforms.halfIntervalContourColor = Cesium.Color.fromCssColorString(halfIntervalContourColor)
|
||||
paramData.halfIntervalContourColor = Cesium.Color.fromCssColorString(halfIntervalContourColor)
|
||||
}
|
||||
},
|
||||
clear: () => {
|
||||
halfIntervalContourColor = 'rgba(255,255,255,1)'
|
||||
if (material) {
|
||||
material.uniforms.halfIntervalContourColor = Cesium.Color.fromCssColorString(halfIntervalContourColor)
|
||||
// material.uniforms.halfIntervalContourColor = Cesium.Color.fromCssColorString(halfIntervalContourColor)
|
||||
paramData.halfIntervalContourColor = Cesium.Color.fromCssColorString(halfIntervalContourColor)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -321,7 +385,8 @@ async function dialog(sdk) {
|
||||
halfIntervalContourWidth = value
|
||||
halfIntervalContourWidthInput.value = value
|
||||
if (material) {
|
||||
material.uniforms.halfIntervalContourWidth = halfIntervalContourWidth
|
||||
// material.uniforms.halfIntervalContourWidth = halfIntervalContourWidth
|
||||
paramData.halfIntervalContourWidth = halfIntervalContourWidth
|
||||
}
|
||||
})
|
||||
|
||||
@ -331,7 +396,8 @@ async function dialog(sdk) {
|
||||
supplementaryContourSwitch.addEventListener('change', (e) => {
|
||||
supplementaryContourShow = e.target.checked
|
||||
if (material) {
|
||||
material.uniforms.supplementaryContourShow = supplementaryContourShow
|
||||
// material.uniforms.supplementaryContourShow = supplementaryContourShow
|
||||
paramData.supplementaryContourShow = supplementaryContourShow
|
||||
}
|
||||
})
|
||||
// 助曲线颜色
|
||||
@ -345,13 +411,15 @@ async function dialog(sdk) {
|
||||
sure: color => {
|
||||
supplementaryContourColor = color
|
||||
if (material) {
|
||||
material.uniforms.supplementaryContourColor = Cesium.Color.fromCssColorString(supplementaryContourColor)
|
||||
// material.uniforms.supplementaryContourColor = Cesium.Color.fromCssColorString(supplementaryContourColor)
|
||||
paramData.supplementaryContourColor = Cesium.Color.fromCssColorString(supplementaryContourColor)
|
||||
}
|
||||
},
|
||||
clear: () => {
|
||||
supplementaryContourColor = 'rgba(255,255,255,1)'
|
||||
if (material) {
|
||||
material.uniforms.supplementaryContourColor = Cesium.Color.fromCssColorString(supplementaryContourColor)
|
||||
// material.uniforms.supplementaryContourColor = Cesium.Color.fromCssColorString(supplementaryContourColor)
|
||||
paramData.supplementaryContourColor = Cesium.Color.fromCssColorString(supplementaryContourColor)
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -363,7 +431,8 @@ async function dialog(sdk) {
|
||||
supplementaryContourWidth = value
|
||||
supplementaryContourWidthInput.value = value
|
||||
if (material) {
|
||||
material.uniforms.supplementaryContourWidth = supplementaryContourWidth
|
||||
// material.uniforms.supplementaryContourWidth = supplementaryContourWidth
|
||||
paramData.supplementaryContourWidth = supplementaryContourWidth
|
||||
}
|
||||
})
|
||||
|
||||
@ -638,4 +707,4 @@ czm_material czm_getMaterial(czm_materialInput materialInput)
|
||||
});
|
||||
}
|
||||
|
||||
export { dialog }
|
||||
export { dialog, startDraw, reset }
|
||||
|
@ -69,7 +69,7 @@ import {
|
||||
} from '../Global/MultiViewportMode'
|
||||
import { MouseCoordinate } from '../Global/MouseCoordinate'
|
||||
import { MouseRightMenu } from '../Global/mouseRightMenu'
|
||||
import { dialog as ContourDialog } from '../Global/Contour'
|
||||
import { dialog as ContourDialog, startDraw as ContourStartDraw, reset as ContourReset } from '../Global/Contour'
|
||||
import { on as SplitScreenOn, off as SplitScreenOff, setActiveId as SplitScreenSetActiveId, getSdk } from '../Global/SplitScreen'
|
||||
import LocateCurrent from '../Obj/Base/LocateCurrent'
|
||||
|
||||
@ -346,7 +346,9 @@ if (!window.YJ) {
|
||||
setActiveId: SplitScreenSetActiveId,
|
||||
getSdk
|
||||
},
|
||||
Contour: ContourDialog
|
||||
Contour: ContourDialog,
|
||||
ContourStartDraw,
|
||||
ContourReset
|
||||
}, //测量
|
||||
Measure: {
|
||||
GetMeasureStatus: () => {
|
||||
|
@ -434,7 +434,7 @@ class ViewShedStage extends Tools {
|
||||
|
||||
clear() {
|
||||
YJ.Measure.SetMeasureStatus(false)
|
||||
this.end()
|
||||
// this.end()
|
||||
this.tip && this.tip.destroy()
|
||||
this.event && this.event.destroy()
|
||||
this.tip = null
|
||||
@ -492,6 +492,7 @@ class ViewShedStage extends Tools {
|
||||
text: '上一次测量未结束',
|
||||
type: 'warning',
|
||||
});
|
||||
return
|
||||
}
|
||||
else {
|
||||
this.editevent && this.editevent.destroy()
|
||||
|
@ -1534,7 +1534,13 @@ class Tools {
|
||||
document.body.appendChild(message)
|
||||
message.classList.add(type)
|
||||
}
|
||||
|
||||
/**两点之间的距离 */
|
||||
pointDistance(p1, p2) {
|
||||
let centerDegress = Cesium.Cartesian3.fromDegrees(p1.lng, p1.lat)
|
||||
let point = Cesium.Cartesian3.fromDegrees(p2, p2)
|
||||
let distance = Cesium.Cartesian3.distance(point, centerDegress)
|
||||
return distance
|
||||
}
|
||||
}
|
||||
|
||||
export default Tools
|
||||
|
@ -1,138 +1,141 @@
|
||||
import Dialog from '../BaseDialog'
|
||||
import { Proj } from './proj'
|
||||
import { legp } from '../Obj/Element/datalist';
|
||||
import Tools from "../Tools";
|
||||
let _DialogObject
|
||||
const open = async (sdk, closeCallBack) => {
|
||||
let proj = new Proj()
|
||||
if (_DialogObject && _DialogObject.close) {
|
||||
_DialogObject.close()
|
||||
_DialogObject = null
|
||||
}
|
||||
_DialogObject = await new Dialog(sdk.viewer._container, {
|
||||
title: '度分秒',
|
||||
left: '180px',
|
||||
top: '100px',
|
||||
closeCallBack: () => {
|
||||
closeCallBack && closeCallBack()
|
||||
}
|
||||
})
|
||||
await _DialogObject.init()
|
||||
let tools = new Tools(sdk)
|
||||
// if (_DialogObject && _DialogObject.close) {
|
||||
// _DialogObject.close()
|
||||
// _DialogObject = null
|
||||
// }
|
||||
// _DialogObject = await new Dialog(sdk.viewer._container, {
|
||||
// title: '度分秒',
|
||||
// left: '180px',
|
||||
// top: '100px',
|
||||
// closeCallBack: () => {
|
||||
// closeCallBack && closeCallBack()
|
||||
// }
|
||||
// })
|
||||
// await _DialogObject.init()
|
||||
|
||||
let html = `
|
||||
<span class="custom-divider"></span>
|
||||
<div class="div-item">
|
||||
<div class="row">
|
||||
<div class="col input-select-box">
|
||||
<span class="label" style="flex: 0 0 60px;">输入格式</span>
|
||||
<div class="input-select"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-item item" data-type="${0}">
|
||||
<span class="custom-divider"></span>
|
||||
<p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
||||
<span style="margin-right: 10px;">度</span>
|
||||
<span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如116.6°, 39.9°</span>
|
||||
</p>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<span class="label" style="flex: auto;">经度</span>
|
||||
<input class="input lng" type="number" min="-180" max="180" value="0" title="">
|
||||
</div>
|
||||
<div class="col" style="margin: 0;">
|
||||
<span class="label">纬度</span>
|
||||
<input class="input lat" type="number" min="-90" max="90" value="0" title="">
|
||||
</div>
|
||||
<div class="col" style="flex: 0 0 24px;">
|
||||
<i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;">
|
||||
<svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
||||
</i>
|
||||
<button class="convert" style="margin-left: 10px;">转 换</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-item item" data-type="${1}">
|
||||
<span class="custom-divider"></span>
|
||||
<p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
||||
<span style="margin-right: 10px;">度分</span>
|
||||
<span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如95°10.1702', 49°12.4015'</span>
|
||||
</p>
|
||||
<div class="row">
|
||||
<div class="col" style="flex-direction: column;">
|
||||
<div class="row" style="margin-bottom: 15px;">
|
||||
<span class="label">经度</span>
|
||||
<input class="input lng-dm-d" style="flex: 1;" type="number" min="-180" max="180" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
<input class="input lng-dm-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
<span class="top-line"></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="label">纬度</span>
|
||||
<input class="input lat-dm-d" style="flex: 1;" type="number" min="-90" max="90" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
<input class="input lat-dm-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
<span class="bottom-line"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col" style="flex: 0 0 24px;margin: 0;">
|
||||
<i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;position: relative;left: -30px;">
|
||||
<svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
||||
</i>
|
||||
<button class="convert" style="margin-left: 10px;">转 换</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-item item" data-type="${2}">
|
||||
<span class="custom-divider"></span>
|
||||
<p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
||||
<span style="margin-right: 10px;">度分秒</span>
|
||||
<span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如11°18'54.37", 39°13'46.57"</span>
|
||||
</p>
|
||||
<div class="row">
|
||||
<div class="col" style="flex-direction: column;">
|
||||
<div class="row" style="margin-bottom: 15px;">
|
||||
<span class="label">经度</span>
|
||||
<input class="input lng-dms-d" style="flex: 1;" type="number" min="-180" max="180" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
<input class="input lng-dms-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
<input class="input lng-dms-s" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">秒</span>
|
||||
<span class="top-line"></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span class="label">纬度</span>
|
||||
<input class="input lat-dms-d" style="flex: 1;" type="number" min="-90" max="90" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
<input class="input lat-dms-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
<input class="input lat-dms-s" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
<span class="label" style="flex: 0 0 14px;margin: 0 10px;">秒</span>
|
||||
<span class="bottom-line"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col" style="flex: 0 0 24px; margin: 0;">
|
||||
<i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;position: relative;left: -30px;">
|
||||
<svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
||||
</i>
|
||||
<button class="convert" style="margin-left: 10px;">转 换</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="custom-divider" style="order: 10;margin-top: 12px;"></span>
|
||||
`
|
||||
_DialogObject._element.body.className = _DialogObject._element.body.className + ' proj-convert'
|
||||
let contentElm = document.createElement('div')
|
||||
contentElm.style.width = '460px'
|
||||
contentElm.style.display = 'flex'
|
||||
contentElm.style.flexDirection = 'column'
|
||||
contentElm.innerHTML = html
|
||||
_DialogObject.contentAppChild(contentElm)
|
||||
// let html = `
|
||||
// <span class="custom-divider"></span>
|
||||
// <div class="div-item">
|
||||
// <div class="row">
|
||||
// <div class="col input-select-box">
|
||||
// <span class="label" style="flex: 0 0 60px;">输入格式</span>
|
||||
// <div class="input-select"></div>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// <div class="div-item item" data-type="${0}">
|
||||
// <span class="custom-divider"></span>
|
||||
// <p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
||||
// <span style="margin-right: 10px;">度</span>
|
||||
// <span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如116.6°, 39.9°</span>
|
||||
// </p>
|
||||
// <div class="row">
|
||||
// <div class="col">
|
||||
// <span class="label" style="flex: auto;">经度</span>
|
||||
// <input class="input lng" type="number" min="-180" max="180" value="0" title="">
|
||||
// </div>
|
||||
// <div class="col" style="margin: 0;">
|
||||
// <span class="label">纬度</span>
|
||||
// <input class="input lat" type="number" min="-90" max="90" value="0" title="">
|
||||
// </div>
|
||||
// <div class="col" style="flex: 0 0 24px;">
|
||||
// <i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;">
|
||||
// <svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
||||
// </i>
|
||||
// <button class="convert" style="margin-left: 10px;">转 换</button>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// <div class="div-item item" data-type="${1}">
|
||||
// <span class="custom-divider"></span>
|
||||
// <p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
||||
// <span style="margin-right: 10px;">度分</span>
|
||||
// <span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如95°10.1702', 49°12.4015'</span>
|
||||
// </p>
|
||||
// <div class="row">
|
||||
// <div class="col" style="flex-direction: column;">
|
||||
// <div class="row" style="margin-bottom: 15px;">
|
||||
// <span class="label">经度</span>
|
||||
// <input class="input lng-dm-d" style="flex: 1;" type="number" min="-180" max="180" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
// <input class="input lng-dm-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
// <span class="top-line"></span>
|
||||
// </div>
|
||||
// <div class="row">
|
||||
// <span class="label">纬度</span>
|
||||
// <input class="input lat-dm-d" style="flex: 1;" type="number" min="-90" max="90" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
// <input class="input lat-dm-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
// <span class="bottom-line"></span>
|
||||
// </div>
|
||||
// </div>
|
||||
// <div class="col" style="flex: 0 0 24px;margin: 0;">
|
||||
// <i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;position: relative;left: -30px;">
|
||||
// <svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
||||
// </i>
|
||||
// <button class="convert" style="margin-left: 10px;">转 换</button>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// <div class="div-item item" data-type="${2}">
|
||||
// <span class="custom-divider"></span>
|
||||
// <p style="font-size: 16px;padding-bottom: 6px;margin-top: 10px;margin-bottom: 5px;">
|
||||
// <span style="margin-right: 10px;">度分秒</span>
|
||||
// <span style="font-size: 12px;margin-bottom: 5px;color: #F16C55">例如11°18'54.37", 39°13'46.57"</span>
|
||||
// </p>
|
||||
// <div class="row">
|
||||
// <div class="col" style="flex-direction: column;">
|
||||
// <div class="row" style="margin-bottom: 15px;">
|
||||
// <span class="label">经度</span>
|
||||
// <input class="input lng-dms-d" style="flex: 1;" type="number" min="-180" max="180" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
// <input class="input lng-dms-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
// <input class="input lng-dms-s" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">秒</span>
|
||||
// <span class="top-line"></span>
|
||||
// </div>
|
||||
// <div class="row">
|
||||
// <span class="label">纬度</span>
|
||||
// <input class="input lat-dms-d" style="flex: 1;" type="number" min="-90" max="90" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">度</span>
|
||||
// <input class="input lat-dms-m" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">分</span>
|
||||
// <input class="input lat-dms-s" style="flex: 1;" type="number" min="0" max="60" value="0" title="">
|
||||
// <span class="label" style="flex: 0 0 14px;margin: 0 10px;">秒</span>
|
||||
// <span class="bottom-line"></span>
|
||||
// </div>
|
||||
// </div>
|
||||
// <div class="col" style="flex: 0 0 24px; margin: 0;">
|
||||
// <i class="icon-copy-box" title="复制" data-clipboard-action="copy" data-clipboard-target=".input" style="cursor: pointer;position: relative;left: -30px;">
|
||||
// <svg class="icon-copy" style="margin: 4px;margin-bottom: 0px;"><use xlink:href="#yj-icon-copy"></use></svg>
|
||||
// </i>
|
||||
// <button class="convert" style="margin-left: 10px;">转 换</button>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// <span class="custom-divider" style="order: 10;margin-top: 12px;"></span>
|
||||
// `
|
||||
// _DialogObject._element.body.className = _DialogObject._element.body.className + ' proj-convert'
|
||||
// let contentElm = document.createElement('div')
|
||||
// contentElm.style.width = '460px'
|
||||
// contentElm.style.display = 'flex'
|
||||
// contentElm.style.flexDirection = 'column'
|
||||
// contentElm.innerHTML = html
|
||||
// _DialogObject.contentAppChild(contentElm)
|
||||
|
||||
let contentElm = document.getElementsByClassName('proj-convert')[0].getElementsByClassName('content')[0]
|
||||
|
||||
let items = contentElm.getElementsByClassName('item')
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
let type = items[i].getAttribute('data-type')
|
||||
let convertElm = items[i].getElementsByClassName('convert')[0]
|
||||
@ -183,20 +186,10 @@ const open = async (sdk, closeCallBack) => {
|
||||
});
|
||||
|
||||
clipboard.on('success', function (e) {
|
||||
window.ELEMENT &&
|
||||
window.ELEMENT.Message({
|
||||
message: '已复制到剪切板',
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
tools.message({ text: '已复制到剪切板' })
|
||||
});
|
||||
clipboard.on('error', function (e) {
|
||||
window.ELEMENT &&
|
||||
window.ELEMENT.Message({
|
||||
message: '复制失败',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
})
|
||||
tools.message({ type: 'warning', text: '复制失败' })
|
||||
});
|
||||
convertElm.addEventListener('click', () => {
|
||||
// let a = proj.degreesToDMS(100.345546743)
|
||||
@ -317,12 +310,7 @@ const open = async (sdk, closeCallBack) => {
|
||||
contentElm.getElementsByClassName('lat-dm-m')[0].value = latdnArr2[0]
|
||||
break
|
||||
}
|
||||
window.ELEMENT &&
|
||||
window.ELEMENT.Message({
|
||||
message: '转换成功',
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
tools.message({ text: '转换成功' })
|
||||
for (let m = 0; m < items.length; m++) {
|
||||
items[m].style.display = 'block'
|
||||
}
|
||||
@ -372,10 +360,10 @@ const open = async (sdk, closeCallBack) => {
|
||||
}
|
||||
]
|
||||
|
||||
let selectDataLegpObject = legp(_DialogObject._element.content.getElementsByClassName('input-select-box')[0], ".input-select")
|
||||
let selectDataLegpObject = legp(contentElm.getElementsByClassName('input-select-box')[0], ".input-select")
|
||||
if (selectDataLegpObject) {
|
||||
selectDataLegpObject.legp_search(selectData)
|
||||
let selectDataLegpElm = _DialogObject._element.content.getElementsByClassName('input-select')[0].getElementsByTagName('input')[0]
|
||||
let selectDataLegpElm = contentElm.getElementsByClassName('input-select')[0].getElementsByTagName('input')[0]
|
||||
selectDataLegpElm.value = selectData[0].value
|
||||
selectDataLegpElm.addEventListener('input', () => {
|
||||
for (let i = 0; i < selectData.length; i++) {
|
||||
|
@ -5,77 +5,78 @@ import MouseEvent from '../Event/index'
|
||||
import MouseTip from '../MouseTip'
|
||||
import Tools from '../Tools'
|
||||
let _DialogObject
|
||||
let tip
|
||||
let event
|
||||
const open = async (sdk, closeCallBack) => {
|
||||
let topls = new Tools()
|
||||
let proj = new Proj()
|
||||
let tip
|
||||
let event
|
||||
if (_DialogObject && _DialogObject.close) {
|
||||
_DialogObject.close()
|
||||
_DialogObject = null
|
||||
}
|
||||
_DialogObject = await new Dialog(sdk.viewer._container, {
|
||||
title: '投影转换', left: '180px', top: '100px',
|
||||
closeCallBack: () => {
|
||||
closeCallBack && closeCallBack()
|
||||
},
|
||||
})
|
||||
await _DialogObject.init()
|
||||
// if (_DialogObject && _DialogObject.close) {
|
||||
// _DialogObject.close()
|
||||
// _DialogObject = null
|
||||
// }
|
||||
// _DialogObject = await new Dialog(sdk.viewer._container, {
|
||||
// title: '投影转换', left: '180px', top: '100px',
|
||||
// closeCallBack: () => {
|
||||
// closeCallBack && closeCallBack()
|
||||
// },
|
||||
// })
|
||||
// await _DialogObject.init()
|
||||
|
||||
let html = `
|
||||
<span class="custom-divider"></span>
|
||||
<div style="width: 540px;display: flex;">
|
||||
<div class="row left" style="flex: 1;margin-bottom: 0;">
|
||||
<div style="margin: 10px 0;flex: 1;display: flex;align-items: center;flex: 1;justify-content: space-between;">
|
||||
<span class="lable-left-line">源坐标</span>
|
||||
<button class="btn pick" style="margin-left: 20px;"><svg class="icon-edit"><use xlink:href="#yj-icon-edit"></use></svg>坐标拾取</button>
|
||||
</div>
|
||||
<div>
|
||||
<div style="display: flex;margin-bottom: 12px;align-items: center;">
|
||||
<span class="label" style="flex: 0 0 60px;">椭圆基准</span>
|
||||
<div class="datalist_left"></div>
|
||||
</div>
|
||||
<div style="display: flex;margin-bottom: 12px;align-items: center;">
|
||||
<span class="label" style="flex: 0 0 60px;">经度(x)</span>
|
||||
<input class="input left-x" type="number" title="">
|
||||
</div>
|
||||
<div style="display: flex;margin-bottom: 10px;align-items: center;">
|
||||
<span class="label" style="flex: 0 0 60px;">纬度(y)</span>
|
||||
<input class="input left-y" type="number" title="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex;flex-direction: column;justify-content: center;margin: 28px 15px 0 15px;">
|
||||
<button class="btn convert">坐标转换<i style="margin-top: 2px;margin-left: 5px;" class="el-icon-right"></i></button>
|
||||
</div>
|
||||
<div class="row right" style="flex: 1;margin-bottom: 0;">
|
||||
<div style="margin: 10px 0;height: 32px; display: flex;align-items: center;flex: 1;justify-content: space-between;">
|
||||
<span class="lable-left-line">目标坐标</span>
|
||||
<button class="btn copy" data-clipboard-action="copy" data-clipboard-target=".input" style="margin-left: 20px;"><svg class="icon-copy"><use xlink:href="#yj-icon-copy"></use></svg>复制</button>
|
||||
</div>
|
||||
<div>
|
||||
<div style="display: flex;margin-bottom: 12px;align-items: center;">
|
||||
<span class="label" style="flex: 0 0 60px;">椭圆基准</span>
|
||||
<div class="datalist_right"></div>
|
||||
</div>
|
||||
<div style="display: flex;margin-bottom: 12px;align-items: center;">
|
||||
<span class="label" style="flex: 0 0 60px;">经度(x)</span>
|
||||
<input class="input right-x" readonly="readonly">
|
||||
</div>
|
||||
<div style="display: flex;margin-bottom: 10px;align-items: center;">
|
||||
<span class="label" style="flex: 0 0 60px;">纬度(y)</span>
|
||||
<input class="input right-y" readonly="readonly">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="custom-divider"></span>
|
||||
`
|
||||
let contentElm = document.createElement('div');
|
||||
contentElm.innerHTML = html
|
||||
_DialogObject.contentAppChild(contentElm)
|
||||
// let html = `
|
||||
// <span class="custom-divider"></span>
|
||||
// <div style="width: 540px;display: flex;">
|
||||
// <div class="row left" style="flex: 1;margin-bottom: 0;">
|
||||
// <div style="margin: 10px 0;flex: 1;display: flex;align-items: center;flex: 1;justify-content: space-between;">
|
||||
// <span class="lable-left-line">源坐标</span>
|
||||
// <button class="btn pick" style="margin-left: 20px;"><svg class="icon-edit"><use xlink:href="#yj-icon-edit"></use></svg>坐标拾取</button>
|
||||
// </div>
|
||||
// <div>
|
||||
// <div style="display: flex;margin-bottom: 12px;align-items: center;">
|
||||
// <span class="label" style="flex: 0 0 60px;">椭圆基准</span>
|
||||
// <div class="datalist_left"></div>
|
||||
// </div>
|
||||
// <div style="display: flex;margin-bottom: 12px;align-items: center;">
|
||||
// <span class="label" style="flex: 0 0 60px;">经度(x)</span>
|
||||
// <input class="input left-x" type="number" title="">
|
||||
// </div>
|
||||
// <div style="display: flex;margin-bottom: 10px;align-items: center;">
|
||||
// <span class="label" style="flex: 0 0 60px;">纬度(y)</span>
|
||||
// <input class="input left-y" type="number" title="">
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// <div style="display: flex;flex-direction: column;justify-content: center;margin: 28px 15px 0 15px;">
|
||||
// <button class="btn convert">坐标转换<i style="margin-top: 2px;margin-left: 5px;" class="el-icon-right"></i></button>
|
||||
// </div>
|
||||
// <div class="row right" style="flex: 1;margin-bottom: 0;">
|
||||
// <div style="margin: 10px 0;height: 32px; display: flex;align-items: center;flex: 1;justify-content: space-between;">
|
||||
// <span class="lable-left-line">目标坐标</span>
|
||||
// <button class="btn copy" data-clipboard-action="copy" data-clipboard-target=".input" style="margin-left: 20px;"><svg class="icon-copy"><use xlink:href="#yj-icon-copy"></use></svg>复制</button>
|
||||
// </div>
|
||||
// <div>
|
||||
// <div style="display: flex;margin-bottom: 12px;align-items: center;">
|
||||
// <span class="label" style="flex: 0 0 60px;">椭圆基准</span>
|
||||
// <div class="datalist_right"></div>
|
||||
// </div>
|
||||
// <div style="display: flex;margin-bottom: 12px;align-items: center;">
|
||||
// <span class="label" style="flex: 0 0 60px;">经度(x)</span>
|
||||
// <input class="input right-x" readonly="readonly">
|
||||
// </div>
|
||||
// <div style="display: flex;margin-bottom: 10px;align-items: center;">
|
||||
// <span class="label" style="flex: 0 0 60px;">纬度(y)</span>
|
||||
// <input class="input right-y" readonly="readonly">
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// <span class="custom-divider"></span>
|
||||
// `
|
||||
// let contentElm = document.createElement('div');
|
||||
// contentElm.innerHTML = html
|
||||
// _DialogObject.contentAppChild(contentElm)
|
||||
|
||||
// legp(contentElm, ".datalist").legp_search(tagData)
|
||||
let contentElm = document.getElementsByClassName('projection-convert')[0].getElementsByClassName('content')[0]
|
||||
|
||||
let tagData = []
|
||||
let i = 0
|
||||
@ -95,6 +96,7 @@ const open = async (sdk, closeCallBack) => {
|
||||
|
||||
let pickElm = contentElm.getElementsByClassName('pick')[0]
|
||||
let copyElm = contentElm.getElementsByClassName('copy')[0]
|
||||
let sourceCopyElm = contentElm.getElementsByClassName('sourceCopy')[0]
|
||||
let datalistLeftInput = contentElm.getElementsByClassName('datalist_left')[0].getElementsByTagName('input')[0]
|
||||
datalistLeftInput.value = tagData[0].value
|
||||
legpObjectLeft.legp_searchActive(tagData[0].value)
|
||||
@ -137,11 +139,7 @@ const open = async (sdk, closeCallBack) => {
|
||||
if (!leftXElm.value || !leftYElm.value) {
|
||||
rightXElm.value = ''
|
||||
rightYElm.value = ''
|
||||
window.ELEMENT && window.ELEMENT.Message({
|
||||
message: '请输入源坐标',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
topls.message({ type: 'warning', text: '请输入源坐标' })
|
||||
return
|
||||
}
|
||||
let result = proj.convert([{ x: Number(leftXElm.value), y: Number(leftYElm.value) }], datalistLeftInput.value, datalistRightInput.value)
|
||||
@ -150,11 +148,7 @@ const open = async (sdk, closeCallBack) => {
|
||||
rightYElm.value = result.points[0].y
|
||||
}
|
||||
else {
|
||||
window.ELEMENT && window.ELEMENT.Message({
|
||||
message: result.message,
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
topls.message({ type: 'warning', text: result.message })
|
||||
}
|
||||
})
|
||||
|
||||
@ -164,11 +158,7 @@ const open = async (sdk, closeCallBack) => {
|
||||
if (!rightXElm.value || !rightYElm.value) {
|
||||
rightXElm.value = ''
|
||||
rightYElm.value = ''
|
||||
window.ELEMENT && window.ELEMENT.Message({
|
||||
message: '复制失败,目标坐标为空!',
|
||||
type: 'warning',
|
||||
duration: 1500
|
||||
});
|
||||
topls.message({ type: 'warning', text: '复制失败,目标坐标为空!' })
|
||||
}
|
||||
else {
|
||||
let text = `${rightXElm.value},${rightYElm.value}`
|
||||
@ -177,13 +167,26 @@ const open = async (sdk, closeCallBack) => {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
clipboard.on('success', function (e) {
|
||||
window.ELEMENT &&
|
||||
window.ELEMENT.Message({
|
||||
message: '已复制到剪切板',
|
||||
type: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
topls.message({ text: '已复制到剪切板' })
|
||||
});
|
||||
|
||||
let sourcelipboard = new ClipboardJS(sourceCopyElm, {
|
||||
text: (trigger) => {
|
||||
if (!leftXElm.value || !leftYElm.value) {
|
||||
leftXElm.value = ''
|
||||
leftYElm.value = ''
|
||||
topls.message({ type: 'warning', text: '复制失败,目标坐标为空!' })
|
||||
}
|
||||
else {
|
||||
let text = `${leftXElm.value},${leftYElm.value}`
|
||||
return text;
|
||||
}
|
||||
}
|
||||
});
|
||||
sourcelipboard.on('success', function (e) {
|
||||
topls.message({ text: '已复制到剪切板' })
|
||||
});
|
||||
}
|
||||
|
||||
@ -192,6 +195,8 @@ const close = () => {
|
||||
_DialogObject.close()
|
||||
_DialogObject = null
|
||||
}
|
||||
tip && tip.destroy()
|
||||
event && event.destroy()
|
||||
}
|
||||
|
||||
export { open, close }
|
Reference in New Issue
Block a user