reactive_graph_std_flow_model/component/
flow_2d.rs

1use crate::NAMESPACE_FLOW;
2use reactive_graph_graph::component_model;
3use reactive_graph_graph::component_ty;
4use reactive_graph_graph::properties;
5
6properties!(
7    Flow2DProperties,
8    (FLOW_2D_X, "f2dx", 0.0),
9    (FLOW_2D_Y, "f2dy", 0.0),
10    (FLOW_2D_W, "f2dw", 10.0),
11    (FLOW_2D_H, "f2dh", 10.0)
12);
13
14component_ty!(COMPONENT_FLOW_2D, NAMESPACE_FLOW, COMPONENT_NAME_FLOW_2D, "flow_2d");
15
16component_model!(
17    Flow2D,
18    data f2dx f64,
19    data f2dy f64,
20    data f2dw f64,
21    data f2dh f64,
22);
23
24pub trait Flow2DElement: Flow2D {
25    fn get_x(&self) -> Option<f64> {
26        self.get_f2dx()
27    }
28
29    fn get_y(&self) -> Option<f64> {
30        self.get_f2dy()
31    }
32
33    fn get_width(&self) -> Option<f64> {
34        self.get_f2dw()
35    }
36
37    fn get_height(&self) -> Option<f64> {
38        self.get_f2dh()
39    }
40}