Skip to content

Commit

Permalink
bump geo-types to 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Feb 17, 2019
1 parent b3c236c commit c168134
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ keywords = ["geojson", "gis", "json", "geo"]
[dependencies]
serde = "~1.0"
serde_json = "~1.0"
geo-types = "0.3"
geo-types = "0.4"
num-traits = "0.2"

[dev-dependencies]
Expand Down
18 changes: 9 additions & 9 deletions src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ where
T: Float,
{
let mut coords = vec![polygon
.exterior
.exterior()
.points_iter()
.map(|point| create_point_type(&point))
.collect()];

coords.extend(
polygon
.interiors
.interiors()
.iter()
.map(|line_string| create_line_string_type(&line_string)),
);
Expand Down Expand Up @@ -767,7 +767,7 @@ mod tests {
let geojson_polygon = Value::Polygon(geojson_multi_line_string_type1);
let geo_polygon: geo_types::Polygon<f64> = geojson_polygon.try_into().unwrap();

let ref geo_line_string1 = geo_polygon.exterior;
let ref geo_line_string1 = geo_polygon.exterior();
assert_almost_eq!(geo_line_string1.0[0].x, coord1[0], 1e-6);
assert_almost_eq!(geo_line_string1.0[0].y, coord1[1], 1e-6);
assert_almost_eq!(geo_line_string1.0[1].x, coord2[0], 1e-6);
Expand All @@ -777,7 +777,7 @@ mod tests {
assert_almost_eq!(geo_line_string1.0[3].x, coord1[0], 1e-6);
assert_almost_eq!(geo_line_string1.0[3].y, coord1[1], 1e-6);

let ref geo_line_string2 = geo_polygon.interiors[0];
let ref geo_line_string2 = geo_polygon.interiors()[0];
assert_almost_eq!(geo_line_string2.0[0].x, coord4[0], 1e-6);
assert_almost_eq!(geo_line_string2.0[0].y, coord4[1], 1e-6);
assert_almost_eq!(geo_line_string2.0[1].x, coord5[0], 1e-6);
Expand All @@ -793,7 +793,7 @@ mod tests {
let geojson_polygon = Value::Polygon(vec![]);
let geo_polygon: geo_types::Polygon<f64> = geojson_polygon.try_into().unwrap();

assert!(geo_polygon.exterior.0.is_empty());
assert!(geo_polygon.exterior().0.is_empty());
}

#[test]
Expand All @@ -811,7 +811,7 @@ mod tests {
let geojson_polygon = Value::Polygon(geojson_multi_line_string_type1);
let geo_polygon: geo_types::Polygon<f64> = geojson_polygon.try_into().unwrap();

let ref geo_line_string1 = geo_polygon.exterior;
let ref geo_line_string1 = geo_polygon.exterior();
assert_almost_eq!(geo_line_string1.0[0].x, coord1[0], 1e-6);
assert_almost_eq!(geo_line_string1.0[0].y, coord1[1], 1e-6);
assert_almost_eq!(geo_line_string1.0[1].x, coord2[0], 1e-6);
Expand All @@ -821,7 +821,7 @@ mod tests {
assert_almost_eq!(geo_line_string1.0[3].x, coord1[0], 1e-6);
assert_almost_eq!(geo_line_string1.0[3].y, coord1[1], 1e-6);

assert_eq!(0, geo_polygon.interiors.len());
assert_eq!(0, geo_polygon.interiors().len());
}

#[test]
Expand Down Expand Up @@ -853,7 +853,7 @@ mod tests {
let geo_multi_polygon: geo_types::MultiPolygon<f64> =
geojson_multi_polygon.try_into().unwrap();

let ref geo_line_string1 = geo_multi_polygon.0[0].exterior;
let ref geo_line_string1 = geo_multi_polygon.0[0].exterior();
assert_almost_eq!(geo_line_string1.0[0].x, coord1[0], 1e-6);
assert_almost_eq!(geo_line_string1.0[0].y, coord1[1], 1e-6);
assert_almost_eq!(geo_line_string1.0[1].x, coord2[0], 1e-6);
Expand All @@ -863,7 +863,7 @@ mod tests {
assert_almost_eq!(geo_line_string1.0[3].x, coord1[0], 1e-6);
assert_almost_eq!(geo_line_string1.0[3].y, coord1[1], 1e-6);

let ref geo_line_string2 = geo_multi_polygon.0[1].exterior;
let ref geo_line_string2 = geo_multi_polygon.0[1].exterior();
assert_almost_eq!(geo_line_string2.0[0].x, coord4[0], 1e-6);
assert_almost_eq!(geo_line_string2.0[0].y, coord4[1], 1e-6);
assert_almost_eq!(geo_line_string2.0[1].x, coord5[0], 1e-6);
Expand Down

0 comments on commit c168134

Please sign in to comment.