Search in sources :

Example 1 with RouteHelper

use of cl.smartcities.isci.transportinspector.database.RouteHelper in project androidApp by InspectorIncognito.

the class BusStopPlugin method busFeatureClick.

private void busFeatureClick(Feature selectedBusFeature) {
    Log.d("BusStopPlugin", "busFeatureClick");
    Feature busFeature = getFeatureByStringProperty(selectedBusFeature, busesFeatures, BusMarker.PROPERTY_ID);
    if (busFeature == null) {
        return;
    }
    if (selectedBus != null) {
        if (busFeature.getId().equals(selectedBus.getId())) {
            boolean maximized = selectedBus.getBooleanProperty(BusMarker.PROPERTY_MAXIMIZED);
            selectedBus.addBooleanProperty(BusMarker.PROPERTY_MAXIMIZED, !maximized);
            refreshBusSource();
            return;
        } else {
            deselectSelectedBusFeature();
        }
    }
    busFeature.addBooleanProperty(BusMarker.PROPERTY_MAXIMIZED, true);
    selectedBus = busFeature;
    selectedBusStop.addBooleanProperty(BusStopMarker.PROPERTY_MAXIMIZED, false);
    refreshBusSource();
    refreshBusStopSource();
    RouteHelper helper = new RouteHelper(getContext());
    ServerSentBus bus = ((BusMarker) busFeature).getBus();
    ArrayList<LatLng> points = helper.getRoute(bus.getService(), bus.getDirection());
    busPolyline = addBusRoutePolyline(points, Constants.BUS_COLOR.get(bus.getColorArrayIndex()));
    animateCameraToSelection(busFeature);
}
Also used : BusMarker(cl.smartcities.isci.transportinspector.map.model.bus.BusMarker) RouteHelper(cl.smartcities.isci.transportinspector.database.RouteHelper) LatLng(com.mapbox.mapboxsdk.geometry.LatLng) Feature(com.mapbox.services.commons.geojson.Feature) ServerSentBus(cl.smartcities.isci.transportinspector.model.gson.ServerSentBus)

Example 2 with RouteHelper

use of cl.smartcities.isci.transportinspector.database.RouteHelper in project androidApp by InspectorIncognito.

the class BusSearchResultActivity method setRouteLists.

private void setRouteLists(Service service) {
    RouteHelper routeHelper = new RouteHelper(this);
    ServiceHelper serviceHelper = new ServiceHelper(this);
    BusStopHelper busStopHelper = new BusStopHelper(this);
    activePoints = routeHelper.getRoute(service.getName(), "I");
    if (activePoints == null) {
        activePoints = new ArrayList<>();
    }
    inactivePoints = routeHelper.getRoute(service.getName(), "R");
    if (inactivePoints == null) {
        inactivePoints = new ArrayList<>();
    }
    String busStopByService = serviceHelper.getBusStopByService(service.getName(), "I");
    if (busStopByService == null || busStopByService.equals("")) {
        activeBusStops = new ArrayList<>();
    } else {
        activeBusStops = busStopHelper.getAllBusStopsIn(busStopByService.split("-"));
    }
    busStopByService = serviceHelper.getBusStopByService(service.getName(), "R");
    if (busStopByService == null || busStopByService.equals("")) {
        inactiveBusStops = new ArrayList<>();
    } else {
        inactiveBusStops = busStopHelper.getAllBusStopsIn(busStopByService.split("-"));
    }
}
Also used : BusStopHelper(cl.smartcities.isci.transportinspector.database.BusStopHelper) RouteHelper(cl.smartcities.isci.transportinspector.database.RouteHelper) ServiceHelper(cl.smartcities.isci.transportinspector.database.ServiceHelper)

Example 3 with RouteHelper

use of cl.smartcities.isci.transportinspector.database.RouteHelper in project androidApp by InspectorIncognito.

the class OnBusEngine method setOnBus.

public void setOnBus(ServerSentBus bus) {
    this.bus = bus;
    RouteHelper helper = new RouteHelper(TranSappApplication.getAppContext());
    ArrayList<LatLng> points = helper.getRoute(bus.getService(), bus.getDirection());
    busPolyline = addBusRoutePolyline(points, Constants.BUS_COLOR.get(bus.getColorArrayIndex()));
    setBusStopDrawable();
    getRouteBusStop();
}
Also used : RouteHelper(cl.smartcities.isci.transportinspector.database.RouteHelper) LatLng(com.mapbox.mapboxsdk.geometry.LatLng)

Aggregations

RouteHelper (cl.smartcities.isci.transportinspector.database.RouteHelper)3 LatLng (com.mapbox.mapboxsdk.geometry.LatLng)2 BusStopHelper (cl.smartcities.isci.transportinspector.database.BusStopHelper)1 ServiceHelper (cl.smartcities.isci.transportinspector.database.ServiceHelper)1 BusMarker (cl.smartcities.isci.transportinspector.map.model.bus.BusMarker)1 ServerSentBus (cl.smartcities.isci.transportinspector.model.gson.ServerSentBus)1 Feature (com.mapbox.services.commons.geojson.Feature)1