Commit 6f25f3bf authored by caicaicai's avatar caicaicai

修改

parent b9815056
......@@ -306,7 +306,13 @@ export default {
</tr>
</table>`;
initGraphicManager(graphicLayer1,itemText);
that.addGraphic_02(graphicLayer1,this.persons,'卡车一');
//that.addGraphic_02(graphicLayer1,this.persons,'卡车一');
//创建矢量数据图层4
var graphicLayer4 = new mars3d.layer.GraphicLayer();
map.addLayer(graphicLayer4)
that.addDemoGraphics(graphicLayer4);
// 抛出事件
this.$emit('onload', map)
......@@ -421,7 +427,66 @@ export default {
}
return property;
},
addDemoGraphics(graphicLayer4) {
let that = this;
for (let i = 0; i < 1; i++) {
const graphic = new mars3d.graphic.ModelPrimitive({
style: {
url: "//data.mars3d.cn/gltf/mars/car/tufangche.glb",
scale: 0.1,
minimumPixelSize: 50,
// 高亮时的样式(默认为鼠标移入,也可以指定type:'click'单击高亮),构造后也可以openHighlight、closeHighlight方法来手动调用
highlight: {
type: mars3d.EventType.click,
silhouette: true,
silhouetteColor: "#ff0000",
silhouetteSize: 4
},
label: {
// 不需要文字时,去掉label配置即可
text: "鲁A12345",
font_size: 16,
color: "#ffffff",
outline: true,
outlineColor: "#000000",
pixelOffsetY: -20,
distanceDisplayCondition: true,
distanceDisplayCondition_far: 50000,
distanceDisplayCondition_near: 0
}
},
})
graphicLayer4.addGraphic(graphic)
}
// 设置动态位置
graphicLayer4.eachGraphic((graphic) => {
graphic.addDynamicPosition(that.randomPoint()) // 首次出现的位置
})
graphicLayer4.eachGraphic((graphic) => {
graphic.addDynamicPosition(that.randomPoint(), 50) // 按20秒运动至指定位置
})
// 定时更新动态位置(setInterval为演示)
setInterval(() => {
graphicLayer4.eachGraphic((graphic) => {
graphic.addDynamicPosition(that.randomPoint(), 50)
})
}, 20000)
},
// 取区域内的随机点
randomPoint() {
const jd = this.random(117.130666 * 1000, 117.130241 * 1000) / 1000
const wd = this.random(36.655207 * 1000, 36.665207 * 1000) / 1000
console.log("jd",jd);
console.log("wd",wd);
return Cesium.Cartesian3.fromDegrees(jd, wd, 500)
},
random(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min)
}
}
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment