use of cl.smartcities.isci.transportinspector.map.engine.DirectionEngine in project androidApp by InspectorIncognito.
the class BusUserPlugin method setOnBus.
private void setOnBus() {
final GeoJsonSource locationGeoJsonSource = mapboxMap.getSourceAs(LocationLayerConstants.LOCATION_SOURCE);
if (locationGeoJsonSource == null) {
return;
}
this.directionDetectionEngine = new DirectionEngine(10, currentUserBus.getService());
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) {
if (mapboxMap != null) {
mapboxMap.addImages(bitmapHashMap);
} else {
return;
}
BearingEngine.Orientation orientation;
if (currentUserBus.isFlipped()) {
userLocationFeature.addStringProperty(LocationLayerConstants.PROPERTY_ORIENTATION, "LEFT");
orientation = BearingEngine.Orientation.Left;
} else {
userLocationFeature.addStringProperty(LocationLayerConstants.PROPERTY_ORIENTATION, "RIGHT");
orientation = BearingEngine.Orientation.Right;
}
userLocationFeature.addBooleanProperty(LocationLayerConstants.PROPERTY_ON_BUS, true);
bearingEngine = new BearingEngine(mapboxMap, previousPoint, orientation);
if (currentUserBus.getDirection() != null && !currentUserBus.getDirection().isEmpty()) {
onBusEngine.setOnBus(currentUserBus);
}
locationGeoJsonSource.setGeoJson(userLocationFeature);
mapboxMap.animateCamera(CameraUpdateFactory.newLatLng(MapboxUtil.convertToLatLng(userLocationFeature)));
}
}, viewMap, buildingList);
task.execute();
}
Aggregations