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);
}
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);
}
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);
}
}
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);
}
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);
}
Aggregations