Skip to content

Bus stop routes overview: colours distinguishing up/downroute#64

Open
emer7 wants to merge 8 commits intocheeaun:mainfrom
emer7:feature/color-direction
Open

Bus stop routes overview: colours distinguishing up/downroute#64
emer7 wants to merge 8 commits intocheeaun:mainfrom
emer7:feature/color-direction

Conversation

@emer7
Copy link
Copy Markdown

@emer7 emer7 commented Jan 25, 2022

Fix #47

  • Add .prettierrc so I don't overwrite / format all the existing files 😅
  • Implement different color for up/down-route

Currently the implementation is as follow:

  • For ⇄ and → route, check direction and assign color accordingly to different direction
  • For ⟲ route, is it a even-numbered or odd-numbered loop route?
    • If it is odd-numbered (i.e. hasMidStop)
      1. Get coordinate for midStop
      2. Find the interpolation of midStop coordinate to the loop
      3. Color the route accordingly up to the interpolatedCoordinate
    • If it is even-numbered (i.e. !hasMidStop)
      1. Get coordinates for 2 stops: lastStopOfFirstHalfOfLoop and firstStopOfSecondHalfOfLoop
      2. Get the segment of the loop that approximates closest to those 2 stops coordinates
      3. Get the middle point of the said segment
      4. Color the route accordingly up to the middle point

This feature removes color gradient for route colouring due to Mapbox's line-gradient not able to accept data-driven property mapbox/mapbox-gl-js#8977

Photos:
image
image

@emer7
Copy link
Copy Markdown
Author

emer7 commented Jan 27, 2022

@cheeaun ready for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bus stop routes overview: colours distinguishing up/downroute

1 participant