[core] Avoid unnecessary work when a symbol annotation is updated

In particular, if only the geometry changes, don't cascade and recalculate the style.
This commit is contained in:
John Firebaugh
2016-06-16 17:31:52 -07:00
parent e2f52a1dd8
commit 2921127bdb
9 changed files with 94 additions and 35 deletions

View File

@@ -106,23 +106,7 @@ TEST(Annotations, NonImmediateAdd) {
test.checkRendering("non_immediate_add");
}
TEST(Annotations, UpdateIcon) {
AnnotationTest test;
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.addAnnotationIcon("flipped_marker", namedMarker("default_marker.png"));
test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 0 }, "flipped_marker" });
test::render(test.map);
test.map.removeAnnotationIcon("flipped_marker");
test.map.addAnnotationIcon("flipped_marker", namedMarker("flipped_marker.png"));
test.map.update(Update::Annotations);
test.checkRendering("update_icon");
}
TEST(Annotations, UpdatePoint) {
TEST(Annotations, UpdateSymbolAnnotationGeometry) {
AnnotationTest test;
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
@@ -132,10 +116,24 @@ TEST(Annotations, UpdatePoint) {
test::render(test.map);
test.map.updateAnnotation(point, SymbolAnnotation { Point<double> { -10, 0 }, "flipped_marker" });
test.map.updateAnnotation(point, SymbolAnnotation { Point<double> { -10, 0 }, "default_marker" });
test.checkRendering("update_point");
}
TEST(Annotations, UpdateSymbolAnnotationIcon) {
AnnotationTest test;
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.addAnnotationIcon("default_marker", namedMarker("default_marker.png"));
test.map.addAnnotationIcon("flipped_marker", namedMarker("flipped_marker.png"));
AnnotationID point = test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 0 }, "default_marker" });
test::render(test.map);
test.map.updateAnnotation(point, SymbolAnnotation { Point<double> { 0, 0 }, "flipped_marker" });
test.checkRendering("update_icon");
}
TEST(Annotations, RemovePoint) {
AnnotationTest test;