Fill Pattern for polygon composed of repeating circles. Add these to the 'fillPattern' field in GeoJson style functions. Parameters ---------- width: int, default 20 Horizontal distance between circles (pixels). height: int, default 20 Vertical distance between
| 77 | |
| 78 | |
| 79 | class CirclePattern(JSCSSMixin, MacroElement): |
| 80 | """Fill Pattern for polygon composed of repeating circles. |
| 81 | |
| 82 | Add these to the 'fillPattern' field in GeoJson style functions. |
| 83 | |
| 84 | Parameters |
| 85 | ---------- |
| 86 | width: int, default 20 |
| 87 | Horizontal distance between circles (pixels). |
| 88 | height: int, default 20 |
| 89 | Vertical distance between circles (pixels). |
| 90 | radius: int, default 12 |
| 91 | Radius of each circle (pixels). |
| 92 | weight: float, default 2.0 |
| 93 | Width of outline around each circle (pixels). |
| 94 | color: string with hexadecimal, RGB, or named color, default "#3388ff" |
| 95 | Color of the circle outline. |
| 96 | fill_color: string with hexadecimal, RGB, or named color, default "#3388ff" |
| 97 | Color of the circle interior. |
| 98 | opacity: float, default 0.75 |
| 99 | Opacity of the circle outline. Should be between 0 and 1. |
| 100 | fill_opacity: float, default 0.5 |
| 101 | Opacity of the circle interior. Should be between 0 and 1. |
| 102 | |
| 103 | See https://github.com/teastman/Leaflet.pattern for more information. |
| 104 | """ |
| 105 | |
| 106 | _template = Template( |
| 107 | """ |
| 108 | {% macro script(this, kwargs) %} |
| 109 | var {{ this.get_name() }}_shape = new L.PatternCircle( |
| 110 | {{ this.options_pattern_circle|tojavascript }} |
| 111 | ); |
| 112 | var {{ this.get_name() }} = new L.Pattern( |
| 113 | {{ this.options_pattern|tojavascript }} |
| 114 | ); |
| 115 | {{ this.get_name() }}.addShape({{ this.get_name() }}_shape); |
| 116 | {{ this.get_name() }}.addTo({{ this.parent_map }}); |
| 117 | {% endmacro %} |
| 118 | """ |
| 119 | ) |
| 120 | |
| 121 | default_js = [ |
| 122 | ("pattern", "https://teastman.github.io/Leaflet.pattern/leaflet.pattern.js") |
| 123 | ] |
| 124 | |
| 125 | def __init__( |
| 126 | self, |
| 127 | width=20, |
| 128 | height=20, |
| 129 | radius=12, |
| 130 | weight=2.0, |
| 131 | color="#3388ff", |
| 132 | fill_color="#3388ff", |
| 133 | opacity=0.75, |
| 134 | fill_opacity=0.5, |
| 135 | ): |
| 136 | super().__init__() |
nothing calls this directly
no test coverage detected
searching dependent graphs…