1use geop_core_topology::{EdgeId, FaceId, SolidId, VertexId};
2
3#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
5pub struct SketchId(pub u64);
6
7impl std::fmt::Display for SketchId {
8 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
9 write!(f, "SketchId({})", self.0)
10 }
11}
12
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct DatumId(pub u64);
16
17impl std::fmt::Display for DatumId {
18 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19 write!(f, "DatumId({})", self.0)
20 }
21}
22
23#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
27pub enum RefId {
28 Vertex(VertexId),
29 Edge(EdgeId),
30 Face(FaceId),
31 Solid(SolidId),
32 Sketch(SketchId),
33 Datum(DatumId),
34}
35
36impl std::fmt::Display for RefId {
37 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
38 match self {
39 RefId::Vertex(id) => write!(f, "{id}"),
40 RefId::Edge(id) => write!(f, "{id}"),
41 RefId::Face(id) => write!(f, "{id}"),
42 RefId::Solid(id) => write!(f, "{id}"),
43 RefId::Sketch(id) => write!(f, "{id}"),
44 RefId::Datum(id) => write!(f, "{id}"),
45 }
46 }
47}
48
49impl From<VertexId> for RefId {
50 fn from(id: VertexId) -> Self {
51 RefId::Vertex(id)
52 }
53}
54impl From<EdgeId> for RefId {
55 fn from(id: EdgeId) -> Self {
56 RefId::Edge(id)
57 }
58}
59impl From<FaceId> for RefId {
60 fn from(id: FaceId) -> Self {
61 RefId::Face(id)
62 }
63}
64impl From<SolidId> for RefId {
65 fn from(id: SolidId) -> Self {
66 RefId::Solid(id)
67 }
68}
69impl From<SketchId> for RefId {
70 fn from(id: SketchId) -> Self {
71 RefId::Sketch(id)
72 }
73}
74impl From<DatumId> for RefId {
75 fn from(id: DatumId) -> Self {
76 RefId::Datum(id)
77 }
78}