Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron committed Nov 16, 2024
1 parent 63ae545 commit 5139145
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 39 deletions.
28 changes: 7 additions & 21 deletions rust/geoarrow/src/algorithm/geo/contains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,7 @@ impl<G: PointTrait<T = f64>> ContainsPoint<G> for &dyn NativeArray {
LineString(_, XY) => ContainsPoint::contains(self.as_line_string(), rhs),
Polygon(_, XY) => ContainsPoint::contains(self.as_polygon(), rhs),
MultiPoint(_, XY) => ContainsPoint::contains(self.as_multi_point(), rhs),
MultiLineString(_, XY) => {
ContainsPoint::contains(self.as_multi_line_string(), rhs)
}
MultiLineString(_, XY) => ContainsPoint::contains(self.as_multi_line_string(), rhs),
MultiPolygon(_, XY) => ContainsPoint::contains(self.as_multi_polygon(), rhs),
Mixed(_, XY) => ContainsPoint::contains(self.as_mixed(), rhs),
GeometryCollection(_, XY) => {
Expand Down Expand Up @@ -291,9 +289,7 @@ impl<G: PolygonTrait<T = f64>> ContainsPolygon<G> for &dyn NativeArray {
LineString(_, XY) => ContainsPolygon::contains(self.as_line_string(), rhs),
Polygon(_, XY) => ContainsPolygon::contains(self.as_polygon(), rhs),
MultiPoint(_, XY) => ContainsPolygon::contains(self.as_multi_point(), rhs),
MultiLineString(_, XY) => {
ContainsPolygon::contains(self.as_multi_line_string(), rhs)
}
MultiLineString(_, XY) => ContainsPolygon::contains(self.as_multi_line_string(), rhs),
MultiPolygon(_, XY) => ContainsPolygon::contains(self.as_multi_polygon(), rhs),
Mixed(_, XY) => ContainsPolygon::contains(self.as_mixed(), rhs),
GeometryCollection(_, XY) => {
Expand Down Expand Up @@ -404,9 +400,7 @@ impl<G: MultiLineStringTrait<T = f64>> ContainsMultiLineString<G> for &dyn Nativ
MultiLineString(_, XY) => {
ContainsMultiLineString::contains(self.as_multi_line_string(), rhs)
}
MultiPolygon(_, XY) => {
ContainsMultiLineString::contains(self.as_multi_polygon(), rhs)
}
MultiPolygon(_, XY) => ContainsMultiLineString::contains(self.as_multi_polygon(), rhs),
Mixed(_, XY) => ContainsMultiLineString::contains(self.as_mixed(), rhs),
GeometryCollection(_, XY) => {
ContainsMultiLineString::contains(self.as_geometry_collection(), rhs)
Expand Down Expand Up @@ -461,9 +455,7 @@ impl<G: MultiPolygonTrait<T = f64>> ContainsMultiPolygon<G> for &dyn NativeArray
MultiLineString(_, XY) => {
ContainsMultiPolygon::contains(self.as_multi_line_string(), rhs)
}
MultiPolygon(_, XY) => {
ContainsMultiPolygon::contains(self.as_multi_polygon(), rhs)
}
MultiPolygon(_, XY) => ContainsMultiPolygon::contains(self.as_multi_polygon(), rhs),
Mixed(_, XY) => ContainsMultiPolygon::contains(self.as_mixed(), rhs),
GeometryCollection(_, XY) => {
ContainsMultiPolygon::contains(self.as_geometry_collection(), rhs)
Expand Down Expand Up @@ -515,9 +507,7 @@ impl<G: GeometryTrait<T = f64>> ContainsGeometry<G> for &dyn NativeArray {
LineString(_, XY) => ContainsGeometry::contains(self.as_line_string(), rhs),
Polygon(_, XY) => ContainsGeometry::contains(self.as_polygon(), rhs),
MultiPoint(_, XY) => todo!(), // ContainsGeometry::contains(self.as_multi_point(), rhs),
MultiLineString(_, XY) => {
ContainsGeometry::contains(self.as_multi_line_string(), rhs)
}
MultiLineString(_, XY) => ContainsGeometry::contains(self.as_multi_line_string(), rhs),
MultiPolygon(_, XY) => todo!(), // ContainsGeometry::contains(self.as_multi_polygon(), rhs),
Mixed(_, XY) => ContainsGeometry::contains(self.as_mixed(), rhs),
GeometryCollection(_, XY) => {
Expand Down Expand Up @@ -567,13 +557,9 @@ impl<G: GeometryCollectionTrait<T = f64>> ContainsGeometryCollection<G> for &dyn

match self.data_type() {
Point(_, XY) => ContainsGeometryCollection::contains(self.as_point(), rhs),
LineString(_, XY) => {
ContainsGeometryCollection::contains(self.as_line_string(), rhs)
}
LineString(_, XY) => ContainsGeometryCollection::contains(self.as_line_string(), rhs),
Polygon(_, XY) => ContainsGeometryCollection::contains(self.as_polygon(), rhs),
MultiPoint(_, XY) => {
ContainsGeometryCollection::contains(self.as_multi_point(), rhs)
}
MultiPoint(_, XY) => ContainsGeometryCollection::contains(self.as_multi_point(), rhs),
MultiLineString(_, XY) => {
ContainsGeometryCollection::contains(self.as_multi_line_string(), rhs)
}
Expand Down
18 changes: 7 additions & 11 deletions rust/geoarrow/src/algorithm/geo/frechet_distance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ impl FrechetDistance for &dyn NativeArray {
use NativeType::*;

let result = match (self.data_type(), rhs.data_type()) {
(LineString(_, XY), LineString(_, XY)) => FrechetDistance::frechet_distance(
self.as_line_string(),
rhs.as_line_string(),
),
(LineString(_, XY), LineString(_, XY)) => {
FrechetDistance::frechet_distance(self.as_line_string(), rhs.as_line_string())
}
_ => return Err(GeoArrowError::IncorrectType("".into())),
};
Ok(result)
Expand All @@ -73,10 +72,9 @@ impl FrechetDistance for &dyn ChunkedNativeArray {
use NativeType::*;

let result = match (self.data_type(), rhs.data_type()) {
(LineString(_, XY), LineString(_, XY)) => FrechetDistance::frechet_distance(
self.as_line_string(),
rhs.as_line_string(),
),
(LineString(_, XY), LineString(_, XY)) => {
FrechetDistance::frechet_distance(self.as_line_string(), rhs.as_line_string())
}
_ => return Err(GeoArrowError::IncorrectType("".into())),
};
Ok(result)
Expand Down Expand Up @@ -105,9 +103,7 @@ impl<G: LineStringTrait<T = f64>> FrechetDistanceLineString<G> for LineStringArr
}
}

impl<G: LineStringTrait<T = f64> + Sync> FrechetDistanceLineString<G>
for ChunkedLineStringArray
{
impl<G: LineStringTrait<T = f64> + Sync> FrechetDistanceLineString<G> for ChunkedLineStringArray {
type Output = ChunkedArray<Float64Array>;

fn frechet_distance(&self, rhs: &G) -> Self::Output {
Expand Down
7 changes: 3 additions & 4 deletions rust/geoarrow/src/algorithm/geo/line_locate_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@ impl LineLocatePoint<&dyn ChunkedNativeArray> for &dyn ChunkedNativeArray {
use NativeType::*;

let result = match (self.data_type(), rhs.data_type()) {
(LineString(_, XY), Point(_, XY)) => LineLocatePoint::line_locate_point(
self.as_line_string(),
&rhs.as_point().chunks,
),
(LineString(_, XY), Point(_, XY)) => {
LineLocatePoint::line_locate_point(self.as_line_string(), &rhs.as_point().chunks)
}
_ => return Err(GeoArrowError::IncorrectType("".into())),
};
Ok(result)
Expand Down
4 changes: 1 addition & 3 deletions rust/geoarrow/src/io/geos/scalar/multipolygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ use geos::{Geom, GeometryTypes};
impl<'a> TryFrom<&'a MultiPolygon<'_>> for geos::Geometry {
type Error = geos::Error;

fn try_from(
value: &'a MultiPolygon<'_>,
) -> std::result::Result<geos::Geometry, geos::Error> {
fn try_from(value: &'a MultiPolygon<'_>) -> std::result::Result<geos::Geometry, geos::Error> {
geos::Geometry::create_multipolygon(
value
.polygons()
Expand Down

0 comments on commit 5139145

Please sign in to comment.