Search in sources :

Example 11 with Layer

use of com.mapbox.mapboxsdk.style.layers.Layer in project androidApp by InspectorIncognito.

the class OnBusEngine method setupBusStopRouteLayer.

private void setupBusStopRouteLayer() {
    busStopSource = new GeoJsonSource(SOURCE_BUS_STOPS, FeatureCollection.fromFeatures(new Feature[] {}));
    mapboxMap.addSource(busStopSource);
    Layer routeLayer = new SymbolLayer("BUS_STOP_ROUTE_ID", SOURCE_BUS_STOPS).withProperties(iconImage("routeBusIcon"), iconSize(0.8f), /* allows show all icons */
    iconAllowOverlap(true), iconOffset(new Float[] { BusStopMarker.MARKER_DX_OFFSET, BusStopMarker.MARKER_DY_OFFSET }));
    routeLayer.setMinZoom(15);
    mapboxMap.addLayerAbove(routeLayer, BUS_STOP_SELECTED_MARKER_LAYER_ID);
}
Also used : GeoJsonSource(com.mapbox.mapboxsdk.style.sources.GeoJsonSource) SymbolLayer(com.mapbox.mapboxsdk.style.layers.SymbolLayer) Layer(com.mapbox.mapboxsdk.style.layers.Layer) SymbolLayer(com.mapbox.mapboxsdk.style.layers.SymbolLayer)

Example 12 with Layer

use of com.mapbox.mapboxsdk.style.layers.Layer in project mapbox-navigation-android by mapbox.

the class NavigationMapRoute method addRouteShieldLayer.

/**
 * 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(Function.zoom(exponential(stop(10f, PropertyFactory.lineWidth(7f)), stop(14f, PropertyFactory.lineWidth(10.5f * scale)), stop(16.5f, PropertyFactory.lineWidth(15.5f * scale)), stop(19f, PropertyFactory.lineWidth(24f * scale)), stop(22f, PropertyFactory.lineWidth(29f * scale))).withBase(1.5f))), PropertyFactory.lineColor(index == primaryRouteIndex ? routeShieldColor : alternativeRouteShieldColor));
    MapUtils.addLayerToMap(mapboxMap, routeLayer, belowLayer);
}
Also used : LineLayer(com.mapbox.mapboxsdk.style.layers.LineLayer) Layer(com.mapbox.mapboxsdk.style.layers.Layer) SymbolLayer(com.mapbox.mapboxsdk.style.layers.SymbolLayer) LineLayer(com.mapbox.mapboxsdk.style.layers.LineLayer)

Aggregations

Layer (com.mapbox.mapboxsdk.style.layers.Layer)12 SymbolLayer (com.mapbox.mapboxsdk.style.layers.SymbolLayer)12 LineLayer (com.mapbox.mapboxsdk.style.layers.LineLayer)6 Bitmap (android.graphics.Bitmap)1 CircleLayer (com.mapbox.mapboxsdk.style.layers.CircleLayer)1 GeoJsonSource (com.mapbox.mapboxsdk.style.sources.GeoJsonSource)1 Source (com.mapbox.mapboxsdk.style.sources.Source)1 VectorSource (com.mapbox.mapboxsdk.style.sources.VectorSource)1