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

Define Geometry Intersection trait and implement it for Geometry #78

Merged
merged 1 commit into from
Jul 13, 2020

Conversation

boydjohnson
Copy link
Contributor

I built off of #75 since it is already approved.

gdal-sys has vector methods for both layers and geometries. It would be nice if these operations could use one trait, but unfortunately the intersection function signature for layers and geometries is much different.

Seeking comments on the location for these traits. I went with crate::vector::ops::geometry::intersection.

@@ -43,7 +43,7 @@ impl Geometry {
*(self.c_geometry_ref.borrow_mut()) = Some(c_geometry);
}

unsafe fn with_c_geometry(c_geom: OGRGeometryH, owned: bool) -> Geometry {
pub unsafe fn with_c_geometry(c_geom: OGRGeometryH, owned: bool) -> Geometry {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if we want to pub this method. Could you change it to pub(crate) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

/// otherwise the result might be wrong.
///
/// # Returns
/// Ok(Geometry) if the two geometries intersect
Copy link
Member

Choose a reason for hiding this comment

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

method returns an Option<Geometry>, but this documentation shows as if it returns a Result<Geometry>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. And added another unit test.

This adds the trait Intersection
and implements it for Geometry.
Copy link
Member

@michaelkirk michaelkirk left a comment

Choose a reason for hiding this comment

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

Thanks for updating the comment. LGTM, but I have no authority here. =)

@jdroenner jdroenner merged commit 91e440c into georust:master Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants