增加地图实体选中功能
This commit is contained in:
parent
9463c42e59
commit
5cc716a3ba
|
|
@ -214,6 +214,7 @@
|
|||
<script>
|
||||
import { getDataSearch, voyageNameList, PlatformTypeList, equipmentTypeList, dataTypeList, dataPoints, sampleLineList, sampleStationList } from '../api/dataSearch'
|
||||
import { getParamsList, getVoyageLine } from '../api/home'
|
||||
import Cookies from 'js-cookie'
|
||||
const Cesium = window.Cesium
|
||||
export default {
|
||||
name: 'Shuju',
|
||||
|
|
@ -332,7 +333,8 @@ export default {
|
|||
search_value: this.searchValue,
|
||||
limit: 20,
|
||||
start: 0,
|
||||
group: 10
|
||||
group: 10,
|
||||
FrameSessionId: Cookies.get('JSESSIONID')
|
||||
}
|
||||
getDataSearch(params).then(res => {
|
||||
const arr = res.page.records
|
||||
|
|
@ -456,6 +458,24 @@ export default {
|
|||
// 不显示底图
|
||||
this.viewer.imageryLayers.get(0).show = false
|
||||
|
||||
// 创建一个ScreenSpaceEventHandler实例
|
||||
const handler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
|
||||
// 设置一个点击事件监听器
|
||||
handler.setInputAction((click) => {
|
||||
// 获取点击位置的笛卡尔坐标(世界坐标)
|
||||
const pickedObject = this.viewer.scene.pick(click.position);
|
||||
this.currenSample = pickedObject.id._id
|
||||
const type = pickedObject.id._type
|
||||
if (type === 'line') {
|
||||
this.job = '测线作业'
|
||||
} else {
|
||||
this.job = '站位作业'
|
||||
}
|
||||
this.onSample({
|
||||
tsy_id: pickedObject.id._id
|
||||
})
|
||||
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
||||
|
||||
// 叠加叠加影像服务
|
||||
const earthMap = new Cesium.WebMapTileServiceImageryProvider(
|
||||
{
|
||||
|
|
@ -497,6 +517,7 @@ export default {
|
|||
drawLine(index, id, degreeArr) {
|
||||
this.viewer.entities.add({
|
||||
id: id,
|
||||
type: 'line',
|
||||
polyline: { //polyline折线实体
|
||||
positions: Cesium.Cartesian3.fromDegreesArray(degreeArr),//位置
|
||||
clampToGround: true, //地表层高度模式,
|
||||
|
|
@ -518,6 +539,7 @@ export default {
|
|||
setPoint(id, degree) {
|
||||
this.viewer.entities.add({
|
||||
id: id,
|
||||
type: 'point',
|
||||
position: Cesium.Cartesian3.fromDegrees(degree[0], degree[1]),
|
||||
point: {
|
||||
pixelSize: 8, // 点像素大小
|
||||
|
|
@ -742,7 +764,7 @@ export default {
|
|||
this.chooseStation.point.color = Cesium.Color.RED
|
||||
}
|
||||
if (this.chooseLine) {
|
||||
this.chooseLine.polyline.width = 5
|
||||
this.chooseLine.polyline.width = 2
|
||||
this.chooseLine.polyline.material = this.chooseLine.oldMaterial
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue