当前位置:网站首页>Leaflet that supports canvas Path. Dashflow dynamic flow direction line
Leaflet that supports canvas Path. Dashflow dynamic flow direction line
2022-06-12 23:48:00 【GIS weapon warehouse】
Through to leaflet And its plug-in learning , We learned to use Leaflet.Path.DashFlow
The plug-in can realize dynamic display of trajectory 、 Dynamic display of pipeline flow direction 、 Dynamic display of river flow , To enhance the visual display effect . The plug-in is very simple to use , Just add lines normally , Join in dashArray
and dashSpeed
Parameters can be . The core code is as follows :
Be careful , stay
dashSpeed
When it is negative , The line is a positive flow .
The effect is as follows :
But in the process of using , There is a drawback to the plug-in , It's when you use Canvas
How to map ( Initialize map preferCanvas
Parameter is true
) when , Dynamic effects are not available . How to solve this problem ?
Through to Leaflet.Path.DashFlow
as well as leaflet
Source code research , It is found that the effect of dynamic line is mainly through dynamic refresh dashOffset
The value of the parameter , To change the style of a line .
L.SVG
stay _updateStyle
When , Updated dashOffset
Parameters , however L.Canvas
stay _updateStyle
when , No updates dashOffset
Parameters . This is in Canvas
The reason why there is no dynamic effect when drawing with .
L.SVG:
L.Canvas:
thus , We found a solution , That is to say L.Canvas
Of _updateStyle
In the method , Reference resources L.SVG
Treatment mode , Add pair dashOffset
Parameter control . The core code is as follows :
For ease of use , We will L.Path.DashFlow
Plug in repackaging , This plug-in is cited , Can be in Canvas
and SVG
Use this plug-in in in two ways .
summary
- Use
Leaflet.Path.DashFlow
The plug-in can realize dynamic display of trajectory 、 Dynamic display of pipeline flow direction, etc . - The default plug-in uses
Canvas
How to map ( Initialize mappreferCanvas
Parameter istrue
) when , Dynamic effects are not available . - By modifying the
L.Canvas
In the code , Can be inCanvas
Mode to achieve dynamic line effect . - take
L.Path.DashFlow
Plug in repackaging , Reference plug-ins , Can be inCanvas
andSVG
Two ways to achieve dynamic line effect .
Online example
Original address :http://gisarmory.xyz/blog/index.html?blog=LeafletPathDashFlow.
Focus on 《GIS Zeughaus 》 official account , The first time to get more high quality GIS article .
This article adopts Creative Commons signature - Noncommercial use - Share in the same way 4.0 International licensing agreement Licensing . Welcome to reprint 、 Use 、 Re release , But be sure to keep the signature of the article 《GIS Zeughaus 》( Include links : http://gisarmory.xyz/blog/), Not for commercial purposes , Based on this revised work must be released with the same license .
边栏推荐
- Basic operations of dict and set
- CV - baseline summary (development history from alexnet to senet)
- Theory + practice will help you master the dynamic programming method
- Industry reshuffle, a large number of programmers are going to lose their jobs? How can we break the current workplace dilemma
- 数组
- 1111111111111111111111111111111111111111111111111111111
- Is the stock account opened by qiniu Gang safe and reliable?
- Zhengzhou University of light industry -- development and sharing of harmonyos pet health system
- Enterprise wechat H5_ Authentication, H5 application web page authorization login to obtain identity
- Based on three JS offshore wind power digital twin 3D effect
猜你喜欢
Access static variables within class in swift
H5时代leaflet中还在用DivIcon?
[opencv learning] small ticket recognition based on perspective transformation and OCR recognition
Alien Skin Exposure X7调色滤镜插件,RAW后期处理工具
Redis实现短信验证码登录
2022 R2 mobile pressure vessel filling test questions and online simulation test
Divicon est toujours utilisé dans le leaflet de l'ère H5?
2202-简历制作
leaflet如何加载10万条数据
Tableau
随机推荐
Operation of simulation test platform for G3 boiler water treatment test questions in 2022
Basic operations of dict and set
CV—BaseLine总结(从AlexNet到SENet的发展历程)
2202 resume making
Alien skin exposure X7 color filter plug-in, raw post-processing tool
【Matlab】基础知识
M_8:设计消息队列存储消息数据的 MySQL 表格
Save state when viewpager is used with fragment fragmentpageradapter
Start of u-boot_ Armboot analysis (II)
Start of u-boot_ Armboot analysis (I)
Novice must see! How rust beginners write gear smart contracts (1)
Redis realizes SMS verification code login
[kubernetes guide ⑤] label quick start
Don't write about the full screen explosion, try the decorator mode, this is the elegant way!!
scala中的隐式转换和隐式参数讲解与实践
RT thread quick start - experience RT thread
C # graphic tutorial (Fourth Edition) chapter7-7.6.1 virtual and override
Actual combat | inductance element positioning -- detailed explanation of Halcon and opencv implementation (with source code)
leaflet如何优雅的展示重叠点位的气泡窗口
Bit_ Binary number