mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.37k stars 1.33k forks source link

RasterLayer.nativeSetFilter() has no effect #16561

Open wingkingbobo opened 3 years ago

wingkingbobo commented 3 years ago

Platform: Mapbox SDK version:

Steps to trigger behavior

1. 2. 3.

Expected behavior

I want to use layer.setFilter() to control the display of RasterLayer,but it has no effect.

class MyRasterLayer extends RasterLayer {
    public MyRasterLayer (String layerId, String sourceId) {
        super(layerId, sourceId);
    }

    public void setFilter(Expression expression) {
        checkThread();
        nativeSetFilter(expression.toArray());
    }
}
Expression filter = Expression.all(
                    Expression.gte(
                            Expression.zoom(), 1
                    ),
                    Expression.lte(
                            Expression.zoom(), 3
                    ));
rasterLayer.setFilter(filter);

Actual behavior