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

Implement SpatialObject for Line type #181

Merged
merged 5 commits into from
Mar 15, 2018

Conversation

urschrei
Copy link
Member

This doesn't get us any speedup, but it does let us use the Line type directly in an RTree, which reduces complexity quite a bit.

@urschrei urschrei requested a review from frewsxcv January 22, 2018 14:43
@urschrei urschrei force-pushed the impl_line_spatialobject branch from 79fffa6 to 70d9b48 Compare January 22, 2018 15:29
@floatdrop
Copy link

Not exactly question about this PR, but generally – is implementing SpatialObject for other types (like Polygon) is planned (or how do I implement them in my code)?

@urschrei
Copy link
Member Author

@floatdrop I haven't really thought about implementing it for any other types, because we haven't yet had to use RTree to store them. It should be easy to do for LineString, but I'm less sure whether it would be useful for Polygon. In terms of implementing it for your own types, you first need to Implement PointN and TwoDimensional for your point type (see here for ours), and then implement SpatialObject as in this PR.

@floatdrop
Copy link

@urschrei thanks for quick response! My question was more about – how do I implement SpatialObject for Polygon? Because these traits are not in scope of my library – rust refuses to accept implementation (or I just do it wrong).

@urschrei
Copy link
Member Author

@floatdrop As you say, you won't be able to do it yourself, because Polygon is a foreign type. So you have two options: use a wrapper type, or store the Polygon's exterior asLines (when this PR lands), and then use that for querying.

@urschrei urschrei force-pushed the impl_line_spatialobject branch from f5bb1ee to 7563f87 Compare January 25, 2018 13:14
Copy link
Member

@frewsxcv frewsxcv left a comment

Choose a reason for hiding this comment

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

woops, this one slipped by. sorry for the delayed review!

This lets us use Line in RTree, skipping the conversion to SimpleEdge
This allows us to skip a conversion step
@urschrei urschrei force-pushed the impl_line_spatialobject branch from 7563f87 to b16dd15 Compare March 15, 2018 22:00
@urschrei
Copy link
Member Author

bors r=frewsxcv

bors bot added a commit that referenced this pull request Mar 15, 2018
181: Implement SpatialObject for Line type r=frewsxcv a=urschrei

This doesn't get us any speedup, but it _does_ let us use the `Line` type directly in an `RTree`, which reduces complexity quite a bit.
@bors
Copy link
Contributor

bors bot commented Mar 15, 2018

Build succeeded

@bors bors bot merged commit 4df2c05 into georust:master Mar 15, 2018
@urschrei urschrei deleted the impl_line_spatialobject branch March 15, 2018 22:13
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