Skip to content

Commit

Permalink
Use maxSlope from defaultRoutingRequest in wheelchair debug layer
Browse files Browse the repository at this point in the history
  • Loading branch information
optionsome committed Dec 5, 2019
1 parent fe76dc3 commit 7dfcbc3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.opentripplanner.analyst.request.TileRequest;
import org.opentripplanner.api.resource.GraphInspectorTileResource;
import org.opentripplanner.inspector.TileRenderer.TileRenderContext;
import org.opentripplanner.routing.core.RoutingRequest;
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.routing.services.GraphService;
import org.slf4j.Logger;
Expand Down Expand Up @@ -35,14 +36,14 @@ public class TileRendererManager {

private Graph graph;

public TileRendererManager(Graph graph) {
public TileRendererManager(Graph graph, RoutingRequest routingRequest) {
this.graph = graph;

// Register layers.
renderers.put("bike-safety", new EdgeVertexTileRenderer(new BikeSafetyEdgeRenderer()));
renderers.put("traversal", new EdgeVertexTileRenderer(
new TraversalPermissionsEdgeRenderer()));
renderers.put("wheelchair", new EdgeVertexTileRenderer(new WheelchairEdgeRenderer()));
renderers.put("wheelchair", new EdgeVertexTileRenderer(new WheelchairEdgeRenderer(routingRequest)));
}

public void registerRenderer(String layer, TileRenderer tileRenderer) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.opentripplanner.inspector;

import org.opentripplanner.inspector.EdgeVertexTileRenderer.EdgeVertexRenderer;
import org.opentripplanner.routing.core.RoutingRequest;
import org.opentripplanner.routing.edgetype.StreetEdge;
import org.opentripplanner.routing.graph.Edge;
import org.opentripplanner.routing.graph.Vertex;
Expand All @@ -16,15 +17,16 @@
public class WheelchairEdgeRenderer implements EdgeVertexRenderer {


private ScalarColorPalette slopePalette = new DefaultScalarColorPalette(0.0, 0.08, 1.0);
private ScalarColorPalette slopePalette;


private static final Color NO_WHEELCHAIR_COLOR = Color.RED;
private static final Color YES_WHEELCHAIR_COLOR = Color.GREEN;
private static final Color NO_WHEELCHAIR_INFORMATION_COLOR = Color.ORANGE;


public WheelchairEdgeRenderer() {
public WheelchairEdgeRenderer(RoutingRequest routingRequest) {
this.slopePalette = new DefaultScalarColorPalette(0.0, routingRequest.maxSlope, 1.0);
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/opentripplanner/standalone/Router.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ public Router(String id, Graph graph) {
*/
public void startup(JsonNode config) {

this.tileRendererManager = new TileRendererManager(this.graph);

// Analyst Modules FIXME make these optional based on JSON?
{
this.tileCache = new TileCache(this.graph);
Expand All @@ -101,6 +99,8 @@ public void startup(JsonNode config) {
this.defaultRoutingRequest = new RoutingRequest();
}

this.tileRendererManager = new TileRendererManager(this.graph, this.defaultRoutingRequest);

/* Apply single timeout. */
JsonNode timeout = config.get("timeout");
if (timeout != null) {
Expand Down

0 comments on commit 7dfcbc3

Please sign in to comment.