Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
23f5fa3
add dropdown menu and todos
josh-willis-arcadis Mar 10, 2025
b809f44
use snap to option to calculate shape
josh-willis-arcadis Mar 10, 2025
356c46e
remove uses of followStreets
josh-willis-arcadis Mar 6, 2025
d69c421
update params sent to rail router
josh-willis-arcadis Mar 7, 2025
ddb4352
use util functions from dev branch
josh-willis-arcadis Mar 11, 2025
69187fb
use type from leaflet
josh-willis-arcadis Mar 11, 2025
d65f69a
use enum and remove magic string
josh-willis-arcadis Mar 19, 2025
b3888af
rename snapToOption to followOption
josh-willis-arcadis Mar 19, 2025
21be59b
disable 'avoidHighways' when street is not selected
josh-willis-arcadis Apr 15, 2025
18dc760
bring in changes from dev branch
josh-willis-arcadis Apr 15, 2025
d4d1ae6
dont delete followStreets logic
josh-willis-arcadis Apr 15, 2025
0e572c5
refactor(editor/util/map.js): bring back followStreets
josh-willis-arcadis Apr 15, 2025
fde3d92
restore use of followStreets
josh-willis-arcadis Apr 15, 2025
e693650
restore use of followStreet in valhalla.js
josh-willis-arcadis Apr 15, 2025
30306a3
restore usage of followStreets
josh-willis-arcadis Apr 16, 2025
c21bc38
add util function from dev
josh-willis-arcadis Apr 16, 2025
2a29438
add followRail to state and use in UI
josh-willis-arcadis Apr 17, 2025
0a1e546
rail routing works!
josh-willis-arcadis Apr 17, 2025
5f822a1
address pr feedback
josh-willis-arcadis Apr 22, 2025
852392d
remove text.js in favor of to-sentence-case.js
josh-willis-arcadis Apr 30, 2025
39722d9
extract followRail and use in polyline call
josh-willis-arcadis Apr 30, 2025
b8c38c1
create on change method for follow option
josh-willis-arcadis Apr 30, 2025
0042619
extract bounds var
josh-willis-arcadis Apr 30, 2025
a2d7022
use followRail when extending pattern
josh-willis-arcadis May 1, 2025
57c4816
call valhalla when followRail is true
josh-willis-arcadis May 2, 2025
0c2ab13
allow snap to rail option only when route_type is 0,1, or 2
josh-willis-arcadis May 5, 2025
9083e6f
sort props
josh-willis-arcadis May 6, 2025
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
27 changes: 22 additions & 5 deletions lib/editor/components/pattern/EditSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import {updateEditSetting} from '../../actions/active'
import {CLICK_OPTIONS, SNAP_TO_OPTIONS} from '../../util'
import toSentenceCase from '../../../common/util/to-sentence-case'
import type {EditSettingsState} from '../../../types/reducers'
import type {GtfsRoute} from '../../../types'

type Props = {
activeEntity: GtfsRoute,
editSettings: EditSettingsState,
patternSegment: number,
updateEditSetting: typeof updateEditSetting
Expand Down Expand Up @@ -62,7 +64,7 @@ export default class EditSettings extends Component<Props, State> {

render () {
// Edit Settings passed in are present
const {editSettings, patternSegment, updateEditSetting} = this.props
const {editSettings, patternSegment, updateEditSetting, activeEntity} = this.props
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit - sort props

const {
editGeometry,
followStreets,
Expand All @@ -83,18 +85,33 @@ export default class EditSettings extends Component<Props, State> {
]
if (!editGeometry) return null
const noSegmentIsActive = !patternSegment && patternSegment !== 0

// If route_type is rail, add "snap to rail" option
const snapToOptions = Object.keys(SNAP_TO_OPTIONS).reduce((acc, key) => {
if (key === 'RAIL') {
const routeType = activeEntity && activeEntity.route_type
if ([0, 1, 2].includes(routeType)) {
acc[key] = SNAP_TO_OPTIONS[key]
}
} else {
acc[key] = SNAP_TO_OPTIONS[key]
}
return acc
}, {})

return (
<div>
<ControlLabel><small>Snap to</small></ControlLabel>
<FormControl
componentClass='select'
value={currentSelection}
name='followOption'
onChange={this._onFollowOptionChange}>
{Object.keys(SNAP_TO_OPTIONS).map(key => (
onChange={this._onFollowOptionChange}
value={currentSelection}
>
{Object.keys(snapToOptions).map(key => (
<option
key={key}
value={SNAP_TO_OPTIONS[key]}>
value={snapToOptions[key]}>
{toSentenceCase(key)}
</option>
))}
Expand Down
7 changes: 5 additions & 2 deletions lib/editor/components/pattern/EditShapePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ import {
getPatternDistance,
isValidStopControlPoint
} from '../../util/map'
import type {ControlPoint, LatLng, Pattern, GtfsStop} from '../../../types'
import type {ControlPoint, GtfsRoute, LatLng, Pattern, GtfsStop} from '../../../types'
import type {EditSettingsUndoState} from '../../../types/reducers'

import EditSettings from './EditSettings'

type Props = {
activeEntity: GtfsRoute,
activePattern: Pattern,
controlPoints: Array<ControlPoint>,
editSettings: EditSettingsUndoState,
Expand All @@ -41,7 +42,7 @@ type Props = {
undoActiveTripPatternEdits: typeof tripPatternActions.undoActiveTripPatternEdits,
updateActiveGtfsEntity: typeof activeActions.updateActiveGtfsEntity,
updateEditSetting: typeof activeActions.updateEditSetting,
updatePatternGeometry: typeof mapActions.updatePatternGeometry,
updatePatternGeometry: typeof mapActions.updatePatternGeometry
}

export default class EditShapePanel extends Component<Props> {
Expand Down Expand Up @@ -200,6 +201,7 @@ export default class EditShapePanel extends Component<Props> {

render () {
const {
activeEntity,
activePattern,
controlPoints, // FIXME use to describe which segment user is editing
patternSegment,
Expand Down Expand Up @@ -360,6 +362,7 @@ export default class EditShapePanel extends Component<Props> {
</Button>
</ButtonToolbar>
<EditSettings
activeEntity={activeEntity}
editSettings={editSettings}
patternSegment={patternSegment}
updateEditSetting={updateEditSetting} />
Expand Down