1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#[derive(Debug, Clone, PartialEq)]
pub struct Coordinate {
    lat: f64,
    lon: f64,
}

impl Coordinate {
    pub fn new(lat: f64, lon: f64) -> Coordinate {
        Coordinate {
            lat,
            lon,
        }
    }

    pub fn lat(&self) -> f64 {
        self.lat
    }

    pub fn lat7(&self) -> i64 {
        (self.lat * 1E7).round() as i64
    }

    pub fn lon(&self) -> f64 {
        self.lon
    }

    pub fn lon7(&self) -> i64 {
        (self.lon * 1E7).round() as i64
    }
}