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

网站更改公司需要重新备案吗推广软文范文800字

网站更改公司需要重新备案吗,推广软文范文800字,做sns网站要多大空间,app软件开发公司排行目录 一、案例截图 二、安装OpenLayers库 三、代码实现 3.1、HTML页面 3.2、初始化变量 3.3、创建起始点位 3.4、遍历轨迹点 3.5、画折线 3.6、初始化弹窗信息 3.7、初始化地图上标点的点击事件 3.8、完整代码 四、Gitee源码 一、案例截图 二、安装OpenLayers库 n…

目录

一、案例截图

二、安装OpenLayers库

三、代码实现

3.1、HTML页面

3.2、初始化变量

3.3、创建起始点位

3.4、遍历轨迹点

3.5、画折线

3.6、初始化弹窗信息

3.7、初始化地图上标点的点击事件

3.8、完整代码

四、Gitee源码


一、案例截图

二、安装OpenLayers库

npm install ol

三、代码实现

整体的实现思路:

1、创建开始、结束点位。

2、遍历轨迹点信息

3、画出轨迹折线

4、初始化弹窗样式

5、初始化地图上标点的点击事件。

3.1、HTML页面

关键代码:

<template><div><div id="map-container"></div><div id="popup-box" class="popup-box"><button id="close-button" class="close-button">&times;</button><div id="popup-content" class="popup-content"></div></div></div>
</template>

3.2、初始化变量

关键代码:

data() {return {map:null,overLay:null,// 定义路径坐标pointList: [[120.430070,31.938140],[120.428570,31.939100],[120.429530,31.941680],[120.431240,31.943580],[120.432410,31.944820],[120.433600,31.943970],],pointLayer: new VectorLayer({source: new VectorSource(),zIndex: 5}),}
},

3.3、创建起始点位

关键代码:

/*** 创建开始点位*/
createStartPoint(){// 创建feature要素,一个feature就是一个点坐标信息let feature = new Feature({geometry: new Point(this.pointList[0]),});// 设置要素的图标feature.setStyle(new Style({// 设置图片效果image: new Icon({src: 'http://lbs.tianditu.gov.cn/images/bus/start.png',// anchor: [0.5, 0.5],scale: 1,}),zIndex: 10,}),);this.pointLayer.getSource().addFeature(feature);
},
//创建结束点位
createEndPoint(){// 创建feature要素,一个feature就是一个点坐标信息let feature = new Feature({geometry: new Point(this.pointList[this.pointList.length-1]),});// 设置要素的图标feature.setStyle(new Style({// 设置图片效果image: new Icon({src: 'http://lbs.tianditu.gov.cn/images/bus/end.png',// anchor: [0.5, 0.5],scale: 1,}),zIndex: 10}),);this.pointLayer.getSource().addFeature(feature);
},

3.4、遍历轨迹点

先封装一个创建轨迹点的方法:

关键代码:

//创建轨迹点位
addPoint(coordinate) {// 创建feature要素,一个feature就是一个点坐标信息let feature = new Feature({geometry: new Point(coordinate),});// 设置要素的图标feature.setStyle(new Style({// 使用 Circle 图形image: new Circle({radius: 10, // 圆的半径fill: new Fill({color: 'white', // 内部颜色}),stroke: new Stroke({color: 'blue', // 外部颜色width: 3, // 外圈线宽}),}),zIndex: 5}),);return feature;
},

遍历轨迹点:

关键代码:

/*** 遍历点位*/
drawPoints(){this.createStartPoint();for(let i = 0 ; i < this.pointList.length ; i++){let feature = this.addPoint(this.pointList[i]);this.pointLayer.getSource().addFeature(feature);}this.createEndPoint();this.map.addLayer(this.pointLayer);
},

3.5、画折线

关键代码:

//画线
drawLine(){// 创建线特征const lineFeature = new Feature({geometry: new LineString(this.pointList),});// 设置线样式const lineStyle = new Style({stroke: new Stroke({color: '#25C2F2',width: 4,lineDash: [10, 8], // 使用点划线 数组的值来控制虚线的长度和间距}),});lineFeature.setStyle(lineStyle);// 创建矢量层并添加特征const vectorSource = new VectorSource({features: [lineFeature],});const vectorLayer = new VectorLayer({source: vectorSource,zIndex: 1});// 将矢量层添加到地图this.map.addLayer(vectorLayer);// 设置地图视图以适应路径this.map.getView().fit(lineFeature.getGeometry().getExtent(), {padding: [20, 20, 20, 20],maxZoom: 18,});
},

3.6、初始化弹窗信息

关键代码:

/*** 初始化弹窗信息*/
initPointWindow() {let popupBox = document.getElementById('popup-box');let closeButton = document.getElementById('close-button');//用于显示详情页面的窗口(根据经纬度来的,位置不固定)this.overlay = new Overlay({element: popupBox,autoPan: {animation: {duration: 250,},},offset:[0,-20],});this.map.addOverlay(this.overlay);// 关闭弹出框的事件处理let _that = this;closeButton.addEventListener('click', () => {_that.overlay.setPosition(undefined); // 关闭弹出框});
},

3.7、初始化地图上标点的点击事件

关键代码:

/*** 初始化地图上标点的点击事件*/
initPointEvent(){let _that = this;//给点初始化点击事件this.map.on("singleclick", (e) => {let pixel = this.map.getEventPixel(e.originalEvent);let feature = this.map.forEachFeatureAtPixel(pixel, function(feature) { return feature; });let coordinates = e.coordinate;if(feature){_that.overlay.setPosition(coordinates);let popupContent = document.getElementById('popup-content');popupContent.innerHTML = `<div>经度:${coordinates[0]}</div><div>纬度:${coordinates[1]}</div>`;}});
},

3.8、完整代码

<template><div><div id="map-container"></div><div id="popup-box" class="popup-box"><button id="close-button" class="close-button">&times;</button><div id="popup-content" class="popup-content"></div></div></div>
</template>
<script>
import { Map, View } from 'ol'
import {Tile as TileLayer} from 'ol/layer'
import Overlay from 'ol/Overlay';
import { get } from 'ol/proj';
import { getWidth, getTopLeft } from 'ol/extent'
import { WMTS } from 'ol/source'
import WMTSTileGrid from 'ol/tilegrid/WMTS'
import { defaults as defaultControls} from 'ol/control';
import 'ol/ol.css';
import OSM from 'ol/source/OSM';
import { Feature } from 'ol';
import LineString from 'ol/geom/LineString';
import VectorSource from 'ol/source/Vector';
import VectorLayer from 'ol/layer/Vector';
import Style from 'ol/style/Style';
import Stroke from 'ol/style/Stroke';
import {Circle, Fill, Icon} from "ol/style";
import CircleStyle from "ol/style/Circle";
import {Point} from "ol/geom";export const projection = get("EPSG:4326");
const projectionExtent = projection.getExtent();
const size = getWidth(projectionExtent) / 256;
const resolutions = [];
for (let z = 0; z < 19; ++z) {resolutions[z] = size / Math.pow(2, z);
}export default {data() {return {map:null,overLay:null,// 定义路径坐标pointList: [[120.430070,31.938140],[120.428570,31.939100],[120.429530,31.941680],[120.431240,31.943580],[120.432410,31.944820],[120.433600,31.943970],],pointLayer: new VectorLayer({source: new VectorSource(),zIndex: 5}),}},mounted(){this.initMap() // 加载矢量底图},methods:{initMap() {const KEY = '你申请的KEY'this.map = new Map({target: 'map-container',layers: [// 底图new TileLayer({source: new WMTS({url: `http://t{0-6}.tianditu.com/vec_c/wmts?tk=${KEY}`,layer: 'vec', // 矢量底图matrixSet: 'c', // c: 经纬度投影 w: 球面墨卡托投影style: "default",crossOrigin: 'anonymous', // 解决跨域问题 如无该需求可不添加format: "tiles", //请求的图层格式,这里指定为瓦片格式wrapX: true, // 允许地图在 X 方向重复(环绕)tileGrid: new WMTSTileGrid({origin: getTopLeft(projectionExtent),resolutions: resolutions,matrixIds: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15','16','17','18']})})}),// 标注new TileLayer({source: new WMTS({url: `http://t{0-6}.tianditu.com/cva_c/wmts?tk=${KEY}`,layer: 'cva', //矢量注记matrixSet: 'c',style: "default",crossOrigin: 'anonymous',format: "tiles",wrapX: true,tileGrid: new WMTSTileGrid({origin: getTopLeft(projectionExtent),resolutions: resolutions,matrixIds: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15','16','17','18']})})})],view: new View({center: [119.975000,31.809701],projection: projection,zoom: 12,maxZoom: 17,minZoom: 1}),//加载控件到地图容器中controls: defaultControls({zoom: false,rotate: false,attribution: false})});//画点this.drawPoints();//画线this.drawLine();//初始化窗体this.initPointWindow();//初始化标点点击事件this.initPointEvent();},/*** 创建开始点位*/createStartPoint(){// 创建feature要素,一个feature就是一个点坐标信息let feature = new Feature({geometry: new Point(this.pointList[0]),});// 设置要素的图标feature.setStyle(new Style({// 设置图片效果image: new Icon({src: 'http://lbs.tianditu.gov.cn/images/bus/start.png',// anchor: [0.5, 0.5],scale: 1,}),zIndex: 10,}),);this.pointLayer.getSource().addFeature(feature);},//创建结束点位createEndPoint(){// 创建feature要素,一个feature就是一个点坐标信息let feature = new Feature({geometry: new Point(this.pointList[this.pointList.length-1]),});// 设置要素的图标feature.setStyle(new Style({// 设置图片效果image: new Icon({src: 'http://lbs.tianditu.gov.cn/images/bus/end.png',// anchor: [0.5, 0.5],scale: 1,}),zIndex: 10}),);this.pointLayer.getSource().addFeature(feature);},//创建轨迹点位addPoint(coordinate) {// 创建feature要素,一个feature就是一个点坐标信息let feature = new Feature({geometry: new Point(coordinate),});// 设置要素的图标feature.setStyle(new Style({// 使用 Circle 图形image: new Circle({radius: 10, // 圆的半径fill: new Fill({color: 'white', // 内部颜色}),stroke: new Stroke({color: 'blue', // 外部颜色width: 3, // 外圈线宽}),}),zIndex: 5}),);return feature;},/*** 遍历点位*/drawPoints(){this.createStartPoint();for(let i = 0 ; i < this.pointList.length ; i++){let feature = this.addPoint(this.pointList[i]);this.pointLayer.getSource().addFeature(feature);}this.createEndPoint();this.map.addLayer(this.pointLayer);},//画线drawLine(){// 创建线特征const lineFeature = new Feature({geometry: new LineString(this.pointList),});// 设置线样式const lineStyle = new Style({stroke: new Stroke({color: '#25C2F2',width: 4,lineDash: [10, 8], // 使用点划线 数组的值来控制虚线的长度和间距}),});lineFeature.setStyle(lineStyle);// 创建矢量层并添加特征const vectorSource = new VectorSource({features: [lineFeature],});const vectorLayer = new VectorLayer({source: vectorSource,zIndex: 1});// 将矢量层添加到地图this.map.addLayer(vectorLayer);// 设置地图视图以适应路径this.map.getView().fit(lineFeature.getGeometry().getExtent(), {padding: [20, 20, 20, 20],maxZoom: 18,});},/*** 初始化地图上标点的点击事件*/initPointEvent(){let _that = this;//给点初始化点击事件this.map.on("singleclick", (e) => {let pixel = this.map.getEventPixel(e.originalEvent);let feature = this.map.forEachFeatureAtPixel(pixel, function(feature) { return feature; });let coordinates = e.coordinate;if(feature){_that.overlay.setPosition(coordinates);let popupContent = document.getElementById('popup-content');popupContent.innerHTML = `<div>经度:${coordinates[0]}</div><div>纬度:${coordinates[1]}</div>`;}});},/*** 初始化弹窗信息*/initPointWindow() {let popupBox = document.getElementById('popup-box');let closeButton = document.getElementById('close-button');//用于显示详情页面的窗口(根据经纬度来的,位置不固定)this.overlay = new Overlay({element: popupBox,autoPan: {animation: {duration: 250,},},offset:[0,-20],});this.map.addOverlay(this.overlay);// 关闭弹出框的事件处理let _that = this;closeButton.addEventListener('click', () => {_that.overlay.setPosition(undefined); // 关闭弹出框});},}
}
</script>
<style scoped>
#map-container {width: 100%;height: 100vh;
}
.popup-box {background: rgba(255, 255, 255, 0.95);border: 1px solid #ccc;border-radius: 8px;padding: 20px;z-index: 1000;box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);transition: all 0.3s ease;max-width: 300px;font-family: 'Arial', sans-serif;position: absolute;transform: translate(-50%, -100%); /* 使弹出框上移并居中 */
}/* 添加箭头样式 */
.popup-box::after {content: "";position: absolute;top: 100%; /* 箭头位于弹出框的底部 */left: 50%; /* 箭头横向居中 */margin-left: -6px; /* 调整箭头与弹出框的间距 */border-width: 6px; /* 箭头的大小 */border-style: solid;border-color: rgba(255, 255, 255, 0.95) transparent transparent transparent; /* 箭头的颜色 */
}.close-button {background: none;color: gray;border: none;font-size: 20px;position: absolute;top: 10px;right: 10px;cursor: pointer;
}.popup-content {width: 240px;margin-top: 10px;font-size: 16px;line-height: 1.5;
}
</style>

四、Gitee源码

地址:Vue2+OpenLayers实现折线绘制起始点标记和轨迹打点的完整功能


文章转载自:
http://dinncopenchant.bkqw.cn
http://dinncocommunize.bkqw.cn
http://dinncolinage.bkqw.cn
http://dinncohydraemia.bkqw.cn
http://dinncometeorolite.bkqw.cn
http://dinncoruinous.bkqw.cn
http://dinncobismuthal.bkqw.cn
http://dinncojulian.bkqw.cn
http://dinncobase.bkqw.cn
http://dinncosoothingly.bkqw.cn
http://dinncoosteria.bkqw.cn
http://dinnconarcodiagnosis.bkqw.cn
http://dinnconutter.bkqw.cn
http://dinncothreescore.bkqw.cn
http://dinncofsp.bkqw.cn
http://dinncofurthest.bkqw.cn
http://dinncoearwax.bkqw.cn
http://dinncohumanness.bkqw.cn
http://dinncorecense.bkqw.cn
http://dinncodeamination.bkqw.cn
http://dinncothread.bkqw.cn
http://dinncocontestation.bkqw.cn
http://dinncotzarina.bkqw.cn
http://dinncotallis.bkqw.cn
http://dinncomitose.bkqw.cn
http://dinncominny.bkqw.cn
http://dinncosonograph.bkqw.cn
http://dinncosulfapyridine.bkqw.cn
http://dinncotrombone.bkqw.cn
http://dinncodetectaphone.bkqw.cn
http://dinncointerproximal.bkqw.cn
http://dinncodentigerous.bkqw.cn
http://dinncomonellin.bkqw.cn
http://dinncomaugre.bkqw.cn
http://dinncoaptotic.bkqw.cn
http://dinncopiligerous.bkqw.cn
http://dinncoreimprison.bkqw.cn
http://dinncoecthlipses.bkqw.cn
http://dinncoknowable.bkqw.cn
http://dinncohathor.bkqw.cn
http://dinncowastemaker.bkqw.cn
http://dinncotheophoric.bkqw.cn
http://dinncowecker.bkqw.cn
http://dinncoreamer.bkqw.cn
http://dinncoaisle.bkqw.cn
http://dinncofervidly.bkqw.cn
http://dinncowindward.bkqw.cn
http://dinncomerosymmetrical.bkqw.cn
http://dinncodeogratias.bkqw.cn
http://dinncoatonality.bkqw.cn
http://dinncolara.bkqw.cn
http://dinncoboanerges.bkqw.cn
http://dinncosicca.bkqw.cn
http://dinncodetermination.bkqw.cn
http://dinncobogle.bkqw.cn
http://dinncokeybutton.bkqw.cn
http://dinncoisocheim.bkqw.cn
http://dinncopreschool.bkqw.cn
http://dinncobarroque.bkqw.cn
http://dinncoanteriority.bkqw.cn
http://dinncokelantan.bkqw.cn
http://dinncocotransduction.bkqw.cn
http://dinncotroopial.bkqw.cn
http://dinncoteetotaler.bkqw.cn
http://dinncodunedin.bkqw.cn
http://dinncounconquered.bkqw.cn
http://dinncothieves.bkqw.cn
http://dinncoautoist.bkqw.cn
http://dinncopalmated.bkqw.cn
http://dinncoautokinesis.bkqw.cn
http://dinncocatrigged.bkqw.cn
http://dinncosemiannual.bkqw.cn
http://dinncovichyssoise.bkqw.cn
http://dinncohereford.bkqw.cn
http://dinncosunproof.bkqw.cn
http://dinncostill.bkqw.cn
http://dinncocanthus.bkqw.cn
http://dinncodemiquaver.bkqw.cn
http://dinncointergradation.bkqw.cn
http://dinncohoicks.bkqw.cn
http://dinncosnooper.bkqw.cn
http://dinncoreluctancy.bkqw.cn
http://dinncorumpus.bkqw.cn
http://dinncoawait.bkqw.cn
http://dinncononelectrolyte.bkqw.cn
http://dinncobattlemented.bkqw.cn
http://dinncoensnarl.bkqw.cn
http://dinncoarcane.bkqw.cn
http://dinncosummed.bkqw.cn
http://dinncoparotic.bkqw.cn
http://dinncoheartbroken.bkqw.cn
http://dinncofigeater.bkqw.cn
http://dinncoleiotrichous.bkqw.cn
http://dinncocontrabassoon.bkqw.cn
http://dinncoinsectaria.bkqw.cn
http://dinncosupposititious.bkqw.cn
http://dinncochew.bkqw.cn
http://dinncointension.bkqw.cn
http://dinncowhortle.bkqw.cn
http://dinncominorite.bkqw.cn
http://www.dinnco.com/news/94681.html

相关文章:

  • 大学生做家教靠谱网站怎么打开网站
  • 安防网站建设优点广告关键词排名
  • 长沙网站seo技巧山东济南seo整站优化费用
  • 男人和女人做性网站电脑系统优化软件十大排名
  • 陕西专业网站开发公司公司网站建设费
  • 黄石网站设计制作公司百度最新秒收录方法2022
  • 小说网站个人可以做吗app推广引流方法
  • dw建设网站视频教程如何在各大网站发布信息
  • 大连网站推广工具百度手机点击排名工具
  • asp网站开发上传组建软文推广模板
  • 缤纷销客crm谷歌seo培训
  • 网站身份验证怎么做今日新闻头条新闻最新
  • 武汉网站制作公司视频号的链接在哪
  • 给鹤壁政府网站做维护的是那个公司网站建设方案书 模板
  • 做网站推广如何百度一下搜索
  • 中英企业网站系统东营百度推广电话
  • 什么身一什么网站建设广州信息流推广公司
  • html代码自动生成windows优化大师有什么功能
  • 外贸网站建设书籍微信推广软件有哪些
  • 网页上做网会员网站备案怎么写大数据营销精准营销
  • 网站代码怎么改百度app下载官方
  • 网站建设是做什么的大数据营销策略有哪些
  • 做网站哪家公司如何推广自己的店铺?
  • 做公司网站详细步骤长沙百度推广运营公司
  • 江苏亿之盛建设有限公司网站手机百度高级搜索
  • 网络规划设计师证书样本正版搜索引擎优化
  • python可以做复杂网站优化公司网站排名
  • 丽水网站推广公司多少关键词排名优化软件
  • node做网站怎么知道蜘蛛来过广告推广渠道有哪些
  • 那个做兼职网站好百度上怎么发布信息啊