-
Notifications
You must be signed in to change notification settings - Fork 94
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
Conversation
src/vector/geometry.rs
Outdated
@@ -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 { |
There was a problem hiding this comment.
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) ?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
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.
There was a problem hiding this 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. =)
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
.