lensbench_core/param/
kind_preds.rs1use super::Kind;
4
5impl Kind {
6 pub fn is_pick(&self) -> bool {
8 matches!(
9 self,
10 Kind::Curv
11 | Kind::Radius
12 | Kind::Conic
13 | Kind::Thick
14 | Kind::Dn
15 | Kind::Disp
16 | Kind::Semi
17 | Kind::MechSemi
18 | Kind::Parm(_)
19 | Kind::Before(_)
20 | Kind::After(_)
21 | Kind::Coating
22 )
23 }
24
25 pub fn is_pick_only(&self) -> bool {
27 matches!(
28 self,
29 Kind::Semi | Kind::Parm(_) | Kind::Before(_) | Kind::After(_) | Kind::Coating
30 )
31 }
32
33 pub fn is_table_only(&self) -> bool {
36 matches!(
37 self,
38 Kind::Semi
39 | Kind::Ignore
40 | Kind::ApMax
41 | Kind::ApMin
42 | Kind::ApDx
43 | Kind::ApDy
44 | Kind::ApType
45 | Kind::Before(_)
46 | Kind::After(_)
47 | Kind::BeforeOrder
48 | Kind::AfterOrder
49 | Kind::ModelNd
50 | Kind::ModelVd
51 | Kind::ModelDpgf
52 | Kind::Tce
53 | Kind::MechSemi
54 | Kind::ChipZone
55 | Kind::CoordRet
56 | Kind::CoordRetSurf
57 | Kind::Material
58 | Kind::Coating
59 ) || self.is_solve_value()
60 }
61
62 pub fn is_coord_return(&self) -> bool {
64 matches!(self, Kind::CoordRet | Kind::CoordRetSurf)
65 }
66
67 pub fn is_solve_value(&self) -> bool {
69 matches!(
70 self,
71 Kind::CurvSolve(_) | Kind::ThickSolve(_) | Kind::ParmSolve(..)
72 )
73 }
74
75 pub fn tilt_index(&self) -> Option<usize> {
77 match self {
78 Kind::Dx => Some(0),
79 Kind::Dy => Some(1),
80 Kind::Tx => Some(2),
81 Kind::Ty => Some(3),
82 Kind::Tz => Some(4),
83 _ => None,
84 }
85 }
86
87 pub fn is_object(&self) -> bool {
89 matches!(self, Kind::ObjX | Kind::ObjY)
90 }
91
92 pub fn is_wave(&self) -> bool {
94 matches!(self, Kind::Wave(_))
95 }
96
97 pub fn is_global(&self) -> bool {
99 self.is_object() || self.is_system_value()
100 }
101
102 pub fn is_system_value(&self) -> bool {
104 matches!(
105 self,
106 Kind::Wave(_)
107 | Kind::WaveW(_)
108 | Kind::Primary
109 | Kind::Aper
110 | Kind::ApertureType
111 | Kind::Stop
112 | Kind::FieldType
113 | Kind::Temp
114 | Kind::Pres
115 | Kind::Afocal
116 | Kind::ApodType
117 | Kind::Apod
118 | Kind::Aiming
119 | Kind::Ropd
120 | Kind::AimPupil(_)
121 | Kind::InputPol(_)
122 | Kind::FieldX(_)
123 | Kind::FieldY(_)
124 | Kind::FieldW(_)
125 | Kind::FieldVig(..)
126 )
127 }
128
129 pub fn is_unit(&self) -> bool {
131 matches!(self, Kind::Unit(_))
132 }
133
134 pub fn is_unit_motion(&self) -> bool {
136 matches!(self, Kind::Unit(u) if u.motion_index().is_some())
137 }
138}