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

用花瓣网站上的图片做游戏行吗百度指数网

用花瓣网站上的图片做游戏行吗,百度指数网,wordpress 农场主题,帝国生成网站地图官网demo地址: LineString Arrows 这篇介绍了在地图上绘制箭头。 创建一个矢量数据源,将其绑定为draw的数据源并展示在矢量图层上。 const source new VectorSource();const vector new VectorLayer({source: source,style: styleFunction,});map.ad…

官网demo地址:

LineString Arrows 

 这篇介绍了在地图上绘制箭头。

创建一个矢量数据源,将其绑定为draw的数据源并展示在矢量图层上。

  const source = new VectorSource();const vector = new VectorLayer({source: source,style: styleFunction,});map.addInteraction(new Draw({source: source,type: "LineString",}));

绘制直线时,通过style函数将直线的末端添加箭头图标。通过forEachSegment 函数拿到箭头的起点和终点坐标,使用 Math.atan2计算出箭头图标的旋转角度。 

const styleFunction = function (feature) {const geometry = feature.getGeometry();const styles = [new Style({stroke: new Stroke({color: "#ffcc33",width:2,}),}),];geometry.forEachSegment(function (start, end) {const dx = end[0] - start[0];const dy = end[1] - start[1];const rotation = Math.atan2(dy, dx);styles.push(new Style({geometry: new Point(end),image: new Icon({src: "https://openlayers.org/en/latest/examples/data/arrow.png",anchor: [0.75, 0.5],rotateWithView: true,rotation: -rotation,}),}));});return styles;};

完整代码:

<template><div class="box"><h1>LineString Arrows</h1><div id="map" class="map"></div></div>
</template><script>
import StadiaMaps from "ol/source/StadiaMaps.js";
import Draw from "ol/interaction/Draw.js";
import Map from "ol/Map.js";
import Point from "ol/geom/Point.js";
import View from "ol/View.js";
import { Icon, Stroke, Style } from "ol/style.js";
import { OSM, Vector as VectorSource } from "ol/source.js";
import { Tile as TileLayer, Vector as VectorLayer } from "ol/layer.js";
import { get } from "ol/proj.js";
export default {name: "",components: {},data() {return {map: null,};},computed: {},created() {},mounted() {const layer = new TileLayer({source: new StadiaMaps({layer: "stamen_terrain_background",}),});const source = new VectorSource();const styleFunction = function (feature) {const geometry = feature.getGeometry();const styles = [new Style({stroke: new Stroke({color: "#ffcc33",width:2,}),}),];geometry.forEachSegment(function (start, end) {const dx = end[0] - start[0];const dy = end[1] - start[1];const rotation = Math.atan2(dy, dx);styles.push(new Style({geometry: new Point(end),image: new Icon({src: "https://openlayers.org/en/latest/examples/data/arrow.png",anchor: [0.75, 0.5],rotateWithView: true,rotation: -rotation,}),}));});return styles;};const vector = new VectorLayer({source: source,style: styleFunction,});const extent = get("EPSG:3857").getExtent().slice();extent[0] += extent[0];extent[2] += extent[2];const map = new Map({layers: [layer, vector],target: "map",view: new View({center: [-11000000, 4600000],zoom: 4,extent,}),});map.addInteraction(new Draw({source: source,type: "LineString",}));},methods: {},
};
</script><style lang="scss" scoped>
#map {width: 100%;height: 500px;
}
.box {height: 100%;
}</style>

 

http://www.ds6.com.cn/news/63505.html

相关文章:

  • 网站良精企业网站系统优秀营销软文范例300字
  • php怎么做全网小视频网站网站外链查询
  • 用html做登录网站河南做网站的公司
  • 免费云服务器试用7天来宾网站seo
  • php新闻网站源码北京网站优化对策
  • 网站维护企业制作小程序的软件
  • 西安蓝海网站建设优化网站链接的方法
  • 微信开店哪个平台好seo技术介绍
  • 网站开发技术岗位职责百度旗下有哪些app
  • 北京一家专门做会所的网站广告营销是做什么的
  • 商城网站建设服务器网站快速排名
  • 潍坊网站建设wf3网站运营推广的方法有哪些
  • 西安北郊做网站北京seo运营
  • 手机网站建设cz35百度文库首页官网
  • 如何知道网站什么时候做的郑州专业的网站公司
  • 电子商务网站规划的原则科技公司网站制作公司
  • 高端的家居行业网站开发seo技术分享免费咨询
  • 自己在电脑上建文档做网站怎么做十大最免费软件排行榜
  • 企业网站建设哪家专业百度收录网站
  • 做垂直类网站精准引流客源的方法可靠吗
  • 九江市建设监理有限公司网站东莞seo建站公司哪家好
  • 购物网站建设网站百度广告登录入口
  • php网站开发报告郑州网站优化排名
  • 单位网站链接怎样做杭州企业seo
  • 福州哪里会网站制作的济南百度seo
  • 住房公积金网站怎么做减员郑州网站优化软件
  • 做网站可以赚钱吗seo搜索引擎优化到底是什么
  • 网站宣传的方法有哪些独立站seo优化
  • 网站图片引导页怎么做网站开发软件
  • 免费vip电影网站怎么做seo网站推广收费