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

2017做那个网站致富海南百度首页广告

2017做那个网站致富,海南百度首页广告,网站建设中企动力强,设计公司英文这篇讲的是使用Draw绘制图形时根据绘制形状设置不同颜色。 根据下拉框中的值在styles对象中取对应的颜色对象,new Draw的时候将其设置为style参数。 const styles {Point: {"circle-radius": 5,"circle-fill-color": "red",},LineS…

这篇讲的是使用Draw绘制图形时根据绘制形状设置不同颜色。

根据下拉框中的值在styles对象中取对应的颜色对象,new Draw的时候将其设置为style参数。

 const styles = {Point: {"circle-radius": 5,"circle-fill-color": "red",},LineString: {"circle-radius": 5,"circle-fill-color": "red","stroke-color": "yellow","stroke-width": 2,},Polygon: {"circle-radius": 5,"circle-fill-color": "red","stroke-color": "yellow","stroke-width": 2,"fill-color": "blue",},Circle: {"circle-radius": 5,"circle-fill-color": "red","stroke-color": "blue","stroke-width": 2,"fill-color": "yellow",},};const typeSelect = document.getElementById("type");let draw; function addInteraction() {const value = typeSelect.value;if (value !== "None") {draw = new Draw({source: source,type: typeSelect.value,style: styles[value],});map.addInteraction(draw);}}

 需要注意的是这个style是绘制过程中的颜色,如果需要设置绘制完成后的颜色还得在图层中设置

  const source = new VectorSource({ wrapX: false });const vector = new VectorLayer({source: source,style:style});

 完整代码:

<template><div class="box"><h1>Drawing Features Style绘制不同颜色的图形</h1><div id="map"></div><div class="row"><div class="col-auto"><span class="input-group"><label class="input-group-text" for="type">Geometry type:</label><select class="form-select" id="type"><option value="Point">Point</option><option value="LineString">LineString</option><option value="Polygon">Polygon</option><option value="Circle">Circle</option><option value="None">None</option></select></span></div></div></div>
</template><script>
import Draw from "ol/interaction/Draw.js";
import Map from "ol/Map.js";
import View from "ol/View.js";
import { OSM, Vector as VectorSource } from "ol/source.js";
import { Tile as TileLayer, Vector as VectorLayer } from "ol/layer.js";
export default {name: "",components: {},data() {return {map: null,};},computed: {},created() {},mounted() {const raster = new TileLayer({source: new OSM(),});const source = new VectorSource({ wrapX: false });const vector = new VectorLayer({source: source,});const map = new Map({layers: [raster, vector],target: "map",view: new View({center: [-11000000, 4600000],zoom: 4,}),});const styles = {Point: {"circle-radius": 5,"circle-fill-color": "red",},LineString: {"circle-radius": 5,"circle-fill-color": "red","stroke-color": "yellow","stroke-width": 2,},Polygon: {"circle-radius": 5,"circle-fill-color": "red","stroke-color": "yellow","stroke-width": 2,"fill-color": "blue",},Circle: {"circle-radius": 5,"circle-fill-color": "red","stroke-color": "blue","stroke-width": 2,"fill-color": "yellow",},};const typeSelect = document.getElementById("type");let draw; function addInteraction() {const value = typeSelect.value;if (value !== "None") {draw = new Draw({source: source,type: typeSelect.value,style: styles[value],});map.addInteraction(draw);}}typeSelect.onchange = function () {map.removeInteraction(draw);addInteraction();};addInteraction();},methods: {},
};
</script><style lang="scss" scoped>
#map {width: 100%;height: 500px;
}
.box {height: 100%;
}#info {width: 100%;height: 24rem;overflow: scroll;display: flex;align-items: baseline;border: 1px solid black;justify-content: flex-start;
}
</style>

http://www.yidumall.com/news/73879.html

相关文章:

  • 做僾网站关键词查询神器
  • 吉林省建设监理协会网站诚信建设免费优化
  • 用DW做网站时怎么在新窗口打开成都网站seo技巧
  • 喜满堂网站建设常见的网站推广方法有哪些
  • 学做宝宝衣服网站汕头网站建设技术外包
  • 厦门网站建设开发百度直播平台
  • 网站维护员招聘怎么制作网页
  • 好的做外贸的网站广州各区风险区域最新动态
  • 如何在网站发广告公司网页制作教程
  • 网站建设费用的会计种子搜索神器 bt 下载
  • 阿里云模板建站好不好厦门seo优化推广
  • 现在网站还用asp做关键词搜索工具好站网
  • 国内php开发的电商网站有哪些小升初最好的补课机构排行榜
  • app手机程序开发百度seo是啥
  • jf厂高仿手表网站苏州新闻今天最新消息新闻事件
  • 制作网站技术东莞seo网站排名优化
  • 海珠区建设和水务局网站优化网站推广教程排名
  • 英文企业网站开发网络营销的主要方式和技巧
  • 唐山seo网络推广百度seo推广怎么收费
  • 商标设计网站主要提供哪些服务企业qq一年多少费用
  • 个人公众号做电影网站吗长沙seo培训班
  • 潍坊网站seo外包网站超级外链
  • 男女直接做那个视频网站腾讯广告代理商加盟
  • 网站开发维护成本计算网站建设公司是怎么找客户
  • 网站建设 psd站内推广的方法和工具
  • 建设银行网站显示404网站seo百度百科
  • 淘宝建设网站首页网站运营需要多少钱
  • 便宜网站制作公司百度经验发布平台
  • 做网站怎样安全采集seo推广主要做什么的
  • 武汉云优化网站建设营销型网站方案