1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! This crate is a lib to generate SVG strings from [geo-types](https://docs.rs/geo-types/0.7.13/geo_types/).
//!
//! Below is an example of a geometry collection rendered to SVG.
//!
//! 
//!
//! # Features
//!
//! - [GeometryCollection](https://docs.rs/geo-types/0.7.13/geo_types/geometry/struct.GeometryCollection.html) and all variants of [Geometry](https://docs.rs/geo-types/0.7.13/geo_types/enum.Geometry.html) are supported
//! - the viewport size is automatically computed to contain all shapes
//! - style and formatting options are available
//!
//! # Example
//!
//! The following will show how to convert a line to a SVG string.
//! The [`to_svg`] method is provided by the [`ToSvg`] trait which is implemented for all [geo-types](https://docs.rs/geo-types/0.7.13/geo_types/).
//!
//! ```
//! # fn main() {
//! use geo::{Coord, Line, Point};
//! use geo_svg::{Color, ToSvg};
//! let point = Point::new(10.0, 28.1);
//! let line = Line::new(
//! Coord { x: 114.19, y: 22.26 },
//! Coord { x: 15.93, y: -15.76 },
//! );
//!
//! let svg = point
//! .to_svg()
//! .with_radius(2.0)
//! .and(line.to_svg().with_stroke_width(2.5))
//! .with_fill_color(Color::Named("red"))
//! .with_stroke_color(Color::Rgb(200, 0, 100))
//! .with_fill_opacity(0.7);
//!
//! println!("{}", svg);
//! # assert_eq!(svg.to_string(), r#"<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" viewBox="7 -18.26 109.69 49.36"><circle cx="10.0" cy="28.1" r="2" fill="red" fill-opacity="0.7" stroke="rgb(200,0,100)"/><path d="M 114.19 22.26 L 15.93 -15.76" fill="red" fill-opacity="0.7" stroke="rgb(200,0,100)" stroke-width="2.5"/></svg>"#);
//! # }
//! ```
//!
//! ## Result
//!
//! ```xml
//! <svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" viewBox="7 -18.26 109.69 49.36"><circle cx="10" cy="28.1" r="2" fill="red" fill-opacity="0.7" stroke="rgb(200,0,100)"/><path d="M 114.19 22.26 L 15.93 -15.76" fill="red" fill-opacity="0.7" stroke="rgb(200,0,100)" stroke-width="2.5"/></svg>
//! ```
//!
//! [`ToSvg`]: svg/trait.ToSvg.html
//! [`to_svg`]: svg/trait.ToSvg.html#method.to_svg
pub use *;
pub use *;
pub use *;
pub use Svg;
pub use *;
pub use *;
pub use *;
pub use Unit;
pub use ViewBox;