Skip to content

Commit 3f51002

Browse files
committed
remove getters/setters from newly-configurable streetlayer variables
1 parent 39ef11e commit 3f51002

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
@@ -97,33 +97,21 @@ public class StreetLayer implements Serializable, Cloneable {
9797
* to mind), or islands that are isolated by infrastructure (for example, airport terminals reachable
9898
* only by transit or driving, for instance BWI or SFO).
9999
*/
100-
private int minSubgraphSize = 40;
101-
102-
public int getMinSubgraphSize() {
103-
return minSubgraphSize;
104-
}
100+
public int minSubgraphSize = 40;
105101

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

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

128116
/**
129117
* 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
@@ -325,7 +325,7 @@ public StreetRouter (StreetLayer streetLayer) {
325325
* @return true if an edge was found near the specified coordinate
326326
*/
327327
public boolean setOrigin (double lat, double lon) {
328-
Split split = streetLayer.findSplit(lat, lon, streetLayer.getPointsetLinkRadiusMeters(), streetMode);
328+
Split split = streetLayer.findSplit(lat, lon, streetLayer.pointsetLinkRadiusMeters, streetMode);
329329
if (split == null) {
330330
LOG.info("No street was found near the specified origin point of {}, {}.", lat, lon);
331331
return false;
@@ -435,7 +435,7 @@ public void setOrigin(TIntObjectMap<State> previousStates, int switchTime, int s
435435
* @return true if edge was found near wanted coordinate
436436
*/
437437
public boolean setDestination (double lat, double lon) {
438-
this.destinationSplit = streetLayer.findSplit(lat, lon, streetLayer.getPointsetLinkRadiusMeters(), streetMode);
438+
this.destinationSplit = streetLayer.findSplit(lat, lon, streetLayer.pointsetLinkRadiusMeters, streetMode);
439439
return this.destinationSplit != null;
440440
}
441441

@@ -832,7 +832,7 @@ public Split getDestinationSplit() {
832832
* @return
833833
*/
834834
public State getState(double lat, double lon) {
835-
Split split = streetLayer.findSplit(lat, lon, streetLayer.getPointsetLinkRadiusMeters(), streetMode);
835+
Split split = streetLayer.findSplit(lat, lon, streetLayer.pointsetLinkRadiusMeters, streetMode);
836836
if (split == null) {
837837
LOG.info("No street was found near the specified origin point of {}, {}.", lat, lon);
838838
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)