Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -588,14 +588,9 @@ else if (roadName == null && !tempState.get(this.roundaboutAccessEnc)) {
boolean matchesPreviousEdgeName = (currentIsBlank && previousIsBlank)
|| (currentEdgeRoadName != null && currentEdgeRoadName.equals(previousRoadName));

if (matchesPreviousEdgeName && !currentIsBlank) {
currentEdge = tempEdge;
usedEdges.add(tempEdge);
break;
}

// Collect both named and unnamed edges for angle-based selection when continuing from an unnamed road.
if (previousIsBlank) {
// Collect all qualifying unnamed edges that either match the previous edge name or are the first unnamed edge after a named edge.
// After the loop we will select the straightest edge from this list to continue the path.
if ((matchesPreviousEdgeName && !currentIsBlank) || previousIsBlank) {
candidateEdgesFromUnnamedRoad.add(tempEdge);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,24 @@ public void testBidirectionalUpstreamPathWhenRequireRoadMatchIsFalse() {
assertNotEquals(lineString0.getCoordinates()[0], lineString1.getCoordinates()[0]);
}

@Test
public void testUnidirectionalUpstreamPathWithUnnamedEdgeStart() {
JsonFeatureCollection featureCollection;
try (Response response = clientTarget(app, "/buffer?queryMultiplier=.000075&"
+ "point=42.531666,1.520129&roadName=CG-3&thresholdDistance=200&buildUpstream=true")
.request().buildGet().invoke()) {
assertEquals(200, response.getStatus());

featureCollection = response.readEntity(JsonFeatureCollection.class);
}

// Expect a single feature collection for unidirectional
assertEquals(1, featureCollection.getFeatures().size());
// Expect a line string with coordinates to have been built
Geometry lineString0 = featureCollection.getFeatures().get(0).getGeometry();
assertNotEquals(0, lineString0.getCoordinates().length);
}

@Test
public void testBidirectionalUpstreamPathWhenRequireRoadMatchIsFalse_InvalidName() {
JsonFeatureCollection featureCollection;
Expand Down
Loading