Fill Pattern for polygon composed of alternating lines. Add these to the 'fillPattern' field in GeoJson style functions. Parameters ---------- angle: float, default 0.5 Angle of the line pattern (degrees). Should be between -360 and 360. weight: float, default 4
| 7 | |
| 8 | |
| 9 | class StripePattern(JSCSSMixin, MacroElement): |
| 10 | """Fill Pattern for polygon composed of alternating lines. |
| 11 | |
| 12 | Add these to the 'fillPattern' field in GeoJson style functions. |
| 13 | |
| 14 | Parameters |
| 15 | ---------- |
| 16 | angle: float, default 0.5 |
| 17 | Angle of the line pattern (degrees). Should be between -360 and 360. |
| 18 | weight: float, default 4 |
| 19 | Width of the main lines (pixels). |
| 20 | space_weight: float |
| 21 | Width of the alternate lines (pixels). |
| 22 | color: string with hexadecimal, RGB, or named color, default "#000000" |
| 23 | Color of the main lines. |
| 24 | space_color: string with hexadecimal, RGB, or named color, default "#ffffff" |
| 25 | Color of the alternate lines. |
| 26 | opacity: float, default 0.75 |
| 27 | Opacity of the main lines. Should be between 0 and 1. |
| 28 | space_opacity: float, default 0.0 |
| 29 | Opacity of the alternate lines. Should be between 0 and 1. |
| 30 | |
| 31 | See https://github.com/teastman/Leaflet.pattern for more information. |
| 32 | """ |
| 33 | |
| 34 | _template = Template( |
| 35 | """ |
| 36 | {% macro script(this, kwargs) %} |
| 37 | var {{ this.get_name() }} = new L.StripePattern( |
| 38 | {{ this.options|tojavascript }} |
| 39 | ); |
| 40 | {{ this.get_name() }}.addTo({{ this.parent_map.get_name() }}); |
| 41 | {% endmacro %} |
| 42 | """ |
| 43 | ) |
| 44 | |
| 45 | default_js = [ |
| 46 | ("pattern", "https://teastman.github.io/Leaflet.pattern/leaflet.pattern.js") |
| 47 | ] |
| 48 | |
| 49 | def __init__( |
| 50 | self, |
| 51 | angle=0.5, |
| 52 | weight=4, |
| 53 | space_weight=4, |
| 54 | color="#000000", |
| 55 | space_color="#ffffff", |
| 56 | opacity=0.75, |
| 57 | space_opacity=0.0, |
| 58 | **kwargs |
| 59 | ): |
| 60 | super().__init__() |
| 61 | self._name = "StripePattern" |
| 62 | self.options = remove_empty( |
| 63 | angle=angle, |
| 64 | weight=weight, |
| 65 | space_weight=space_weight, |
| 66 | color=color, |
nothing calls this directly
no test coverage detected
searching dependent graphs…