Search in sources :

Example 6 with GeoJsonSource

use of com.mapbox.mapboxsdk.style.sources.GeoJsonSource in project androidApp by InspectorIncognito.

the class BusUserPlugin method minimizeFeature.

private void minimizeFeature() {
    userLocationFeature.addBooleanProperty(LocationLayerConstants.PROPERTY_MAXIMIZED, false);
    GeoJsonSource locationGeoJsonSource = mapboxMap.getSourceAs(LocationLayerConstants.LOCATION_SOURCE);
    if (locationGeoJsonSource == null) {
        return;
    }
    locationGeoJsonSource.setGeoJson(userLocationFeature);
}
Also used : GeoJsonSource(com.mapbox.mapboxsdk.style.sources.GeoJsonSource)

Example 7 with GeoJsonSource

use of com.mapbox.mapboxsdk.style.sources.GeoJsonSource in project androidApp by InspectorIncognito.

the class BusUserPlugin method setOutOfBus.

private void setOutOfBus() {
    this.currentUserBus = null;
    onBusEngine.setOutOfBus();
    GeoJsonSource locationGeoJsonSource = mapboxMap.getSourceAs(LocationLayerConstants.LOCATION_SOURCE);
    if (locationGeoJsonSource == null) {
        return;
    }
    userLocationFeature.addBooleanProperty(LocationLayerConstants.PROPERTY_ON_BUS, false);
    userLocationFeature.addStringProperty(LocationLayerConstants.PROPERTY_ORIENTATION, "NONE");
    userLocationFeature.addBooleanProperty(LocationLayerConstants.PROPERTY_MAXIMIZED, false);
    locationGeoJsonSource.setGeoJson(userLocationFeature);
}
Also used : GeoJsonSource(com.mapbox.mapboxsdk.style.sources.GeoJsonSource)

Example 8 with GeoJsonSource

use of com.mapbox.mapboxsdk.style.sources.GeoJsonSource in project mapbox-navigation-android by mapbox.

the class MapUtils method updateMapSourceFromFeatureCollection.

/**
 * Takes a {@link FeatureCollection} and creates a map GeoJson source using the sourceId also
 * provided.
 *
 * @param mapboxMap  that the current mapView is using
 * @param collection the feature collection to be added to the map style
 * @param sourceId   the source's id for identifying it when adding layers
 * @since 0.8.0
 */
public static void updateMapSourceFromFeatureCollection(@NonNull MapboxMap mapboxMap, @Nullable FeatureCollection collection, @NonNull String sourceId) {
    if (collection == null) {
        collection = FeatureCollection.fromFeatures(new Feature[] {});
    }
    GeoJsonSource source = mapboxMap.getSourceAs(sourceId);
    if (source == null) {
        GeoJsonOptions routeGeoJsonOptions = new GeoJsonOptions().withMaxZoom(16);
        GeoJsonSource routeSource = new GeoJsonSource(sourceId, collection, routeGeoJsonOptions);
        mapboxMap.addSource(routeSource);
    } else {
        source.setGeoJson(collection);
    }
}
Also used : GeoJsonSource(com.mapbox.mapboxsdk.style.sources.GeoJsonSource) GeoJsonOptions(com.mapbox.mapboxsdk.style.sources.GeoJsonOptions) Feature(com.mapbox.services.commons.geojson.Feature)

Example 9 with GeoJsonSource

use of com.mapbox.mapboxsdk.style.sources.GeoJsonSource in project mapbox-plugins-android by mapbox.

the class LocationLayer method addLocationSource.

// 
// Source actions
// 
private void addLocationSource() {
    FeatureCollection emptyFeature = FeatureCollection.fromFeatures(new Feature[] {});
    GeoJsonSource locationSource = new GeoJsonSource(LOCATION_SOURCE, emptyFeature, new GeoJsonOptions().withMaxZoom(16));
    mapboxMap.addSource(locationSource);
    sourceMap.put(LOCATION_SOURCE, locationSource);
}
Also used : GeoJsonSource(com.mapbox.mapboxsdk.style.sources.GeoJsonSource) GeoJsonOptions(com.mapbox.mapboxsdk.style.sources.GeoJsonOptions) FeatureCollection(com.mapbox.geojson.FeatureCollection)

Example 10 with GeoJsonSource

use of com.mapbox.mapboxsdk.style.sources.GeoJsonSource in project androidApp by InspectorIncognito.

the class BusStopPlugin method setupBusRouteSource.

private void setupBusRouteSource() {
    busRouteStartSource = new GeoJsonSource(SOURCE_BUS_ROUTE_START, busRouteStartFeature);
    mapboxMap.addSource(busRouteStartSource);
    busRouteEndSource = new GeoJsonSource(SOURCE_BUS_ROUTE_END, busRouteEndFeature);
    mapboxMap.addSource(busRouteEndSource);
}
Also used : GeoJsonSource(com.mapbox.mapboxsdk.style.sources.GeoJsonSource)

Aggregations

GeoJsonSource (com.mapbox.mapboxsdk.style.sources.GeoJsonSource)15 Bitmap (android.graphics.Bitmap)3 View (android.view.View)3 UserBusIconsBuilder (cl.smartcities.isci.transportinspector.map.model.bus.UserBusIconsBuilder)3 IconBuilder (cl.smartcities.isci.transportinspector.map.model.busStop.IconBuilder)3 GenerateViewIconTask (cl.smartcities.isci.transportinspector.map.tasks.GenerateViewIconTask)3 MapView (com.mapbox.mapboxsdk.maps.MapView)3 ArrayList (java.util.ArrayList)3 GeoJsonOptions (com.mapbox.mapboxsdk.style.sources.GeoJsonOptions)2 Feature (com.mapbox.services.commons.geojson.Feature)2 PointF (android.graphics.PointF)1 NonNull (android.support.annotation.NonNull)1 BearingEngine (cl.smartcities.isci.transportinspector.map.engine.BearingEngine)1 DirectionEngine (cl.smartcities.isci.transportinspector.map.engine.DirectionEngine)1 BusClickHandler (cl.smartcities.isci.transportinspector.map.model.bus.BusClickHandler)1 MultiLayerOnMapClickListener (cl.smartcities.isci.transportinspector.map.utils.MultiLayerOnMapClickListener)1 PeriodicRequestHandler (cl.smartcities.isci.transportinspector.periodicRequest.PeriodicRequestHandler)1 JsonObject (com.google.gson.JsonObject)1 FeatureCollection (com.mapbox.geojson.FeatureCollection)1 LatLng (com.mapbox.mapboxsdk.geometry.LatLng)1