Skip to content

Commit 10b7f08

Browse files
Merge branch 'georust:main' into vector-ops-proposal
2 parents 006a48c + 2ab2b27 commit 10b7f08

File tree

16 files changed

+783
-36
lines changed

16 files changed

+783
-36
lines changed

.github/workflows/test.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ jobs:
4343
matrix:
4444
container_image:
4545
# Use the latest stable version. No need for older versions.
46-
- "georust/geo-ci:rust-1.66"
46+
- "georust/geo-ci:proj-9.2.1-rust-1.70"
4747
container:
4848
image: ${{ matrix.container_image }}
4949
steps:
5050
- name: Checkout repository
51-
uses: actions/checkout@v2
51+
uses: actions/checkout@v3
5252
- run: rustup component add rustfmt clippy
5353
- run: cargo fmt --all -- --check
5454
- run: cargo clippy --all-features --all-targets -- -Dwarnings
@@ -67,15 +67,15 @@ jobs:
6767
# giving us about 6 months of coverage.
6868
#
6969
# Minimum supported rust version (MSRV)
70-
- "georust/geo-ci:rust-1.63"
70+
- "georust/geo-ci:proj-9.2.1-rust-1.63"
7171
# Two most recent releases - we omit older ones for expedient CI
72-
- "georust/geo-ci:rust-1.65"
73-
- "georust/geo-ci:rust-1.66"
72+
- "georust/geo-ci:proj-9.2.1-rust-1.69"
73+
- "georust/geo-ci:proj-9.2.1-rust-1.70"
7474
container:
7575
image: ${{ matrix.container_image }}
7676
steps:
7777
- name: Checkout repository
78-
uses: actions/checkout@v2
78+
uses: actions/checkout@v3
7979
- run: rustup target add thumbv7em-none-eabihf
8080
- run: cargo check --all-targets --no-default-features
8181
- run: cargo check --lib --target thumbv7em-none-eabihf --no-default-features -F use-rstar_0_9,serde
@@ -95,15 +95,15 @@ jobs:
9595
# giving us about 6 months of coverage.
9696
#
9797
# Minimum supported rust version (MSRV)
98-
- "georust/geo-ci:rust-1.63"
98+
- "georust/geo-ci:proj-9.2.1-rust-1.63"
9999
# Two most recent releases - we omit older ones for expedient CI
100-
- "georust/geo-ci:rust-1.65"
101-
- "georust/geo-ci:rust-1.66"
100+
- "georust/geo-ci:proj-9.2.1-rust-1.69"
101+
- "georust/geo-ci:proj-9.2.1-rust-1.70"
102102
container:
103103
image: ${{ matrix.container_image }}
104104
steps:
105105
- name: Checkout repository
106-
uses: actions/checkout@v2
106+
uses: actions/checkout@v3
107107
- run: cargo check --all-targets --no-default-features
108108
# we don't want to test `proj-network` because it only enables the `proj` feature
109109
- run: cargo test --features "use-proj use-serde"
@@ -122,15 +122,15 @@ jobs:
122122
# giving us about 6 months of coverage.
123123
#
124124
# Minimum supported rust version (MSRV)
125-
- "georust/geo-ci:rust-1.63"
125+
- "georust/geo-ci:proj-9.2.1-rust-1.63"
126126
# Two most recent releases - we omit older ones for expedient CI
127-
- "georust/geo-ci:rust-1.65"
128-
- "georust/geo-ci:rust-1.66"
127+
- "georust/geo-ci:proj-9.2.1-rust-1.69"
128+
- "georust/geo-ci:proj-9.2.1-rust-1.70"
129129
container:
130130
image: ${{ matrix.container_image }}
131131
steps:
132132
- name: Checkout repository
133-
uses: actions/checkout@v2
133+
uses: actions/checkout@v3
134134
- run: cargo check --all-targets
135135
- run: cargo test
136136

@@ -145,21 +145,21 @@ jobs:
145145
matrix:
146146
container_image:
147147
# Fuzz only on latest
148-
- "georust/geo-ci:rust-1.66"
148+
- "georust/geo-ci:proj-9.2.1-rust-1.70"
149149
container:
150150
image: ${{ matrix.container_image }}
151151
steps:
152152
- name: Checkout repository
153-
uses: actions/checkout@v2
153+
uses: actions/checkout@v3
154154
- run: cargo build --bins
155155

156156
bench:
157157
name: bench
158158
runs-on: ubuntu-latest
159159
if: "!contains(github.event.head_commit.message, '[skip ci]')"
160160
container:
161-
image: georust/geo-ci:rust-1.66
161+
image: georust/geo-ci:proj-9.2.1-rust-1.70
162162
steps:
163163
- name: Checkout repository
164-
uses: actions/checkout@v2
164+
uses: actions/checkout@v3
165165
- run: cargo bench --no-run

geo-bool-ops-benches/benches/boolean_ops.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn run_complex<T: Measurement>(c: &mut Criterion<T>) {
4646
|b, _| {
4747
b.iter_batched(
4848
polys.sampler(),
49-
|&(ref poly, ref poly2, _, _)| poly.intersection(poly2),
49+
|(poly, poly2, _, _)| poly.intersection(poly2),
5050
BatchSize::SmallInput,
5151
);
5252
},
@@ -55,7 +55,7 @@ fn run_complex<T: Measurement>(c: &mut Criterion<T>) {
5555
group.bench_with_input(BenchmarkId::new("bops::union", steps), &(), |b, _| {
5656
b.iter_batched(
5757
polys.sampler(),
58-
|&(ref poly, ref poly2, _, _)| poly.union(poly2),
58+
|(poly, poly2, _, _)| poly.union(poly2),
5959
BatchSize::SmallInput,
6060
);
6161
});
@@ -66,7 +66,7 @@ fn run_complex<T: Measurement>(c: &mut Criterion<T>) {
6666
|b, _| {
6767
b.iter_batched(
6868
polys.sampler(),
69-
|&(_, _, ref poly, ref poly2)| OtherBooleanOp::intersection(poly, poly2),
69+
|(_, _, poly, poly2)| OtherBooleanOp::intersection(poly, poly2),
7070
BatchSize::SmallInput,
7171
);
7272
},
@@ -75,15 +75,15 @@ fn run_complex<T: Measurement>(c: &mut Criterion<T>) {
7575
group.bench_with_input(BenchmarkId::new("rgbops::union", steps), &(), |b, _| {
7676
b.iter_batched(
7777
polys.sampler(),
78-
|&(_, _, ref poly, ref poly2)| OtherBooleanOp::union(poly, poly2),
78+
|(_, _, poly, poly2)| OtherBooleanOp::union(poly, poly2),
7979
BatchSize::SmallInput,
8080
);
8181
});
8282

8383
group.bench_with_input(BenchmarkId::new("geo::relate", steps), &(), |b, _| {
8484
b.iter_batched(
8585
polys.sampler(),
86-
|&(ref poly, ref poly2, _, _)| poly.relate(poly2).is_intersects(),
86+
|(poly, poly2, _, _)| poly.relate(poly2).is_intersects(),
8787
BatchSize::SmallInput,
8888
);
8989
});

geo-types/CHANGES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changes
22

3-
## Unreleased
3+
## 0.7.11
4+
* Bump rstar dependency
5+
<https://github.com/georust/geo/pull/1030>
6+
7+
## 0.7.10
48

59
* Implement `From<&Line>` for `LineString`
610

geo-types/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "geo-types"
3-
version = "0.7.9"
3+
version = "0.7.11"
44
license = "MIT OR Apache-2.0"
55
repository = "https://github.com/georust/geo"
66
documentation = "https://docs.rs/geo-types/"
@@ -12,7 +12,7 @@ edition = "2021"
1212

1313
[features]
1414
default = ["std"]
15-
std = ["approx/std", "num-traits/std", "serde/std"]
15+
std = ["approx?/std", "num-traits/std", "serde?/std"]
1616
# Prefer `use-rstar` feature rather than enabling rstar directly.
1717
# rstar integration relies on the optional approx crate, but implicit features cannot yet enable other features.
1818
# See: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#namespaced-features
@@ -21,6 +21,7 @@ use-rstar = ["use-rstar_0_8"]
2121
use-rstar_0_8 = ["rstar_0_8", "approx"]
2222
use-rstar_0_9 = ["rstar_0_9", "approx"]
2323
use-rstar_0_10 = ["rstar_0_10", "approx"]
24+
use-rstar_0_11 = ["rstar_0_11", "approx"]
2425

2526
[dependencies]
2627
approx = { version = ">= 0.4.0, < 0.6.0", optional = true, default-features = false }
@@ -29,6 +30,7 @@ num-traits = { version = "0.2", default-features = false, features = ["libm"] }
2930
rstar_0_8 = { package = "rstar", version = "0.8", optional = true }
3031
rstar_0_9 = { package = "rstar", version = "0.9", optional = true }
3132
rstar_0_10 = { package = "rstar", version = "0.10", optional = true }
33+
rstar_0_11 = { package = "rstar", version = "0.11", optional = true }
3234
serde = { version = "1", optional = true, default-features = false, features = ["alloc", "derive"] }
3335

3436
[dev-dependencies]

geo-types/src/geometry/coord.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,3 +426,39 @@ where
426426
}
427427
}
428428
}
429+
430+
#[cfg(feature = "rstar_0_11")]
431+
impl<T> ::rstar_0_11::Point for Coord<T>
432+
where
433+
T: ::num_traits::Float + ::rstar_0_11::RTreeNum,
434+
{
435+
type Scalar = T;
436+
437+
const DIMENSIONS: usize = 2;
438+
439+
#[inline]
440+
fn generate(mut generator: impl FnMut(usize) -> Self::Scalar) -> Self {
441+
coord! {
442+
x: generator(0),
443+
y: generator(1),
444+
}
445+
}
446+
447+
#[inline]
448+
fn nth(&self, index: usize) -> Self::Scalar {
449+
match index {
450+
0 => self.x,
451+
1 => self.y,
452+
_ => unreachable!(),
453+
}
454+
}
455+
456+
#[inline]
457+
fn nth_mut(&mut self, index: usize) -> &mut Self::Scalar {
458+
match index {
459+
0 => &mut self.x,
460+
1 => &mut self.y,
461+
_ => unreachable!(),
462+
}
463+
}
464+
}

geo-types/src/geometry/line.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,12 @@ impl<T: AbsDiffEq<Epsilon = T> + CoordNum> AbsDiffEq for Line<T> {
221221
}
222222
}
223223

224-
#[cfg(any(feature = "rstar_0_8", feature = "rstar_0_9", feature = "rstar_0_10"))]
224+
#[cfg(any(
225+
feature = "rstar_0_8",
226+
feature = "rstar_0_9",
227+
feature = "rstar_0_10",
228+
feature = "rstar_0_11"
229+
))]
225230
macro_rules! impl_rstar_line {
226231
($rstar:ident) => {
227232
impl<T> ::$rstar::RTreeObject for Line<T>
@@ -257,6 +262,9 @@ impl_rstar_line!(rstar_0_9);
257262
#[cfg(feature = "rstar_0_10")]
258263
impl_rstar_line!(rstar_0_10);
259264

265+
#[cfg(feature = "rstar_0_11")]
266+
impl_rstar_line!(rstar_0_11);
267+
260268
#[cfg(test)]
261269
mod test {
262270
use super::*;

geo-types/src/geometry/line_string.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,12 @@ impl<T: AbsDiffEq<Epsilon = T> + CoordNum> AbsDiffEq for LineString<T> {
486486
}
487487
}
488488

489-
#[cfg(any(feature = "rstar_0_8", feature = "rstar_0_9", feature = "rstar_0_10"))]
489+
#[cfg(any(
490+
feature = "rstar_0_8",
491+
feature = "rstar_0_9",
492+
feature = "rstar_0_10",
493+
feature = "rstar_0_11"
494+
))]
490495
macro_rules! impl_rstar_line_string {
491496
($rstar:ident) => {
492497
impl<T> ::$rstar::RTreeObject for LineString<T>
@@ -536,6 +541,9 @@ impl_rstar_line_string!(rstar_0_9);
536541
#[cfg(feature = "rstar_0_10")]
537542
impl_rstar_line_string!(rstar_0_10);
538543

544+
#[cfg(feature = "rstar_0_11")]
545+
impl_rstar_line_string!(rstar_0_11);
546+
539547
#[cfg(test)]
540548
mod test {
541549
use super::*;

geo-types/src/geometry/point.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,35 @@ where
674674
}
675675
}
676676

677+
#[cfg(feature = "rstar_0_11")]
678+
impl<T> ::rstar_0_11::Point for Point<T>
679+
where
680+
T: ::num_traits::Float + ::rstar_0_11::RTreeNum,
681+
{
682+
type Scalar = T;
683+
684+
const DIMENSIONS: usize = 2;
685+
686+
fn generate(mut generator: impl FnMut(usize) -> Self::Scalar) -> Self {
687+
Point::new(generator(0), generator(1))
688+
}
689+
690+
fn nth(&self, index: usize) -> Self::Scalar {
691+
match index {
692+
0 => self.0.x,
693+
1 => self.0.y,
694+
_ => unreachable!(),
695+
}
696+
}
697+
fn nth_mut(&mut self, index: usize) -> &mut Self::Scalar {
698+
match index {
699+
0 => &mut self.0.x,
700+
1 => &mut self.0.y,
701+
_ => unreachable!(),
702+
}
703+
}
704+
}
705+
677706
#[cfg(test)]
678707
mod test {
679708
use super::*;

geo-types/src/geometry/polygon.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,12 @@ impl<T: AbsDiffEq<Epsilon = T> + CoordNum> AbsDiffEq for Polygon<T> {
545545
}
546546
}
547547

548-
#[cfg(any(feature = "rstar_0_8", feature = "rstar_0_9", feature = "rstar_0_10"))]
548+
#[cfg(any(
549+
feature = "rstar_0_8",
550+
feature = "rstar_0_9",
551+
feature = "rstar_0_10",
552+
feature = "rstar_0_11"
553+
))]
549554
macro_rules! impl_rstar_polygon {
550555
($rstar:ident) => {
551556
impl<T> $rstar::RTreeObject for Polygon<T>
@@ -569,3 +574,6 @@ impl_rstar_polygon!(rstar_0_9);
569574

570575
#[cfg(feature = "rstar_0_10")]
571576
impl_rstar_polygon!(rstar_0_10);
577+
578+
#[cfg(feature = "rstar_0_11")]
579+
impl_rstar_polygon!(rstar_0_11);

geo-types/src/lib.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
//! - `use-rstar_0_8`: Allows geometry types to be inserted into [rstar] R*-trees (`rstar v0.8`)
6969
//! - `use-rstar_0_9`: Allows geometry types to be inserted into [rstar] R*-trees (`rstar v0.9`)
7070
//! - `use-rstar_0_10`: Allows geometry types to be inserted into [rstar] R*-trees (`rstar v0.10`)
71+
//! - `use-rstar_0_11`: Allows geometry types to be inserted into [rstar] R*-trees (`rstar v0.11`)
7172
//!
7273
//! This library can be used in `#![no_std]` environments if the default `std` feature is disabled. At
7374
//! the moment, the `arbitrary` and `use-rstar_0_8` features require `std`. This may change in a
@@ -136,7 +137,12 @@ mod macros;
136137
#[cfg(feature = "arbitrary")]
137138
mod arbitrary;
138139

139-
#[cfg(any(feature = "rstar_0_8", feature = "rstar_0_9", feature = "rstar_0_10"))]
140+
#[cfg(any(
141+
feature = "rstar_0_8",
142+
feature = "rstar_0_9",
143+
feature = "rstar_0_10",
144+
feature = "rstar_0_11"
145+
))]
140146
#[doc(hidden)]
141147
pub mod private_utils;
142148

@@ -273,6 +279,21 @@ mod tests {
273279
assert_relative_eq!(25.999999999999996, l.distance_2(&Point::new(4.0, 10.0)));
274280
}
275281

282+
#[cfg(feature = "rstar_0_11")]
283+
#[test]
284+
/// ensure Line's SpatialObject impl is correct
285+
fn line_test_0_11() {
286+
use rstar_0_11::primitives::Line as RStarLine;
287+
use rstar_0_11::{PointDistance, RTreeObject};
288+
289+
let rl = RStarLine::new(Point::new(0.0, 0.0), Point::new(5.0, 5.0));
290+
let l = Line::new(coord! { x: 0.0, y: 0.0 }, coord! { x: 5., y: 5. });
291+
assert_eq!(rl.envelope(), l.envelope());
292+
// difference in 15th decimal place
293+
assert_relative_eq!(26.0, rl.distance_2(&Point::new(4.0, 10.0)));
294+
assert_relative_eq!(25.999999999999996, l.distance_2(&Point::new(4.0, 10.0)));
295+
}
296+
276297
#[test]
277298
fn test_rects() {
278299
let r = Rect::new(coord! { x: -1., y: -1. }, coord! { x: 1., y: 1. });

geo/CHANGES.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Changes
22

3-
## Unreleased
3+
## 0.26.0
4+
5+
* Implement "Closest Point" from a `Point` on a `Geometry` using spherical geometry. <https://github.com/georust/geo/pull/958>
6+
* Bump CI containers to use libproj 9.2.1
7+
* **BREAKING**: Bump rstar and robust dependencies
8+
<https://github.com/georust/geo/pull/1030>
9+
10+
## 0.25.1
411

512
- Add `TriangulateEarcut` algorithm trait to triangulate polygons with the earcut algorithm.
613
- <https://github.com/georust/geo/pull/1007>

0 commit comments

Comments
 (0)