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

deprecate legacy line measure traits #1222

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

michaelkirk
Copy link
Member

@michaelkirk michaelkirk commented Oct 8, 2024

  • I agree to follow the project's code of conduct.
  • I added an entry to CHANGES.md if knowledge of this change could be valuable to users.

Deprecating the old call sites of {Haversine,Rhumb,Geodesic}x{Distance,Bearing,Destination,Intermediate} in favor of the new methods introduced in #1216

Moved some implementation details from HaversineIntermediateFill to Haversine.

@michaelkirk michaelkirk force-pushed the mkirk/deprecate-legacy-line-measures-2 branch from 414de5a to 5a5aa7b Compare October 8, 2024 18:07
}

#[allow(clippy::many_single_char_names)]
struct HaversineIntermediateFillCalculation<T> {
Copy link
Member Author

@michaelkirk michaelkirk Oct 8, 2024

Choose a reason for hiding this comment

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

HaversineIntermediateFillCalculation was cut/paste and renamed from haversine_intermediate::HaversineParams here:

https://github.com/georust/geo/pull/1222/files#diff-634e7da640fe8307cf8b1ef08ca56b7bfd954216ed7a41bee8e5d06b2e660d1fL94

I also re-organized the methods, which were previously free methods, and are now instance methods. The actual implementation logic is identical.

@@ -36,7 +37,13 @@ impl Bearing<f64> for Geodesic {
/// [geodesic line]: https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid
/// [Karney (2013)]: https://arxiv.org/pdf/1109.4448.pdf
fn bearing(origin: Point<f64>, destination: Point<f64>) -> f64 {
Copy link
Member Author

@michaelkirk michaelkirk Oct 8, 2024

Choose a reason for hiding this comment

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

All these implementations were copy/pasted (with some variable renaming) from the deprecated traits.

So, instead of the modern traits delegating to the deprecated traits, the deprecated traits now delegate to the modern ones.

Copy link
Member Author

@michaelkirk michaelkirk Oct 8, 2024

Choose a reason for hiding this comment

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

So, instead of the modern traits delegating to the deprecated traits, the deprecated traits now delegate to the modern ones.

Oh! The 2 exceptions to this are that the deprecated GeodesicBearing and HaversineBearing do not delegate to the modern traits. They have kept their legacy implementation in tact to preserve the fact that their output range is [-180...180], whereas all the modern Bearing traits have unified around [0...360].

See #1210 for more details.

…er moving implementation to modern traits

Moved some implementation details from HaversineIntermediateFill to
Haversine.
@michaelkirk michaelkirk force-pushed the mkirk/deprecate-legacy-line-measures-2 branch from dcda3e4 to 5f6bc01 Compare October 14, 2024 17:41
@michaelkirk michaelkirk added this pull request to the merge queue Oct 14, 2024
Merged via the queue into main with commit 9c95906 Oct 14, 2024
15 checks passed
@michaelkirk michaelkirk deleted the mkirk/deprecate-legacy-line-measures-2 branch October 14, 2024 17:47
@michaelkirk michaelkirk mentioned this pull request Oct 22, 2024
2 tasks
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.

2 participants