Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Add solution for shape overlays to cross antimeridian #6043

Closed
wants to merge 1 commit into from

Conversation

boundsj
Copy link
Contributor

@boundsj boundsj commented Aug 16, 2016

#4974 points out how GL Native cannot support a shape overlay that crosses the antimeridian. This PR is to provide support that use case by:

  • Adding tests that describe the problem
  • Changing Core GL to support shapes going over the antimeridian

The change in core should be a continuation of the work done in 026b6d4 which fixed several issues related to points surrounding the antimeridian but removed support for expressing shapes crossing the antimerdian with longitudinal values +-180º.

This adds two tests:

AntimeridianAnnotationSmall: Test that a shape that is represented with
+-180 longitudinal values is drawn spanning the antimeridian. In other
words, it is rendered as a "small" shape as opposed to one that spans
around the world to reach the other side of the antimeridian. This test
is currently failing at the time of this commit.

AntimeridianAnnotationLarge: Test that a shape that is represented with
points that do not cross the +-180 boundary is rendered as a "large"
shape. In other words, it is rendered by wrapping around the world to
reach the other side of the meridian. This test is currently passing at
the time of this commit.
@boundsj boundsj added feature tests ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold Core The cross-platform C++ core, aka mbgl labels Aug 16, 2016
@boundsj boundsj added this to the ios-v3.4.0 milestone Aug 16, 2016
@boundsj boundsj self-assigned this Aug 16, 2016
@mention-bot
Copy link

@boundsj, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh, @1ec5 and @tmpsantos to be potential reviewers.

@boundsj
Copy link
Contributor Author

boundsj commented Aug 16, 2016

The diff in the new AntimeridianAnnotationSmall test illustrates the case we would like to support but currently cannot. A shape with points greater than or less than +- 180º is not fully rendered. It is cut off at the antimeridian.

diff

cc @brunoabinader

@boundsj boundsj added bug and removed feature labels Aug 16, 2016
@brunoabinader
Copy link
Member

This looks related: #5600

@brunoabinader
Copy link
Member

Another observation: the full triangle is drawn when we duplicate each polyline coordinate with its 360 degrees negative counterpart, so the following workaround draws the full small triangle:

mbgl::Polygon<double> polygon = {{
    {{ { 190, 0 }, { 170, 10 }, { 170, -10 } }},
    {{ { -170, 0 }, { -190, 10 }, { -190, -10 } }}
}};

@mourner
Copy link
Member

mourner commented Aug 18, 2016

The triangle bug above will be fixed by mapbox/geojson-vt-cpp#57

@brunoabinader
Copy link
Member

Cherry-picked this commit in #6088 with a minor update to the expectation from AntimeridianAnnotationLarge: because we are now properly painting on both sides, the red line fill for the right tile now appears (you can notice it is bolder now):
expected

@brunoabinader brunoabinader deleted the boundsj-shapes-over-antimeridian branch August 19, 2016 14:57
@boundsj boundsj changed the title [WIP] Add solution for shape overlays to cross antimeridian Add solution for shape overlays to cross antimeridian Aug 19, 2016
@boundsj boundsj removed the ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold label Aug 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Core The cross-platform C++ core, aka mbgl tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants