diff --git a/examples/asemic/grid-beveled.svg b/examples/asemic/grid-beveled.svg
index 37548d6..37599ab 100644
--- a/examples/asemic/grid-beveled.svg
+++ b/examples/asemic/grid-beveled.svg
@@ -1,6 +1,6 @@
-
diff --git a/examples/asemic/grid-radial-dense.svg b/examples/asemic/grid-radial-dense.svg
index 16b9ea6..e4e64cb 100644
--- a/examples/asemic/grid-radial-dense.svg
+++ b/examples/asemic/grid-radial-dense.svg
@@ -1,6 +1,6 @@
-
-
@@ -642,4 +642,4 @@ svg { stroke:black; stroke-width:2; fill:none;}
-
\ No newline at end of file
+
diff --git a/examples/asemic/grid-radial.svg b/examples/asemic/grid-radial.svg
index 12675f9..98da791 100644
--- a/examples/asemic/grid-radial.svg
+++ b/examples/asemic/grid-radial.svg
@@ -1,6 +1,6 @@
-
-
@@ -377,4 +377,4 @@ svg { stroke:black; stroke-width:2; fill:none;}
-
\ No newline at end of file
+
diff --git a/examples/asemic/grid-rounded.svg b/examples/asemic/grid-rounded.svg
index f5448f7..3480a0f 100644
--- a/examples/asemic/grid-rounded.svg
+++ b/examples/asemic/grid-rounded.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/asemic/grid-triangulated.svg b/examples/asemic/grid-triangulated.svg
index f086ad3..99182ff 100644
--- a/examples/asemic/grid-triangulated.svg
+++ b/examples/asemic/grid-triangulated.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/asemic/random-rounded.svg b/examples/asemic/random-rounded.svg
index 0adb798..2bb8c3d 100644
--- a/examples/asemic/random-rounded.svg
+++ b/examples/asemic/random-rounded.svg
@@ -1,6 +1,6 @@
-
-
@@ -1802,4 +1802,4 @@ svg { stroke:black; stroke-width:2; fill:none;}
-
\ No newline at end of file
+
diff --git a/examples/asemic/random-triangulated.svg b/examples/asemic/random-triangulated.svg
index 6bb531e..ebbacd3 100644
--- a/examples/asemic/random-triangulated.svg
+++ b/examples/asemic/random-triangulated.svg
@@ -1,6 +1,6 @@
-
-
@@ -301,4 +301,4 @@ svg { stroke:black; stroke-width:2; fill:none;}
-
\ No newline at end of file
+
diff --git a/examples/bitwise/expr1.svg b/examples/bitwise/expr1.svg
index e0f7c6b..c206c10 100644
--- a/examples/bitwise/expr1.svg
+++ b/examples/bitwise/expr1.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/bitwise/expr2.svg b/examples/bitwise/expr2.svg
index b301997..299f0d9 100644
--- a/examples/bitwise/expr2.svg
+++ b/examples/bitwise/expr2.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/bitwise/expr3.svg b/examples/bitwise/expr3.svg
index 5c456ac..7c10da7 100644
--- a/examples/bitwise/expr3.svg
+++ b/examples/bitwise/expr3.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/dla/organic.svg b/examples/dla/organic.svg
index 7b3187e..4751dec 100644
--- a/examples/dla/organic.svg
+++ b/examples/dla/organic.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/geom2graph/offset-squares.svg b/examples/geom2graph/offset-squares.svg
index ab06837..43b8eba 100644
--- a/examples/geom2graph/offset-squares.svg
+++ b/examples/geom2graph/offset-squares.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/grid/hex.svg b/examples/grid/hex.svg
index 045c305..983c7a1 100644
--- a/examples/grid/hex.svg
+++ b/examples/grid/hex.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/grid/radial-filled.svg b/examples/grid/radial-filled.svg
index 75fed70..d646db0 100644
--- a/examples/grid/radial-filled.svg
+++ b/examples/grid/radial-filled.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/grid/radial.svg b/examples/grid/radial.svg
index 47249b5..700e7b3 100644
--- a/examples/grid/radial.svg
+++ b/examples/grid/radial.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/lsystems/sierpinski-tree.svg b/examples/lsystems/sierpinski-tree.svg
index b24c9b0..528abaf 100644
--- a/examples/lsystems/sierpinski-tree.svg
+++ b/examples/lsystems/sierpinski-tree.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/pack/squares.svg b/examples/pack/squares.svg
index 2cbd540..1bc5caa 100644
--- a/examples/pack/squares.svg
+++ b/examples/pack/squares.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/project/isometric.svg b/examples/project/isometric.svg
index af44993..1d2d226 100644
--- a/examples/project/isometric.svg
+++ b/examples/project/isometric.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/random-lsystems/random-0.svg b/examples/random-lsystems/random-0.svg
index b7a7a4b..9438a26 100644
--- a/examples/random-lsystems/random-0.svg
+++ b/examples/random-lsystems/random-0.svg
@@ -1,6 +1,6 @@
-
-
@@ -124,4 +124,4 @@ svg { stroke:black; stroke-width:2; fill:none;}
-
\ No newline at end of file
+
diff --git a/examples/random-lsystems/random-1.svg b/examples/random-lsystems/random-1.svg
index 8ec6f32..2f36de5 100644
--- a/examples/random-lsystems/random-1.svg
+++ b/examples/random-lsystems/random-1.svg
@@ -1,6 +1,6 @@
-
-
@@ -488,4 +488,4 @@ svg { stroke:black; stroke-width:2; fill:none;}
-
\ No newline at end of file
+
diff --git a/examples/random-lsystems/random-10.svg b/examples/random-lsystems/random-10.svg
index 394daae..b3d2e11 100644
--- a/examples/random-lsystems/random-10.svg
+++ b/examples/random-lsystems/random-10.svg
@@ -1,6 +1,6 @@
-
-
@@ -637,4 +637,4 @@ svg { stroke:black; stroke-width:2; fill:none;}
-
\ No newline at end of file
+
diff --git a/examples/random-lsystems/random-11.svg b/examples/random-lsystems/random-11.svg
index 4159b9f..bcc1f31 100644
--- a/examples/random-lsystems/random-11.svg
+++ b/examples/random-lsystems/random-11.svg
@@ -1,6 +1,6 @@
-
-
-
\ No newline at end of file
+
diff --git a/examples/random-lsystems/random-12.svg b/examples/random-lsystems/random-12.svg
index adf7d69..e1558b0 100644
--- a/examples/random-lsystems/random-12.svg
+++ b/examples/random-lsystems/random-12.svg
@@ -1,6 +1,6 @@
-
-
@@ -531,4 +531,4 @@ svg { stroke:black; stroke-width:2; fill:none;}
-
\ No newline at end of file
+
diff --git a/examples/random-lsystems/random-13.svg b/examples/random-lsystems/random-13.svg
index b5347ee..9ab448a 100644
--- a/examples/random-lsystems/random-13.svg
+++ b/examples/random-lsystems/random-13.svg
@@ -1,6 +1,6 @@
-
-
@@ -1819,4 +1819,4 @@ svg { stroke:black; stroke-width:2; fill:none;}
-
\ No newline at end of file
+
diff --git a/examples/random-lsystems/random-2.svg b/examples/random-lsystems/random-2.svg
index eda4c4b..45293e1 100644
--- a/examples/random-lsystems/random-2.svg
+++ b/examples/random-lsystems/random-2.svg
@@ -1,6 +1,6 @@
-
-
-
\ No newline at end of file
+
diff --git a/examples/random-lsystems/random-3.svg b/examples/random-lsystems/random-3.svg
index dda8728..73f490b 100644
--- a/examples/random-lsystems/random-3.svg
+++ b/examples/random-lsystems/random-3.svg
@@ -1,6 +1,6 @@
-
-
@@ -444,4 +444,4 @@ svg { stroke:black; stroke-width:2; fill:none;}
-
\ No newline at end of file
+
diff --git a/examples/random-lsystems/random-4.svg b/examples/random-lsystems/random-4.svg
index b5d2f0c..9b53ee3 100644
--- a/examples/random-lsystems/random-4.svg
+++ b/examples/random-lsystems/random-4.svg
@@ -1,6 +1,6 @@
-
-
-
\ No newline at end of file
+
diff --git a/examples/random-lsystems/random-5.svg b/examples/random-lsystems/random-5.svg
index a3e1175..2fb07f4 100644
--- a/examples/random-lsystems/random-5.svg
+++ b/examples/random-lsystems/random-5.svg
@@ -1,6 +1,6 @@
-
-
-
\ No newline at end of file
+
diff --git a/examples/random-lsystems/random-6.svg b/examples/random-lsystems/random-6.svg
index 41743a9..04e41ca 100644
--- a/examples/random-lsystems/random-6.svg
+++ b/examples/random-lsystems/random-6.svg
@@ -1,6 +1,6 @@
-
-
-
\ No newline at end of file
+
diff --git a/examples/random-lsystems/random-7.svg b/examples/random-lsystems/random-7.svg
index 312d10a..dadf676 100644
--- a/examples/random-lsystems/random-7.svg
+++ b/examples/random-lsystems/random-7.svg
@@ -1,6 +1,6 @@
-
-
-
\ No newline at end of file
+
diff --git a/examples/random-lsystems/random-8.svg b/examples/random-lsystems/random-8.svg
index 06c14ca..6ee7d53 100644
--- a/examples/random-lsystems/random-8.svg
+++ b/examples/random-lsystems/random-8.svg
@@ -1,6 +1,6 @@
-
-
@@ -1025,4 +1025,4 @@ svg { stroke:black; stroke-width:2; fill:none;}
-
\ No newline at end of file
+
diff --git a/examples/random-lsystems/random-9.svg b/examples/random-lsystems/random-9.svg
index a80bcc0..8b43c74 100644
--- a/examples/random-lsystems/random-9.svg
+++ b/examples/random-lsystems/random-9.svg
@@ -1,6 +1,6 @@
-
-
@@ -157,4 +157,4 @@ svg { stroke:black; stroke-width:2; fill:none;}
-
\ No newline at end of file
+
diff --git a/examples/smooth/beveled.svg b/examples/smooth/beveled.svg
index f532b7b..d1a6650 100644
--- a/examples/smooth/beveled.svg
+++ b/examples/smooth/beveled.svg
@@ -1,6 +1,6 @@
-
-
\ No newline at end of file
diff --git a/examples/smooth/rounded.svg b/examples/smooth/rounded.svg
index 496b104..1e7051f 100644
--- a/examples/smooth/rounded.svg
+++ b/examples/smooth/rounded.svg
@@ -1,6 +1,6 @@
-
-
\ No newline at end of file
diff --git a/examples/snap/grid.svg b/examples/snap/grid.svg
index 6878a1d..9839e43 100644
--- a/examples/snap/grid.svg
+++ b/examples/snap/grid.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/snap/snap-closest.svg b/examples/snap/snap-closest.svg
index 6247c24..6fba971 100644
--- a/examples/snap/snap-closest.svg
+++ b/examples/snap/snap-closest.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/snap/snap-grid.svg b/examples/snap/snap-grid.svg
index 3d83aa7..439966f 100644
--- a/examples/snap/snap-grid.svg
+++ b/examples/snap/snap-grid.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/streamline/field1.svg b/examples/streamline/field1.svg
index 3ed160d..1365420 100644
--- a/examples/streamline/field1.svg
+++ b/examples/streamline/field1.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/streamline/field2.svg b/examples/streamline/field2.svg
index dcfa9d3..0b8b41e 100644
--- a/examples/streamline/field2.svg
+++ b/examples/streamline/field2.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/transform/square.svg b/examples/transform/square.svg
index 7e304a4..b10597c 100644
--- a/examples/transform/square.svg
+++ b/examples/transform/square.svg
@@ -1,6 +1,6 @@
-
-
\ No newline at end of file
diff --git a/examples/traverse/hex-walk.svg b/examples/traverse/hex-walk.svg
index 8547dc2..8c59130 100644
--- a/examples/traverse/hex-walk.svg
+++ b/examples/traverse/hex-walk.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/urquhart/triangulation.svg b/examples/urquhart/triangulation.svg
index 5b102bd..198b18a 100644
--- a/examples/urquhart/triangulation.svg
+++ b/examples/urquhart/triangulation.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/urquhart/urquhart.svg b/examples/urquhart/urquhart.svg
index 49503ed..6087b60 100644
--- a/examples/urquhart/urquhart.svg
+++ b/examples/urquhart/urquhart.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/wkt2svg/styles.svg b/examples/wkt2svg/styles.svg
index 6b01a01..9a3a181 100644
--- a/examples/wkt2svg/styles.svg
+++ b/examples/wkt2svg/styles.svg
@@ -1,6 +1,6 @@
-
-
diff --git a/tools/wkt2svg.rs b/tools/wkt2svg.rs
index 9c96ce9..40dfe51 100644
--- a/tools/wkt2svg.rs
+++ b/tools/wkt2svg.rs
@@ -124,21 +124,23 @@ impl From<&CmdlineOptions> for SvgOptions {
}
impl SvgOptions {
- fn get_global_style(&self) -> element::Style {
- // let style = element::Style::new("svg { stroke:black; stroke-width:2px; fill:none;}");
-
+ fn get_global_style(&self, use_screen_coordinates: bool) -> element::Style {
let style = if let Some(dasharray) = &self.global_stroke_dasharray {
format!("stroke-dasharray:{dasharray};")
} else {
String::new()
};
- let style = format!(
+ let mut style = format!(
"{style} stroke:{}; stroke-width:{}; fill:{};",
self.global_stroke, self.global_stroke_width, self.global_fill
);
+ if !use_screen_coordinates {
+ style.push_str(" transform:scale(1,-1);");
+ }
- element::Style::new(format!("svg {{{style}}}"))
+ let style = element::Style::new(format!("svg {{{style}}}"));
+ style.set("type", "text/css")
}
}
@@ -515,10 +517,7 @@ fn main() -> eyre::Result<()> {
tracing::debug!("Transforming geometries with: {transform:?} to fit into viewBox {viewbox:?}");
let mut document = Document::new().set("viewBox", viewbox);
- if !args.screen_coordinates {
- document = document.set("transform", "scale(1,-1)");
- }
- let style = options.get_global_style();
+ let style = options.get_global_style(args.screen_coordinates);
document = document.add(style);
for geometry in geometries {
document = to_svg(geometry, &transform, document, &mut options);