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

Allow configuring of the i_overlay Rayon transitive dep. Document more features. #1250

Merged
merged 4 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions geo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This multithreading feature also enables i_overlay - is that intended?

If so, then I think we should call it something like i_overlay_multithreading (or per my other comment, bool_ops_multithreading)

Though I could imagine a use case for a multithreading flag in geo more generally. In which case this name is good as is! But we should change the definition to:

multithreading = ["i_overlay?/allow_multithreading"]

Which enables allow_multithreading on i_overlay if we're using i_overlay, but otherwise don't enable i_overlay just because someone tried to build geo with multithreading.

Copy link
Member

@michaelkirk michaelkirk Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My own preference is:
multithreading = ["i_overlay?/allow_multithreading"]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change it! I didn't know about this syntax


[dependencies]
earcutr = { version = "0.4.2", optional = true }
Expand All @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion geo/src/algorithm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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")]
Expand Down
2 changes: 2 additions & 0 deletions geo/src/algorithm/triangulate_earcut.rs
Original file line number Diff line number Diff line change
@@ -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<T: CoordFloat> {
/// # Examples
///
Expand Down
23 changes: 18 additions & 5 deletions geo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
//!
Expand Down Expand Up @@ -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
//!
Expand Down Expand Up @@ -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
//!
Expand Down
Loading