@Test public void constructTravellerInfo() throws Exception { Double[][] coordinates = {{1.0, 3.0}, {1.0, 3.0}}; Double[] coordinate = {1.0, 3.0}; Coordinate realCoordinate = new Coordinate(); realCoordinate.x = 1.0; realCoordinate.y = 3.0; IsochronesRequest request = new IsochronesRequest(); request.setProfile(APIEnums.Profile.DRIVING_CAR); request.setLocations(coordinates); List<Double> range = new ArrayList<>(); range.add(300.0); range.add(600.0); request.setRange(range); IsochronesRequestHandler isochronesRequestHandler = new IsochronesRequestHandler(); TravellerInfo travellerInfo = isochronesRequestHandler.constructTravellerInfo(coordinate, request); Assert.assertEquals(String.valueOf(0), travellerInfo.getId()); Assert.assertEquals(realCoordinate, travellerInfo.getLocation()); Assert.assertEquals("start", travellerInfo.getLocationType()); Assert.assertEquals(range.toString(), Arrays.toString(travellerInfo.getRanges())); Assert.assertEquals(TravelRangeType.TIME, travellerInfo.getRangeType()); }
TravellerInfo constructTravellerInfo(Double[] coordinate, IsochronesRequest request) throws Exception { TravellerInfo travellerInfo = new TravellerInfo(); RouteSearchParameters routeSearchParameters = constructRouteSearchParameters(request); travellerInfo.setRouteSearchParameters(routeSearchParameters); if (request.hasRangeType()) travellerInfo.setRangeType(convertRangeType(request.getRangeType())); if (request.hasLocationType()) travellerInfo.setLocationType(convertLocationType(request.getLocationType())); travellerInfo.setLocation(convertSingleCoordinate(coordinate)); travellerInfo.getRanges(); if (request.getRange() == null) { throw new ParameterValueException(IsochronesErrorCodes.MISSING_PARAMETER, IsochronesRequest.PARAM_RANGE); } List<Double> rangeValues = request.getRange(); Double intervalValue = request.getInterval(); setRangeAndIntervals(travellerInfo, rangeValues, intervalValue); return travellerInfo; }
IsochronesRequestHandler extends GenericHandler { TravellerInfo constructTravellerInfo(Double[] coordinate, IsochronesRequest request) throws Exception { TravellerInfo travellerInfo = new TravellerInfo(); RouteSearchParameters routeSearchParameters = constructRouteSearchParameters(request); travellerInfo.setRouteSearchParameters(routeSearchParameters); if (request.hasRangeType()) travellerInfo.setRangeType(convertRangeType(request.getRangeType())); if (request.hasLocationType()) travellerInfo.setLocationType(convertLocationType(request.getLocationType())); travellerInfo.setLocation(convertSingleCoordinate(coordinate)); travellerInfo.getRanges(); if (request.getRange() == null) { throw new ParameterValueException(IsochronesErrorCodes.MISSING_PARAMETER, IsochronesRequest.PARAM_RANGE); } List<Double> rangeValues = request.getRange(); Double intervalValue = request.getInterval(); setRangeAndIntervals(travellerInfo, rangeValues, intervalValue); return travellerInfo; } }
IsochronesRequestHandler extends GenericHandler { TravellerInfo constructTravellerInfo(Double[] coordinate, IsochronesRequest request) throws Exception { TravellerInfo travellerInfo = new TravellerInfo(); RouteSearchParameters routeSearchParameters = constructRouteSearchParameters(request); travellerInfo.setRouteSearchParameters(routeSearchParameters); if (request.hasRangeType()) travellerInfo.setRangeType(convertRangeType(request.getRangeType())); if (request.hasLocationType()) travellerInfo.setLocationType(convertLocationType(request.getLocationType())); travellerInfo.setLocation(convertSingleCoordinate(coordinate)); travellerInfo.getRanges(); if (request.getRange() == null) { throw new ParameterValueException(IsochronesErrorCodes.MISSING_PARAMETER, IsochronesRequest.PARAM_RANGE); } List<Double> rangeValues = request.getRange(); Double intervalValue = request.getInterval(); setRangeAndIntervals(travellerInfo, rangeValues, intervalValue); return travellerInfo; } IsochronesRequestHandler(); }
IsochronesRequestHandler extends GenericHandler { TravellerInfo constructTravellerInfo(Double[] coordinate, IsochronesRequest request) throws Exception { TravellerInfo travellerInfo = new TravellerInfo(); RouteSearchParameters routeSearchParameters = constructRouteSearchParameters(request); travellerInfo.setRouteSearchParameters(routeSearchParameters); if (request.hasRangeType()) travellerInfo.setRangeType(convertRangeType(request.getRangeType())); if (request.hasLocationType()) travellerInfo.setLocationType(convertLocationType(request.getLocationType())); travellerInfo.setLocation(convertSingleCoordinate(coordinate)); travellerInfo.getRanges(); if (request.getRange() == null) { throw new ParameterValueException(IsochronesErrorCodes.MISSING_PARAMETER, IsochronesRequest.PARAM_RANGE); } List<Double> rangeValues = request.getRange(); Double intervalValue = request.getInterval(); setRangeAndIntervals(travellerInfo, rangeValues, intervalValue); return travellerInfo; } IsochronesRequestHandler(); void generateIsochronesFromRequest(IsochronesRequest request); IsochroneMapCollection getIsoMaps(); IsochroneRequest getIsochroneRequest(); }
IsochronesRequestHandler extends GenericHandler { TravellerInfo constructTravellerInfo(Double[] coordinate, IsochronesRequest request) throws Exception { TravellerInfo travellerInfo = new TravellerInfo(); RouteSearchParameters routeSearchParameters = constructRouteSearchParameters(request); travellerInfo.setRouteSearchParameters(routeSearchParameters); if (request.hasRangeType()) travellerInfo.setRangeType(convertRangeType(request.getRangeType())); if (request.hasLocationType()) travellerInfo.setLocationType(convertLocationType(request.getLocationType())); travellerInfo.setLocation(convertSingleCoordinate(coordinate)); travellerInfo.getRanges(); if (request.getRange() == null) { throw new ParameterValueException(IsochronesErrorCodes.MISSING_PARAMETER, IsochronesRequest.PARAM_RANGE); } List<Double> rangeValues = request.getRange(); Double intervalValue = request.getInterval(); setRangeAndIntervals(travellerInfo, rangeValues, intervalValue); return travellerInfo; } IsochronesRequestHandler(); void generateIsochronesFromRequest(IsochronesRequest request); IsochroneMapCollection getIsoMaps(); IsochroneRequest getIsochroneRequest();  }