1. <tfoot id='LjzI8'></tfoot>

  2. <legend id='LjzI8'><style id='LjzI8'><dir id='LjzI8'><q id='LjzI8'></q></dir></style></legend>

      <small id='LjzI8'></small><noframes id='LjzI8'>

      <i id='LjzI8'><tr id='LjzI8'><dt id='LjzI8'><q id='LjzI8'><span id='LjzI8'><b id='LjzI8'><form id='LjzI8'><ins id='LjzI8'></ins><ul id='LjzI8'></ul><sub id='LjzI8'></sub></form><legend id='LjzI8'></legend><bdo id='LjzI8'><pre id='LjzI8'><center id='LjzI8'></center></pre></bdo></b><th id='LjzI8'></th></span></q></dt></tr></i><div id='LjzI8'><tfoot id='LjzI8'></tfoot><dl id='LjzI8'><fieldset id='LjzI8'></fieldset></dl></div>
      • <bdo id='LjzI8'></bdo><ul id='LjzI8'></ul>

      Leaflet.draw 映射:如何在没有工具栏的情况下启动绘

      时间:2023-05-28

      <small id='eDxpv'></small><noframes id='eDxpv'>

        <legend id='eDxpv'><style id='eDxpv'><dir id='eDxpv'><q id='eDxpv'></q></dir></style></legend>
          <bdo id='eDxpv'></bdo><ul id='eDxpv'></ul>

              <tfoot id='eDxpv'></tfoot>
                <tbody id='eDxpv'></tbody>

                <i id='eDxpv'><tr id='eDxpv'><dt id='eDxpv'><q id='eDxpv'><span id='eDxpv'><b id='eDxpv'><form id='eDxpv'><ins id='eDxpv'></ins><ul id='eDxpv'></ul><sub id='eDxpv'></sub></form><legend id='eDxpv'></legend><bdo id='eDxpv'><pre id='eDxpv'><center id='eDxpv'></center></pre></bdo></b><th id='eDxpv'></th></span></q></dt></tr></i><div id='eDxpv'><tfoot id='eDxpv'></tfoot><dl id='eDxpv'><fieldset id='eDxpv'></fieldset></dl></div>
              1. 本文介绍了Leaflet.draw 映射:如何在没有工具栏的情况下启动绘图功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                对于任何使用过传单或传单.draw 插件的人:

                For anyone experienced with leaflet or leaflet.draw plugin:

                我想在不使用 leaflet.draw 的工具栏的情况下开始绘制多边形.我已经设法通过在线搜索(不在主文档中)找到允许在不使用工具栏(layer.editing.enable();)的情况下进行编辑的属性.如果没有工具栏按钮,我似乎无法找到如何开始绘制多边形.任何帮助将不胜感激!

                I want to initiate drawing a polygon without using the toolbar from leaflet.draw. I've managed to find the property that allows editing without using the toolbar (layer.editing.enable();) by searching online (it's not in the main documentation). I can't seem to find how to begin drawing a polygon without the toolbar button. Any help would be much appreciated!

                谢谢你:)

                推荐答案

                这个简单的代码对我有用:

                This simple code works for me:

                new L.Draw.Polyline(map, drawControl.options.polyline).enable();
                

                只需将其放入自定义按钮的 onclick 处理程序(或任何您想要的位置).

                Just put it into the onclick handler of your custom button (or wherever you want).

                变量 map 和 drawControl 是对您的传单地图和绘图控件的引用.

                The variables map and drawControl are references to your leaflet map and draw control.

                深入研究源代码 (leaflet.draw-src.js),您可以找到绘制其他元素以及编辑或删除它们的函数.

                Diving into the source code (leaflet.draw-src.js) you can find the functions to draw the other elements and to edit or delete them.

                new L.Draw.Polygon(map, drawControl.options.polygon).enable()
                new L.Draw.Rectangle(map, drawControl.options.rectangle).enable()
                new L.Draw.Circle(map, drawControl.options.circle).enable()
                new L.Draw.Marker(map, drawControl.options.marker).enable()
                
                new L.EditToolbar.Edit(map, {
                                featureGroup: drawControl.options.featureGroup,
                                selectedPathOptions: drawControl.options.edit.selectedPathOptions
                            })
                new L.EditToolbar.Delete(map, {
                                featureGroup: drawControl.options.featureGroup
                            })
                

                我希望这对你也有用.

                L.EditToolbar.Edit 和 L.EditToolbar.Delete 类公开了以下有用的方法:

                The L.EditToolbar.Edit and L.EditToolbar.Delete classes expose the following useful methods:

                • enable():启动编辑/删除模式
                • disable():返回标准模式
                • save():保存更改(触发 draw:edited/draw:deleted 事件)
                • revertLayers():撤消更改

                这篇关于Leaflet.draw 映射:如何在没有工具栏的情况下启动绘图功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何从地图外部与传单标记层进行交互? 下一篇:单击 Leaflet Popup 中的链接并执行 Javascript

                相关文章

                最新文章

                <legend id='ehFMQ'><style id='ehFMQ'><dir id='ehFMQ'><q id='ehFMQ'></q></dir></style></legend>
              2. <tfoot id='ehFMQ'></tfoot>
                • <bdo id='ehFMQ'></bdo><ul id='ehFMQ'></ul>

                    <i id='ehFMQ'><tr id='ehFMQ'><dt id='ehFMQ'><q id='ehFMQ'><span id='ehFMQ'><b id='ehFMQ'><form id='ehFMQ'><ins id='ehFMQ'></ins><ul id='ehFMQ'></ul><sub id='ehFMQ'></sub></form><legend id='ehFMQ'></legend><bdo id='ehFMQ'><pre id='ehFMQ'><center id='ehFMQ'></center></pre></bdo></b><th id='ehFMQ'></th></span></q></dt></tr></i><div id='ehFMQ'><tfoot id='ehFMQ'></tfoot><dl id='ehFMQ'><fieldset id='ehFMQ'></fieldset></dl></div>

                    <small id='ehFMQ'></small><noframes id='ehFMQ'>