Leaflet Map Circle-用于在地图上绘制圆形叠加层的类扩展了环标记

Leaflet Map Circle-用于在地图上绘制圆形叠加层的类扩展了环标记

It’s an approximation and starts to diverge from a real circle closer to poles (due to projection distortion).

这是一个近似值,并开始偏离靠近极点的真实圆(由于投影失真)。

Usage example

用法示例

L.circle([50.5, 30.5], {radius: 200}).addTo(map);

Creation

FactoryDescription
L.circle(<LatLnglatlng, <Circle optionsoptions?)Instantiates a circle object given a geographical point, and an options object which contains the circle radius.
实例化给定地理点的圆对象,以及包含圆半径的选项对象。
L.circle(<LatLnglatlng, <Number> radius, <Circle optionsoptions?)Obsolete way of instantiating a circle, for compatibility with 0.7.x code. Do not use in new applications or plugins.
过时的实例化圆圈的方式,以便与 0.7.x 代码兼容。请勿在新的应用程序或插件中使用。

Options

OptionTypeDefaultDescription
radiusNumberRadius of the circle, in meters.
圆的半径,以米为单位。

▶ Options inherited from Path

从路径继承的选项

OptionTypeDefaultDescription
strokeBooleantrueWhether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
是否沿路径绘制描边。将其设置为 false 可禁用多边形或圆上的边框。
colorString'#3388ff'Stroke color
描边颜色
weightNumber3Stroke width in pixels
描边宽度(以像素为单位)
opacityNumber1.0Stroke opacity
描边不透明度
lineCapString'round'A string that defines shape to be used at the end of the stroke.
一个字符串,用于定义要在描边末尾使用的形状。
lineJoinString'round'A string that defines shape to be used at the corners of the stroke.
一个字符串,用于定义要在描边的角上使用的形状。
dashArrayStringnullA string that defines the stroke dash pattern. Doesn’t work on Canvas-powered layers in some old browsers.
定义描边虚线图案的字符串。在某些旧浏览器中,不适用于由 Canvas 提供支持的图层。
dashOffsetStringnullA string that defines the distance into the dash pattern to start the dash. Doesn’t work on Canvas-powered layers in some old browsers.
一个字符串,用于定义到破折号模式中开始破折号的距离。在某些旧浏览器中,不适用于由 Canvas 提供支持的图层。
fillBooleandependsWhether to fill the path with color. Set it to false to disable filling on polygons or circles.
是否用颜色填充路径。将其设置为 false 可禁用多边形或圆的填充。
fillColorString*Fill color. Defaults to the value of the color option
填充颜色。默认为颜色选项的值
fillOpacityNumber0.2Fill opacity.
填充不透明度。
fillRuleString'evenodd'A string that defines how the inside of a shape is determined.
定义如何确定形状内部的字符串。
bubblingMouseEventsBooleantrueWhen true, a mouse event on this path will trigger the same event on the map (unless L.DomEvent.stopPropagation is used).
如果为 true,则此路径上的鼠标事件将在地图上触发相同的事件(除非使用 L.DomEvent.stop 传播)。
rendererRendererUse this specific instance of Renderer for this path. Takes precedence over the map’s default renderer.
将此特定呈现器实例用于此路径。优先于地图的默认渲染器。
classNameStringnullCustom class name set on an element. Only for SVG renderer.
在元素上设置的自定义类名。仅适用于 SVG 渲染器。

▶ Options inherited from Interactive layer

从交互式图层继承的选项

OptionTypeDefaultDescription
interactiveBooleantrueIf false, the layer will not emit mouse events and will act as a part of the underlying map.
如果为 false,则该图层将不会发出鼠标事件,并将充当基础地图的一部分。

▶ Options inherited from Layer

从图层继承的选项

OptionTypeDefaultDescription
paneString'overlayPane'By default the layer will be added to the map’s overlay pane. Overriding this option will cause the layer to be placed on another pane by default.
默认情况下,该图层将添加到地图的叠加窗格中。默认情况下,覆盖此选项将导致图层放置在另一个窗格上。
attributionStringnullString to be shown in the attribution control, e.g. “© OpenStreetMap contributors”. It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
要在归因控件中显示的字符串,例如“©开放街道地图贡献者”。它描述了图层数据,通常是对版权所有者和切片提供商的法律义务。

Events

▶ Events inherited from CircleMarker

CircleMarker 继承的事件

EventDataDescription
moveEventFired when the marker is moved via setLatLng. Old and new coordinates are included in event arguments as oldLatLnglatlng.
当标记通过设置移动时触发。旧坐标和新坐标包含在事件参数中,如旧纬度,拉特朗。

▶ Mouse events inherited from Interactive layer

从交互式图层继承的鼠标事件

EventDataDescription
clickMouseEventFired when the user clicks (or taps) the layer.
当用户单击(或点击)图层时触发。
dblclickMouseEventFired when the user double-clicks (or double-taps) the layer.
当用户双击(或双击)图层时触发。
mousedownMouseEventFired when the user pushes the mouse button on the layer.
当用户按下图层上的鼠标按钮时触发。
mouseupMouseEventFired when the user releases the mouse button pushed on the layer.
当用户松开按下图层上的鼠标按钮时触发。
mouseoverMouseEventFired when the mouse enters the layer.
鼠标进入图层时触发。
mouseoutMouseEventFired when the mouse leaves the layer.
鼠标离开图层时触发。
contextmenuMouseEventFired when the user right-clicks on the layer, prevents default browser context menu from showing if there are listeners on this event. Also fired on mobile when the user holds a single touch for a second (also called long press).
当用户右键单击图层时触发,可防止默认浏览器上下文菜单显示此事件是否有侦听器。当用户按住一次触摸一秒钟(也称为长按)时,也会在移动设备上触发。

▶ Events inherited from Layer

从图层继承的事件

EventDataDescription
addEventFired after the layer is added to a map
将图层添加到地图后触发
removeEventFired after the layer is removed from a map
从地图中移除图层后触发

▶ Popup events inherited from Layer

从图层继承的弹出事件

EventDataDescription
popupopenPopupEventFired when a popup bound to this layer is opened
打开绑定到此图层的弹出窗口时触发
popupclosePopupEventFired when a popup bound to this layer is closed
当绑定到此图层的弹出窗口关闭时触发

▶ Tooltip events inherited from Layer

从图层继承的工具提示事件

EventDataDescription
tooltipopenTooltipEventFired when a tooltip bound to this layer is opened.
打开绑定到此图层的工具提示时激发。
tooltipcloseTooltipEventFired when a tooltip bound to this layer is closed.
当绑定到此层的工具提示关闭时激发。

Methods

MethodReturnsDescription
setRadius(<Number> radius)thisSets the radius of a circle. Units are in meters.
设置圆的半径。单位以米为单位。
getRadius()NumberReturns the current radius of a circle. Units are in meters.
返回圆的当前半径。单位以米为单位。
getBounds()LatLngBoundsReturns the LatLngBounds of the path.
返回路径的纬度边界。

▶ Methods inherited from CircleMarker

从圆圈标记继承的方法

MethodReturnsDescription
toGeoJSON(<Number|false>
 precision?)
ObjectCoordinates values are rounded with formatNum function with given precision. Returns a GeoJSON representation of the circle marker (as a GeoJSON Point Feature).
坐标值使用具有给定精度的 formatNum 函数进行舍入。返回圆标记的地理 JSON 制图表达(作为地理地理符号点要素)。
setLatLng(<LatLng
latLng)
thisSets the position of a circle marker to a new location.
将圆标记的位置设置为新位置。
getLatLng()LatLngReturns the current geographical position of the circle marker
返回圆标记的当前地理位置

▶ Methods inherited from Path

从Path继承的方法

MethodReturnsDescription
redraw()thisRedraws the layer. Sometimes useful after you changed the coordinates that the path uses.
重新绘制图层。有时在更改路径使用的坐标后会很有用。
setStyle(<Path optionsstyle)thisChanges the appearance of a Path based on the options in the Path options object.
根据路径选项对象中的选项更改路径的外观。
bringToFront()thisBrings the layer to the top of all path layers.
将图层置于所有路径图层的顶部。
bringToBack()thisBrings the layer to the bottom of all path layers.
将图层置于所有路径图层的底部。

▶ Methods inherited from Layer

从Layer继承的方法

MethodReturnsDescription
addTo(<Map|LayerGroup> map)thisAdds the layer to the given map or layer group.
将图层添加到给定地图或图层组。
remove()thisRemoves the layer from the map it is currently active on.
从当前处于活动状态的地图中删除图层。
removeFrom(<Mapmap)thisRemoves the layer from the given map
从给定地图中删除图层
removeFrom(<LayerGroupgroup)thisRemoves the layer from the given LayerGroup
从给定的LayerGroup中删除层
getPane(<String> name?)HTMLElementReturns the HTMLElement representing the named pane on the map. If name is omitted, returns the pane for this layer.
返回表示地图上命名窗格的HTMLElement。如果省略名称,则返回此层的窗格。
getAttribution()StringUsed by the attribution control, returns the attribution option.
由属性控件使用,返回属性选项。

▶ Popup methods inherited from Layer

从层继承的弹出式方法

MethodReturnsDescription
bindPopup(<String|HTMLElement
|Function|Popup> content
<Popup optionsoptions?)
thisBinds a popup to the layer with the passed content and sets up the necessary event listeners. If a Function is passed it will receive the layer as the first argument and should return a String or HTMLElement.
将弹出窗口与传递的内容绑定到层,并设置必要的事件侦听器。如果传递了Function,它将接收层作为第一个参数,并应返回String或HTMLElement。
unbindPopup()thisRemoves the popup previously bound with bindPopup.
删除以前与bindPopup绑定的弹出窗口。
openPopup(<LatLnglatlng?)thisOpens the bound popup at the specified latlng or at the default popup anchor if no latlng is passed.
在指定的latlng处打开绑定弹出窗口,如果未传递latlng,则在默认弹出窗口锚定处打开绑定的弹出窗口。
closePopup()thisCloses the popup bound to this layer if it is open.
关闭绑定到此层的弹出窗口(如果已打开)。
togglePopup()thisOpens or closes the popup bound to this layer depending on its current state.
根据当前状态打开或关闭绑定到此层的弹出窗口。
isPopupOpen()booleanReturns true if the popup bound to this layer is currently open.
如果绑定到此层的弹出窗口当前打开,则返回true。
setPopupContent(<String|
HTMLElement|Popup> content)
thisSets the content of the popup bound to this layer.
设置绑定到此层的弹出窗口的内容。
getPopup()PopupReturns the popup bound to this layer.
返回绑定到此层的弹出窗口。

▶ Tooltip methods inherited from Layer

从层继承的工具提示方法

MethodReturnsDescription
bindTooltip(<String|HTMLElement|
Function|Tooltip> content
<Tooltip optionsoptions?)
thisBinds a tooltip to the layer with the passed content and sets up the necessary event listeners. If a Function is passed it will receive the layer as the first argument and should return a String or HTMLElement.
将工具提示与传递的内容绑定到层,并设置必要的事件侦听器。如果传递了Function,它将接收层作为第一个参数,并应返回String或HTMLElement。
unbindTooltip()thisRemoves the tooltip previously bound with bindTooltip.
删除以前与bindTooltip绑定的工具提示。
openTooltip(<LatLnglatlng?)thisOpens the bound tooltip at the specified latlng or at the default tooltip anchor if no latlng is passed.
在指定的latlng处打开绑定工具提示,如果未传递latlng,则在默认工具提示锚定处打开绑定的工具提示。
closeTooltip()thisCloses the tooltip bound to this layer if it is open.
如果绑定到此层的工具提示处于打开状态,则将其关闭。
toggleTooltip()thisOpens or closes the tooltip bound to this layer depending on its current state.
根据当前状态打开或关闭绑定到此层的工具提示。
isTooltipOpen()booleanReturns true if the tooltip bound to this layer is currently open.
如果绑定到此层的工具提示当前处于打开状态,则返回true。
setTooltipContent(<String|
HTMLElement|Tooltip> content)
thisSets the content of the tooltip bound to this layer.
设置绑定到此层的工具提示的内容。
getTooltip()TooltipReturns the tooltip bound to this layer.
返回绑定到此层的工具提示。

▶ Methods inherited from Evented

从Evented继承的方法

MethodReturnsDescription
on(<String> type, <Function> 
fn, <Object> context?)
thisAdds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').
将侦听器函数(fn)添加到对象的特定事件类型。您可以选择指定侦听器的上下文(this关键字将指向的对象)。您还可以传递几个空格分隔的类型(例如“click dblclick”)。
on(<Object> eventMap)thisAdds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
添加一组类型/侦听器对,例如{click:onClick、mousemove:onMouseMove}
off(<String> type, <Function>
 fn?, <Object> context?)
thisRemoves a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.
删除以前添加的侦听器函数。如果没有指定函数,它将从对象中删除该特定事件的所有侦听器。请注意,如果将自定义上下文传递给on,则必须将同一上下文传递给off才能删除侦听器。
off(<Object> eventMap)thisRemoves a set of type/listener pairs.
删除一组类型/侦听器对。
off()thisRemoves all listeners to all events on the object. This includes implicitly attached events..
删除对象上所有事件的所有侦听器。这包括隐式附加的事件。
fire(<String> type, <Object> 
data?, <Boolean> propagate?)
thisFires an event of the specified type. You can optionally provide a data object — the first argument of the listener function will contain its properties. The event can optionally be propagated to event parents.
激发指定类型的事件。您可以选择提供一个数据对象-侦听器函数的第一个参数将包含其属性。可以选择将事件传播到事件父级。
listens(<String> type
<Boolean> propagate?)
BooleanReturns true if a particular event type has any listeners attached to it. The verification can optionally be propagated, it will return true if parents have the listener attached to it.
如果特定事件类型附加了任何侦听器,则返回true。验证可以选择性地传播,如果父级附加了侦听器,它将返回true。
once()thisBehaves as on(…), except the listener will only get fired once and then removed.
行为与on(…)相同,但侦听器只会被激发一次,然后被移除。
addEventParent(<Eventedobj)thisAdds an event parent – an Evented that will receive propagated events
添加事件父级-将接收传播事件的Evented
removeEventParent(<Eventedobj)thisRemoves an event parent, so it will stop receiving propagated events
删除事件父级,因此它将停止接收传播的事件
addEventListener()thisAlias to on(…)
removeEventListener()thisAlias to off(…)
clearAllEventListeners()thisAlias to off()
addOneTimeEventListener()thisAlias to once(…)
fireEvent()thisAlias to fire(…)
hasEventListeners()BooleanAlias to listens(…)
0 0 投票数
文章评分
订阅评论
提醒
0 评论
内联反馈
查看所有评论
0
希望看到您的想法,请您发表评论x