com.mapbox.mapboxsdk.style.layers.LineLayer Java Examples

The following examples show how to use com.mapbox.mapboxsdk.style.layers.LineLayer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MapStyleController.java    From AirMapSDK-Android with Apache License 2.0 6 votes vote down vote up
public void highlight(@NonNull Feature feature, AirMapAdvisory advisory) {
    // remove old highlight
    unhighlight();

    // add new highlight
    String sourceId = feature.getStringProperty("ruleset_id");
    highlightLayerId = "airmap|highlight|line|" + sourceId;
    LineLayer highlightLayer = map.getMap().getStyle().getLayerAs(highlightLayerId);
    highlightLayer.setSourceLayer(sourceId + "_" + advisory.getType().toString());

    // feature's airspace_id can be an int or string (tile server bug), so match on either
    Expression filter;
    try {
        int airspaceId = Integer.parseInt(advisory.getId());
        filter = Expression.any(Expression.eq(Expression.get("id"), advisory.getId()), Expression.eq(Expression.get("id"), airspaceId));
    } catch (NumberFormatException e) {
        filter = Expression.any(Expression.eq(Expression.get("id"), advisory.getId()));
    }
    highlightLayer.setFilter(filter);
}
 
Example #2
Source File: TrafficPlugin.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
static LineLayer getLineLayer(String lineLayerId, float minZoom, Expression filter,
                              Expression lineColorExpression, Expression lineWidthExpression,
                              Expression lineOffsetExpression, Expression lineOpacityExpression) {
  LineLayer lineLayer = new LineLayer(lineLayerId, TrafficData.SOURCE_ID);
  lineLayer.setSourceLayer(TrafficData.SOURCE_LAYER);
  lineLayer.setProperties(
    lineCap(Property.LINE_CAP_ROUND),
    lineJoin(Property.LINE_JOIN_ROUND),
    lineColor(lineColorExpression),
    lineWidth(lineWidthExpression),
    lineOffset(lineOffsetExpression)
  );
  if (lineOpacityExpression != null) {
    lineLayer.setProperties(lineOpacity(lineOpacityExpression));
  }

  lineLayer.setFilter(filter);
  lineLayer.setMinZoom(minZoom);
  return lineLayer;
}
 
Example #3
Source File: NavigationMapRoute.java    From graphhopper-navigation-android with MIT License 6 votes vote down vote up
private void initializeUpcomingManeuverArrow() {
  arrowShaftGeoJsonSource = (GeoJsonSource) mapboxMap.getSource(ARROW_SHAFT_SOURCE_ID);
  arrowHeadGeoJsonSource = (GeoJsonSource) mapboxMap.getSource(ARROW_HEAD_SOURCE_ID);

  LineLayer shaftLayer = createArrowShaftLayer();
  LineLayer shaftCasingLayer = createArrowShaftCasingLayer();
  SymbolLayer headLayer = createArrowHeadLayer();
  SymbolLayer headCasingLayer = createArrowHeadCasingLayer();

  if (arrowShaftGeoJsonSource == null && arrowHeadGeoJsonSource == null) {
    initializeArrowShaft();
    initializeArrowHead();

    addArrowHeadIcon();
    addArrowHeadIconCasing();

    mapboxMap.addLayerBelow(shaftCasingLayer, LAYER_ABOVE_UPCOMING_MANEUVER_ARROW);
    mapboxMap.addLayerAbove(headCasingLayer, shaftCasingLayer.getId());

    mapboxMap.addLayerAbove(shaftLayer, headCasingLayer.getId());
    mapboxMap.addLayerAbove(headLayer, shaftLayer.getId());
  }
  initializeArrowLayers(shaftLayer, shaftCasingLayer, headLayer, headCasingLayer);
}
 
Example #4
Source File: NavigationMapRoute.java    From graphhopper-navigation-android with MIT License 6 votes vote down vote up
private LineLayer createArrowShaftLayer() {
  LineLayer shaftLayer = (LineLayer) mapboxMap.getLayer(ARROW_SHAFT_LINE_LAYER_ID);
  if (shaftLayer != null) {
    return shaftLayer;
  }
  return new LineLayer(ARROW_SHAFT_LINE_LAYER_ID, ARROW_SHAFT_SOURCE_ID).withProperties(
    PropertyFactory.lineColor(color(arrowColor)),
    PropertyFactory.lineWidth(
      interpolate(linear(), zoom(),
        stop(MIN_ARROW_ZOOM, MIN_ZOOM_ARROW_SHAFT_SCALE),
        stop(MAX_ARROW_ZOOM, MAX_ZOOM_ARROW_SHAFT_SCALE)
      )
    ),
    PropertyFactory.lineCap(Property.LINE_CAP_ROUND),
    PropertyFactory.lineJoin(Property.LINE_JOIN_ROUND),
    PropertyFactory.visibility(NONE),
    PropertyFactory.lineOpacity(
      step(zoom(), OPAQUE,
        stop(
          ARROW_HIDDEN_ZOOM_LEVEL, TRANSPARENT
        )
      )
    )
  );
}
 
Example #5
Source File: NavigationMapRoute.java    From graphhopper-navigation-android with MIT License 6 votes vote down vote up
private LineLayer createArrowShaftCasingLayer() {
  LineLayer shaftCasingLayer = (LineLayer) mapboxMap.getLayer(ARROW_SHAFT_CASING_LINE_LAYER_ID);
  if (shaftCasingLayer != null) {
    return shaftCasingLayer;
  }
  return new LineLayer(ARROW_SHAFT_CASING_LINE_LAYER_ID, ARROW_SHAFT_SOURCE_ID).withProperties(
    PropertyFactory.lineColor(color(arrowBorderColor)),
    PropertyFactory.lineWidth(
      interpolate(linear(), zoom(),
        stop(MIN_ARROW_ZOOM, MIN_ZOOM_ARROW_SHAFT_CASING_SCALE),
        stop(MAX_ARROW_ZOOM, MAX_ZOOM_ARROW_SHAFT_CASING_SCALE)
      )
    ),
    PropertyFactory.lineCap(Property.LINE_CAP_ROUND),
    PropertyFactory.lineJoin(Property.LINE_JOIN_ROUND),
    PropertyFactory.visibility(NONE),
    PropertyFactory.lineOpacity(
      step(zoom(), OPAQUE,
        stop(
          ARROW_HIDDEN_ZOOM_LEVEL, TRANSPARENT
        )
      )
    )
  );
}
 
Example #6
Source File: MapStyleController.java    From AirMapSDK-Android with Apache License 2.0 6 votes vote down vote up
public void highlight(Feature feature) {
    String id = feature.getStringProperty("id");
    String type = feature.getStringProperty("category");

    // remove old highlight
    unhighlight();

    // add new highlight
    String sourceId = feature.getStringProperty("ruleset_id");
    highlightLayerId = "airmap|highlight|line|" + sourceId;
    LineLayer highlightLayer = map.getMap().getStyle().getLayerAs(highlightLayerId);
    highlightLayer.setSourceLayer(sourceId + "_" + type);

    // feature's airspace_id can be an int or string (tile server bug), so match on either
    Expression filter;
    try {
        int airspaceId = Integer.parseInt(id);
        filter = Expression.any(Expression.eq(Expression.get("id"), id), Expression.eq(Expression.get("id"), airspaceId));
    } catch (NumberFormatException e) {
        filter = Expression.any(Expression.eq(Expression.get("id"), id));
    }
    highlightLayer.setFilter(filter);
}
 
Example #7
Source File: TrafficPlugin.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Add motorway layer to the map.
 */
private void addMotorwayLayer() {
  LineLayer motorWay = TrafficLayer.getLineLayer(
    MotorWay.BASE_LAYER_ID,
    MotorWay.ZOOM_LEVEL,
    MotorWay.FILTER,
    MotorWay.FUNCTION_LINE_COLOR,
    MotorWay.FUNCTION_LINE_WIDTH,
    MotorWay.FUNCTION_LINE_OFFSET
  );

  LineLayer motorwayCase = TrafficLayer.getLineLayer(
    MotorWay.CASE_LAYER_ID,
    MotorWay.ZOOM_LEVEL,
    MotorWay.FILTER,
    MotorWay.FUNCTION_LINE_COLOR_CASE,
    MotorWay.FUNCTION_LINE_WIDTH_CASE,
    MotorWay.FUNCTION_LINE_OFFSET
  );

  addTrafficLayersToMap(motorwayCase, motorWay, getLastAddedLayerId());
}
 
Example #8
Source File: NavigationMapRoute.java    From graphhopper-navigation-android with MIT License 6 votes vote down vote up
/**
 * Add the route shield layer to the map either using the custom style values or the default.
 */
private void addRouteShieldLayer(String layerId, String sourceId, int index) {
  float scale = index == primaryRouteIndex ? routeScale : alternativeRouteScale;
  Layer routeLayer = new LineLayer(layerId, sourceId).withProperties(
    PropertyFactory.lineCap(Property.LINE_CAP_ROUND),
    PropertyFactory.lineJoin(Property.LINE_JOIN_ROUND),
    PropertyFactory.lineWidth(interpolate(
      exponential(1.5f), zoom(),
      stop(10f, 7f),
      stop(14f, 10.5f * scale),
      stop(16.5f, 15.5f * scale),
      stop(19f, 24f * scale),
      stop(22f, 29f * scale)
      )
    ),
    PropertyFactory.lineColor(
      index == primaryRouteIndex ? routeShieldColor : alternativeRouteShieldColor)
  );
  MapUtils.addLayerToMap(mapboxMap, routeLayer, belowLayer);
}
 
Example #9
Source File: TrafficPlugin.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Add trunk layer to the map.
 */
private void addTrunkLayer() {
  LineLayer trunk = TrafficLayer.getLineLayer(
    Trunk.BASE_LAYER_ID,
    Trunk.ZOOM_LEVEL,
    Trunk.FILTER,
    Trunk.FUNCTION_LINE_COLOR,
    Trunk.FUNCTION_LINE_WIDTH,
    Trunk.FUNCTION_LINE_OFFSET
  );

  LineLayer trunkCase = TrafficLayer.getLineLayer(
    Trunk.CASE_LAYER_ID,
    Trunk.ZOOM_LEVEL,
    Trunk.FILTER,
    Trunk.FUNCTION_LINE_COLOR_CASE,
    Trunk.FUNCTION_LINE_WIDTH_CASE,
    Trunk.FUNCTION_LINE_OFFSET
  );

  addTrafficLayersToMap(trunkCase, trunk, getLastAddedLayerId());
}
 
Example #10
Source File: TrafficPlugin.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Add primary layer to the map.
 */
private void addPrimaryLayer() {
  LineLayer primary = TrafficLayer.getLineLayer(
    Primary.BASE_LAYER_ID,
    Primary.ZOOM_LEVEL,
    Primary.FILTER,
    Primary.FUNCTION_LINE_COLOR,
    Primary.FUNCTION_LINE_WIDTH,
    Primary.FUNCTION_LINE_OFFSET
  );

  LineLayer primaryCase = TrafficLayer.getLineLayer(
    Primary.CASE_LAYER_ID,
    Primary.ZOOM_LEVEL,
    Primary.FILTER,
    Primary.FUNCTION_LINE_COLOR_CASE,
    Primary.FUNCTION_LINE_WIDTH_CASE,
    Primary.FUNCTION_LINE_OFFSET,
    Primary.FUNCTION_LINE_OPACITY_CASE
  );

  addTrafficLayersToMap(primaryCase, primary, getLastAddedLayerId());
}
 
Example #11
Source File: TrafficPlugin.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Add secondary layer to the map.
 */
private void addSecondaryLayer() {
  LineLayer secondary = TrafficLayer.getLineLayer(
    Secondary.BASE_LAYER_ID,
    Secondary.ZOOM_LEVEL,
    Secondary.FILTER,
    Secondary.FUNCTION_LINE_COLOR,
    Secondary.FUNCTION_LINE_WIDTH,
    Secondary.FUNCTION_LINE_OFFSET
  );

  LineLayer secondaryCase = TrafficLayer.getLineLayer(
    Secondary.CASE_LAYER_ID,
    Secondary.ZOOM_LEVEL,
    Secondary.FILTER,
    Secondary.FUNCTION_LINE_COLOR_CASE,
    Secondary.FUNCTION_LINE_WIDTH_CASE,
    Secondary.FUNCTION_LINE_OFFSET,
    Secondary.FUNCTION_LINE_OPACITY_CASE
  );

  addTrafficLayersToMap(secondaryCase, secondary, getLastAddedLayerId());
}
 
Example #12
Source File: TrafficPlugin.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Add local layer to the map.
 */
private void addLocalLayer() {
  LineLayer local = TrafficLayer.getLineLayer(
    Local.BASE_LAYER_ID,
    Local.ZOOM_LEVEL,
    Local.FILTER,
    Local.FUNCTION_LINE_COLOR,
    Local.FUNCTION_LINE_WIDTH,
    Local.FUNCTION_LINE_OFFSET
  );

  LineLayer localCase = TrafficLayer.getLineLayer(
    Local.CASE_LAYER_ID,
    Local.ZOOM_LEVEL,
    Local.FILTER,
    Local.FUNCTION_LINE_COLOR_CASE,
    Local.FUNCTION_LINE_WIDTH_CASE,
    Local.FUNCTION_LINE_OFFSET,
    Local.FUNCTION_LINE_OPACITY_CASE
  );

  addTrafficLayersToMap(localCase, local, placeLayerBelow());
}
 
Example #13
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineOffsetFunctionMotorwayCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(MotorWay.CASE_LAYER_ID);
      assertNotNull(layer.getLineOffset());
      assertNotNull(layer.getLineOffset().getExpression());
    }
  });
}
 
Example #14
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineOffsetFunctionLocalBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(Local.BASE_LAYER_ID);
      assertNotNull(layer.getLineOffset());
      assertNotNull(layer.getLineOffset().getExpression());
    }
  });
}
 
Example #15
Source File: MapStyleController.java    From AirMapSDK-Android with Apache License 2.0 5 votes vote down vote up
public void hideInactiveAirspace(){
    Expression hasActive = Expression.has("active");
    Expression activeIsTrue = Expression.eq(Expression.get("active"), true);
    Expression active = Expression.all(hasActive, activeIsTrue);
    map.getMap().getStyle(style -> {
        for(Layer layer : Objects.requireNonNull(style.getLayers())){
            if(layer.getId().contains("airmap")){
                if(layer instanceof FillLayer){
                    if(((FillLayer) layer).getFilter() != null){
                        ((FillLayer) layer).setFilter(Expression.any(((FillLayer) layer).getFilter(), active));
                    } else {
                        ((FillLayer) layer).setFilter(active);
                    }

                } else if (layer instanceof  LineLayer){
                    if(((LineLayer) layer).getFilter() != null){
                        ((LineLayer) layer).setFilter(Expression.any(((LineLayer) layer).getFilter(), active));
                    } else {
                        ((LineLayer) layer).setFilter(active);
                    }

                } else if(layer instanceof  SymbolLayer){
                    if(((SymbolLayer) layer).getFilter() != null){
                        ((SymbolLayer) layer).setFilter(Expression.any(((SymbolLayer) layer).getFilter(), active));
                    } else {
                        ((SymbolLayer) layer).setFilter(active);
                    }

                } else {
                    Timber.e("Unknown layer");

                }
            }
        }
    });
}
 
Example #16
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineOffsetFunctionTrunkBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(Trunk.BASE_LAYER_ID);
      assertNotNull(layer.getLineOffset());
      assertNotNull(layer.getLineOffset().getExpression());
    }
  });
}
 
Example #17
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineWidthFunctionSecondaryCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(Secondary.CASE_LAYER_ID);
      assertNotNull(layer.getLineWidth());
      assertNotNull(layer.getLineWidth().getExpression());
    }
  });
}
 
Example #18
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineOffsetFunctionMotorwayBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(MotorWay.BASE_LAYER_ID);
      assertNotNull(layer.getLineOffset());
      assertNotNull(layer.getLineOffset().getExpression());
    }
  });
}
 
Example #19
Source File: SearchTEActivity.java    From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void setLayer(Style style) {

        SymbolLayer symbolLayer = new SymbolLayer("POINT_LAYER", "teis").withProperties(
                PropertyFactory.iconImage(get("teiImage")),
                iconOffset(new Float[]{0f, -25f}),
                iconAllowOverlap(true),
                textAllowOverlap(true)
        );

        symbolLayer.setFilter(eq(literal("$type"), literal("Point")));

        style.addLayer(symbolLayer);

        if (featureType != FeatureType.POINT) {
            style.addLayerBelow(new FillLayer("POLYGON_LAYER", "teis")
                            .withProperties(
                                    fillColor(
                                            ColorUtils.getPrimaryColorWithAlpha(this, ColorUtils.ColorType.PRIMARY_LIGHT, 150f)
                                    ))
                            .withFilter(eq(literal("$type"), literal("Polygon"))),
                    "POINT_LAYER"
            );
            style.addLayerAbove(new LineLayer("POLYGON_BORDER_LAYER", "teis")
                            .withProperties(
                                    lineColor(
                                            ColorUtils.getPrimaryColor(this, ColorUtils.ColorType.PRIMARY_DARK)
                                    ),
                                    lineWidth(2f))
                            .withFilter(eq(literal("$type"), literal("Polygon"))),
                    "POLYGON_LAYER"

            );
        }
    }
 
Example #20
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineOffsetFunctionPrimaryBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(Primary.BASE_LAYER_ID);
      assertNotNull(layer.getLineOffset());
      assertNotNull(layer.getLineOffset().getExpression());
    }
  });
}
 
Example #21
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineOffsetFunctionSecondaryBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(Secondary.BASE_LAYER_ID);
      assertNotNull(layer.getLineOffset());
      assertNotNull(layer.getLineOffset().getExpression());
    }
  });
}
 
Example #22
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineWidthFunctionMotorwayCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(MotorWay.CASE_LAYER_ID);
      assertNotNull(layer.getLineWidth());
      assertNotNull(layer.getLineWidth().getExpression());
    }
  });
}
 
Example #23
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineWidthFunctionMotorwayBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(MotorWay.BASE_LAYER_ID);
      assertNotNull(layer.getLineWidth());
      assertNotNull(layer.getLineWidth().getExpression());
    }
  });
}
 
Example #24
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineWidthFunctionTrunkCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(Trunk.CASE_LAYER_ID);
      assertNotNull(layer.getLineWidth());
      assertNotNull(layer.getLineWidth().getExpression());
    }
  });
}
 
Example #25
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineWidthFunctionTrunkBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(Trunk.BASE_LAYER_ID);
      assertNotNull(layer.getLineWidth());
      assertNotNull(layer.getLineWidth().getExpression());
    }
  });
}
 
Example #26
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineWidthFunctionPrimaryCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(Primary.CASE_LAYER_ID);
      assertNotNull(layer.getLineWidth());
      assertNotNull(layer.getLineWidth().getExpression());
    }
  });
}
 
Example #27
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineWidthFunctionPrimaryBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(Primary.BASE_LAYER_ID);
      assertNotNull(layer.getLineWidth());
      assertNotNull(layer.getLineWidth().getExpression());
    }
  });
}
 
Example #28
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineOffsetFunctionTrunkCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(Trunk.CASE_LAYER_ID);
      assertNotNull(layer.getLineOffset());
      assertNotNull(layer.getLineOffset().getExpression());
    }
  });
}
 
Example #29
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineWidthFunctionSecondaryBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(Secondary.BASE_LAYER_ID);
      assertNotNull(layer.getLineWidth());
      assertNotNull(layer.getLineWidth().getExpression());
    }
  });
}
 
Example #30
Source File: TrafficPluginTest.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineWidthFunctionLocalCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      LineLayer layer = mapboxMap.getStyle().getLayerAs(Local.CASE_LAYER_ID);
      assertNotNull(layer.getLineWidth());
      assertNotNull(layer.getLineWidth().getExpression());
    }
  });
}