Move rounding of WgsCoordinate from constructor to factory method #6014
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.
Summary
This is part 1 of some changes to the coordinate classes.
This PR converts the
WgsCoordinate
into a record and changes the default constructor to not round the coordinates to 7 decimal places. If you want the rounding behaviour you instead call theWgsCoordinate.normalized(lat, lon)
factory method.The main reason for this change is that we want to change a lot of code to start using the
WgsCoordinate
class without having to change the behaviour of the existing code.This code is mostly a refactor. But there are some changes in behaviour:
WgsCoordinate.of(Coordinate)
andWgsCoordinate.of(Point)
constructors will throw exceptions if the lat/lon is out of bounds.new WgsCoordinate(1, 2)
, i left those as they are.Issue
See #6013
Unit tests
I updated some test code in the WgsCoordinateTest according to the new behaviour.
Documentation
I added javadoc to the new factory methods.
Bumping the serialization version id
Converting the WgsCoordinate into a record will probably change the serialization.