Search in sources :

Example 6 with IconBuilder

use of cl.smartcities.isci.transportinspector.map.model.busStop.IconBuilder in project androidApp by InspectorIncognito.

the class BusStopPlugin method updateSelectedBusStopIcons.

private void updateSelectedBusStopIcons() {
    ArrayList<IconBuilder> buildingList = new ArrayList<>();
    buildingList.add(new BusStopIconsBuilder(FeatureCollection.fromFeatures(new Feature[] { selectedBusStop })).toBuilder());
    final GenerateViewIconTask task = new GenerateViewIconTask(new GenerateViewIconTask.ImageLoaderListener() {

        @Override
        public void onImageGenResult(HashMap<String, View> viewMap, HashMap<String, Bitmap> bitmapHashMap) {
            if (mapboxMap != null) {
                mapboxMap.addImages(bitmapHashMap);
            }
            refreshBusStopSource();
        }
    }, viewMap, buildingList);
    task.execute();
}
Also used : GenerateViewIconTask(cl.smartcities.isci.transportinspector.map.tasks.GenerateViewIconTask) IconBuilder(cl.smartcities.isci.transportinspector.map.model.busStop.IconBuilder) ArrayList(java.util.ArrayList) Feature(com.mapbox.services.commons.geojson.Feature) View(android.view.View) Bitmap(android.graphics.Bitmap) BusStopIconsBuilder(cl.smartcities.isci.transportinspector.map.model.busStop.BusStopIconsBuilder)

Example 7 with IconBuilder

use of cl.smartcities.isci.transportinspector.map.model.busStop.IconBuilder in project androidApp by InspectorIncognito.

the class BusUserPlugin method updateUserEvents.

public void updateUserEvents(ArrayList<ServerSentEvent> newEvents, String reporterId) {
    if (currentUserBus != null && reporterId.equals(currentUserBus.getId())) {
        currentUserBus.setEvents(newEvents);
        final GeoJsonSource locationGeoJsonSource = mapboxMap.getSourceAs(LocationLayerConstants.LOCATION_SOURCE);
        ArrayList<IconBuilder> buildingList = new ArrayList<>();
        buildingList.add(new UserBusIconsBuilder(currentUserBus).toBuilder());
        GenerateViewIconTask task = new GenerateViewIconTask(new GenerateViewIconTask.ImageLoaderListener() {

            @Override
            public void onImageGenResult(HashMap<String, View> viewMap, HashMap<String, Bitmap> bitmapHashMap) {
                mapboxMap.addImages(bitmapHashMap);
                if (locationGeoJsonSource != null) {
                    locationGeoJsonSource.setGeoJson(userLocationFeature);
                }
            }
        }, viewMap, buildingList);
        task.execute();
    }
}
Also used : GeoJsonSource(com.mapbox.mapboxsdk.style.sources.GeoJsonSource) GenerateViewIconTask(cl.smartcities.isci.transportinspector.map.tasks.GenerateViewIconTask) IconBuilder(cl.smartcities.isci.transportinspector.map.model.busStop.IconBuilder) ArrayList(java.util.ArrayList) UserBusIconsBuilder(cl.smartcities.isci.transportinspector.map.model.bus.UserBusIconsBuilder) MapView(com.mapbox.mapboxsdk.maps.MapView) View(android.view.View) Bitmap(android.graphics.Bitmap)

Aggregations

Bitmap (android.graphics.Bitmap)7 IconBuilder (cl.smartcities.isci.transportinspector.map.model.busStop.IconBuilder)7 View (android.view.View)6 GenerateViewIconTask (cl.smartcities.isci.transportinspector.map.tasks.GenerateViewIconTask)6 ArrayList (java.util.ArrayList)6 UserBusIconsBuilder (cl.smartcities.isci.transportinspector.map.model.bus.UserBusIconsBuilder)3 BusStopIconsBuilder (cl.smartcities.isci.transportinspector.map.model.busStop.BusStopIconsBuilder)3 MapView (com.mapbox.mapboxsdk.maps.MapView)3 GeoJsonSource (com.mapbox.mapboxsdk.style.sources.GeoJsonSource)3 Feature (com.mapbox.services.commons.geojson.Feature)3 LayoutInflater (android.view.LayoutInflater)1 BusStop (cl.smartcities.isci.transportinspector.backend.BusStop)1 FavoriteHelper (cl.smartcities.isci.transportinspector.database.FavoriteHelper)1 BearingEngine (cl.smartcities.isci.transportinspector.map.engine.BearingEngine)1 DirectionEngine (cl.smartcities.isci.transportinspector.map.engine.DirectionEngine)1 BusMarker (cl.smartcities.isci.transportinspector.map.model.bus.BusMarker)1 MapBusIconsBuilder (cl.smartcities.isci.transportinspector.map.model.bus.MapBusIconsBuilder)1 BusStopMarker (cl.smartcities.isci.transportinspector.map.model.busStop.BusStopMarker)1 ServerSentEvent (cl.smartcities.isci.transportinspector.model.gson.ServerSentEvent)1 CameraUpdate (com.mapbox.mapboxsdk.camera.CameraUpdate)1