时态图根据时间轴动态播放热力图

效果图如下:

<!DOCTYPE html>
<html><head><title>时态图</title><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><!-- 引入样式 --><!-- <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> --><link rel="stylesheet" href="../../lib/element-ui@2.13.0/index.css" /><style>html,body,#map {height: 100%;padding: 0;margin: 0;}.timeslider {position: absolute;z-index: 999;width: 100%;height: 100px;background: lightseagreen;bottom: 0px;display: flex;align-items: center;justify-content: center;}.block {width: 80%;display: flex;}.block .icon {display: flex;align-items: center;color: rgb(64, 158, 255);justify-content: center;width: 100px;cursor: pointer;}.block .timestool {flex: 1;}.timeslider .slider-demo-block {display: flex;align-items: center;}.slider-demo-block .el-slider {margin-top: 0;margin-left: 12px;}.el-slider__marks-text {position: absolute;-webkit-transform: translateX(-50%);transform: translateX(-50%);font-size: 14px;color: #fff;margin-top: 15px;}.icon:hover {color: #66b1ff;}.el-slider__marks :last-child {right: -60px;}</style><script src="../../lib/vue@2.6.11/vue.js"></script><!-- <script src="https://unpkg.com/vue@2.6.11/dist/vue.js"></script> --><!-- 引入组件库 --><!-- <script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script> --><script src="../../lib/element-ui@2.13.0/index.js"></script><script src="../../js/prjconfig.js" maptype="leaflet"></script><!-- 引入插件 --><script src="../../lib/leaflet/plugins/leaflet.polylineDecorator.js"></script><script src="../../lib/leaflet/plugins/Leaflet.AnimatedMarker.js"></script></head><body><div id="map"></div><div id="app" class="timeslider"><div class="block"><div v-if="show" class="icon"><iclass="icon el-icon-video-play"style="font-size: 32px"@click="playChange('stop')"></i></div><div v-if="!show" class="icon"><iclass="icon el-icon-video-pause"style="font-size: 32px"@click="playChange('play')"></i></div><div class="icon"><iclass="icon el-icon-arrow-left"style="font-size: 32px"@click="prevStep()"></i></div><div class="timestool"><el-sliderv-model="currIndex":max="maxIndex":step="10":marks="marks":show-tooltip="false"@change="change"></el-slider></div><div class="icon"><iclass="icon el-icon-arrow-right"style="font-size: 32px"@click="nextStep()"></i></div></div></div><script>//'http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineStreetPurplishBlue/MapServer/tile/{z}/{y}/{x}'var map = L.map("map", {crs: L.CRS.EPSG4326, //L.CRS.EPSG3857center: [MAPINIT.Location.lat, MAPINIT.Location.lon], //[40.76339, 106.9477844],zoom: MAPINIT.Location.zoom,minZoom: MAPINIT.zoomsExtent[0],maxZoom: MAPINIT.zoomsExtent[1],zoomControl: true,});// 使用WMTS Key-Value加载地图服务let _getc ="http://192.168.1.212:8095/server/default/getTile/wmts?request=GetCapabilities&service=wmts&layer=yx";MAPCONFIG.MAPWMTS_IMG ="http://192.168.1.212:8095/server/vtile/getTile/wmts";let ls ="http://192.168.1.212:8095/server/vtile/getTile/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=yx&STYLE=default&TILEMATRIXSET=w&FORMAT=image/png&TILEMATRIX={z}&TILECOL={x}&TILEROW={y}&tk=''";L.tileLayer(ls, {zoomOffset: 1,}).addTo(map);map.setView(L.latLng(37.550339, 104.114129), 4); //设置缩放级别及中心点var heatmapLayer;// 初始化热力图function initHeatMap(data, cfg) {heatmapLayer = new HeatmapOverlay(cfg);heatmapLayer.addTo(map);heatmapLayer.setData(data);}function clear() {map.removeLayer(heatmapLayer);}let app = new Vue({el: "#app",data: {message: "Hello Vue!",// 数据testData: {max: 8,data: [{lat: 36.793094 + Math.random(),lng: 118.054241 + Math.random(),count: 8,},{lat: 36.405841 + Math.random(),lng: 118.159911 + Math.random(),count: 5,},{lat: 36.215321 + Math.random(),lng: 118.17456 + Math.random(),count: 9,},{lat: 36.527985 + Math.random(),lng: 118.400512 + Math.random(),count: 8,},{lat: 36.512117 + Math.random(),lng: 118.401366 + Math.random(),count: 7,},{lat: 36.332074 + Math.random(),lng: 118.360107 + Math.random(),count: 6,},{lat: 36.244085 + Math.random(),lng: 118.595214 + Math.random(),count: 7,},],},// 配置cfg: {radius: 0.5, //设置每一个热力点的半径maxOpacity: 0.9, //设置最大的不透明度// minOpacity: 0.3,     //设置最小的不透明度scaleRadius: true, //设置热力点是否平滑过渡blur: 0.95, //系数越高,渐变越平滑,默认是0.85,//滤镜系数将应用于所有热点数据useLocalExtrema: true, //使用局部极值latField: "lat", //纬度lngField: "lng", //经度valueField: "count", //热力点的值gradient: {0.99: "rgba(255,0,0,1)",0.9: "rgba(255,255,0,1)",0.8: "rgba(0,255,0,1)",0.5: "rgba(0,255,255,1)",0: "rgba(0,0,255,1)",},},currIndex: 0,maxIndex: 50,show: true,curPage: 3,curMonth: "",marks: {0: "2023-01",10: "2023-02",20: "2023-03",30: "2023-04",40: "2023-05",50: "2023-06",},},mounted() {// console.log([119.23 + Math.random(), 30.14 + Math.random()]);this.getCurrentMonth();this.getBeforeMonth();initHeatMap(this.testData, this.cfg);},watch: {// watch第一次绑定值的时候不会执行监听,修改数据才会触发函数currIndex(newVal, oldVal) {console.log(newVal);let step = newVal.toString();if (Object.keys(this.marks).indexOf(step) > -1) {// console.log(this.marks[step], 222);// 先清除原来的clear();let data = {max: 8,data: [{lat: 36.60976 + Math.random(),lng: 117.067686 + Math.random(),count: 8,},{lat: 36.60976 + Math.random(),lng: 117.067686 + Math.random(),count: 5,},{lat: 36.60976 + Math.random(),lng: 117.067686 + Math.random(),count: 9,},{lat: 36.60976 + Math.random(),lng: 117.067686 + Math.random(),count: 8,},],};initHeatMap(data, this.cfg);}},},methods: {change(e) {let step = e.toString();// console.log(Object.keys(this.marks));if (Object.keys(this.marks).indexOf(step) > -1) {console.log(this.marks[step]);}// console.log(this.currIndex);},// 获取当前月份getCurrentMonth() {let data = new Date();let year = data.getFullYear();// getMonth()返回的数字范围从0到11,因此需要加1来得到正确的月份let mth = data.getMonth() + 1;let month =mth < 10 ? "0" + mth : mth;this.curMonth = data.getFullYear() + "-" + month;},// 获取当月之前半年的月份getBeforeMonth() {let dataArr = [];let data = new Date();let year = data.getFullYear();data.setMonth(data.getMonth() + 1, 1); //获取到当前月份,设置月份for (let i = 0; i < 6; i++) {data.setMonth(data.getMonth() - 1); //每次循环一次,月份值减1let m = data.getMonth() + 1;m = m < 10 ? "0" + m : m;dataArr.push(data.getFullYear() + "-" + m);}let list = dataArr.reverse();let obj = {};let labelArr = Object.keys(this.marks);labelArr.forEach((item, index) => {obj[item] = list[index];});this.marks = obj;},// 获取指定月之前半年的月份数组getBeforeCurMonth(mon) {let dataArr = [];let data = new Date(mon);let year = data.getFullYear();data.setMonth(data.getMonth(), 1); //获取到当前月份,设置月份for (let i = 0; i < 6; i++) {data.setMonth(data.getMonth() - 1); //每次循环一次,月份值减1let m = data.getMonth() + 1;m = m < 10 ? "0" + m : m;dataArr.push(data.getFullYear() + "-" + m);}let list = dataArr.reverse();let obj = {};let labelArr = Object.keys(this.marks);labelArr.forEach((item, index) => {obj[item] = list[index];});this.marks = obj;},// 获取指定月份之后半年的月份数组getAfterMonth(mon) {let dataArr = [];let data = new Date(mon);let year = data.getFullYear();data.setMonth(data.getMonth(), 1); //获取到当前月份,设置月份for (let i = 0; i < 6; i++) {data.setMonth(data.getMonth() + 1); //每次循环一次,月份值加1let m = data.getMonth() + 1;m = m < 10 ? "0" + m : m;dataArr.push(data.getFullYear() + "-" + m);}let list = dataArr;let obj = {};let labelArr = Object.keys(this.marks);labelArr.forEach((item, index) => {obj[item] = list[index];});this.marks = obj;},playChange(val) {let that = this;let data = new Date();let year = data.getFullYear();let mth = data.getMonth()+1;let month =mth < 10 ? "0" + mth : mth;var curMonth = data.getFullYear() + "-" + month;if (val == "stop") {if (that.timer) {clearInterval(that.timer);}that.show = false;that.timer = setInterval(() => {that.currIndex += 10;const lastValue = that.marks[that.maxIndex];let customM = curMonth.replace("-", "");let curMaxIndexM = lastValue.replace("-", "");if (that.currIndex > that.maxIndex) {that.currIndex = 0;// that.show = true;// clearInterval(that.timer);// 自动循环播放if (parseInt(curMaxIndexM) < parseInt(customM)) {that.getAfterMonth(lastValue.replace("-", "/"))}if (lastValue == curMonth) {that.show = true;clearInterval(that.timer);}}}, 3000);} else {clearInterval(that.timer);that.show = true;}},// 往前播放prevStep() {clearInterval(this.timer);this.show = true;if (this.currIndex === 0) {let curMonth = this.marks[this.currIndex];let customM = this.curMonth.replace("-", "/");var d = new Date(customM);d.setMonth(d.getMonth() - 12);let year = d.getFullYear();let month =d.getMonth() < 10 ? "0" + d.getMonth() : d.getMonth();let beforeM = year + "-" + month;// console.log(year + "-" + month)let curMaxIndexM = curMonth.replace("-", "");let customMs = beforeM.replace("-", "");if (parseInt(curMaxIndexM) < parseInt(customMs)) {return} else {this.getBeforeCurMonth(curMonth.replace("-", "/"))}} else {this.currIndex -= 10;}},// 往后播放nextStep() {clearInterval(this.timer);this.show = true;if (this.currIndex === this.maxIndex) {const lastValue = this.marks[this.maxIndex];const curMonth = this.marks[this.currIndex];// console.log(this.curMonth);// console.log(lastValue);// console.log(curMonth);let customM = this.curMonth.replace("-", "");let curMaxIndexM = lastValue.replace("-", "");let curM = curMonth.replace("-", "");if (parseInt(curMaxIndexM) < parseInt(customM)) {this.getAfterMonth(lastValue.replace("-", "/"))this.currIndex = 0;} else {this.currIndex = this.maxIndex;}} else {this.currIndex += 10;}},},});</script></body>
</html>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/206302.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

java的继承特性和方法重写

java的继承特性和方法重写 Java的继承特性是一种面向对象编程的重要概念&#xff0c;它允许我们基于已有的类创建新的类&#xff0c;并且保留了已有的类的一些特性。这是通过使用"继承"这个关键词来实现的&#xff0c;新创建的类称为子类&#xff08;subclass&#…

【OpenCV实现图像:使用OpenCV进行物体轮廓排序】

文章目录 概要读取图像获取轮廓轮廓排序小结 概要 在图像处理中&#xff0c;经常需要进行与物体轮廓相关的操作&#xff0c;比如计算目标轮廓的周长、面积等。为了获取目标轮廓的信息&#xff0c;通常使用OpenCV的findContours函数。然而&#xff0c;一旦获得轮廓信息后&#…

echarts实现如下图功能代码

这里写自定义目录标题 const option {tooltip: {trigger: axis},legend: {left: "-1px",top:15px,type: "scroll",icon:rect,data: [{name:1, textStyle:{color: theme?"#E5EAF3":#303133,fontSize:14}}, {name: 2, textStyle:{color: theme…

监控摄像头连接NAS,实现监控管理一体化

嗯&#xff1f;你问干嘛要把摄像头连到NAS&#xff1f; 小马给家里安了个监控摄像头 本意是想家里有啥事也能查监控 却没想到这些监控不仅存储回放有限制 要想更多功能还是得多花钱 恰好&#xff0c;我有铁威马NAS 打开Surveillance Manager 轻松搭建网络摄像头管理系统 …

安防监控视频融合平台EasyCVR定制化页面开发

安防监控EasyCVR视频汇聚平台基于云边端智能协同&#xff0c;支持海量视频的轻量化接入与汇聚、转码与处理、全网智能分发、视频集中存储等。安防视频平台EasyCVR拓展性强&#xff0c;视频能力丰富&#xff0c;具体可实现视频监控直播、视频轮播、视频录像、云存储、回放与检索…

用HALCON标定助手对相机进行标定

任务要求&#xff1a; 已知相机镜头焦距f为8mm&#xff0c;相机单个CCD像素在水平和竖直两个方向上的尺寸均为3.75微米&#xff0c;相机为普通透光镜头和面阵相机&#xff0c;对相机进行标定&#xff0c;测量相机的内外参数。 操作步骤&#xff1a; 1. 在HALCON中运行gen_ca…

专业pdf编辑工具PDF Expert mac中文版特点介绍

PDF Expert mac是一款专业的PDF编辑和阅读工具。它可以帮助用户在Mac、iPad和iPhone等设备上查看、注释、编辑、填写和签署PDF文档。 PDF Expert mac软件特点 PDF编辑&#xff1a;PDF Expert提供了丰富的PDF编辑功能&#xff0c;包括添加、删除、移动、旋转、缩放、裁剪等操作…

焦炉加热系统简述

烟道吸力 焦炉负压烘炉分烟道的吸力会影响立火道温度&#xff0c;具体影响因素如下&#xff1a; 烟道吸力过大会导致热量被抽走&#xff0c;使立火道温度降低。烟道吸力不足会导致烟气在烘炉内停留时间过长&#xff0c;使热量无法充分利用&#xff0c;也会导致立火道温度降低…

【Windows 常用工具系列 13 -- Confluence 如何快速输入代码块 code block】

文章目录 Confluence 如何快速输入代码块方法二 Confluence 如何快速输入代码块 在使用使用 confluence 进行文档编辑时&#xff0c;有时需要贴上部分代码&#xff0c;但是直接贴代码在 confluence上&#xff0c;显示效果不是太好看&#xff0c;所以confluence 给我们提供了符…

sklearn模型中预测值的R2_score为负数

目录 正文评论区参考链接 正文 Sklearn.metrics下面的r2_score函数用于计算R&#xff08;确定系数&#xff1a;coefficient of determination&#xff09;。它用来度量未来的样本是否可能通过模型被很好地预测。 分值为 1 表示最好&#xff0c;但我们在使用过程中&#xff0c…

剧情继续:马斯克曝出OpenAI前员工举报信,董事会与奥特曼谈判回归

丰色 发自 凹非寺 量子位 | 公众号QbitAI 经过4天的极限拉扯、反转再反转&#xff0c;奥特曼有可能重新回归了。 据知情人士透露&#xff0c;OpenAI董事会正与奥特曼进行一场“富有成效”的新谈判。 如果奥特曼回到OpenAI&#xff0c;他将继续担任CEO。 与此同时&#xff0c…

ROS设置DHCP option121

配置时&#xff0c;了解格式很关键&#xff0c;16进制填写格式如下&#xff1a; 将要访问的IPV&#xff14;地址&#xff1a;192.168.100.0/24 192.168.30.254 转换为&#xff1a;掩码 目标网段 网关 0x18c0a864c0a81efe&#xff0c;0不用填写 ROS配置如下图&#xff1a; 抓…