Skip to content

Commit ceb8cb0

Browse files
committed
remove getters/setters from newly-configurable streetlayer variables
1 parent 43fb33a commit ceb8cb0

File tree

4 files changed

+11
-23
lines changed

4 files changed

+11
-23
lines changed

src/main/java/com/conveyal/r5/streets/LinkedPointSet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ private void linkPointsToStreets (boolean all) {
323323
double pointLatFixed = floatingDegreesToFixed(pointSet.getLat(p));
324324
double pointLonFixed = floatingDegreesToFixed(pointSet.getLon(p));
325325
Envelope pointEnvelopeFixed = new Envelope(pointLonFixed, pointLonFixed, pointLatFixed, pointLatFixed);
326-
double radiusMeters = streetLayer.getPointsetLinkRadiusMeters();
326+
double radiusMeters = streetLayer.pointsetLinkRadiusMeters;
327327
if (edges[p] != -1) {
328328
radiusMeters = this.distancesToEdge_mm[p] / 1000.0;
329329
}
@@ -335,7 +335,7 @@ private void linkPointsToStreets (boolean all) {
335335
if (relinkThisPoint) {
336336
// Use radius from StreetLayer such that maximum origin and destination walk distances are symmetric.
337337
Split split = streetLayer.findSplit(pointSet.getLat(p), pointSet.getLon(p),
338-
streetLayer.getPointsetLinkRadiusMeters(), streetMode);
338+
streetLayer.pointsetLinkRadiusMeters, streetMode);
339339
if (split == null) {
340340
edges[p] = -1;
341341
} else {

src/main/java/com/conveyal/r5/streets/StreetLayer.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,33 +95,21 @@ public class StreetLayer implements Serializable, Cloneable {
9595
* to mind), or islands that are isolated by infrastructure (for example, airport terminals reachable
9696
* only by transit or driving, for instance BWI or SFO).
9797
*/
98-
private int minSubgraphSize = 40;
99-
100-
public int getMinSubgraphSize() {
101-
return minSubgraphSize;
102-
}
98+
public int minSubgraphSize = 40;
10399

104100
/**
105101
* The radius of a circle in meters within which to search for nearby streets when linking stops/park and rides.
106102
*
107103
* The default, 1.6km, is really far to walk off a street. But some places have offices in the middle of big parking lots.
108104
*/
109-
private double stopLinkRadiusMeters = 1600;
110-
111-
public double getStopLinkRadiusMeters() {
112-
return stopLinkRadiusMeters;
113-
}
105+
public double stopLinkRadiusMeters = 1600;
114106

115107
/**
116108
* The radius of a circle in meters within which to search for nearby streets when linking pointsets/origins/destinations.
117109
*
118110
* The default, 1.6km is really far to walk off a street. But some places have offices in the middle of big parking lots.
119111
*/
120-
private double pointsetLinkRadiusMeters = 1600;
121-
122-
public double getPointsetLinkRadiusMeters() {
123-
return pointsetLinkRadiusMeters;
124-
}
112+
public double pointsetLinkRadiusMeters = 1600;
125113

126114
/**
127115
* Searching for streets takes a fair amount of computation, and the number of streets examined grows roughly as

src/main/java/com/conveyal/r5/streets/StreetRouter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ public StreetRouter (StreetLayer streetLayer) {
323323
* @return true if an edge was found near the specified coordinate
324324
*/
325325
public boolean setOrigin (double lat, double lon) {
326-
Split split = streetLayer.findSplit(lat, lon, streetLayer.getPointsetLinkRadiusMeters(), streetMode);
326+
Split split = streetLayer.findSplit(lat, lon, streetLayer.pointsetLinkRadiusMeters, streetMode);
327327
if (split == null) {
328328
LOG.info("No street was found near the specified origin point of {}, {}.", lat, lon);
329329
return false;
@@ -433,7 +433,7 @@ public void setOrigin(TIntObjectMap<State> previousStates, int switchTime, int s
433433
* @return true if edge was found near wanted coordinate
434434
*/
435435
public boolean setDestination (double lat, double lon) {
436-
this.destinationSplit = streetLayer.findSplit(lat, lon, streetLayer.getPointsetLinkRadiusMeters(), streetMode);
436+
this.destinationSplit = streetLayer.findSplit(lat, lon, streetLayer.pointsetLinkRadiusMeters, streetMode);
437437
return this.destinationSplit != null;
438438
}
439439

@@ -830,7 +830,7 @@ public Split getDestinationSplit() {
830830
* @return
831831
*/
832832
public State getState(double lat, double lon) {
833-
Split split = streetLayer.findSplit(lat, lon, streetLayer.getPointsetLinkRadiusMeters(), streetMode);
833+
Split split = streetLayer.findSplit(lat, lon, streetLayer.pointsetLinkRadiusMeters, streetMode);
834834
if (split == null) {
835835
LOG.info("No street was found near the specified origin point of {}, {}.", lat, lon);
836836
return null;

src/test/java/com/conveyal/r5/streets/StreetLayerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,9 @@ public void testConfigurableSplitDistancesAndIslandRemoval() {
450450
sl.buildEdgeLists();
451451
sl.indexStreets();
452452

453-
assertEquals(sl.getStopLinkRadiusMeters(), 50d * multiplier);
454-
assertEquals(sl.getPointsetLinkRadiusMeters(), 100d * multiplier);
455-
assertEquals(sl.getMinSubgraphSize(), 5 * multiplier);
453+
assertEquals(sl.stopLinkRadiusMeters, 50d * multiplier);
454+
assertEquals(sl.pointsetLinkRadiusMeters, 100d * multiplier);
455+
assertEquals(sl.minSubgraphSize, 5 * multiplier);
456456

457457
// This is an island with size 6: https://www.openstreetmap.org/way/140476882#map=19/39.409392/-76.642615&layers=D
458458
// Because it is at the edge of the PBF, West Joppa Road is not in the PBF, so Riderwood Stn and

0 commit comments

Comments
 (0)