diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ddf68ef01..598c60b2c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -116,7 +116,7 @@ jobs: uses: actions/checkout@v3 - run: cargo check --all-targets --no-default-features # we don't want to test `proj-network` because it only enables the `proj` feature - - run: cargo test --features "use-proj use-serde" + - run: cargo test --features "use-proj use-serde earcutr multithreading" geo_traits: name: geo-traits diff --git a/geo/Cargo.toml b/geo/Cargo.toml index c8cc5f188..082d2cb9b 100644 --- a/geo/Cargo.toml +++ b/geo/Cargo.toml @@ -13,10 +13,11 @@ rust-version = "1.75" categories = ["science::geo"] [features] -default = ["earcutr", "spade"] +default = ["earcutr", "spade", "multithreading"] use-proj = ["proj"] proj-network = ["use-proj", "proj/network"] use-serde = ["serde", "geo-types/serde"] +multithreading = ["i_overlay/allow_multithreading"] [dependencies] earcutr = { version = "0.4.2", optional = true } @@ -30,7 +31,7 @@ proj = { version = "0.27.0", optional = true } robust = "1.1.0" rstar = "0.12.0" serde = { version = "1.0", optional = true, features = ["derive"] } -i_overlay = "1.7.2" +i_overlay = { version = "1.7.2", default-features = false } [dev-dependencies] approx = ">= 0.4.0, < 0.6.0" diff --git a/geo/src/algorithm/mod.rs b/geo/src/algorithm/mod.rs index 344084dc3..6f92320cf 100644 --- a/geo/src/algorithm/mod.rs +++ b/geo/src/algorithm/mod.rs @@ -6,7 +6,7 @@ pub use kernels::{Kernel, Orientation}; pub mod area; pub use area::Area; -/// Boolean Ops such as union, xor, difference; +/// Boolean Ops such as union, xor, difference. pub mod bool_ops; pub use bool_ops::{BooleanOps, OpType}; @@ -254,6 +254,8 @@ pub mod translate; pub use translate::Translate; /// Triangulate polygons using an [ear-cutting algorithm](https://www.geometrictools.com/Documentation/TriangulationByEarClipping.pdf). +/// +/// Requires the `"earcutr"` feature. #[cfg(feature = "earcutr")] pub mod triangulate_earcut; #[cfg(feature = "earcutr")] diff --git a/geo/src/algorithm/triangulate_earcut.rs b/geo/src/algorithm/triangulate_earcut.rs index d4d23df32..586f3cb3d 100644 --- a/geo/src/algorithm/triangulate_earcut.rs +++ b/geo/src/algorithm/triangulate_earcut.rs @@ -1,6 +1,8 @@ use crate::{coord, CoordFloat, CoordsIter, Polygon, Triangle}; /// Triangulate polygons using an [ear-cutting algorithm](https://www.geometrictools.com/Documentation/TriangulationByEarClipping.pdf). +/// +/// Requires the `"earcutr"` feature, which is enabled by default. pub trait TriangulateEarcut { /// # Examples /// diff --git a/geo/src/lib.rs b/geo/src/lib.rs index 11cf8bc4a..88bf61aa8 100644 --- a/geo/src/lib.rs +++ b/geo/src/lib.rs @@ -67,7 +67,7 @@ //! //! ## Boolean Operations //! -//! - **[`BooleanOps`]**: combine or split (Multi)Polygons using intersecton, union, xor, or difference operations +//! - **[`BooleanOps`]**: combine or split (Multi)Polygons using intersecton, union, xor, or difference operations. //! //! ## Outlier Detection //! @@ -112,7 +112,7 @@ //! //! ## Triangulation //! -//! - **[`TriangulateEarcut`](triangulate_earcut)**: Triangulate polygons using the earcut algorithm (requires the `earcutr` feature). +//! - **[`TriangulateEarcut`](triangulate_earcut)**: Triangulate polygons using the earcut algorithm. Requires the `"earcutr"` feature, which is enabled by default. //! //! ## Winding //! @@ -177,9 +177,22 @@ //! //! The following optional [Cargo features] are available: //! -//! - `proj-network`: Enables [network grid] support for the [`proj` crate]. After enabling this feature, [further configuration][proj crate file download] is required to use the network grid -//! - `use-proj`: Enables coordinate conversion and transformation of `Point` geometries using the [`proj` crate] -//! - `use-serde`: Allows geometry types to be serialized and deserialized with [Serde] +//! - `earcutr`: +//! - Enables the `earcutr` crate, which provides triangulation of polygons using the earcut algorithm. +//! - ☑ Enabled by default. +//! - `proj-network`: +//! - Enables [network grid] support for the [`proj` crate]. +//! - After enabling this feature, [further configuration][proj crate file download] is required to use the network grid. +//! - ☐ Disabled by default. +//! - `use-proj`: +//! - Enables coordinate conversion and transformation of `Point` geometries using the [`proj` crate] +//! - ☐ Disabled by default. +//! - `use-serde`: +//! - Allows geometry types to be serialized and deserialized with [Serde]. +//! - ☐ Disabled by default. +//! - `multithreading`: +//! - Enables multithreading support for the `i_overlay` crate. +//! - ☑ Enabled by default. //! //! # Ecosystem //!