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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions test/api/annotations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,48 @@ TEST(Annotations, FillAnnotation) {
test.checkRendering("fill_annotation_max_zoom");
}

TEST(Annotations, AntimeridianAnnotationSmall) {
AnnotationTest test;

double antimeridian = 180;
test.map.setLatLngZoom(mbgl::LatLng(0, antimeridian), 0);
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));

LineString<double> line = {{ { antimeridian, 20 }, { antimeridian, -20 } }};
LineAnnotation lineAnnotation { line };
lineAnnotation.color = { { 255, 0, 0, 1 } };
lineAnnotation.width = { 2 };
test.map.addAnnotation(lineAnnotation);

Polygon<double> polygon = {{ {{ { antimeridian+10, 0 }, { antimeridian - 10, 10 }, { antimeridian-10, -10 } }} }};
FillAnnotation polygonAnnotation { polygon };
polygonAnnotation.color = { { 0, 0, 255, 1 } };
test.map.addAnnotation(polygonAnnotation);

test.checkRendering("antimeridian_annotation_small");
}

TEST(Annotations, AntimeridianAnnotationLarge) {
AnnotationTest test;

double antimeridian = 180;
test.map.setLatLngZoom(mbgl::LatLng(0, antimeridian), 0);
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));

LineString<double> line = {{ { antimeridian, 20 }, { antimeridian, -20 } }};
LineAnnotation lineAnnotation { line };
lineAnnotation.color = { { 255, 0, 0, 1 } };
lineAnnotation.width = { 2 };
test.map.addAnnotation(lineAnnotation);

Polygon<double> polygon = {{ {{ { antimeridian-10, 0 }, { -antimeridian+10, 10 }, { -antimeridian+10, -10 } }} }};
FillAnnotation polygonAnnotation { polygon };
polygonAnnotation.color = { { 0, 0, 255, 1 } };
test.map.addAnnotation(polygonAnnotation);

test.checkRendering("antimeridian_annotation_large");
}

TEST(Annotations, OverlappingFillAnnotation) {
AnnotationTest test;

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.