Leaflet Map LineUtil—用于多段线点处理的各种实用函数

Leaflet Map LineUtil—用于多段线点处理的各种实用函数

用于多段线点处理的各种实用函数,由Leaflet内部使用,使多段线快速生成。

Functions

FunctionReturnsDescription
simplify(<Point[]> points
<Number> tolerance)
Point[]Dramatically reduces the number of points in a polyline while retaining its shape and returns a new array of simplified points, using the Ramer-Douglas-Peucker algorithm. Used for a huge performance boost when processing/displaying Leaflet polylines for each zoom level and also reducing visual noise. tolerance affects the amount of simplification (lesser value means higher quality but slower and with more points). Also released as a separated micro-library Simplify.js.
使用Ramer-Douglas Peucker算法,在保持折线形状的同时,大幅减少折线中的点数,并返回一个新的简化点阵列。用于在处理/显示每个缩放级别的Leaflet多段线时大幅提高性能,并减少视觉噪音。公差影响简化的数量(值越小意味着质量越高,但速度越慢,点数越多)。也作为单独的微库Simplify.js发布。
pointToSegmentDistance(<Point
p, <Pointp1, <Pointp2)
NumberReturns the distance between point p and segment p1 to p2.
返回点p和线段p1到p2之间的距离。
closestPointOnSegment(<Point
p, <Pointp1, <Pointp2)
NumberReturns the closest point from a point p on a segment p1 to p2.
返回从线段p1上的点p到p2的最近点。
clipSegment(<Pointa, <Pointb,
 <Boundsbounds, <Boolean>
 useLastCode?, <Boolean> round?)
Point[]|BooleanClips the segment a to b by rectangular bounds with the Cohen-Sutherland algorithm (modifying the segment points directly!). Used by Leaflet to only show polyline points that are on the screen or near, increasing performance.
使用Cohen Sutherland算法(直接修改线段点!)通过矩形边界剪裁线段a到b。由传单用于仅显示屏幕上或附近的多段线点,从而提高性能。
isFlat(<LatLng[]> latlngs)BooleanReturns true if latlngs is a flat array, false is nested.
如果latlngs是平面数组,则返回true,如果嵌套,则返回false。
polylineCenter(<LatLng[]>
 latlngs, <CRScrs)
LatLngReturns the center (centroid) of the passed LatLngs (first ring) from a polyline.
返回从多段线传递的LatLngs(第一个环)的中心(质心)。
0 0 投票数
文章评分
订阅评论
提醒
0 评论
内联反馈
查看所有评论
0
希望看到您的想法,请您发表评论x