-
-
Notifications
You must be signed in to change notification settings - Fork 860
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
fix: 1338 - longitude +-180 with correct polylines and polygons #1969
base: master
Are you sure you want to change the base?
Conversation
Impacted files * `crs.dart`: new methods `getHalfWorldWidth` and `projectList` * `painter.dart`: refactored using pre-computed `List<Double>` * `polygon.dart`: added an example around longitude 180 * `polyline.dart`: added an example around longitude 180 * `polyline_layer.dart`: we don't cull polylines that go beyond longitude 180 * `projected_polygon.dart`: using new method `Projection.projectList` * `projected_polyline.dart`: using new method `Projection.projectList`
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.
Thanks for the pull request @monsieurtanuki! I did some quick testing and your added examples work like intended (thanks for adding them).
Some additional thoughts:
The main use case of line wrapping are paths that cross the -180/180 longitude for example when we want to display flights. We need to figure out a solution when the user follows a polyline or polygon accross the world border. Currently the line suddenly disapears. This, of course, is not in scope for this this pull request. (:
line.wrapping.mp4
); | ||
|
||
/// Returns true if the points stretch on different versions of the world. | ||
bool goesBeyondTheUniverse(double halfWorldWidth) { |
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.
As much as I like this name, a declarative name would be more understandable in the future. 😄
Oh it's a bug then! Probably related to the "teleportation" issue. |
I actually don't think it's an bug. The line just moves to the new world that comes into center. So the line is still active but basically on the other side of the world. If you plan to look into this as well how it can get improved that's awesome of couse. (: |
@josxha Your description is correct: it's the "teleportation" issue (I can see a unique polyline jumping from world to world on the same zoom 0 map) but when the zoom is high - the "other" world is not visible. I still think it's a bug, probably not a new bug, but a fair user expectation is to see at least one polyline. Working on it. The current PR is relatively small (7 files changed), so I'll see how review-able it would become when including that bug fix. |
Impacted files: * `offsets.dart`: new method `getAddedWorldWidth`, used to add/subtract a world width in order to display visible polylines * `painter.dart`: minor fix, as now we may unproject coordinates from the wrong world
@josxha Fixed! One visible copy of the polyline, with a small or a large zoom. |
What
Polyline
Results In Unexpected Lines #1338)Screenshots
Impacted files
crs.dart
: new methodsgetHalfWorldWidth
andprojectList
painter.dart
: refactored using pre-computedList<Double>
polygon.dart
: added an example around longitude 180polyline.dart
: added an example around longitude 180polyline_layer.dart
: we don't cull polylines that go beyond longitude 180projected_polygon.dart
: using new methodProjection.projectList
projected_polyline.dart
: using new methodProjection.projectList