-
Notifications
You must be signed in to change notification settings - Fork 49
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
Port transform trait from geo and add a mutable flavor #109
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Feb 15, 2022
I think we get that for free from: https://doc.rust-lang.org/src/core/result.rs.html#500
… On Feb 16, 2022, at 1:36 AM, Xavier Delamotte ***@***.***> wrote:
@x4d3 commented on this pull request.
In src/transform.rs <#109 (comment)>:
> +let point = geo_types::point!(x: -36.508f32, y: -54.2815f32);
+let proj = Proj::new("+proj=axisswap +order=2,1,3,4").expect("invalid proj string");
+
+assert_relative_eq!(
+ point.transformed(&proj).unwrap(),
+ geo_types::point!(x: -54.2815f32, y: -36.508f32)
+);
+
+// original `point` is untouched
+assert_relative_eq!(
+ point,
+ geo_types::point!(x: -36.508f32, y: -54.2815f32)
+);
+```
+"##)]
+ fn transformed(&self, proj: &Proj) -> Result<Self::Output, ProjError>;
Should we add must_use <https://rust-lang.github.io/rfcs/1940-must-use-functions.html> here ?
—
Reply to this email directly, view it on GitHub <#109 (review)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABU7YPVCJJVFVXBTTMGM7TU3NV3BANCNFSM5OPWQXJA>.
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.
|
frewsxcv
approved these changes
Feb 20, 2022
bors r+ |
Build succeeded: |
bors bot
added a commit
to georust/geo
that referenced
this pull request
Feb 20, 2022
730: Port Transform trait to `proj` crate. r=frewsxcv a=michaelkirk - [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/master/CODE_OF_CONDUCT.md). - [x] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users. --- ~~Based on the #729, so please review that first:~~: Done! Merged and rebased. Depends on proj pr: - georust/proj#109 Co-authored-by: Michael Kirk <michael.code@endoftheworl.de>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #101, #108
An alternative to #106, but as proposed in #108, I've done so by porting the Transform trait from geo to proj so that we won't need similar-but-different code in two places.
I chose to double down on a trait-based approach since it seemed idiomatic to our other georust code. However, like proposed in #106, I leveraged proj_array in more places.
/cc @x4d3
corresponding PRs:
proj
crate. geo#730