当前位置:网站首页>mars3d点线面的绘制和重置
mars3d点线面的绘制和重置
2022-06-23 05:23:00 【~前端小攻城狮】
<template>
<div id="app">
地图
<button @click="drawPoint()">点</button>
<button @click="drawLine()">线</button>
<button @click="drawPolygon()">面</button>
<button @click="clearFeatures()">重置</button>
<div id="mars3dContainer" class="mars3d-container"></div>
</div>
</template>
<script>
import * as mars3d from "mars3d";
export default {
name: "App",
methods: {
init() {
var mapOptions = {
basemaps: [{ name: "天地图", type: "tdt", layer: "img_d", show: true }],
};
// 创建三维地球场景
const map = new mars3d.Map("mars3dContainer", mapOptions);
this.map = map;
return map;
},
drawPolygon(clampToGround) {
this.map.graphicLayer.startDraw({
type: "polygon",
style: {
color: clampToGround ? "#ffff00" : "#3388ff",
opacity: 0.5,
outline: true,
outlineColor: "#ffffff",
outlineWidth: 2.0,
clampToGround: clampToGround,
},
});
},
drawPoint(clampToGround) {
this.map.graphicLayer.startDraw({
type: "point",
style: {
color: clampToGround ? "#ffff00" : "#3388ff",
opacity: 0.5,
outline: true,
outlineColor: "#ffffff",
outlineWidth: 2.0,
clampToGround: clampToGround,
},
});
},
drawLine(clampToGround) {
this.map.graphicLayer.startDraw({
type: "polyline",
style: {
color: clampToGround ? "#ffff00" : "#3388ff",
opacity: 0.5,
outline: true,
outlineColor: "#ffffff",
outlineWidth: 2.0,
clampToGround: clampToGround,
},
});
},
clearFeatures() {
this.map.graphicLayer.clear();
},
},
mounted() {
this.init();
},
};
</script>
<style>
#mars3dContainer {
height: 800px;
}
</style>边栏推荐
- How to build a data application system based on overall value for energy enterprises
- Smart port: how to realize intelligent port supervision based on the national standard gb28181 protocol easygbs?
- Day_04 傳智健康項目-預約管理-套餐管理
- English语法_形容词比较级 - 3级变化
- Day_ 05 smart communication health project - appointment management - appointment settings
- C language obtains second, millisecond, subtle and nanosecond timestamps
- Day_ 02 smart communication health project - appointment management - inspection item management
- Day_02 传智健康项目-预约管理-检查项管理
- 将TensorFlow1.x改写为pytorch
- Sklearn classification in sklearn_ Report & accuracy / recall /f1 value
猜你喜欢
随机推荐
把CSMA/CD、Token Bus、Token Ring说清楚
For non dpdk kvm1.0 machines, set init Maxrxbuffers changed from 256 to 1024 to improve packet receiving capacity
RF content learning
Day_ 09 smart health project - mobile terminal development - Mobile quick login and permission control
idea的去除转义的复制粘贴
Coordinate transformation
In the half year summary, it people just want to lie flat
Day_ 02 smart communication health project - appointment management - inspection item management
C语言去除字符串尾部的换行(或其他字符)
Global attribute lang attribute
Skilled use of slicing operations
Day_ 06 smart health project - mobile terminal development - physical examination appointment
如何查看本机IP
综合培养学生脑力思维的少儿编程
Redis sentry
haas506 2.0开发教程-高级组件库-modem.sim(仅支持2.2以上版本)
haas506 2.0开发教程-高级组件库-modem.sms(仅支持2.2以上版本)
qt creater搭建osgearth环境(osgQT MSVC2017)
Smart port: how to realize intelligent port supervision based on the national standard gb28181 protocol easygbs?
Termux









