Skip to content

Commit 81092fa

Browse files
committed
Merge remote-tracking branch 'otp/dev-2.x' into via_coordinate
2 parents d99e081 + caf673b commit 81092fa

File tree

6 files changed

+15
-24
lines changed

6 files changed

+15
-24
lines changed

application/src/main/java/org/opentripplanner/routing/graph/index/StreetIndex.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import java.util.List;
77
import java.util.Map;
88
import java.util.Set;
9-
import java.util.UUID;
109
import java.util.stream.Collectors;
1110
import javax.annotation.Nullable;
1211
import org.locationtech.jts.geom.Coordinate;
@@ -102,7 +101,7 @@ public static TemporaryStreetLocation createTemporaryStreetLocationForTest(
102101
) {
103102
boolean wheelchairAccessible = false;
104103

105-
var location = new TemporaryStreetLocation(label, nearestPoint, name);
104+
TemporaryStreetLocation location = new TemporaryStreetLocation(nearestPoint, name);
106105

107106
for (StreetEdge street : edges) {
108107
Vertex fromv = street.getFromVertex();
@@ -372,8 +371,7 @@ private Vertex createVertexFromCoordinate(
372371
name = new NonLocalizedString(label);
373372
}
374373

375-
String id = UUID.randomUUID().toString();
376-
var temporaryStreetLocation = new TemporaryStreetLocation(id, coordinate, name);
374+
var temporaryStreetLocation = new TemporaryStreetLocation(coordinate, name);
377375

378376
TraverseMode nonTransitMode = getTraverseModeForLinker(streetMode, endVertex);
379377

application/src/main/java/org/opentripplanner/routing/via/service/DefaultViaCoordinateTransferFactory.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public List<ViaCoordinateTransfer> createViaTransfers(
6161
);
6262

6363
var viaVertex = new TemporaryStreetLocation(
64-
UUID.randomUUID().toString(),
6564
coordinate.asJtsCoordinate(),
6665
name
6766
);

application/src/main/java/org/opentripplanner/street/model/vertex/TemporaryStreetLocation.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.opentripplanner.street.model.vertex;
22

3+
import java.util.concurrent.atomic.AtomicLong;
34
import org.locationtech.jts.geom.Coordinate;
45
import org.opentripplanner.framework.i18n.I18NString;
56
import org.opentripplanner.street.model.edge.Edge;
@@ -15,8 +16,10 @@
1516
*/
1617
public final class TemporaryStreetLocation extends StreetLocation implements TemporaryVertex {
1718

18-
public TemporaryStreetLocation(String id, Coordinate nearestPoint, I18NString name) {
19-
super(id, nearestPoint, name);
19+
private static final AtomicLong idCounter = new AtomicLong(0);
20+
21+
public TemporaryStreetLocation(Coordinate nearestPoint, I18NString name) {
22+
super("TempVertex-" + idCounter.incrementAndGet(), nearestPoint, name);
2023
}
2124

2225
@Override

application/src/test/java/org/opentripplanner/astar/AStarTest.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,12 @@ public void testForwardExtraEdges() {
164164
request.withPreferences(pref -> pref.withWalk(w -> w.withSpeed(1.0)));
165165

166166
TemporaryStreetLocation from = new TemporaryStreetLocation(
167-
"near_shilshole_22nd",
168167
new Coordinate(-122.385050, 47.666620),
169168
new NonLocalizedString("near_shilshole_22nd")
170169
);
171170
TemporaryConcreteEdge.createTemporaryConcreteEdge(from, graph.getVertex("shilshole_22nd"));
172171

173172
TemporaryStreetLocation to = new TemporaryStreetLocation(
174-
"near_56th_20th",
175173
new Coordinate(-122.382347, 47.669518),
176174
new NonLocalizedString("near_56th_20th")
177175
);
@@ -191,15 +189,15 @@ public void testForwardExtraEdges() {
191189

192190
assertEquals(9, states.size());
193191

194-
assertEquals("near_shilshole_22nd", states.get(0).getVertex().getLabelString());
192+
assertEquals("near_shilshole_22nd", states.get(0).getVertex().getDefaultName());
195193
assertEquals("shilshole_22nd", states.get(1).getVertex().getLabelString());
196194
assertEquals("ballard_22nd", states.get(2).getVertex().getLabelString());
197195
assertEquals("market_22nd", states.get(3).getVertex().getLabelString());
198196
assertEquals("market_leary", states.get(4).getVertex().getLabelString());
199197
assertEquals("market_russell", states.get(5).getVertex().getLabelString());
200198
assertEquals("market_20th", states.get(6).getVertex().getLabelString());
201199
assertEquals("56th_20th", states.get(7).getVertex().getLabelString());
202-
assertEquals("near_56th_20th", states.get(8).getVertex().getLabelString());
200+
assertEquals("near_56th_20th", states.get(8).getVertex().getDefaultName());
203201
}
204202

205203
@Test
@@ -210,14 +208,12 @@ public void testBackExtraEdges() {
210208
request.setArriveBy(true);
211209

212210
TemporaryStreetLocation from = new TemporaryStreetLocation(
213-
"near_shilshole_22nd",
214211
new Coordinate(-122.385050, 47.666620),
215212
new NonLocalizedString("near_shilshole_22nd")
216213
);
217214
TemporaryConcreteEdge.createTemporaryConcreteEdge(from, graph.getVertex("shilshole_22nd"));
218215

219216
TemporaryStreetLocation to = new TemporaryStreetLocation(
220-
"near_56th_20th",
221217
new Coordinate(-122.382347, 47.669518),
222218
new NonLocalizedString("near_56th_20th")
223219
);
@@ -237,15 +233,15 @@ public void testBackExtraEdges() {
237233

238234
assertEquals(9, states.size());
239235

240-
assertEquals("near_shilshole_22nd", states.get(0).getVertex().getLabelString());
236+
assertEquals("near_shilshole_22nd", states.get(0).getVertex().getDefaultName());
241237
assertEquals("shilshole_22nd", states.get(1).getVertex().getLabelString());
242238
assertEquals("ballard_22nd", states.get(2).getVertex().getLabelString());
243239
assertEquals("market_22nd", states.get(3).getVertex().getLabelString());
244240
assertEquals("market_leary", states.get(4).getVertex().getLabelString());
245241
assertEquals("market_russell", states.get(5).getVertex().getLabelString());
246242
assertEquals("market_20th", states.get(6).getVertex().getLabelString());
247243
assertEquals("56th_20th", states.get(7).getVertex().getLabelString());
248-
assertEquals("near_56th_20th", states.get(8).getVertex().getLabelString());
244+
assertEquals("near_56th_20th", states.get(8).getVertex().getDefaultName());
249245
}
250246

251247
@Test

application/src/test/java/org/opentripplanner/routing/algorithm/GraphRoutingTest.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,14 +353,9 @@ public PathwayEdge pathway(Vertex from, Vertex to, int time, int length) {
353353
}
354354

355355
// -- Street linking
356-
public TemporaryStreetLocation streetLocation(
357-
String name,
358-
double latitude,
359-
double longitude,
360-
boolean endVertex
361-
) {
356+
public TemporaryStreetLocation streetLocation(String name, double latitude, double longitude) {
362357
var nearestPoint = new Coordinate(longitude, latitude);
363-
return new TemporaryStreetLocation(name, nearestPoint, new NonLocalizedString(name));
358+
return new TemporaryStreetLocation(nearestPoint, new NonLocalizedString(name));
364359
}
365360

366361
public TemporaryFreeEdge link(TemporaryVertex from, StreetVertex to) {

application/src/test/java/org/opentripplanner/street/integration/BikeRentalTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ public void build() {
6565
D = intersection("D", 47.530, 19.000);
6666
E1 = entrance("E1", 47.530, 19.001);
6767

68-
T1 = streetLocation("T1", 47.500, 18.999, false);
69-
T2 = streetLocation("T1", 47.530, 18.999, true);
68+
T1 = streetLocation("T1", 47.500, 18.999);
69+
T2 = streetLocation("T1", 47.530, 18.999);
7070

7171
B1 = vehicleRentalStation("B1", 47.510, 19.001);
7272
B2 = vehicleRentalStation("B2", 47.520, 19.001);

0 commit comments

Comments
 (0)