use of com.graphhopper.config.CHProfile in project graphhopper by graphhopper.
the class CHProfileSelectorTest method missingWeighting_multiplePossibilities_throws.
@Test
public void missingWeighting_multiplePossibilities_throws() {
List<Profile> profiles = Arrays.asList(fastBike, shortBike);
List<CHProfile> chProfiles = Arrays.asList(new CHProfile("fast_bike"), new CHProfile("short_bike"));
assertCHProfileSelectionError(MULTIPLE_MATCHES_ERROR, profiles, chProfiles, "bike", null, null, null);
}
use of com.graphhopper.config.CHProfile in project graphhopper by graphhopper.
the class CHProfileSelectorTest method onlyNodeBasedPresent.
@Test
public void onlyNodeBasedPresent() {
List<Profile> profiles = Collections.singletonList(fastCar);
List<CHProfile> chProfiles = Collections.singletonList(new CHProfile("fast_car"));
assertCHProfileSelectionError(NO_MATCH_ERROR, profiles, chProfiles, true, null);
assertCHProfileSelectionError(NO_MATCH_ERROR, profiles, chProfiles, true, 20);
assertProfileFound(profiles.get(0), profiles, chProfiles, false, null);
assertCHProfileSelectionError(NO_MATCH_ERROR, profiles, chProfiles, false, 20);
assertProfileFound(profiles.get(0), profiles, chProfiles, null, null);
assertCHProfileSelectionError(NO_MATCH_ERROR, profiles, chProfiles, null, 30);
String error = assertCHProfileSelectionError(NO_MATCH_ERROR, profiles, chProfiles, "foot", "fastest", false, null);
assertTrue(error.contains("requested: fastest|foot|turn_costs=false|u_turn_costs=*"), error);
assertTrue(error.contains("available: [fastest|car|turn_costs=false]"), error);
}
use of com.graphhopper.config.CHProfile in project graphhopper by graphhopper.
the class CHProfileSelectorTest method missingWeightingMultipleProfiles.
@Test
public void missingWeightingMultipleProfiles() {
List<Profile> profiles = Arrays.asList(fastBike, fastCarEdge10, fastBikeEdge40);
List<CHProfile> chProfiles = Arrays.asList(new CHProfile("fast_bike"), new CHProfile("fast_car_edge10"), new CHProfile("fast_bike_edge40"));
// the weighting is not given but only fastest is used so its fine. note that we prefer edge-based because no edge_based parameter is specified
assertProfileFound(profiles.get(2), profiles, chProfiles, "bike", null, null, null);
// if we do not specify the vehicle its not clear what to return -> there is an error
assertCHProfileSelectionError(MULTIPLE_MATCHES_ERROR, profiles, chProfiles, null, null, null, null);
// if we do not specify the vehicle but edge_based=false its clear what to return because for node-based there is only one weighting
assertProfileFound(profiles.get(0), profiles, chProfiles, null, null, false, null);
// ... for edge_based=true this is an error, because there are two edge_based profiles
assertCHProfileSelectionError(MULTIPLE_MATCHES_ERROR, profiles, chProfiles, null, null, true, null);
// ... we can however get a clear match if we specify the u-turn costs
assertProfileFound(profiles.get(1), profiles, chProfiles, null, null, true, 10);
}
use of com.graphhopper.config.CHProfile in project graphhopper by graphhopper.
the class CHProfileSelectorTest method multipleEdgeBased.
@Test
public void multipleEdgeBased() {
List<Profile> profiles = Arrays.asList(fastCar, fastCarEdge30, fastCarEdge50);
List<CHProfile> chProfiles = Arrays.asList(new CHProfile("fast_car"), new CHProfile("fast_car_edge30"), new CHProfile("fast_car_edge50"));
// when no u-turns are specified we throw
assertCHProfileSelectionError(MULTIPLE_MATCHES_ERROR, profiles, chProfiles, true, null);
// when we request one that does not exist we throw
assertCHProfileSelectionError(NO_MATCH_ERROR, profiles, chProfiles, true, 40);
// when we request one that exists it works
assertProfileFound(profiles.get(1), profiles, chProfiles, true, 30);
// without specifying edge-based we also get an error
assertProfileFound(profiles.get(1), profiles, chProfiles, null, 30);
assertCHProfileSelectionError(NO_MATCH_ERROR, profiles, chProfiles, null, 40);
String error = assertCHProfileSelectionError(MULTIPLE_MATCHES_ERROR, profiles, chProfiles, null, null);
assertTrue(error.contains("requested: fastest|car|turn_costs=*|u_turn_costs=*"), error);
assertTrue(error.contains("matched: [fastest|car|turn_costs=false, fastest|car|turn_costs=true|u_turn_costs=30, fastest|car|turn_costs=true|u_turn_costs=50]"), error);
assertTrue(error.contains("available: [fastest|car|turn_costs=false, fastest|car|turn_costs=true|u_turn_costs=30, fastest|car|turn_costs=true|u_turn_costs=50]"), error);
}
use of com.graphhopper.config.CHProfile in project graphhopper by graphhopper.
the class CHProfileSelectorTest method missingVehicleOrWeighting_otherVehicleAndCar.
@Test
public void missingVehicleOrWeighting_otherVehicleAndCar() {
List<Profile> profiles = Collections.singletonList(shortBike);
List<CHProfile> chProfiles = Collections.singletonList(new CHProfile("short_bike"));
assertProfileFound(profiles.get(0), profiles, chProfiles, "bike", "shortest", null, null);
assertProfileFound(profiles.get(0), profiles, chProfiles, "bike", null, null, null);
assertProfileFound(profiles.get(0), profiles, chProfiles, null, "shortest", null, null);
assertProfileFound(profiles.get(0), profiles, chProfiles, null, null, null, null);
}
Aggregations