Skip to content

Commit 1e0bc7e

Browse files
committed
comments and imports relating to cost fields
1 parent c83659c commit 1e0bc7e

File tree

4 files changed

+6
-19
lines changed

4 files changed

+6
-19
lines changed

src/main/java/com/conveyal/r5/rastercost/CostField.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
package com.conveyal.r5.rastercost;
22

3-
import com.conveyal.r5.profile.ProfileRequest;
4-
import com.conveyal.r5.profile.StreetMode;
53
import com.conveyal.r5.streets.EdgeStore;
64
import com.conveyal.r5.streets.StreetLayer;
7-
import com.conveyal.r5.streets.TraversalTimeCalculator;
8-
import com.conveyal.r5.streets.VertexStore;
9-
import gnu.trove.list.TFloatList;
10-
import gnu.trove.list.TShortList;
11-
12-
import java.io.File;
13-
import java.util.List;
145

156
/**
167
* This models a field of traversal costs, in the sense of a cost that varies over geographic space having different
@@ -21,7 +12,7 @@
2112
* ignored for car routing. Ideally CostFields would know which modes they applied to, and the list of CostFields would
2213
* be filtered before the street search happens. The logic currently in the StreetRouter constructor could be factored
2314
* into a mode-aware factory method that would yield the correct TraversalTimeCalculator. StreetRouter is explicitly
24-
* single-use with a single StreetMode. That mode could be specified up front and the TraversalTimeCalculator
15+
* single-use with a single StreetMode. That mode could be specified up front and the TraversalTimeCalculator
2516
* chosen accordingly (avoiding the MultistageTraversalTimeCalculator construct entirely when no CostFields apply).
2617
*
2718
* Interface-wise, a CostField is like a TraversalTimeCalculator with no turn costs, which transforms an existing

src/main/java/com/conveyal/r5/rastercost/SunCostField.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class SunCostField implements CostField, Serializable {
2929

3030
/**
3131
* Number in the range 0...1 representing the proportion of each edge pair that is in the shade.
32-
* Floating point numbers are densest in this range, so 32 bits are more than sufficent.
32+
* Floating point numbers are densest in this range, so 32 bits are more than sufficient.
3333
* These could probably be made 2-4x smaller by storing them in shorts or bytes; we should measure this.
3434
*/
3535
TFloatList sunProportions = new TFloatArrayList();

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
package com.conveyal.r5.streets;
22

3-
import com.conveyal.r5.common.GeometryUtils;
43
import com.conveyal.r5.profile.ProfileRequest;
54
import com.conveyal.r5.profile.StreetMode;
65
import com.conveyal.r5.rastercost.CostField;
7-
import com.conveyal.r5.rastercost.SunLoader;
8-
import org.apache.commons.math3.util.FastMath;
9-
import org.locationtech.jts.algorithm.Angle;
10-
import org.locationtech.jts.geom.Coordinate;
11-
import org.locationtech.jts.geom.LineString;
126
import org.slf4j.Logger;
137
import org.slf4j.LoggerFactory;
148

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,12 @@ public TIntObjectMap<State> getReachedVertices (VertexStore.VertexFlag flag) {
295295

296296
public StreetRouter (StreetLayer streetLayer) {
297297
this.streetLayer = streetLayer;
298+
// The street layer of the network may contain per-edge traversal times, e.g. from observed traffic data.
298299
this.timeCalculator = streetLayer.edgeStore.edgeTraversalTimes;
299-
// If no per-edge timings were supplied in the network, fall back on simple default timings
300+
// If the network has no per-edge timings, fall back on default timings, using OSM speed limits for cars.
300301
if (this.timeCalculator == null) {
301-
// TODO either: 1) don't hardwire drive-on-right, or 2) global https://en.wikipedia.org/wiki/Dagen_H
302+
// Constructor call is currently hard-coded to specify drive-on-right turn costs. We should
303+
// either a) make this configurable or b) global https://en.wikipedia.org/wiki/Dagen_H
302304
this.timeCalculator = new BasicTraversalTimeCalculator(streetLayer, true);
303305
}
304306
// If any additional costs such as hills or sun are defined, add them on to the base traversal times.

0 commit comments

Comments
 (0)