clipper2_sys/int64/
paths_64.rs

1use crate::Path64;
2
3#[derive(Clone, Debug)]
4pub struct Paths64(pub(crate) Vec<Path64>);
5
6impl Paths64 {
7    pub fn new(paths: &Vec<Path64>) -> 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) -> Path64 {
20        self.0[index].clone()
21    }
22
23    pub fn add_path(&mut self, path: Path64) {
24        self.0.push(path)
25    }
26
27    pub fn add_paths(&mut self, mut paths: Vec<Path64>) {
28        self.0.append(&mut paths)
29    }
30
31    pub fn get_paths(&self) -> Vec<Path64> {
32        self.0.clone()
33    }
34
35    pub fn translate(&self, dx: i64, dy: i64) -> 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}