当前位置:网站首页>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>边栏推荐
- Programmers' real ideas | daily anecdotes
- Index - MySQL
- Day_ 03 smart communication health project - appointment management - inspection team management
- 综合培养学生脑力思维的少儿编程
- Day_07 传智健康项目-Freemarker
- 从 WAN 到 SD-WAN 边缘设备的网络架构
- Smart port: how to realize intelligent port supervision based on the national standard gb28181 protocol easygbs?
- Kubesphere offline deployment without network environment
- 什么是PDCA循环?如何整合 PDCA 循环和 OKR
- Day_05 传智健康项目-预约管理-预约设置
猜你喜欢

Day_ 09 smart health project - mobile terminal development - Mobile quick login and permission control

Gridsearchcv (grid search), a model parameter adjuster in sklearn

Illustration Google V8 18: asynchronous programming (I): how does V8 implement micro tasks?

业务逻辑安全思路总结

Synchronous switching power supply reduces EMI layout dv/dt di/dt

Day_ 03 smart communication health project - appointment management - inspection team management

什么是客户体验自动化?

Detailed explanation of redis persistence, master-slave and sentry architecture

Day_ 05 smart communication health project - appointment management - appointment settings

Day_03 传智健康项目-预约管理-检查组管理
随机推荐
Illuminate\support\collection de duplication unique list de duplication
Machine learning artifact scikit learn minimalist tutorial
Day_ 09 smart health project - mobile terminal development - Mobile quick login and permission control
Qt使用多线程编译项目的方法
Day_08 传智健康项目-移动端开发-体检预约
Link of Baidu URL parameter? Research on URL parameter encryption and decryption (code example)
CVE-2021-20038
sklearn sklearn中classification_report&精确度/召回率/F1值
There are so many code comments! I laughed
English语法_形容词比较级 - 3级变化
C # database reports errors. Let's have a look
How to batch produce QR codes that can be read online after scanning
C Advanced Learning -- Reflection
解读创客教育中的团结协作精神
Day_05 传智健康项目-预约管理-预约设置
Illustration Google V8 18: asynchronous programming (I): how does V8 implement micro tasks?
程序员的真实想法 | 每日趣闻
Long substring without repeating characters for leetcode topic resolution
中台库存中的实仓与虚仓的业务逻辑设计
MySQL5.6 (5.7-8) 基于shardingsphere5.1.1 Sharding-Proxy模式读写分离