当前位置: 首页 > news >正文

郑州网站建设专家电子商务营销

郑州网站建设专家,电子商务营销,山西网站建设报价单,怎么做网站文字图片使用addInteraction添加交互draw绘制&#xff0c;预期removeInteraction删除交互draw绘制时不再绘制&#xff0c;但是删除绘制不起作用&#xff0c;各种找原因&#xff0c;结果把data中的map变量注释掉即可&#xff0c;原因未知。 <template><div><div id"…

使用addInteraction添加交互draw绘制,预期removeInteraction删除交互draw绘制时不再绘制,但是删除绘制不起作用,各种找原因,结果把data中的map变量注释掉即可,原因未知。

<template><div><div id="map" style="position:absolute;width:100vw;height:100vh"></div><div style="position: absolute; left: 50px; top:10px"><el-button @click="addInteractions">绘制</el-button><el-button @click="removeInteractions">取消</el-button></div></div>
</template>
<script src="./index.js"></script>
<style lang="scss" src="./index.scss" scoped></style>
import "ol/ol.css";
import GeoJSON from 'ol/format/GeoJSON'
import { Map, View } from "ol";
import TileLayer from "ol/layer/Tile";
import { fromLonLat } from "ol/proj";
import { Select, Modify, Draw, Snap } from 'ol/interaction';
import { Tile, Vector as VectorLayer } from 'ol/layer'
import { Point } from 'ol/geom'
import { XYZ, TileWMS, Vector as VectorSource } from 'ol/source'
import MapOne from '@/components/MapOne/index.vue';export default {components: {MapOne},data() {return {// map: null, // 不要声明,否则removeInteraction不起作用}},computed: {},watch: {},mounted() {this.initMap()},created() {},methods: {initMap() {this.map = new Map({target: "map",view: new View({center: fromLonLat([113.53450137499999, 34.44104525]),zoom: 5}),layers: [new TileLayer({source: new XYZ({url: 'http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}'}),}),],});this.selectSource = new VectorSource({format: new GeoJSON(),})var selectLayer = new VectorLayer({source: this.selectSource,})this.map.addLayer(selectLayer)},addInteractions() {this.select = new Select({wrapX: false,});this.modify = new Modify({features: this.select.getFeatures(),});this.draw = new Draw({type: 'Polygon',source: this.selectSource,});this.snap = new Snap({source: this.selectSource,});this.changeInteractions('draw')},removeInteractions() {this.map.removeInteraction(this.modify);this.map.removeInteraction(this.select);this.map.removeInteraction(this.draw);this.map.removeInteraction(this.select);},changeInteractions(value) {this.removeInteractions();switch (value) {case 'draw': {this.map.addInteraction(this.draw);this.map.addInteraction(this.snap);break;}case 'modify': {this.map.addInteraction(this.select);this.map.addInteraction(this.modify);this.map.addInteraction(this.snap);break;}default: {// pass}}},}
}

http://www.wooajung.com/news/21927.html

相关文章:

  • 做美食下载什么网站智能营销方法
  • 一级a做爰片51网站超级软文网
  • 海珠区网站建设武汉it培训机构排名前十
  • 邯郸做网站找谁关键词推广是什么意思
  • 如何挖掘和布局网站关键词游戏优化是什么意思
  • 河南省做网站的公司中文网站排行榜
  • 上海政府门户网站的建设网址创建
  • 做音频的网站网站搭建工具
  • 网站建设免费的服务器搜索引擎优化与推广技术
  • h5广告宜昌网站seo收费
  • 摄影网站定位抖音搜索关键词排名查询
  • 墙绘网站建设如何在百度上发布自己的广告
  • 中国排名前十的企业百度seo流量
  • 沈阳网站制作找网势科技seo关键词怎么选
  • wordpress加个留言板海洋seo
  • 一般网站设计多大宽度互联网营销外包推广
  • 美食网站建设策划书网站百度百科
  • 上海网安备案网站seosem顾问
  • java 做博客网站抖音seo怎么做
  • 杭州建设网站网站app拉新一手渠道商
  • 山东网站建设费用网络优化的三个方法
  • 个人网站的设计论文怎么给公司做网站
  • 北京做网站推广seogoogle怎么推广
  • 珠海网站建设案例汕头网站建设方案开发
  • wordpress权重推广优化网站排名教程
  • 国家卫生计生委能力建设和继续教育中心网站百度指数如何分析数据
  • 品牌网站建设-建站之路搜索优化指的是什么
  • 网站建设的一般步骤包含哪些自己有域名怎么建网站
  • 成都中方互动做网站怎样品牌营销服务
  • 佛山新网站制作公司seo比较好的公司