增加地图实体选中功能

This commit is contained in:
2024-10-08 14:49:06 +08:00
parent 9463c42e59
commit 5cc716a3ba
1 changed files with 24 additions and 2 deletions

View File

@ -214,6 +214,7 @@
<script> <script>
import { getDataSearch, voyageNameList, PlatformTypeList, equipmentTypeList, dataTypeList, dataPoints, sampleLineList, sampleStationList } from '../api/dataSearch' import { getDataSearch, voyageNameList, PlatformTypeList, equipmentTypeList, dataTypeList, dataPoints, sampleLineList, sampleStationList } from '../api/dataSearch'
import { getParamsList, getVoyageLine } from '../api/home' import { getParamsList, getVoyageLine } from '../api/home'
import Cookies from 'js-cookie'
const Cesium = window.Cesium const Cesium = window.Cesium
export default { export default {
name: 'Shuju', name: 'Shuju',
@ -332,7 +333,8 @@ export default {
search_value: this.searchValue, search_value: this.searchValue,
limit: 20, limit: 20,
start: 0, start: 0,
group: 10 group: 10,
FrameSessionId: Cookies.get('JSESSIONID')
} }
getDataSearch(params).then(res => { getDataSearch(params).then(res => {
const arr = res.page.records const arr = res.page.records
@ -456,6 +458,24 @@ export default {
// //
this.viewer.imageryLayers.get(0).show = false 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( const earthMap = new Cesium.WebMapTileServiceImageryProvider(
{ {
@ -497,6 +517,7 @@ export default {
drawLine(index, id, degreeArr) { drawLine(index, id, degreeArr) {
this.viewer.entities.add({ this.viewer.entities.add({
id: id, id: id,
type: 'line',
polyline: { //polyline线 polyline: { //polyline线
positions: Cesium.Cartesian3.fromDegreesArray(degreeArr),// positions: Cesium.Cartesian3.fromDegreesArray(degreeArr),//
clampToGround: true, //, clampToGround: true, //,
@ -518,6 +539,7 @@ export default {
setPoint(id, degree) { setPoint(id, degree) {
this.viewer.entities.add({ this.viewer.entities.add({
id: id, id: id,
type: 'point',
position: Cesium.Cartesian3.fromDegrees(degree[0], degree[1]), position: Cesium.Cartesian3.fromDegrees(degree[0], degree[1]),
point: { point: {
pixelSize: 8, // pixelSize: 8, //
@ -742,7 +764,7 @@ export default {
this.chooseStation.point.color = Cesium.Color.RED this.chooseStation.point.color = Cesium.Color.RED
} }
if (this.chooseLine) { if (this.chooseLine) {
this.chooseLine.polyline.width = 5 this.chooseLine.polyline.width = 2
this.chooseLine.polyline.material = this.chooseLine.oldMaterial this.chooseLine.polyline.material = this.chooseLine.oldMaterial
} }
}, },