Skip to main content

geop_core_topology/model/
display.rs

1use core::fmt::{self, Display};
2
3use super::Model;
4
5impl Display for Model {
6    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7        writeln!(f, "Model {{")?;
8
9        writeln!(f, "  vertices:")?;
10        for (id, vertex) in &self.vertices {
11            writeln!(f, "    {id}: point={}", vertex.point)?;
12        }
13
14        writeln!(f, "  edges:")?;
15        for (id, edge) in &self.edges {
16            writeln!(
17                f,
18                "    {id}: {} -> {}, curve={}",
19                edge.start_vertex, edge.end_vertex, edge.curve
20            )?;
21        }
22
23        writeln!(f, "  coedges:")?;
24        for (id, coedge) in &self.coedges {
25            writeln!(
26                f,
27                "    {id}: geometry={:?}, sense={:?}, next={}, prev={}, face={}, pcurve={}",
28                coedge.geometry, coedge.sense, coedge.next, coedge.prev, coedge.face, coedge.pcurve
29            )?;
30        }
31
32        writeln!(f, "  faces:")?;
33        for (id, face) in &self.faces {
34            writeln!(
35                f,
36                "    {id}: shell={}, outer={:?}, holes={:?}, surface={}",
37                face.shell, face.outer, face.holes, face.surface
38            )?;
39        }
40
41        writeln!(f, "  shells:")?;
42        for (id, shell) in &self.shells {
43            writeln!(
44                f,
45                "    {id}: solid={:?}, faces={:?}",
46                shell.solid, shell.faces
47            )?;
48        }
49
50        writeln!(f, "  solids:")?;
51        for (id, solid) in &self.solids {
52            writeln!(f, "    {id}: shells={:?}", solid.shells)?;
53        }
54
55        writeln!(f, "  wires:")?;
56        for (id, wire) in &self.wires {
57            writeln!(
58                f,
59                "    {id}: vertices={:?}, edges={:?}",
60                wire.vertices, wire.edges
61            )?;
62        }
63
64        write!(f, "}}")
65    }
66}