Search in sources :

Example 1 with SymbolLayer

use of com.mapbox.mapboxsdk.style.layers.SymbolLayer in project mapbox-plugins-android by mapbox.

the class LocationLayer method addSymbolLayer.

private void addSymbolLayer(String layerId, String beforeLayerId) {
    SymbolLayer layer = new SymbolLayer(layerId, LOCATION_SOURCE);
    layer.setProperties(iconAllowOverlap(true), iconIgnorePlacement(true), iconSize(interpolate(exponential(1f), zoom(), stop(0f, 0.6f), stop(18f, 1.2f))), iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP));
    addLayerToMap(layer, beforeLayerId);
}
Also used : SymbolLayer(com.mapbox.mapboxsdk.style.layers.SymbolLayer)

Example 2 with SymbolLayer

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

the class RouteLayer method setupLayers.

public void setupLayers(String suffix, MapboxMap mapboxMap, Context context, String startSource, String endSource) {
    Bitmap iconStart = BitmapFactory.decodeResource(context.getResources(), R.drawable.circulo_inicio);
    Bitmap iconEnd = BitmapFactory.decodeResource(context.getResources(), R.drawable.circulo_fin);
    mapboxMap.addImage("startRouteIcon", iconStart);
    mapboxMap.addImage("endRouteIcon", iconEnd);
    mapboxMap.addLayer(new SymbolLayer(BUS_ROUTE_LAYER_ID_START + suffix, startSource).withProperties(iconImage("startRouteIcon"), iconSize(0.8f), /* allows show all icons */
    iconAllowOverlap(true)));
    mapboxMap.addLayer(new SymbolLayer(BUS_ROUTE_LAYER_ID_END + suffix, endSource).withProperties(iconImage("endRouteIcon"), iconSize(0.8f), /* allows show all icons */
    iconAllowOverlap(true)));
}
Also used : Bitmap(android.graphics.Bitmap) SymbolLayer(com.mapbox.mapboxsdk.style.layers.SymbolLayer)

Example 3 with SymbolLayer

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

the class LocationLayer method addInfoWindowLayer.

private void addInfoWindowLayer(String image) {
    Layer infoWindowLayer = new SymbolLayer(LocationLayerConstants.LOCATION_LAYER_INFO_WINDOW, LocationLayerConstants.LOCATION_SOURCE).withProperties(iconImage(image + "-max"), /* set anchor of icon to bottom-left */
    iconAnchor("bottom-left"), iconAllowOverlap(true), /* offset icon slightly to match bubble layout */
    iconOffset(new Float[] { BusMarker.MAX_DX_OFFSET, BusMarker.MAX_DY_OFFSET })).withFilter(eq(LocationLayerConstants.PROPERTY_MAXIMIZED, true));
    addLocationLayerToMap(infoWindowLayer);
}
Also used : SymbolLayer(com.mapbox.mapboxsdk.style.layers.SymbolLayer) Layer(com.mapbox.mapboxsdk.style.layers.Layer) SymbolLayer(com.mapbox.mapboxsdk.style.layers.SymbolLayer)

Example 4 with SymbolLayer

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

the class BusStopLayer method setupAllLayers.

public void setupAllLayers(MapboxMap mapboxMap, Context context, String busStopsSource) {
    Bitmap icon = BitmapFactory.decodeResource(context.getResources(), R.drawable.paradero);
    mapboxMap.addImage("busStopIcon", icon);
    // LOADING LAYER
    mapboxMap.addLayer(new CircleLayer(BUS_STOP_LOADING_LAYER_ID, busStopsSource).withProperties(circleRadius(property(BusStopMarker.PROPERTY_LOADING_PROGRESS, exponential(getLoadingAnimationStops()))), PropertyFactory.circlePitchAlignment(Property.CIRCLE_PITCH_ALIGNMENT_MAP), PropertyFactory.iconRotationAlignment(Property.ICON_ROTATION_ALIGNMENT_MAP), circleColor(ContextCompat.getColor(context, R.color.green_button)), circleOpacity(0.6f)).withFilter(eq(BusStopMarker.PROPERTY_LOADING, true)));
    // MARKER LAYER
    Layer layer = new SymbolLayer(BUS_STOP_MARKER_LAYER_ID, busStopsSource).withProperties(iconImage("busStopIcon"), iconSize(0.8f), /* allows show all icons */
    iconAllowOverlap(true), iconOffset(new Float[] { BusStopMarker.MARKER_DX_OFFSET, BusStopMarker.MARKER_DY_OFFSET })).withFilter(eq(BusStopMarker.PROPERTY_SELECTED, false));
    layer.setMinZoom(15);
    mapboxMap.addLayer(layer);
    // SELECTED MARKER LAYER
    mapboxMap.addLayer(new SymbolLayer(BUS_STOP_SELECTED_MARKER_LAYER_ID, busStopsSource).withProperties(iconImage("busStopIcon"), iconSize(0.8f), /* allows show all icons */
    iconAllowOverlap(true), iconOffset(new Float[] { BusStopMarker.MARKER_DX_OFFSET, BusStopMarker.MARKER_DY_OFFSET })).withFilter(eq(BusStopMarker.PROPERTY_SELECTED, true)));
    // MIN INFO WINDOW LAYER
    mapboxMap.addLayer(new SymbolLayer(BUS_STOP_INFO_WINDOW_LAYER_ID_MIN, busStopsSource).withProperties(/* show image with id title based on the value of the maximized feature property */
    iconImage("{ID}-min"), /* set anchor of icon to bottom-left */
    iconAnchor("bottom-left"), /* offset icon slightly to match bubble layout */
    iconOffset(new Float[] { BusStopMarker.MIN_DX_OFFSET, BusStopMarker.MIN_DY_OFFSET })).withFilter(all(eq(BusStopMarker.PROPERTY_SELECTED, true), eq(BusStopMarker.PROPERTY_LOADING, false), eq(BusStopMarker.PROPERTY_MAXIMIZED, false))));
    // MAX INFO WINDOW LAYER
    mapboxMap.addLayer(new SymbolLayer(BUS_STOP_INFO_WINDOW_LAYER_ID_MAX, busStopsSource).withProperties(/* show image with id title based on the value of the maximized feature property */
    iconImage("{ID}-max"), /* set anchor of icon to bottom-left */
    iconAnchor("bottom-left"), /* offset icon slightly to match bubble layout */
    iconOffset(new Float[] { BusStopMarker.MAX_DX_OFFSET, BusStopMarker.MAX_DY_OFFSET })).withFilter(all(eq(BusStopMarker.PROPERTY_SELECTED, true), eq(BusStopMarker.PROPERTY_LOADING, false), eq(BusStopMarker.PROPERTY_MAXIMIZED, true))));
}
Also used : Bitmap(android.graphics.Bitmap) SymbolLayer(com.mapbox.mapboxsdk.style.layers.SymbolLayer) CircleLayer(com.mapbox.mapboxsdk.style.layers.CircleLayer) Layer(com.mapbox.mapboxsdk.style.layers.Layer) SymbolLayer(com.mapbox.mapboxsdk.style.layers.SymbolLayer) CircleLayer(com.mapbox.mapboxsdk.style.layers.CircleLayer)

Example 5 with SymbolLayer

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

the class NavigationMapRoute method drawWaypointMarkers.

private void drawWaypointMarkers(@NonNull MapboxMap mapboxMap, @Nullable Drawable originMarker, @Nullable Drawable destinationMarker) {
    if (originMarker == null || destinationMarker == null) {
        return;
    }
    SymbolLayer waypointLayer = mapboxMap.getLayerAs(WAYPOINT_LAYER_ID);
    if (waypointLayer == null) {
        Bitmap bitmap = MapImageUtils.getBitmapFromDrawable(originMarker);
        mapboxMap.addImage("originMarker", bitmap);
        bitmap = MapImageUtils.getBitmapFromDrawable(destinationMarker);
        mapboxMap.addImage("destinationMarker", bitmap);
        waypointLayer = new SymbolLayer(WAYPOINT_LAYER_ID, WAYPOINT_SOURCE_ID).withProperties(PropertyFactory.iconImage(Function.property("waypoint", categorical(stop("origin", PropertyFactory.iconImage("originMarker")), stop("destination", PropertyFactory.iconImage("destinationMarker"))))), PropertyFactory.iconSize(Function.zoom(Stops.exponential(Stop.stop(22f, PropertyFactory.iconSize(2.8f)), Stop.stop(12f, PropertyFactory.iconSize(1.3f)), Stop.stop(10f, PropertyFactory.iconSize(0.8f)), Stop.stop(0f, PropertyFactory.iconSize(0.6f))).withBase(1.5f))), PropertyFactory.iconPitchAlignment(Property.ANCHOR_MAP), PropertyFactory.iconAllowOverlap(true), PropertyFactory.iconIgnorePlacement(true));
        layerIds.add(WAYPOINT_LAYER_ID);
        MapUtils.addLayerToMap(mapboxMap, waypointLayer, belowLayer);
    }
}
Also used : Bitmap(android.graphics.Bitmap) SymbolLayer(com.mapbox.mapboxsdk.style.layers.SymbolLayer)

Aggregations

SymbolLayer (com.mapbox.mapboxsdk.style.layers.SymbolLayer)11 Layer (com.mapbox.mapboxsdk.style.layers.Layer)5 Bitmap (android.graphics.Bitmap)4 CircleLayer (com.mapbox.mapboxsdk.style.layers.CircleLayer)1 LineLayer (com.mapbox.mapboxsdk.style.layers.LineLayer)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 Test (org.junit.Test)1