Skip to content

Commit 62907d3

Browse files
add dropdown menu and todos
1 parent f044bbb commit 62907d3

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

lib/editor/components/pattern/EditSettings.js

+23-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {Alert, Checkbox, Form, FormControl, ControlLabel} from 'react-bootstrap'
55
import Rcslider from 'rc-slider'
66

77
import {updateEditSetting} from '../../actions/active'
8-
import {CLICK_OPTIONS} from '../../util'
8+
import {CLICK_OPTIONS, SNAP_TO_OPTIONS} from '../../util'
99
import toSentenceCase from '../../../common/util/text'
1010
import type {EditSettingsState} from '../../../types/reducers'
1111

@@ -64,6 +64,7 @@ export default class EditSettings extends Component<Props, State> {
6464
stopInterval
6565
} = editSettings
6666
const SETTINGS = [
67+
// RAIL-TODO remove snap to streets
6768
{type: 'followStreets', label: 'Snap to streets'},
6869
{type: 'avoidMotorways', label: 'Avoid highways in routing'},
6970
{type: 'hideStopHandles', label: 'Hide stop handles'},
@@ -75,6 +76,27 @@ export default class EditSettings extends Component<Props, State> {
7576
const noSegmentIsActive = !patternSegment && patternSegment !== 0
7677
return (
7778
<div>
79+
<ControlLabel><small>Snap to options</small></ControlLabel>
80+
<FormControl
81+
componentClass='select'
82+
value={onMapClick}
83+
name={'onMapClick'}
84+
onChange={this._onSelectChange}>
85+
{SNAP_TO_OPTIONS.map(v => {
86+
// ADD_STOPS_AT_INTERSECTIONS only enabled for nysdot extenstion
87+
// (due to custom r5 deployment)
88+
// FIXME: Temporarily disable add stops at intersection entirely
89+
// (needs to be fixed for sql editor).
90+
const disabled = v === 'ADD_STOPS_AT_INTERSECTIONS' // && !isExtensionEnabled('nysdot')
91+
return (
92+
<option
93+
key={v}
94+
disabled={disabled}
95+
value={v}>{toSentenceCase(v.replace(/_/g, ' '))}
96+
</option>
97+
)
98+
})}
99+
</FormControl>
78100
{SETTINGS.map((s, i) => (
79101
<Checkbox
80102
checked={editSettings[s.type]}

lib/editor/util/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ export const CLICK_OPTIONS: Array<string> = [
1919
'ADD_STOPS_AT_INTERVAL',
2020
'ADD_STOPS_AT_INTERSECTIONS'
2121
]
22+
export const SNAP_TO_OPTIONS: Array<string> = [
23+
'NONE',
24+
'STREET',
25+
'RAIL'
26+
]
2227
export const YEAR_FORMAT: string = 'YYYY-MM-DD'
2328
export const EXCEPTION_EXEMPLARS = {
2429
MONDAY: 0,

lib/scenario-editor/utils/valhalla.js

+2
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ export function routeWithGraphHopper (points: Array<LatLng>, avoidMotorways?: bo
216216
}
217217

218218
// Use custom url if it exists, otherwise default to the hosted service.
219+
// RAIL-TODO use default server if no alternates are provided
220+
// RAIL-TODO support overiding rail url
219221
let graphHopperUrl = process.env.GRAPH_HOPPER_URL || 'https://graphhopper.com/api/1/'
220222
let graphHopperKey = process.env.GRAPH_HOPPER_KEY
221223

lib/types/reducers.js

+1
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ export type DataState = {
208208
}
209209

210210
export type EditSettingsState = {
211+
// RAIL-TODO add any types that are missing
211212
addStops: boolean,
212213
afterIntersection: boolean,
213214
avoidMotorways: boolean,

0 commit comments

Comments
 (0)