diff --git a/geozero/CHANGELOG.md b/geozero/CHANGELOG.md index 9748a114..3802af72 100644 --- a/geozero/CHANGELOG.md +++ b/geozero/CHANGELOG.md @@ -1,5 +1,6 @@ ## UNRELEASED +* Add `style` option to SVGWriter for writing \ tags * Add `BoundsProcessor` to compute bounds of geometry * Update Deps: * BREAKING: `flatgeobuf` to 4.5.0 diff --git a/geozero/src/svg/writer.rs b/geozero/src/svg/writer.rs index 6db58176..10640f79 100644 --- a/geozero/src/svg/writer.rs +++ b/geozero/src/svg/writer.rs @@ -7,6 +7,7 @@ pub struct SvgWriter { out: W, invert_y: bool, view_box: Option<(f64, f64, f64, f64)>, + style: Option, size: Option<(u32, u32)>, } @@ -16,6 +17,7 @@ impl SvgWriter { out, invert_y, view_box: None, + style: None, size: None, } } @@ -35,6 +37,9 @@ impl SvgWriter { }; self.size = Some((width, height)); } + pub fn set_style(&mut self, style: Option) { + self.style = style; + } } impl FeatureProcessor for SvgWriter { @@ -55,7 +60,14 @@ impl FeatureProcessor for SvgWriter { } self.out.write_all( br#"stroke-linecap="round" stroke-linejoin="round"> -{style}")?; + } + + self.out.write_all( +br#"