Skip to content
Merged
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 @@ -65,7 +65,7 @@ void getAreaStops() {
LAYER_CONFIG,
Locale.ENGLISH
);
var geometries = subject.getGeometries(AREA_STOP.getGeometry().getEnvelopeInternal());
var geometries = subject.findGeometries(AREA_STOP.getGeometry().getEnvelopeInternal());
assertEquals(List.of(Polygons.BERLIN), geometries);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void vehicleParkingGroupGeometryTest() {
Locale.US
);

List<Geometry> geometries = builder.getGeometries(new Envelope(0.99, 1.01, 1.99, 2.01));
List<Geometry> geometries = builder.findGeometries(new Envelope(0.99, 1.01, 1.99, 2.01));

assertEquals("[POINT (1.1 1.9)]", geometries.toString());
assertEquals(
Expand Down Expand Up @@ -170,8 +170,8 @@ public VehicleParkingGroupsLayerBuilderWithPublicGeometry(
}

@Override
public List<Geometry> getGeometries(Envelope query) {
return super.getGeometries(query);
public List<Geometry> findGeometries(Envelope query) {
return super.findGeometries(query);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void vehicleParkingGeometryTest() {
Locale.US
);

List<Geometry> geometries = builder.getGeometries(new Envelope(0.99, 1.01, 1.99, 2.01));
List<Geometry> geometries = builder.findGeometries(new Envelope(0.99, 1.01, 1.99, 2.01));

assertEquals("[POINT (1 2)]", geometries.toString());
assertEquals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public AreaStopsLayerBuilder(
this.transitService = transitService;
}

protected List<Geometry> getGeometries(Envelope query) {
protected List<Geometry> findGeometries(Envelope query) {
return transitService
.findAreaStops(query)
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public StationsLayerBuilder(
this.transitService = transitService;
}

protected List<Geometry> getGeometries(Envelope query) {
protected List<Geometry> findGeometries(Envelope query) {
return transitService
.listStations()
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public StopsLayerBuilder(
this.filter = LayerFilters.forType(layerParameters.filterType(), transitService);
}

protected List<Geometry> getGeometries(Envelope query) {
protected List<Geometry> findGeometries(Envelope query) {
return transitService
.findRegularStopsByBoundingBox(query)
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public VehicleParkingGroupsLayerBuilder(
}

@Override
protected List<Geometry> getGeometries(Envelope query) {
protected List<Geometry> findGeometries(Envelope query) {
return service
.listVehicleParkingGroups()
.asMap()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public VehicleParkingsLayerBuilder(
}

@Override
protected List<Geometry> getGeometries(Envelope query) {
protected List<Geometry> findGeometries(Envelope query) {
return service
.listVehicleParkings()
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public VehicleRentalLayerBuilder(
}

@Override
protected List<Geometry> getGeometries(Envelope query) {
protected List<Geometry> findGeometries(Envelope query) {
if (service == null) {
return List.of();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public LayerBuilder(PropertyMapper<T> mapper, String layerName, double expansion
* Get a list of geometries in this layer inside the query envelope. The geometries should include
* an object of type T as their userData.
*/
protected abstract List<Geometry> getGeometries(Envelope query);
protected abstract List<Geometry> findGeometries(Envelope query);

final VectorTile.Tile.Layer build(Envelope envelope) {
Envelope query = new Envelope(envelope);
query.expandBy(envelope.getWidth() * expansionFactor, envelope.getHeight() * expansionFactor);

TileGeomResult tileGeom = JtsAdapter.createTileGeom(
getGeometries(query),
findGeometries(query),
envelope,
query,
GEOMETRY_FACTORY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public EdgeLayerBuilder(
}

@Override
protected List<Geometry> getGeometries(Envelope query) {
protected List<Geometry> findGeometries(Envelope query) {
return graph
.findEdges(query)
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ public GeofencingZonesLayerBuilder(
}

@Override
protected List<Geometry> getGeometries(Envelope query) {
return geofencingZoneService.allZones().stream().map(this::createGeometryWithUserData).toList();
protected List<Geometry> findGeometries(Envelope query) {
return geofencingZoneService
.listZones()
.stream()
.map(this::createGeometryWithUserData)
.toList();
}

private Geometry createGeometryWithUserData(GeofencingZone zone) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public RentalLayerBuilder(VehicleRentalService service, LayerParameters layerPar
}

@Override
protected List<Geometry> getGeometries(Envelope env) {
protected List<Geometry> findGeometries(Envelope env) {
return service
.getVehicleRentalPlacesForEnvelope(env)
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public GroupStopLayerBuilder(
}

@Override
protected List<Geometry> getGeometries(Envelope query) {
protected List<Geometry> findGeometries(Envelope query) {
return geometries;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public StopLayerBuilder(
}

@Override
protected List<Geometry> getGeometries(Envelope query) {
protected List<Geometry> findGeometries(Envelope query) {
return findStops
.apply(query)
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public TransfersLayerBuilder(
}

@Override
protected List<Geometry> getGeometries(Envelope envelope) {
protected List<Geometry> findGeometries(Envelope envelope) {
return transitService
.findAreaStops(envelope)
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public VertexLayerBuilder(Graph graph, LayerParameters layerParameters) {
}

@Override
protected List<Geometry> getGeometries(Envelope env) {
protected List<Geometry> findGeometries(Envelope env) {
return graph
.findVertices(env)
.stream()
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/MapView/RightMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class RightMenu extends Component<RightMenuProps, RightMenuState> {
top: '20px',
}}
>
<img src={debugLayerIcon} alt="Debug layer" title="Debug layer" style={{ width: '25px', height: '25px' }} />
<img src={debugLayerIcon} alt="Debug layers" title="Debug layers" style={{ width: '25px', height: '25px' }} />
</button>

{/* Sidebar */}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public boolean hasIndexedZones() {
}

@Override
public Set<GeofencingZone> allZones() {
public Set<GeofencingZone> listZones() {
return Set.of();
}
};
Expand All @@ -44,5 +44,5 @@ public Set<GeofencingZone> allZones() {
boolean hasIndexedZones();

/** All zones across all registered data sources. Used by the debug map layer. */
Set<GeofencingZone> allZones();
Set<GeofencingZone> listZones();
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public boolean hasIndexedZones() {
}

@Override
public Set<GeofencingZone> allZones() {
public Set<GeofencingZone> listZones() {
var zones = new HashSet<GeofencingZone>();
for (var idx : geofencingZoneIndexes.values()) {
zones.addAll(idx.listZones());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public GeofencingZone(
) {
this.id = Objects.requireNonNull(id);
this.name = name;
this.geometry = geometry;
this.geometry = Objects.requireNonNull(geometry);
this.dropOffBanned = dropOffBanned;
this.traversalBanned = traversalBanned;
this.rideStartBanned = rideStartBanned;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public DisposableEdgeCollection linkVertexForRealTime(double lat, double lon) {
return disposable;
}

public void linkVertexPermanently(Vertex linkedVertex) {
public void linkVertexPermanently(TransitStopVertex linkedVertex) {
linker.linkVertexPermanently(
linkedVertex,
new TraverseModeSet(TraverseMode.WALK),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.opentripplanner.service.vehiclerental.street.VehicleRentalEdge;
import org.opentripplanner.service.vehiclerental.street.VehicleRentalPlaceVertex;
import org.opentripplanner.service.vehiclerental.street.geofencing.GeofencingBoundaryExtension;
import org.opentripplanner.street.geometry.Polygons;
import org.opentripplanner.street.model.RentalFormFactor;
import org.opentripplanner.street.model.StreetMode;
import org.opentripplanner.street.model.StreetTraversalPermission;
Expand Down Expand Up @@ -51,6 +52,7 @@ public class ScooterRentalGeofencingTest extends GraphRoutingTest {
NETWORK,
"no-dropoff-zone"
)
.withGeometry(Polygons.OSLO)
.noDropOff()
.build();

Expand Down Expand Up @@ -161,6 +163,7 @@ public void build() {
@Test
public void forwardSearchBlocksRidingIntoNoTraversalZone() {
var noTraversalZone = TestGeofencingZoneBuilder.of(NETWORK, "no-traversal-zone")
.withGeometry(Polygons.OSLO)
.noTraversal()
.build();

Expand All @@ -174,6 +177,7 @@ public void forwardSearchBlocksRidingIntoNoTraversalZone() {
@Test
public void arriveBySearchBlocksRidingIntoNoTraversalZone() {
var noTraversalZone = TestGeofencingZoneBuilder.of(NETWORK, "no-traversal-zone")
.withGeometry(Polygons.OSLO)
.noTraversal()
.build();

Expand Down Expand Up @@ -220,8 +224,14 @@ public void arriveBySearchBlocksRidingIntoNoTraversalZone() {

@Test
public void forwardSearchDoesNotDropOffBetweenAdjacentNoDropOffZones() {
var zoneA = TestGeofencingZoneBuilder.of(NETWORK, "zone-a").noDropOff().build();
var zoneB = TestGeofencingZoneBuilder.of(NETWORK, "zone-b").noDropOff().build();
var zoneA = TestGeofencingZoneBuilder.of(NETWORK, "zone-a")
.withGeometry(Polygons.OSLO)
.noDropOff()
.build();
var zoneB = TestGeofencingZoneBuilder.of(NETWORK, "zone-b")
.withGeometry(Polygons.OSLO)
.noDropOff()
.build();

modelOf(
new Builder() {
Expand Down Expand Up @@ -264,6 +274,7 @@ public void build() {
@Test
public void forwardSearchRidesAroundNoTraversalZoneInsteadOfWalkingThrough() {
var noTraversalZone = TestGeofencingZoneBuilder.of(NETWORK, "no-traversal-zone")
.withGeometry(Polygons.OSLO)
.noTraversal()
.build();

Expand Down Expand Up @@ -333,8 +344,14 @@ public void build() {
*/
@Test
public void arriveByAdjacentNoDropOffZonesDropsOutsideBothZones() {
var zoneA = TestGeofencingZoneBuilder.of(NETWORK, "zone-a").noDropOff().build();
var zoneB = TestGeofencingZoneBuilder.of(NETWORK, "zone-b").noDropOff().build();
var zoneA = TestGeofencingZoneBuilder.of(NETWORK, "zone-a")
.withGeometry(Polygons.OSLO)
.noDropOff()
.build();
var zoneB = TestGeofencingZoneBuilder.of(NETWORK, "zone-b")
.withGeometry(Polygons.OSLO)
.noDropOff()
.build();

modelOf(
new Builder() {
Expand Down Expand Up @@ -469,6 +486,7 @@ public void build() {
@Test
public void forwardSearchDropsOffInsideBusinessArea() {
var businessArea = TestGeofencingZoneBuilder.of(NETWORK, "business-area")
.withGeometry(Polygons.OSLO)
.asBusinessArea()
.build();

Expand Down Expand Up @@ -516,6 +534,7 @@ public void build() {
@Test
public void arriveBySearchDropsOffInsideBusinessArea() {
var businessArea = TestGeofencingZoneBuilder.of(NETWORK, "business-area")
.withGeometry(Polygons.OSLO)
.asBusinessArea()
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

/// Tests that linking a vertex with identical coordinates results in the same vertex being re-used
/// and no split edges/vertices being created.
/// It also repeats this with very small variations to ensure that very small differences are being
/// treated equally.
/// It also repeats this with very small variations to ensure that very small distances still re-use
/// the vertex.
class IdenticalCoordinateLinkingTest {

@ParameterizedTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public boolean hasIndexedZones() {
}

@Override
public Set<GeofencingZone> allZones() {
public Set<GeofencingZone> listZones() {
return index.listZones();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.opentripplanner.service.vehiclerental.model.RentalVehicleType.PropulsionType;
import org.opentripplanner.service.vehiclerental.model.TestGeofencingZoneBuilder;
import org.opentripplanner.service.vehiclerental.street.geofencing.GeofencingBoundaryExtension;
import org.opentripplanner.street.geometry.Polygons;
import org.opentripplanner.street.model.RentalFormFactor;
import org.opentripplanner.street.model.StreetMode;
import org.opentripplanner.street.model.vertex.StreetVertex;
Expand All @@ -33,31 +34,36 @@ class StreetEdgeGeofencingTest {
static String NETWORK_BIRD = "bird-oslo";

static GeofencingZone NO_DROP_OFF_ZONE_TIER = TestGeofencingZoneBuilder.of(NETWORK_TIER, "a-park")
.withGeometry(Polygons.OSLO)
.noDropOff()
.build();

static GeofencingZone NO_DROP_OFF_ZONE_BIRD = TestGeofencingZoneBuilder.of(NETWORK_BIRD, "a-park")
.withGeometry(Polygons.OSLO)
.noDropOff()
.build();

static GeofencingZone NO_DROP_OFF_ZONE_TIER_2 = TestGeofencingZoneBuilder.of(
NETWORK_TIER,
"b-park"
)
.withGeometry(Polygons.OSLO)
.noDropOff()
.build();

static GeofencingZone NO_TRAVERSAL_ZONE = TestGeofencingZoneBuilder.of(
NETWORK_TIER,
"no-traverse"
)
.withGeometry(Polygons.OSLO)
.noTraversal()
.build();

static GeofencingZone BUSINESS_AREA_ZONE = TestGeofencingZoneBuilder.of(
NETWORK_TIER,
"business-area"
)
.withGeometry(Polygons.OSLO)
.asBusinessArea()
.build();

Expand Down Expand Up @@ -271,10 +277,12 @@ public void traversalBanInStateInsideNoDropOffZoneIsDeadEnd() {
// No-drop-off zone: dropOffBanned=true, traversalBanned=null (unspecified).
// Higher priority (lower value) so its dropOffBanned wins per-field precedence.
var noDropOffOnly = TestGeofencingZoneBuilder.of(NETWORK_TIER, "no-dropoff-only")
.withGeometry(Polygons.OSLO)
.withDropOffBanned(true)
.build();
// No-traversal zone: traversalBanned=true, dropOffBanned=null (unspecified).
var noTraversalOnly = TestGeofencingZoneBuilder.of(NETWORK_TIER, "no-traverse-only")
.withGeometry(Polygons.OSLO)
.withTraversalBanned(true)
.withPriority(1)
.build();
Expand Down
Loading
Loading