osm_io/osm/model/
node.rs

1use crate::osm::model::coordinate::Coordinate;
2use crate::osm::model::tag::Tag;
3
4#[derive(Debug, Clone)]
5pub struct Node {
6    id: i64,
7    version: i32,
8    coordinate: Coordinate,
9    timestamp: i64,
10    changeset: i64,
11    uid: i32,
12    user: String,
13    visible: bool,
14    tags: Vec<Tag>,
15}
16
17impl Node {
18    #[allow(clippy::too_many_arguments)]
19    pub fn new(id: i64, version: i32, coordinate: Coordinate, timestamp: i64, changeset: i64, uid: i32, user: String, visible: bool, tags: Vec<Tag>) -> Node {
20        Node {
21            id,
22            version,
23            coordinate,
24            timestamp,
25            changeset,
26            uid,
27            user,
28            visible,
29            tags,
30        }
31    }
32
33    pub fn id(&self) -> i64 {
34        self.id
35    }
36
37    pub fn version(&self) -> i32 {
38        self.version
39    }
40
41    pub fn coordinate(&self) -> &Coordinate {
42        &self.coordinate
43    }
44
45    pub fn timestamp(&self) -> i64 {
46        self.timestamp
47    }
48
49    pub fn changeset(&self) -> i64 {
50        self.changeset
51    }
52
53    pub fn uid(&self) -> i32 {
54        self.uid
55    }
56
57    pub fn user(&self) -> &String {
58        &self.user
59    }
60
61    pub fn take_user(&mut self) -> String {
62        std::mem::take(&mut self.user)
63    }
64
65    pub fn visible(&self) -> bool {
66        self.visible
67    }
68
69    pub fn tags(&self) -> &Vec<Tag> {
70        &self.tags
71    }
72
73    pub fn take_tags(&mut self) -> Vec<Tag> {
74        std::mem::take(&mut self.tags)
75    }
76}