Skip to content

Commit

Permalink
update polygon impl to work with the multiple versions of rstar we no…
Browse files Browse the repository at this point in the history
…w support
  • Loading branch information
michaelkirk committed May 6, 2022
1 parent 57a5c78 commit 5947bbb
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions geo-types/src/polygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,14 +543,24 @@ impl<T: AbsDiffEq<Epsilon = T> + CoordNum> AbsDiffEq for Polygon<T> {
}
}

#[cfg(feature = "rstar")]
impl<T> ::rstar::RTreeObject for Polygon<T>
where
T: ::num_traits::Float + ::rstar::RTreeNum,
{
type Envelope = ::rstar::AABB<Point<T>>;
#[cfg(any(feature = "rstar_0_8", feature = "rstar_0_9"))]
macro_rules! impl_rstar_polygon {
($rstar:ident) => {
impl<T> $rstar::RTreeObject for Polygon<T>
where
T: ::num_traits::Float + ::$rstar::RTreeNum,
{
type Envelope = ::$rstar::AABB<Point<T>>;

fn envelope(&self) -> Self::Envelope {
self.exterior.envelope()
}
fn envelope(&self) -> Self::Envelope {
self.exterior.envelope()
}
}
};
}

#[cfg(feature = "rstar_0_8")]
impl_rstar_polygon!(rstar_0_8);

#[cfg(feature = "rstar_0_9")]
impl_rstar_polygon!(rstar_0_9);

0 comments on commit 5947bbb

Please sign in to comment.