Search in sources :

Example 1 with IsoChroneRequest

use of org.opentripplanner.analyst.request.IsoChroneRequest in project OpenTripPlanner by opentripplanner.

the class LIsochrone method computeIsochrone.

/**
 * Generic method to compute isochrones. Parse the request, call the adequate builder, and
 * return a list of generic isochrone data.
 *
 * @return
 * @throws Exception
 */
public List<IsochroneData> computeIsochrone() throws Exception {
    if (debug == null)
        debug = false;
    if (precisionMeters < 10)
        throw new IllegalArgumentException("Too small precisionMeters: " + precisionMeters);
    if (offRoadDistanceMeters < 10)
        throw new IllegalArgumentException("Too small offRoadDistanceMeters: " + offRoadDistanceMeters);
    IsoChroneRequest isoChroneRequest = new IsoChroneRequest(cutoffSecList);
    isoChroneRequest.includeDebugGeometry = debug;
    isoChroneRequest.precisionMeters = precisionMeters;
    isoChroneRequest.offRoadDistanceMeters = offRoadDistanceMeters;
    if (coordinateOrigin != null)
        isoChroneRequest.coordinateOrigin = new GenericLocation(null, coordinateOrigin).getCoordinate();
    RoutingRequest sptRequest = buildRequest();
    if (maxTimeSec != null) {
        isoChroneRequest.maxTimeSec = maxTimeSec;
    } else {
        isoChroneRequest.maxTimeSec = isoChroneRequest.maxCutoffSec;
    }
    Router router = otpServer.getRouter(routerId);
    return router.isoChroneSPTRenderer.getIsochrones(isoChroneRequest, sptRequest);
}
Also used : GenericLocation(org.opentripplanner.common.model.GenericLocation) Router(org.opentripplanner.standalone.Router) RoutingRequest(org.opentripplanner.routing.core.RoutingRequest) IsoChroneRequest(org.opentripplanner.analyst.request.IsoChroneRequest)

Aggregations

IsoChroneRequest (org.opentripplanner.analyst.request.IsoChroneRequest)1 GenericLocation (org.opentripplanner.common.model.GenericLocation)1 RoutingRequest (org.opentripplanner.routing.core.RoutingRequest)1 Router (org.opentripplanner.standalone.Router)1