-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add CoordsIter
trait for iterating over coordinates in geometries.
#164
Conversation
ba17ca3
to
ddae160
Compare
working on refactoring some of the rust-geo traits right now. this is similar to |
ddae160
to
bf85e8d
Compare
I have a |
yep, the main reason i opened this is so that i can modify |
:) I also wanted to modify objects without allocations. I should clean up my code and start opening PRs |
@rory don't want to pressure you into reviewing, but did you happen to already look at the code here? if so, any thoughts? |
I only skimmed it earlier. I might be able to look at it properly within the next few days |
src/algorithm/coords_iter.rs
Outdated
MultiLineString}; | ||
|
||
pub trait CoordsIter<T: Float> { | ||
fn coords_iter<'a>(&'a self) -> Box<Iterator<Item = &'a Coordinate<T>> + 'a>; |
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.
just like the other boxed iterators that get returned in this crate, we can remove the Box
once return impl
s stabilize
170: Map coords inplace r=frewsxcv a=rory To compliment the `.map_coords()` feature, I've added a `.map_coords_inplace` which will apply a provided function to all coordinatines in place, i.e. not doing any allocations. Some of this has a lot of overlap with #164. I've used that to add a `.translate_inplace()` feature.
just finished this! i'll try to find some time in the next few days to add tests. most of the time i spent on this was trying to remove |
also will add docs to the trait. just realized they're missing |
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.
nice!
bors r=michaelkirk |
Build succeeded: |
A new trait to iterate over all coordinates in a geometry. In the future, we should add a new method to this trait called
external_coords_iter
which iterates over the external coordinates of a geometry, excluding coordinates of interior holes. Then we can make algorithms likeConvexHull
have a generic implementation whereG: CoordsIter