[core] Update shaders.
Implements 'icon-pitch-alignment' (issue #9345) Fixes issue #9456 (map-aligned point label regression)
This commit is contained in:
@@ -1052,11 +1052,16 @@ public class CircleLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("circle-pitch-alignment");
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
layer.setProperties(circlePitchAlignment(CIRCLE_PITCH_ALIGNMENT_MAP));
|
||||
assertEquals((String) layer.getCirclePitchAlignment().getValue(), (String) CIRCLE_PITCH_ALIGNMENT_MAP);
|
||||
// Set and Get
|
||||
layer.setProperties(circlePitchAlignment(CIRCLE_PITCH_ALIGNMENT_MAP));
|
||||
assertEquals((String) layer.getCirclePitchAlignment().getValue(), (String) CIRCLE_PITCH_ALIGNMENT_MAP);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1064,25 +1069,30 @@ public class CircleLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("circle-pitch-alignment");
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
circlePitchAlignment(
|
||||
zoom(
|
||||
interval(
|
||||
stop(2, circlePitchAlignment(CIRCLE_PITCH_ALIGNMENT_MAP))
|
||||
// Set
|
||||
layer.setProperties(
|
||||
circlePitchAlignment(
|
||||
zoom(
|
||||
interval(
|
||||
stop(2, circlePitchAlignment(CIRCLE_PITCH_ALIGNMENT_MAP))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getCirclePitchAlignment());
|
||||
assertNotNull(layer.getCirclePitchAlignment().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getCirclePitchAlignment().getFunction().getClass());
|
||||
assertEquals(IntervalStops.class, layer.getCirclePitchAlignment().getFunction().getStops().getClass());
|
||||
assertEquals(1, ((IntervalStops) layer.getCirclePitchAlignment().getFunction().getStops()).size());
|
||||
// Verify
|
||||
assertNotNull(layer.getCirclePitchAlignment());
|
||||
assertNotNull(layer.getCirclePitchAlignment().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getCirclePitchAlignment().getFunction().getClass());
|
||||
assertEquals(IntervalStops.class, layer.getCirclePitchAlignment().getFunction().getStops().getClass());
|
||||
assertEquals(1, ((IntervalStops) layer.getCirclePitchAlignment().getFunction().getStops()).size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -865,19 +865,24 @@ public class LineLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("line-width");
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
lineWidth(property("FeaturePropertyA", Stops.<Float>identity()))
|
||||
);
|
||||
// Set
|
||||
layer.setProperties(
|
||||
lineWidth(property("FeaturePropertyA", Stops.<Float>identity()))
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getLineWidth());
|
||||
assertNotNull(layer.getLineWidth().getFunction());
|
||||
assertEquals(SourceFunction.class, layer.getLineWidth().getFunction().getClass());
|
||||
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineWidth().getFunction()).getProperty());
|
||||
assertEquals(IdentityStops.class, layer.getLineWidth().getFunction().getStops().getClass());
|
||||
// Verify
|
||||
assertNotNull(layer.getLineWidth());
|
||||
assertNotNull(layer.getLineWidth().getFunction());
|
||||
assertEquals(SourceFunction.class, layer.getLineWidth().getFunction().getClass());
|
||||
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineWidth().getFunction()).getProperty());
|
||||
assertEquals(IdentityStops.class, layer.getLineWidth().getFunction().getStops().getClass());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -885,26 +890,31 @@ public class LineLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("line-width");
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
lineWidth(
|
||||
property(
|
||||
"FeaturePropertyA",
|
||||
exponential(
|
||||
stop(0.3f, lineWidth(0.3f))
|
||||
).withBase(0.5f)
|
||||
)
|
||||
)
|
||||
);
|
||||
// Set
|
||||
layer.setProperties(
|
||||
lineWidth(
|
||||
property(
|
||||
"FeaturePropertyA",
|
||||
exponential(
|
||||
stop(0.3f, lineWidth(0.3f))
|
||||
).withBase(0.5f)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getLineWidth());
|
||||
assertNotNull(layer.getLineWidth().getFunction());
|
||||
assertEquals(SourceFunction.class, layer.getLineWidth().getFunction().getClass());
|
||||
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineWidth().getFunction()).getProperty());
|
||||
assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass());
|
||||
// Verify
|
||||
assertNotNull(layer.getLineWidth());
|
||||
assertNotNull(layer.getLineWidth().getFunction());
|
||||
assertEquals(SourceFunction.class, layer.getLineWidth().getFunction().getClass());
|
||||
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineWidth().getFunction()).getProperty());
|
||||
assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -912,29 +922,35 @@ public class LineLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("line-width");
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
lineWidth(
|
||||
property(
|
||||
"FeaturePropertyA",
|
||||
categorical(
|
||||
stop(1.0f, lineWidth(0.3f))
|
||||
// Set
|
||||
layer.setProperties(
|
||||
lineWidth(
|
||||
property(
|
||||
"FeaturePropertyA",
|
||||
categorical(
|
||||
stop(1.0f, lineWidth(0.3f))
|
||||
)
|
||||
).withDefaultValue(lineWidth(0.3f))
|
||||
)
|
||||
).withDefaultValue(lineWidth(0.3f))
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getLineWidth());
|
||||
assertNotNull(layer.getLineWidth().getFunction());
|
||||
assertEquals(SourceFunction.class, layer.getLineWidth().getFunction().getClass());
|
||||
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineWidth().getFunction()).getProperty());
|
||||
assertEquals(CategoricalStops.class, layer.getLineWidth().getFunction().getStops().getClass());
|
||||
assertNotNull(((SourceFunction) layer.getLineWidth().getFunction()).getDefaultValue());
|
||||
assertNotNull(((SourceFunction) layer.getLineWidth().getFunction()).getDefaultValue().getValue());
|
||||
assertEquals(0.3f, ((SourceFunction) layer.getLineWidth().getFunction()).getDefaultValue().getValue());
|
||||
}
|
||||
});
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getLineWidth());
|
||||
assertNotNull(layer.getLineWidth().getFunction());
|
||||
assertEquals(SourceFunction.class, layer.getLineWidth().getFunction().getClass());
|
||||
assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineWidth().getFunction()).getProperty());
|
||||
assertEquals(CategoricalStops.class, layer.getLineWidth().getFunction().getStops().getClass());
|
||||
assertNotNull(((SourceFunction) layer.getLineWidth().getFunction()).getDefaultValue());
|
||||
assertNotNull(((SourceFunction) layer.getLineWidth().getFunction()).getDefaultValue().getValue());
|
||||
assertEquals(0.3f, ((SourceFunction) layer.getLineWidth().getFunction()).getDefaultValue().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -942,34 +958,39 @@ public class LineLayerTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("line-width");
|
||||
assertNotNull(layer);
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
lineWidth(
|
||||
composite(
|
||||
"FeaturePropertyA",
|
||||
exponential(
|
||||
stop(0, 0.3f, lineWidth(0.9f))
|
||||
).withBase(0.5f)
|
||||
).withDefaultValue(lineWidth(0.3f))
|
||||
)
|
||||
);
|
||||
// Set
|
||||
layer.setProperties(
|
||||
lineWidth(
|
||||
composite(
|
||||
"FeaturePropertyA",
|
||||
exponential(
|
||||
stop(0, 0.3f, lineWidth(0.9f))
|
||||
).withBase(0.5f)
|
||||
).withDefaultValue(lineWidth(0.3f))
|
||||
)
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getLineWidth());
|
||||
assertNotNull(layer.getLineWidth().getFunction());
|
||||
assertEquals(CompositeFunction.class, layer.getLineWidth().getFunction().getClass());
|
||||
assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineWidth().getFunction()).getProperty());
|
||||
assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass());
|
||||
assertEquals(1, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).size());
|
||||
// Verify
|
||||
assertNotNull(layer.getLineWidth());
|
||||
assertNotNull(layer.getLineWidth().getFunction());
|
||||
assertEquals(CompositeFunction.class, layer.getLineWidth().getFunction().getClass());
|
||||
assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineWidth().getFunction()).getProperty());
|
||||
assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass());
|
||||
assertEquals(1, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).size());
|
||||
|
||||
ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
|
||||
(ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineWidth().getFunction().getStops();
|
||||
Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
|
||||
assertEquals(0f, stop.in.zoom, 0.001);
|
||||
assertEquals(0.3f, stop.in.value, 0.001f);
|
||||
assertEquals(0.9f, stop.out, 0.001f);
|
||||
ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
|
||||
(ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineWidth().getFunction().getStops();
|
||||
Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
|
||||
assertEquals(0f, stop.in.zoom, 0.001);
|
||||
assertEquals(0.3f, stop.in.value, 0.001f);
|
||||
assertEquals(0.9f, stop.out, 0.001f);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1213,6 +1213,54 @@ public class SymbolLayerTest extends BaseActivityTest {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIconPitchAlignmentAsConstant() {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("icon-pitch-alignment");
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set and Get
|
||||
layer.setProperties(iconPitchAlignment(ICON_PITCH_ALIGNMENT_MAP));
|
||||
assertEquals((String) layer.getIconPitchAlignment().getValue(), (String) ICON_PITCH_ALIGNMENT_MAP);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIconPitchAlignmentAsCameraFunction() {
|
||||
validateTestSetup();
|
||||
setupLayer();
|
||||
Timber.i("icon-pitch-alignment");
|
||||
invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() {
|
||||
@Override
|
||||
public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) {
|
||||
assertNotNull(layer);
|
||||
|
||||
// Set
|
||||
layer.setProperties(
|
||||
iconPitchAlignment(
|
||||
zoom(
|
||||
interval(
|
||||
stop(2, iconPitchAlignment(ICON_PITCH_ALIGNMENT_MAP))
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// Verify
|
||||
assertNotNull(layer.getIconPitchAlignment());
|
||||
assertNotNull(layer.getIconPitchAlignment().getFunction());
|
||||
assertEquals(CameraFunction.class, layer.getIconPitchAlignment().getFunction().getClass());
|
||||
assertEquals(IntervalStops.class, layer.getIconPitchAlignment().getFunction().getStops().getClass());
|
||||
assertEquals(1, ((IntervalStops) layer.getIconPitchAlignment().getFunction().getStops()).size());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTextPitchAlignmentAsConstant() {
|
||||
validateTestSetup();
|
||||
|
||||
Reference in New Issue
Block a user