diff options
| author | Arne Dußin | 2020-12-21 01:22:15 +0100 |
|---|---|---|
| committer | Arne Dußin | 2020-12-21 21:15:55 +0100 |
| commit | d7e9c3cc46d616c2fcd1a6e9f73adbb79c6570b4 (patch) | |
| tree | e5633f4d3b18472922c943d759e9f58722ba4405 /src/svg/mod.rs | |
| parent | 48f321a80970ebeb8374072b1d2e0a4d297aa348 (diff) | |
| download | graf_karto-d7e9c3cc46d616c2fcd1a6e9f73adbb79c6570b4.tar.gz graf_karto-d7e9c3cc46d616c2fcd1a6e9f73adbb79c6570b4.zip | |
Add previously missing docs where appropriate
Diffstat (limited to 'src/svg/mod.rs')
| -rw-r--r-- | src/svg/mod.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/svg/mod.rs b/src/svg/mod.rs index fffc00b..af066f1 100644 --- a/src/svg/mod.rs +++ b/src/svg/mod.rs @@ -13,10 +13,10 @@ use style::Style; use svgtypes::{Path as SVGPath, PathSegment}; use xmltree::{Element, XMLNode}; -// Find the first XML-Node with the given name. With depth, the maximum depth the -// algorithm will search to can be set. If it is set to `None`, the algorithm will search the -// entire sub-tree. Returns `None` if no such child can be found. Returns itself, in case the root -// node is already of the name given. +/// Find the first XML-Node with the given name. With depth, the maximum depth the +/// algorithm will search to can be set. If it is set to `None`, the algorithm will search the +/// entire sub-tree. Returns `None` if no such child can be found. Returns itself, in case the root +/// node is already of the name given. pub fn find_first_node(root: Element, name: &str, depth: Option<usize>) -> Option<Element> { // The abort condition of this recursive function. If the element itself is of the required // name, return it. @@ -68,7 +68,10 @@ pub fn read_svg_file<P: AsRef<Path>>(file: P) -> io::Result<Element> { } } +/// Trait that indicates a struct is capable of drawing SVG-elements. pub trait DrawSVG { + /// Draw the elements given by `svg_data` and all its children to the implementor, with the + /// specified scale and translated by `position_px`. fn draw_svg(&mut self, svg_data: &Element, pixels_per_m: f32, position_px: Vec2<f32>); } |
