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

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

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

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