Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/user/editor/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ Once you have adjusted the stop timings, another warning will appear prompting y

![normalize pattern stops](../../img/normalize-stop-times.png)

#### Interpolation
Datatools features two interpolation modes.

"Interpolate stop times between timepoints" ignores all non-timepoint pattern info. The timepoint timings are assumed to be in realation *to the previous timepoint*.

"Only update blank stop times" only updates blank stop times. Datatools will use shape data and non-blank stop times to calculate likely stoptimes. Stop times with values will be ignored.

### Calculate timings
The average speed for the route can be used to calculate all the time gaps between stops in one go. A few parameters can be specified before calculating times:

Expand All @@ -101,6 +108,8 @@ Specific timings for each pattern stop can be set by either clicking on the stop
- **Travel time:** the time it took to get from the previous station (should be 00:00 on the first stop of the sequence)
- **Dwell time:** the time the vehicle rests at the stop

###### When using timepoint interpolation, these timings are assumed to be in relation to the previous timepoint. Otherwise, they are assumed to be in relation to the previous stop.

### Tutorial Video: Editing/Creating Patterns
The following video demonstrates how to create patterns as outlined above, in a step by step manner.
<iframe
Expand Down
9 changes: 5 additions & 4 deletions i18n/english.yml
Original file line number Diff line number Diff line change
Expand Up @@ -804,11 +804,12 @@ components:
substitutionInvalid: Some substitution patterns are invalid.
NormalizeStopTimesModal:
close: Close
interpolateStopTimes: Interpolate stop times between timepoints?
interpolateStopTimes: Interpolate stop times between timepoints (Ignore all travel/dwell times except for timepoints)
normalizeStopTimes: Normalize stop times
normalizeStopTimesQuestion: Normalize stop times?
selectBeginningPatternStop: "Select beginning pattern stop:"
tooFewTimepoints: "You must have more than 1 timepoint to interpolate times"
updateBlankOnly: Only update blank stop times
usageExplanationOne: This feature is useful when the travel times for one or more
pattern stops change. Take for example a pattern
that has been re-routed along to travel a longer distance, has had a
Expand All @@ -817,10 +818,10 @@ components:
you can normalize the stop times to bring them into alignment with the
updated travel times reflected in the pattern stops.
usageExplanationTwo: Interpolating stop times calculates the implicit speed between timepoints
based on the shape distance and the default travel times. This speed is
based on the shape distance and the default travel times of timepoints. This speed is
then applied to the shape distance traveled for each intermediate non-timepoint
stop to provide interpolated travel times. The default travel time for non-timepoint
stops will not be modified.
stop to provide interpolated stop times.
This feature ignores all travel/dwell times except for timepoints!
usageNotes: " Usage notes"
NormalizeStopTimesTip:
info: "Tip: when changing travel times, consider
Expand Down
1 change: 1 addition & 0 deletions i18n/german.yml
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,7 @@ components:
normalizeStopTimesQuestion: Normalize stop times?
selectBeginningPatternStop: "Select beginning pattern stop:"
tooFewTimepoints: "You must have more than 1 timepoint to interpolate times"
updateBlankOnly: Only update blank stop times
usageExplanationOne: This feature is useful when the travel times for one or more
pattern stops change. Take for example a pattern
that has been re-routed along to travel a longer distance, has had a
Expand Down
1 change: 1 addition & 0 deletions i18n/polish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ components:
normalizeStopTimesQuestion: Normalize stop times?
selectBeginningPatternStop: "Select beginning pattern stop:"
tooFewTimepoints: "You must have more than 1 timepoint to interpolate times"
updateBlankOnly: Only update blank stop times
usageExplanationOne: This feature is useful when the travel times for one or more
pattern stops change. Take for example a pattern
that has been re-routed along to travel a longer distance, has had a
Expand Down
4 changes: 2 additions & 2 deletions lib/editor/actions/tripPattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ export type EditorTripPatternActions = ActionType<typeof normalizeStopTimes> |
* provides a way to bulk update existing trips when pattern stops are modified
* (e.g., a pattern stop is inserted, removed, or its travel times modified).
*/
export function normalizeStopTimes (patternId: number, beginStopSequence: number, interpolateStopTimes: boolean) {
export function normalizeStopTimes (patternId: number, beginStopSequence: number, interpolateStopTimes: boolean, ignoreNonBlank: boolean) {
return function (dispatch: dispatchFn, getState: getStateFn) {
const {data} = getState().editor
const {feedSourceId} = data.active
const sessionId = data.lock.sessionId || ''
const url = `/api/editor/secure/pattern/${patternId}/stop_times?feedId=${feedSourceId || ''}&sessionId=${sessionId}&stopSequence=${beginStopSequence}&interpolateStopTimes=${interpolateStopTimes.toString()}`
const url = `/api/editor/secure/pattern/${patternId}/stop_times?feedId=${feedSourceId || ''}&sessionId=${sessionId}&stopSequence=${beginStopSequence}&interpolateStopTimes=${interpolateStopTimes.toString()}&ignoreNonBlankStopTimes=${ignoreNonBlank.toString()}`
return dispatch(secureFetch(url, 'put'))
.then(res => res.json())
.then(json => toast.info(`ⓘ ${json.updateResult}`, {
Expand Down
29 changes: 22 additions & 7 deletions lib/editor/components/pattern/NormalizeStopTimesModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,42 @@ type Props = {
stops: Array<GtfsStop>
}

type State = { interpolateStopTimes: boolean, patternStopIndex: number, show: boolean }
type State = { ignoreNonBlank: boolean, interpolateStopTimes: boolean, patternStopIndex: number, show: boolean }

export default class NormalizeStopTimesModal extends Component<Props, State> {
messages = getComponentMessages('NormalizeStopTimesModal')

state = {
ignoreNonBlank: false,
Comment thread
miles-grant-ibigroup marked this conversation as resolved.
interpolateStopTimes: false,
patternStopIndex: 0, // default to zeroth pattern stop
show: false
}

_onClickNormalize = () => {
const { activePattern, normalizeStopTimes } = this.props
normalizeStopTimes(activePattern.id, this.state.patternStopIndex, this.state.interpolateStopTimes)
this.setState({interpolateStopTimes: false})
normalizeStopTimes(activePattern.id, this.state.patternStopIndex, this.state.interpolateStopTimes, this.state.ignoreNonBlank)
this.setState({interpolateStopTimes: false, ignoreNonBlank: false})
this.props.onClose()
}

_onChangeStop = (evt: SyntheticInputEvent<HTMLInputElement>) => {
this.setState({patternStopIndex: +evt.target.value})
}

_onClose = () => {
this.setState({ show: false, interpolateStopTimes: false })
this.setState({ show: false, interpolateStopTimes: false, ignoreNonBlank: false })
this.props.onClose()
}

_onChangeInterpolation = () => {
this.setState({interpolateStopTimes: !this.state.interpolateStopTimes})
}

_onChangeNonBlank = () => {
this.setState({ignoreNonBlank: !this.state.ignoreNonBlank, interpolateStopTimes: false})
}

render () {
const { Body, Footer, Header, Title } = Modal
const { activePattern, stops } = this.props
Expand Down Expand Up @@ -89,15 +95,24 @@ export default class NormalizeStopTimesModal extends Component<Props, State> {
>
<Checkbox
disabled={interpolationDisabled}
id='interpolate'
onChange={this._onChangeInterpolation}
value={this.state.interpolateStopTimes}
/>
</OverlayTrigger>
{/* Separate label so that tooltip appears over checkbox. Hack: Padding to align center with checkbox */}
<span style={{paddingBottom: '2px'}}>{this.messages('interpolateStopTimes')}</span>
<label htmlFor='interpolate' style={{fontWeight: 'normal', paddingBottom: '2px'}}>{this.messages('interpolateStopTimes')}</label>
</div>
<div style={{alignContent: 'center', alignItems: 'center', display: 'flex', marginTop: -20, marginBottom: -20}}>
<Checkbox
id='ignoreNonBlank'
onChange={this._onChangeNonBlank}
value={this.state.ignoreNonBlank}
/>
<label htmlFor='ignoreNonBlank' style={{fontWeight: 'normal', paddingBottom: '2px'}}>{this.messages('updateBlankOnly')}</label>
</div>
<br />
<Alert bsStyle='warning'>
{!this.state.ignoreNonBlank && <Alert bsStyle='warning'>
{this.state.patternStopIndex === 0
// TODO: figure out how yml messages with html tags can be rendered
// correctly.
Expand All @@ -111,7 +126,7 @@ export default class NormalizeStopTimesModal extends Component<Props, State> {
prior will be unmodified).
</span>
}
</Alert>
</Alert>}
<Alert bsStyle='info'>
<h5><Icon type='info-circle' />{this.messages('usageNotes')}</h5>
<small>
Expand Down
Loading