stb_parser/st_bridge/stb_model/
stb_nodes.rs

1use std::collections::HashMap;
2use strum_macros::EnumString;
3
4#[derive(Debug)]
5pub struct StbNodes {
6    pub map: HashMap<i32, StbNode>,
7}
8
9impl StbNodes {
10    pub fn new() -> StbNodes {
11        StbNodes {
12            map: HashMap::new(),
13        }
14    }
15
16    pub fn insert(&mut self, key: i32, value: StbNode) {
17        self.map.insert(key, value);
18    }
19
20    pub fn get(&self, key: i32) -> Option<&StbNode> {
21        self.map.get(&key)
22    }
23}
24
25#[derive(Debug)]
26pub struct StbNode {
27    pub x: f64,
28    pub y: f64,
29    pub z: f64,
30    pub kind: StbNodeKind,
31    pub id_member: Option<i32>,
32}
33
34#[derive(Debug, EnumString)]
35pub enum StbNodeKind {
36    #[strum(serialize = "ON_GIRDER")]
37    OnGirder,
38    #[strum(serialize = "ON_BEAM")]
39    OnBeam,
40    #[strum(serialize = "ON_COLUMN")]
41    OnColumn,
42    #[strum(serialize = "ON_POST")]
43    OnPost,
44    #[strum(serialize = "ON_GRID")]
45    OnGrid,
46    #[strum(serialize = "ON_CANTI")]
47    OnCanti,
48    #[strum(serialize = "ON_SLAB")]
49    OnSlab,
50    #[strum(serialize = "OTHER")]
51    Other,
52}