• <tfoot id='ZKbAc'></tfoot>

      1. <legend id='ZKbAc'><style id='ZKbAc'><dir id='ZKbAc'><q id='ZKbAc'></q></dir></style></legend>
        • <bdo id='ZKbAc'></bdo><ul id='ZKbAc'></ul>

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

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

        具有模糊轮廓的传单多边形

        时间:2023-08-08
        <legend id='OLmO4'><style id='OLmO4'><dir id='OLmO4'><q id='OLmO4'></q></dir></style></legend>

          <tbody id='OLmO4'></tbody>

          1. <small id='OLmO4'></small><noframes id='OLmO4'>

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

                <bdo id='OLmO4'></bdo><ul id='OLmO4'></ul>
                  <tfoot id='OLmO4'></tfoot>
                  本文介绍了具有模糊轮廓的传单多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在寻找一种方法来获得传单多边形的模糊/模糊/渐变轮廓.

                  这应该有助于使国家/地区轮廓更加简单(当前,当您放大代表国家/地区的 svg 时,它会变得丑陋/不准确).

                  我正在考虑将 CSS 属性附加到与此类似的 svg:

                  I am looking for a way to have a fuzzy/blur/gradient outline of a leaflet polygon.

                  This should help make country outlines more simple (currently, when you zoom in to a svg representing a country, it gets ugly/inaccurate).

                  I was thinking about attaching CSS attributes to the svg similiar to this: http://www.w3schools.com/svg/svg_fegaussianblur.asp But apparently the svg subelement <g> (used for the leaflet polygon) does not accept this.

                  I also had a look at <defs> of svg (see here: http://geoexamples.blogspot.be/2014/01/d3-map-styling-tutorial-ii-giving-style.html) but have no clue in applying this to leaflet.

                  http://leafletjs.com/examples/quick-start-example.html

                  解决方案

                  You would first need to put the actual filter element into the svg element of the map, otherwise assigning a filter to a path or g won't work because the filter will be undefined. So you're going to need to do this in Javascript. But assigning a filter by classname in CSS is as far as i can see impossible because it will only work with the url() function of CSS. That won't fly with the dynamic SVG embedded in Leaflet's overlaypane. You can however assign it with Javascript:

                  // Get the SVG element from the overlayPane
                  var svg = map.getPanes().overlayPane.firstChild,
                      // Create filter element
                      svgFilter = document.createElementNS('http://www.w3.org/2000/svg', 'filter'),
                      // Create blur element
                      svgBlur = document.createElementNS('http://www.w3.org/2000/svg', 'feGaussianBlur');
                  
                  // Set ID attribute of filter
                  svgFilter.setAttribute('id', 'blur');
                  
                  // Give room to blur to prevent clipping
                  svgFilter.setAttribute('x', '-100%');
                  svgFilter.setAttribute('y', '-100%');
                  svgFilter.setAttribute('width', '500%');
                  svgFilter.setAttribute('height', '500%');
                  
                  // Set deviation attribute of blur
                  svgBlur.setAttribute('stdDeviation', 3);
                  
                  // Append blur element to filter element 
                  svgFilter.appendChild(svgBlur);
                  // Append filter element to SVG element
                  svg.appendChild(svgFilter);
                  

                  After that you can use the filter on polygons, linestrings, etc:

                  // Creating a polygon and adding to the map
                  var polygon = L.polygon([[10, 10],[-10,10], [-10,-10],[10,-10]]).addTo(map);
                  
                  // Set filter attribute on the polygon
                  polygon._path.setAttribute('filter', 'url(#blur)');
                  

                  That's it, here's a working example on Plunker: http://plnkr.co/edit/JTNgeXuiBaL8LIbmkVjz?p=preview

                  这篇关于具有模糊轮廓的传单多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:提供地图瓦片包以供离线使用 下一篇:单击(右键单击)使用传单地图库获取图像叠加层的

                  相关文章

                  最新文章

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

                      <tfoot id='NTd4P'></tfoot>
                    1. <legend id='NTd4P'><style id='NTd4P'><dir id='NTd4P'><q id='NTd4P'></q></dir></style></legend>
                        <bdo id='NTd4P'></bdo><ul id='NTd4P'></ul>