reactive_graph_flow_model/reactive_graph/flow/
flow_2_d.rs1#![allow(dead_code, unused)]
5#![cfg_attr(rustfmt, rustfmt_skip)]
6
7#[cfg_attr(rustfmt, rustfmt_skip)]
9pub const FLOW_2_D_NAMESPACE: &str = "reactive_graph::flow::Flow2D";
10
11pub static FLOW_2_D: std::sync::LazyLock<reactive_graph_graph::ComponentTypeId> = std::sync::LazyLock::new(||
18std::str::FromStr::from_str(FLOW_2_D_NAMESPACE).unwrap());
19
20#[allow(non_camel_case_types)]
22#[derive(Debug, PartialEq, PartialOrd, Eq, Hash, Clone)]
23pub enum Flow2DProperties {
24
25 F_2_DH,
36
37 F_2_DW,
48
49 F_2_DX,
60
61 F_2_DY,
72}
73impl Flow2DProperties {
74 pub fn len() -> usize {
75 4usize
76 }
77
78 pub fn property_types() -> reactive_graph_graph::PropertyTypes {
79 let property_types = reactive_graph_graph::PropertyTypes::new();
80 property_types.push(Flow2DProperties::F_2_DH);
81 property_types.push(Flow2DProperties::F_2_DW);
82 property_types.push(Flow2DProperties::F_2_DX);
83 property_types.push(Flow2DProperties::F_2_DY);
84 property_types
85 }
86}
87
88impl AsRef<str> for Flow2DProperties {
89 #[inline]
90 fn as_ref(&self) -> &str {
91 match *self {
92 Flow2DProperties::F_2_DH => "f2dh",
93 Flow2DProperties::F_2_DW => "f2dw",
94 Flow2DProperties::F_2_DX => "f2dx",
95 Flow2DProperties::F_2_DY => "f2dy",
96 }
97 }
98}
99
100impl From<Flow2DProperties> for &'static str {
101 #[inline]
102 fn from(properties: Flow2DProperties) -> &'static str {
103 match properties {
104 Flow2DProperties::F_2_DH => "f2dh",
105 Flow2DProperties::F_2_DW => "f2dw",
106 Flow2DProperties::F_2_DX => "f2dx",
107 Flow2DProperties::F_2_DY => "f2dy",
108 }
109 }
110}
111
112impl From<Flow2DProperties> for String {
113 #[inline]
114 fn from(properties: Flow2DProperties) -> String {
115 match properties {
116 Flow2DProperties::F_2_DH => "f2dh".to_owned(),
117 Flow2DProperties::F_2_DW => "f2dw".to_owned(),
118 Flow2DProperties::F_2_DX => "f2dx".to_owned(),
119 Flow2DProperties::F_2_DY => "f2dy".to_owned(),
120 }
121 }
122}
123
124impl From<Flow2DProperties> for reactive_graph_graph::PropertyType {
125 #[inline]
126 fn from(properties: Flow2DProperties) -> reactive_graph_graph::PropertyType {
127 match properties {
128 Flow2DProperties::F_2_DH => {
129 reactive_graph_graph::PropertyType::new_with_all(
130 "f2dh",
131 "The height (y-axis) in a 2D flow",
132 reactive_graph_graph::DataType::Number,
133 reactive_graph_graph::SocketType::None,
134 reactive_graph_graph::Mutability::Mutable,
135 reactive_graph_graph::Extensions::new(),
136 )
137 }
138 Flow2DProperties::F_2_DW => {
139 reactive_graph_graph::PropertyType::new_with_all(
140 "f2dw",
141 "The width (x-axis) in a 2D flow",
142 reactive_graph_graph::DataType::Number,
143 reactive_graph_graph::SocketType::None,
144 reactive_graph_graph::Mutability::Mutable,
145 reactive_graph_graph::Extensions::new(),
146 )
147 }
148 Flow2DProperties::F_2_DX => {
149 reactive_graph_graph::PropertyType::new_with_all(
150 "f2dx",
151 "The X position in a 2D flow",
152 reactive_graph_graph::DataType::Number,
153 reactive_graph_graph::SocketType::None,
154 reactive_graph_graph::Mutability::Mutable,
155 reactive_graph_graph::Extensions::new(),
156 )
157 }
158 Flow2DProperties::F_2_DY => {
159 reactive_graph_graph::PropertyType::new_with_all(
160 "f2dy",
161 "The Y position in a 2D flow",
162 reactive_graph_graph::DataType::Number,
163 reactive_graph_graph::SocketType::None,
164 reactive_graph_graph::Mutability::Mutable,
165 reactive_graph_graph::Extensions::new(),
166 )
167 }
168 }
169 }
170}
171
172pub struct Flow2DPropertiesIterator(Option<Flow2DProperties>);
173
174impl Flow2DProperties {
175 pub fn into_iter() -> Flow2DPropertiesIterator {
176 Flow2DPropertiesIterator(None)
177 }
178}
179
180impl Iterator for Flow2DPropertiesIterator {
181 type Item = Flow2DProperties;
182 fn next(&mut self) -> Option<Self::Item> {
183 self.0 = match self.0 {
184 None => Some(Flow2DProperties::F_2_DH),
185 Some(Flow2DProperties::F_2_DH) => Some(Flow2DProperties::F_2_DW),
186 Some(Flow2DProperties::F_2_DW) => Some(Flow2DProperties::F_2_DX),
187 Some(Flow2DProperties::F_2_DX) => Some(Flow2DProperties::F_2_DY),
188 Some(Flow2DProperties::F_2_DY) => None,
189 };
190 self.0.clone()
191 }
192}
193
194impl IntoIterator for Flow2DProperties {
195 type Item = Flow2DProperties;
196 type IntoIter = Flow2DPropertiesIterator;
197 fn into_iter(self) -> Self::IntoIter {
198 Flow2DPropertiesIterator(None)
199 }
200}
201
202impl core::fmt::Display for Flow2DProperties {
203 fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
204 match *self {
205 Flow2DProperties::F_2_DH => core::fmt::Display::fmt("f2dh", f),
206 Flow2DProperties::F_2_DW => core::fmt::Display::fmt("f2dw", f),
207 Flow2DProperties::F_2_DX => core::fmt::Display::fmt("f2dx", f),
208 Flow2DProperties::F_2_DY => core::fmt::Display::fmt("f2dy", f),
209 }
210 }
211}
212
213pub static FLOW_2_D_EXTENSIONS: std::sync::LazyLock<reactive_graph_graph::Extensions> = std::sync::LazyLock::new(||
215{ reactive_graph_graph::Extensions::new() });
216
217pub static FLOW_2_D_TYPE: std::sync::LazyLock<reactive_graph_graph::Component> = std::sync::LazyLock::new(||
218{
219 reactive_graph_graph::Component::builder()
220 .ty(core::ops::Deref::deref(&FLOW_2_D))
221 .description(
222 "The position (x,y) of the entity or relation on a two dimensional flow.",
223 )
224 .properties(Flow2DProperties::property_types())
225 .build()
226});
227
228pub trait Flow2D {
250
251 fn f2dh(&self) -> u64;
262
263 fn set_f2dh(&mut self, f2dh: u64);
274
275 fn f2dw(&self) -> u64;
286
287 fn set_f2dw(&mut self, f2dw: u64);
298
299 fn f2dx(&self) -> u64;
310
311 fn set_f2dx(&mut self, f2dx: u64);
322
323 fn f2dy(&self) -> u64;
334
335 fn set_f2dy(&mut self, f2dy: u64);
346}