Skip to content

Commit

Permalink
feat: change type of bounds to f32 instead of i32 (#1) (h/t @jasperve…
Browse files Browse the repository at this point in the history
…rcnocke)

* Change type of bounds to f32 instead of i32
  • Loading branch information
jaspervercnocke authored Sep 12, 2020
1 parent 09f051a commit a7cffa8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/tilejson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub struct TileJSON {
/// covered by all zoom levels. The bounds are represented in WGS:84
/// latitude and longitude values, in the order left, bottom, right, top.
/// Values may be integers or floating point numbers.
pub bounds: Option<Vec<i32>>,
pub bounds: Option<Vec<f32>>,

/// The first value is the longitude, the second is latitude (both in
/// WGS:84 values), the third value is the zoom level as an integer.
Expand Down Expand Up @@ -118,7 +118,7 @@ pub struct TileJSONBuilder {
data: Option<Vec<String>>,
minzoom: Option<u8>,
maxzoom: Option<u8>,
bounds: Option<Vec<i32>>,
bounds: Option<Vec<f32>>,
center: Option<Vec<i32>>,
}

Expand All @@ -139,7 +139,7 @@ impl TileJSONBuilder {
data: None,
minzoom: Some(0),
maxzoom: Some(30),
bounds: Some(vec![-180, -90, 180, 90]),
bounds: Some(vec![-180.0, -90.0, 180.0, 90.0]),
center: None,
}
}
Expand Down Expand Up @@ -209,7 +209,7 @@ impl TileJSONBuilder {
self
}

pub fn bounds(&mut self, bounds: Vec<i32>) -> &mut TileJSONBuilder {
pub fn bounds(&mut self, bounds: Vec<f32>) -> &mut TileJSONBuilder {
self.bounds = Some(bounds);
self
}
Expand Down Expand Up @@ -298,7 +298,7 @@ mod tests {

assert_eq!(
serialized_tilejson,
r#"{"tilejson":"2.2.0","id":null,"name":"compositing","description":null,"version":"1.0.0","attribution":null,"template":null,"legend":null,"scheme":"tms","tiles":["http://localhost:8888/admin/1.0.0/world-light,broadband/{z}/{x}/{y}.png"],"grids":null,"data":null,"minzoom":0,"maxzoom":30,"bounds":[-180,-90,180,90],"center":null}"#
r#"{"tilejson":"2.2.0","id":null,"name":"compositing","description":null,"version":"1.0.0","attribution":null,"template":null,"legend":null,"scheme":"tms","tiles":["http://localhost:8888/admin/1.0.0/world-light,broadband/{z}/{x}/{y}.png"],"grids":null,"data":null,"minzoom":0,"maxzoom":30,"bounds":[-180.0,-90.0,180.0,90.0],"center":null}"#
)
}
}

0 comments on commit a7cffa8

Please sign in to comment.