fix(javaTest): correct route comparison and layer visibility
This commit is contained in:
@@ -40,6 +40,12 @@ final class HistoricalRouteQualityMapper {
|
||||
}
|
||||
|
||||
double historicalDistance = distanceCalculator.pathDistance(map, historicalPath);
|
||||
if (plannedPath.isEmpty()) {
|
||||
// 失败或仍等待的任务没有新路线,不能把“无结果”伪装成算法质量退化。
|
||||
return new HistoricalRouteComparison(
|
||||
HistoricalRouteComparison.Comparability.COMPARABLE,
|
||||
null, historicalDistance, null);
|
||||
}
|
||||
if (!isValidPath(map, plannedPath)) {
|
||||
return new HistoricalRouteComparison(
|
||||
HistoricalRouteComparison.Comparability.COMPARABLE,
|
||||
|
||||
@@ -548,7 +548,9 @@
|
||||
}
|
||||
hideMapHint();
|
||||
|
||||
drawPath(layer, approach, "approach", project);
|
||||
if (elements["show-current-route"].checked) {
|
||||
drawPath(layer, approach, "approach", project);
|
||||
}
|
||||
if (elements["show-initial-route"].checked) {
|
||||
drawPath(layer, initialService, "initial-service", project);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
class HistoricalRouteQualityMapperTest {
|
||||
|
||||
@@ -70,6 +71,20 @@ class HistoricalRouteQualityMapperTest {
|
||||
comparison.getQualityCategory());
|
||||
}
|
||||
|
||||
@Test
|
||||
void excludesMissingPlannedRouteFromQualityClassification() {
|
||||
GridMap map = map();
|
||||
HistoricalRouteComparison comparison = new HistoricalRouteQualityMapper().compare(
|
||||
map, "A", "D", Arrays.asList("A", "B", "D"),
|
||||
Collections.<String>emptyList(), null, null);
|
||||
|
||||
assertEquals(HistoricalRouteComparison.Comparability.COMPARABLE,
|
||||
comparison.getComparability());
|
||||
assertEquals(10.0d, comparison.getHistoricalPhysicalDistance(), 0.000001d);
|
||||
assertNull(comparison.getPlannedPhysicalDistance());
|
||||
assertNull(comparison.getQualityCategory());
|
||||
}
|
||||
|
||||
private RouteQuality quality(GridMap map, java.util.List<String> path,
|
||||
TrafficRouteSnapshot snapshot) {
|
||||
double distance = new com.ft546.wcs.demo.traffic.RouteCandidatePlanner()
|
||||
|
||||
Reference in New Issue
Block a user