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 Project: graphhopper-navigation-android   Author: graphhopper   File: NavigationMapRoute.java    License: 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 #2
Source Project: graphhopper-navigation-android   Author: graphhopper   File: NavigationMapRoute.java    License: 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 #3
Source Project: graphhopper-navigation-android   Author: graphhopper   File: NavigationMapRoute.java    License: 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 #4
Source Project: graphhopper-navigation-android   Author: graphhopper   File: NavigationMapRoute.java    License: 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 #5
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPlugin.java    License: 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 #6
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPlugin.java    License: 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 #7
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPlugin.java    License: 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 #8
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPlugin.java    License: 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 #9
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPlugin.java    License: 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 #10
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPlugin.java    License: 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 #11
Source Project: AirMapSDK-Android   Author: airmap   File: MapStyleController.java    License: 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 #12
Source Project: AirMapSDK-Android   Author: airmap   File: MapStyleController.java    License: 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 #13
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 #14
Source Project: graphhopper-navigation-android   Author: graphhopper   File: MapLayerInteractor.java    License: MIT License 5 votes vote down vote up
private String retrieveSourceLayerId(Layer layer) {
  String sourceIdentifier;
  if (layer instanceof LineLayer) {
    sourceIdentifier = ((LineLayer) layer).getSourceLayer();
  } else {
    sourceIdentifier = ((SymbolLayer) layer).getSourceLayer();
  }
  return sourceIdentifier;
}
 
Example #15
Source Project: graphhopper-navigation-android   Author: graphhopper   File: NavigationMapboxMap.java    License: MIT License 5 votes vote down vote up
private void initializeStreetsSource(MapboxMap mapboxMap) {
  VectorSource streetSource = new VectorSource(STREETS_SOURCE_ID, MAPBOX_STREETS_V7);
  mapboxMap.addSource(streetSource);
  LineLayer streetsLayer = new LineLayer(STREETS_LAYER_ID, STREETS_SOURCE_ID)
    .withProperties(
      lineWidth(DEFAULT_WIDTH),
      lineColor(Color.WHITE)
    )
    .withSourceLayer(ROAD_LABEL);
  mapboxMap.addLayerAt(streetsLayer, LAST_INDEX);
}
 
Example #16
Source Project: graphhopper-navigation-android   Author: graphhopper   File: NavigationMapRoute.java    License: MIT License 5 votes vote down vote up
private void initializeArrowLayers(LineLayer shaftLayer, LineLayer shaftCasingLayer, SymbolLayer headLayer,
                                   SymbolLayer headCasingLayer) {
  arrowLayers = new ArrayList<>();
  arrowLayers.add(shaftCasingLayer);
  arrowLayers.add(shaftLayer);
  arrowLayers.add(headCasingLayer);
  arrowLayers.add(headLayer);
}
 
Example #17
Source Project: graphhopper-navigation-android   Author: graphhopper   File: NavigationMapRoute.java    License: MIT License 5 votes vote down vote up
/**
 * Add the route layer to the map either using the custom style values or the default.
 */
private void addRouteLayer(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(4f, 3f * scale),
      stop(10f, 4f * scale),
      stop(13f, 6f * scale),
      stop(16f, 10f * scale),
      stop(19f, 14f * scale),
      stop(22f, 18f * scale)
      )
    ),
    PropertyFactory.lineColor(match(
      Expression.toString(get(CONGESTION_KEY)),
      color(index == primaryRouteIndex ? routeDefaultColor : alternativeRouteDefaultColor),
      stop("moderate", color(index == primaryRouteIndex ? routeModerateColor : alternativeRouteModerateColor)),
      stop("heavy", color(index == primaryRouteIndex ? routeSevereColor : alternativeRouteSevereColor)),
      stop("severe", color(index == primaryRouteIndex ? routeSevereColor : alternativeRouteSevereColor))
      )
    )
  );
  MapUtils.addLayerToMap(mapboxMap, routeLayer, belowLayer);
}
 
Example #18
Source Project: graphhopper-navigation-android   Author: graphhopper   File: MapLayerInteractorTest.java    License: MIT License 5 votes vote down vote up
@Test
public void updateLayerVisibility_visibilityIsSet() {
  LineLayer anySymbolOrLineLayer = mock(LineLayer.class);
  when(anySymbolOrLineLayer.getSourceLayer()).thenReturn("any");
  List<Layer> layers = buildLayerListWith(anySymbolOrLineLayer);
  MapboxMap map = mock(MapboxMap.class);
  when(map.getLayers()).thenReturn(layers);
  MapLayerInteractor layerInteractor = new MapLayerInteractor(map);

  layerInteractor.updateLayerVisibility(true, "any");

  verify(anySymbolOrLineLayer).setProperties(any(PropertyValue.class));
}
 
Example #19
Source Project: graphhopper-navigation-android   Author: graphhopper   File: MapLayerInteractorTest.java    License: MIT License 5 votes vote down vote up
@Test
public void isLayerVisible_visibleReturnsFalse() {
  LineLayer anySymbolOrLineLayer = mock(LineLayer.class);
  when(anySymbolOrLineLayer.getSourceLayer()).thenReturn("any");
  when(anySymbolOrLineLayer.getVisibility()).thenReturn(visibility(Property.NONE));
  List<Layer> layers = buildLayerListWith(anySymbolOrLineLayer);
  MapboxMap map = mock(MapboxMap.class);
  when(map.getLayers()).thenReturn(layers);
  MapLayerInteractor layerInteractor = new MapLayerInteractor(map);

  boolean isVisible = layerInteractor.isLayerVisible("any");

  assertFalse(isVisible);
}
 
Example #20
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPluginTest.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineCapSecondaryBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getStyle().getLayerAs(Secondary.BASE_LAYER_ID)).getLineCap().getValue());
    }
  });
}
 
Example #21
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPluginTest.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineCapSecondaryCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getStyle().getLayerAs(Secondary.CASE_LAYER_ID)).getLineCap().getValue());
    }
  });
}
 
Example #22
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPluginTest.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineCapLocalBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getStyle().getLayerAs(Local.BASE_LAYER_ID)).getLineCap().getValue());
    }
  });
}
 
Example #23
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPluginTest.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineCapLocalCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getStyle().getLayerAs(Local.CASE_LAYER_ID)).getLineCap().getValue());
    }
  });
}
 
Example #24
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPluginTest.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineCapPrimaryBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getStyle().getLayerAs(Primary.BASE_LAYER_ID)).getLineCap().getValue());
    }
  });
}
 
Example #25
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPluginTest.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineCapPrimaryCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getStyle().getLayerAs(Primary.CASE_LAYER_ID)).getLineCap().getValue());
    }
  });
}
 
Example #26
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPluginTest.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineCapTrunkBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getStyle().getLayerAs(Trunk.BASE_LAYER_ID)).getLineCap().getValue());
    }
  });
}
 
Example #27
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPluginTest.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineCapTrunkCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getStyle().getLayerAs(Trunk.CASE_LAYER_ID)).getLineCap().getValue());
    }
  });
}
 
Example #28
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPluginTest.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineJoinLocalBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getStyle().getLayerAs(Local.BASE_LAYER_ID)).getLineJoin().getValue());
    }
  });
}
 
Example #29
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPluginTest.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineJoinLocalCaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getStyle().getLayerAs(Local.CASE_LAYER_ID)).getLineJoin().getValue());
    }
  });
}
 
Example #30
Source Project: mapbox-plugins-android   Author: mapbox   File: TrafficPluginTest.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void lineJoinSecondaryBaseLayer() throws Exception {
  executeTrafficTest(new TrafficPluginAction.OnPerformTrafficAction() {
    @Override
    public void onTrafficAction(TrafficPlugin trafficPlugin, MapboxMap mapboxMap, UiController controller) {
      assertEquals(ROUND, ((LineLayer) mapboxMap.getStyle().getLayerAs(Secondary.BASE_LAYER_ID)).getLineJoin().getValue());
    }
  });
}