adic_shape/shape/
element.rs1#[derive(Debug, Clone)]
2pub enum AdicEl {
4 Circle(CircleEl),
6 Path(PathEl),
8 Text(TextEl),
10}
11
12
13#[derive(Debug, Clone)]
14pub struct PathEl {
15 pub class: Option<String>,
16 pub d: Vec<PathDInstruction>,
17}
18
19#[derive(Debug, Clone, Copy)]
20pub enum PathDInstruction {
21 Move((f64, f64)),
22 Line((f64, f64)),
23}
24
25impl From<PathDInstruction> for String {
26 fn from(instruction: PathDInstruction) -> Self {
27 match instruction {
28 PathDInstruction::Move(m) => format!("M {} {}", m.0, m.1),
29 PathDInstruction::Line(l) => format!("L {} {}", l.0, l.1),
30 }
31 }
32}
33
34
35#[derive(Debug, Clone)]
36pub struct CircleEl {
37 pub class: Option<String>,
38 pub cx: f64,
39 pub cy: f64,
40 pub r: f64,
41}
42
43
44#[derive(Debug, Clone)]
45pub struct TextEl {
46 pub content: String,
47 pub class: Option<String>,
48 pub style: Option<String>,
49 pub x: f64,
50 pub y: f64,
51 pub dx: f64,
52 pub dy: f64,
53}