clipper2_sys/double/
paths_d.rs1use crate::PathD;
2
3#[derive(Clone, Debug)]
4pub struct PathsD(pub(crate) Vec<PathD>);
5
6impl PathsD {
7 pub fn new(paths: &Vec<PathD>) -> Self {
8 Self(paths.clone())
9 }
10
11 pub fn is_empty(&self) -> bool {
12 self.0.is_empty()
13 }
14
15 pub fn len(&self) -> usize {
16 self.0.len()
17 }
18
19 pub fn get_path(&self, index: usize) -> PathD {
20 self.0[index].clone()
21 }
22
23 pub fn add_path(&mut self, path: PathD) {
24 self.0.push(path)
25 }
26
27 pub fn add_paths(&mut self, mut paths: Vec<PathD>) {
28 self.0.append(&mut paths)
29 }
30
31 pub fn get_paths(&self) -> Vec<PathD> {
32 self.0.clone()
33 }
34
35 pub fn translate(&self, dx: f64, dy: f64) -> Self {
36 let new_paths = self.0.iter().map(|p| p.translate(dx, dy)).collect();
37 Self(new_paths)
38 }
39
40 pub fn scale(&self, sx: f64, sy: f64) -> Self {
41 let new_paths = self.0.iter().map(|p| p.scale(sx, sy)).collect();
42 Self(new_paths)
43 }
44}