固定航线支持航线轨迹,循环航线

main
许宏杰 2 weeks ago
parent 30e07b54e2
commit 4a76d2bebe

@ -5,7 +5,7 @@
<script setup> <script setup>
import marsMap from "@/components/marsMap"; import marsMap from "@/components/marsMap";
import PointJson from "./point.json"; import PointJson from "./point.json";
import { onMounted } from "vue"; import { onMounted,nextTick } from "vue";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
let options = { let options = {
scene: { scene: {
@ -90,7 +90,11 @@ const mapLoad = (mapInstance) => {
mapLayer.uav = new mars3d.layer.GraphicLayer() mapLayer.uav = new mars3d.layer.GraphicLayer()
map.addLayer(mapLayer.uav); map.addLayer(mapLayer.uav);
boostrapUav(); map.on(mars3d.EventType.load, function (event) {
boostrapUav();
})
}; };
@ -133,12 +137,12 @@ const onAddGamepadboardListener = () => {
}; };
const boostrapUav = () => { const boostrapUav = () => {
// // //
// initRectangle(); initRectangle();
// // //
initMarker(); initMarker();
// //
// initUav(); initUav();
}; };
const startgamepad = () => { const startgamepad = () => {
@ -239,13 +243,9 @@ const onAdjustAttitude = () => {
const initUav = () => { const initUav = () => {
if (list.length == 0 && !isGamepad ) { if (list.length == 0 && !isGamepad ) {
PointJson.map((item) => { list = PointJson.map((item) => item.wz);
const position = item.wz.split(",").map(Number)
position[2] = 100
list.push(position);
});
} }
uav = new mars3d.graphic.Route({ uav = new mars3d.graphic.FixedRoute({
id: "uav1", id: "uav1",
name: "无人机模型", name: "无人机模型",
position: { position: {
@ -253,6 +253,7 @@ const initUav = () => {
speed: 100, speed: 100,
list: list, list: list,
}, },
clockLoop: true, //
model: { model: {
url: "https://data.mars3d.cn/gltf/mars/wrj.glb", url: "https://data.mars3d.cn/gltf/mars/wrj.glb",
scale: 0.1, scale: 0.1,
@ -260,12 +261,19 @@ const initUav = () => {
runAnimations: true, runAnimations: true,
// mergeOrientation: true, // mergeOrientation: true,
}, },
polyline:{
materialType: mars3d.MaterialType.PolylineDash,//线
materialOptions:{
color: 'rgba(34, 232, 174, 1)',
dashLength: 8.0
}
},
camera: { camera: {
type: "gs", type: "gs",
}, },
}); });
mapLayer.uav.addGraphic(uav); mapLayer.uav.addGraphic(uav);
uav.start()
}; };
const initRectangle = () => { const initRectangle = () => {

@ -4,20 +4,17 @@
"wz":[120.657967,31.048193,100] "wz":[120.657967,31.048193,100]
}, },
{ {
"name": "吴江公园", "name": "胜地生态公园",
"wz":[120.634741,31.155611,100] , "wz":[120.650494,31.082684,100] ,
"type": "park" "type": "park"
}, },
{ {
"name": "江苏同里国家湿地公园", "name": "江苏同里国家湿地公园",
"wz":[120.806956,31.157053,100] , "wz":[120.806956,31.157053,100] ,
"type": "park" "type": "park"
}, },
{
"name": "胜地生态公园",
"wz":[120.650494,31.082684,100] ,
"type": "park"
},
{ {
"name": "新湖郁金香公园", "name": "新湖郁金香公园",
"wz":[120.634291,31.183498,100] , "wz":[120.634291,31.183498,100] ,
@ -257,5 +254,10 @@
"name": "吴江高级中学", "name": "吴江高级中学",
"wz":[120.645829,31.175176,100] , "wz":[120.645829,31.175176,100] ,
"type": "school" "type": "school"
},
{
"name": "吴江公园",
"wz":[120.634741,31.155611,100] ,
"type": "park"
} }
] ]
Loading…
Cancel
Save