Skip to content

Commit 4f57c88

Browse files
authored
Upgrade geo-traits to 0.3.0, upgrade geo to 0.30.0 (#127)
1 parent 9540c05 commit 4f57c88

File tree

5 files changed

+243
-52
lines changed

5 files changed

+243
-52
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
**This is the changelog for the core Rust library**. There's a [separate changelog](./python/CHANGELOG.md) for the Python bindings.
44

5+
## [0.3.0] - <RELEASE DATE>
6+
7+
### Breaking
8+
9+
- Upgrade geo-traits to 0.3 by @kontinuation in https://github.com/kylebarron/geo-index/pull/127
10+
- Update geo to 0.30.0 by @kontinuation in https://github.com/kylebarron/geo-index/pull/127
11+
512
## [0.2.0] - 2025-01-06
613

714
### Breaking

Cargo.lock

Lines changed: 72 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,19 @@ categories = ["data-structures", "algorithms", "science::geo"]
1515
[dependencies]
1616
bytemuck = "1"
1717
float_next_after = "1"
18-
geo-traits = "0.2"
18+
geo-traits = "0.3"
1919
num-traits = "0.2"
2020
rayon = { version = "1.8.0", optional = true }
2121
thiserror = "1"
2222
tinyvec = { version = "1", features = ["alloc", "rustc_1_40"] }
2323

2424
[dev-dependencies]
2525
criterion = { version = "0.5", features = ["html_reports"] }
26-
geo = "0.28.0"
26+
geo = "0.30.0"
2727
geozero = "0.12"
2828
rstar = "0.12"
2929
zip = "2.2.2"
3030

31-
3231
[[bench]]
3332
name = "rtree"
3433
harness = false

src/kdtree/traversal.rs

Lines changed: 81 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
//! Utilities to traverse the KDTree structure.
22
3-
use geo_traits::RectTrait;
3+
use geo_traits::{
4+
GeometryTrait, RectTrait, UnimplementedGeometryCollection, UnimplementedLine,
5+
UnimplementedLineString, UnimplementedMultiLineString, UnimplementedMultiPoint,
6+
UnimplementedMultiPolygon, UnimplementedPoint, UnimplementedPolygon, UnimplementedTriangle,
7+
};
48

59
use crate::kdtree::KDTreeIndex;
610
use crate::r#type::{Coord, IndexableNum};
@@ -216,16 +220,11 @@ impl<'a, N: IndexableNum, T: KDTreeIndex<N>> Node<'a, N, T> {
216220
}
217221

218222
impl<N: IndexableNum, T: KDTreeIndex<N>> RectTrait for Node<'_, N, T> {
219-
type T = N;
220223
type CoordType<'a>
221224
= Coord<N>
222225
where
223226
Self: 'a;
224227

225-
fn dim(&self) -> geo_traits::Dimensions {
226-
geo_traits::Dimensions::Xy
227-
}
228-
229228
fn min(&self) -> Self::CoordType<'_> {
230229
Coord {
231230
x: self.min_x,
@@ -240,3 +239,79 @@ impl<N: IndexableNum, T: KDTreeIndex<N>> RectTrait for Node<'_, N, T> {
240239
}
241240
}
242241
}
242+
243+
impl<N: IndexableNum, T: KDTreeIndex<N>> GeometryTrait for Node<'_, N, T> {
244+
type T = N;
245+
246+
type PointType<'a>
247+
= UnimplementedPoint<N>
248+
where
249+
Self: 'a;
250+
251+
type LineStringType<'a>
252+
= UnimplementedLineString<N>
253+
where
254+
Self: 'a;
255+
256+
type PolygonType<'a>
257+
= UnimplementedPolygon<N>
258+
where
259+
Self: 'a;
260+
261+
type MultiPointType<'a>
262+
= UnimplementedMultiPoint<N>
263+
where
264+
Self: 'a;
265+
266+
type MultiLineStringType<'a>
267+
= UnimplementedMultiLineString<N>
268+
where
269+
Self: 'a;
270+
271+
type MultiPolygonType<'a>
272+
= UnimplementedMultiPolygon<N>
273+
where
274+
Self: 'a;
275+
276+
type GeometryCollectionType<'a>
277+
= UnimplementedGeometryCollection<N>
278+
where
279+
Self: 'a;
280+
281+
type RectType<'a>
282+
= Node<'a, N, T>
283+
where
284+
Self: 'a;
285+
286+
type TriangleType<'a>
287+
= UnimplementedTriangle<N>
288+
where
289+
Self: 'a;
290+
291+
type LineType<'a>
292+
= UnimplementedLine<N>
293+
where
294+
Self: 'a;
295+
296+
fn dim(&self) -> geo_traits::Dimensions {
297+
geo_traits::Dimensions::Xy
298+
}
299+
300+
fn as_type(
301+
&self,
302+
) -> geo_traits::GeometryType<
303+
'_,
304+
Self::PointType<'_>,
305+
Self::LineStringType<'_>,
306+
Self::PolygonType<'_>,
307+
Self::MultiPointType<'_>,
308+
Self::MultiLineStringType<'_>,
309+
Self::MultiPolygonType<'_>,
310+
Self::GeometryCollectionType<'_>,
311+
Self::RectType<'_>,
312+
Self::TriangleType<'_>,
313+
Self::LineType<'_>,
314+
> {
315+
geo_traits::GeometryType::Rect(self)
316+
}
317+
}

0 commit comments

Comments
 (0)