Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.

Commit

Permalink
add reachability thresholds for multipoint queries, see opentripplann…
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwigway committed Oct 15, 2015
1 parent 81c71fc commit 020778c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/main/java/models/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public class Query implements Serializable {
public String projectId;
public String name;

/** The reachability threshold used for this query */
public float reachabilityThreshold;

public RaptorWorkerTimetable.BoardingAssumption boardingAssumption;

private static final AmazonS3 s3 = new AmazonS3Client();
Expand Down Expand Up @@ -275,8 +278,12 @@ public void run() {
if (bikeSpeed > 1e-6)
profileRequest.bikeSpeed = (float) bikeSpeed;

profileRequest.reachabilityThreshold = reachabilityThreshold;

}
// At this point PR is known not to be null, it was either supplied by the caller or has been created above.
// store profile request in MapDB
this.save();

// TODO batch?
long now = System.currentTimeMillis();
Expand Down
15 changes: 14 additions & 1 deletion src/main/resources/public/javascripts/analysis-multi.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ var Analyst = Analyst || {};
_this.updateResults();
}).data('slider');

this.reachabilityThresholdSlider = this.$('#reachabilityThresholdSlider').slider({
formater: function(value) {
var pct = Math.round(value * 100);
_this.$('#reachabilityThresholdValue').html(window.Messages("analysis.reachability-threshold", pct));
return pct + '%';
}
}).on('slideStop', function(value) {

_this.updateResults();
}).data('slider');

this.scenarios = new A.models.Scenarios();
this.queries = new A.models.Queries();
this.shapefiles = new A.models.Shapefiles();
Expand Down Expand Up @@ -199,6 +210,7 @@ var Analyst = Analyst || {};
var walkSpeed = (this.walkSpeedSlider.getValue() * 1000 / 60 / 60 );
var walkTime = this.walkTimeSlider.getValue();
var bikeTime = this.bikeTimeSlider.getValue();
var reachabilityThreshold = this.reachabilityThresholdSlider.getValue();

var data = {
name: this.$("#name").val(),
Expand All @@ -213,7 +225,8 @@ var Analyst = Analyst || {};
walkSpeed: walkSpeed,
bikeSpeed: bikeSpeed,
maxWalkTime: walkTime,
maxBikeTime: bikeTime
maxBikeTime: bikeTime,
reachabilityThreshold: reachabilityThreshold
};

// profile routing uses a to time as well
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,20 @@ <h5 class="panel-title">
<input id="bikeTimeSlider" data-slider-id="bikeTimeSlider" style="width: 250px;" type="text" data-slider-min="1" data-slider-max="60" data-slider-step="1" data-slider-value="20"/>
</div>

<button class="btn btn-primary" id="createQuery">{{I18n "analysis.run-query"}}</button> <button class="btn btn-default" id="cancelQuery">{{I18n "app.shared.cancel"}}</button>
<div class="form-group">
<!--
the reachability threshold, see extensive javadoc on the parameter in ProfileRequest.
This is more of an advanced parameter, in the new UI we should probably have some sort of "advanced settings" pane where
settings like this are hidden.
The default here is zero, which is not really a recommended value but was the hard-wired value until Analyst Server 0.7.26
-->
<label><span class="notes" id="reachabilityThresholdValue"></span></label>
<input id="reachabilityThresholdSlider" data-slider-id="reachabilityThresholdSlider" style="width: 250px;" type="text" data-slider-min="0" data-slider-max="1" data-slider-step="0.01" data-slider-value="0"/>
</div>
</div>

<button class="btn btn-primary" id="createQuery">{{I18n "analysis.run-query"}}</button> <button class="btn btn-default" id="cancelQuery">{{I18n "app.shared.cancel"}}</button>
</div>
</div>
</div>
Expand Down

0 comments on commit 020778c

Please sign in to comment.