Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use geometry::* to concisely include all the geometry variants #853

Merged
merged 6 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
apply geometry::* consolidation
  • Loading branch information
michaelkirk committed Jun 24, 2022
commit fef1b3db411f35e353c2c38490d3e30e0aa2625b
6 changes: 2 additions & 4 deletions geo/src/algorithm/area.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use crate::{
CoordFloat, CoordNum, Geometry, GeometryCollection, Line, LineString, MultiLineString,
MultiPoint, MultiPolygon, Point, Polygon, Rect, Triangle,
};
use crate::geometry::*;
use crate::{CoordFloat, CoordNum};

pub(crate) fn twice_signed_ring_area<T>(linestring: &LineString<T>) -> T
where
Expand Down
5 changes: 1 addition & 4 deletions geo/src/algorithm/bounding_rect.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use crate::utils::{partial_max, partial_min};
use crate::{
coord, CoordNum, Coordinate, Geometry, GeometryCollection, GeometryCow, Line, LineString,
MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, Rect, Triangle,
};
use crate::{coord, geometry::*, CoordNum, GeometryCow};
use geo_types::private_utils::{get_bounding_rect, line_string_bounding_rect};

/// Calculation of the bounding rectangle of a geometry.
Expand Down
6 changes: 2 additions & 4 deletions geo/src/algorithm/centroid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ use std::cmp::Ordering;

use crate::area::{get_linestring_area, Area};
use crate::dimensions::{Dimensions, Dimensions::*, HasDimensions};
use crate::geometry::*;
use crate::EuclideanLength;
use crate::{
Coordinate, GeoFloat, Geometry, GeometryCollection, Line, LineString, MultiLineString,
MultiPoint, MultiPolygon, Point, Polygon, Rect, Triangle,
};
use crate::GeoFloat;

/// Calculation of the centroid.
/// The centroid is the arithmetic mean position of all points in the shape.
Expand Down
7 changes: 2 additions & 5 deletions geo/src/algorithm/chamberlain_duquette_area.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use crate::{
CoordNum, Geometry, GeometryCollection, Line, LineString, MultiLineString, MultiPoint,
MultiPolygon, Point, Polygon, Rect, Triangle, EQUATORIAL_EARTH_RADIUS,
};
use num_traits::Float;
use crate::geometry::*;
use crate::{CoordFloat, EQUATORIAL_EARTH_RADIUS};

/// Calculate the signed approximate geodesic area of a `Geometry`.
///
Expand Down
11 changes: 6 additions & 5 deletions geo/src/algorithm/closest_point.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::prelude::*;
use crate::{
Closest, Coordinate, GeoFloat, Geometry, GeometryCollection, Line, LineString, MultiLineString,
MultiPoint, MultiPolygon, Point, Polygon, Rect, Triangle,
};
use crate::algorithm::{EuclideanLength, Intersects};
use crate::geometry::*;
use crate::Closest;
use crate::GeoFloat;

use std::iter;

/// Find the closest `Point` between a given geometry and an input `Point`.
Expand Down Expand Up @@ -185,6 +185,7 @@ impl<F: GeoFloat> ClosestPoint<F> for Geometry<F> {
#[cfg(test)]
mod tests {
use super::*;
use crate::algorithm::{Contains, Translate};
use crate::{point, polygon};

/// Create a test which checks that we get `$should_be` when trying to find
Expand Down
4 changes: 3 additions & 1 deletion geo/src/algorithm/contains/geometry.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use super::Contains;
use crate::*;
use crate::geometry::{Coordinate, Geometry, GeometryCollection, Point};
use crate::geometry_delegate_impl;
use crate::GeoNum;

// ┌──────────────────────────────┐
// │ Implementations for Geometry │
Expand Down
6 changes: 2 additions & 4 deletions geo/src/algorithm/coordinate_position.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use crate::{
coord, Coordinate, GeoNum, Geometry, GeometryCollection, GeometryCow, Line, LineString,
MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, Rect, Triangle,
};
use crate::geometry::*;
use crate::{coord, GeoNum, GeometryCow};
use crate::{BoundingRect, HasDimensions, Intersects};

/// The position of a `Coordinate` relative to a `Geometry`
Expand Down
6 changes: 2 additions & 4 deletions geo/src/algorithm/coords_iter.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use std::fmt::Debug;

use crate::{
coord, CoordNum, Coordinate, Geometry, GeometryCollection, Line, LineString, MultiLineString,
MultiPoint, MultiPolygon, Point, Polygon, Rect, Triangle,
};
use crate::geometry::*;
use crate::{coord, CoordNum};

use std::{fmt, iter, marker, slice};

Expand Down
6 changes: 2 additions & 4 deletions geo/src/algorithm/dimensions.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::geometry::*;
use crate::Orientation::Collinear;
use crate::{
CoordNum, GeoNum, Geometry, GeometryCollection, GeometryCow, Line, LineString, MultiLineString,
MultiPoint, MultiPolygon, Point, Polygon, Rect, Triangle,
};
use crate::{CoordNum, GeoNum, GeometryCow};

/// Geometries can have 0, 1, or two dimensions. Or, in the case of an [`empty`](#is_empty)
/// geometry, a special `Empty` dimensionality.
Expand Down
4 changes: 3 additions & 1 deletion geo/src/algorithm/intersects/collections.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use super::{has_disjoint_bboxes, Intersects};
use crate::geometry::*;
use crate::geometry_delegate_impl;
use crate::BoundingRect;
use crate::*;
use crate::CoordNum;

impl<T, G> Intersects<G> for Geometry<T>
where
Expand Down
6 changes: 2 additions & 4 deletions geo/src/algorithm/map_coords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@

pub use modern::*;
mod modern {
pub(crate) use crate::{
CoordNum, Coordinate, Geometry, GeometryCollection, Line, LineString, MultiLineString,
MultiPoint, MultiPolygon, Point, Polygon, Rect, Triangle,
};
pub(crate) use crate::geometry::*;
pub(crate) use crate::CoordNum;

/// Map a function over all the coordinates in an object, returning a new one
pub trait MapCoords<T, NT> {
Expand Down
6 changes: 2 additions & 4 deletions geo/src/algorithm/relate/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
pub(crate) use edge_end_builder::EdgeEndBuilder;
pub use geomgraph::intersection_matrix::IntersectionMatrix;

use crate::{
GeoFloat, Geometry, GeometryCollection, GeometryCow, Line, LineString, MultiLineString,
MultiPoint, MultiPolygon, Point, Polygon, Rect, Triangle,
};
use crate::geometry::*;
use crate::{GeoFloat, GeometryCow};

mod edge_end_builder;
mod geomgraph;
Expand Down