Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate the main map to Deck.gl #773

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from

Commits on May 24, 2024

  1. Deck.gl proof of work

    Working layers using geojson data, events and custom shader
    
    Co-authored-by: Wassim27 <[email protected]>
    Co-authored-by: Gabriel Bruno <[email protected]>
    Co-authored-by: Florence Lauer <[email protected]>
    Co-authored-by: MohamedAli-M <[email protected]>
    Co-authored-by: mahdiguermache <[email protected]>
    Co-authored-by: nik498 <[email protected]>
    6 people authored and tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    b361dac View commit details
    Browse the repository at this point in the history
  2. Replace main map with a Deck.gl layer

    Current state: no background, simple geometries are displayed. All
    enabled layers are displayed, with proper color if that color is in the
    properties, otherwise, it is a default color.
    
    There is no interaction with the layers and the circles are very small
    when zoomed out. The selected shaders do not work.
    
    The original layer descriptions in the layers.config.ts file have not
    been changed or updated yet. The information they contain may be useful
    for the Deck.gl data, but we'll need to take each field and see how to
    define/type it for best Deck.gl support
    tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    cab1aef View commit details
    Browse the repository at this point in the history
  3. Add MapLibre as the base map

    davidmurray authored and tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    fdae15d View commit details
    Browse the repository at this point in the history
  4. Allow showing an XYZ tile layer

    davidmurray authored and tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    8f6d94d View commit details
    Browse the repository at this point in the history
  5. Allow changing map background via the preferences

    For now, only three styles are available: OSM, positron and dark matter from CartoDB. Eventually, we can extend to also use MapTiler's tiles, but his requires an API key.
    davidmurray authored and tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    e0fb537 View commit details
    Browse the repository at this point in the history
  6. Remove references to mapbox in .env file

    READMEs remain to be updated
    davidmurray authored and tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    c82a285 View commit details
    Browse the repository at this point in the history
  7. deck.gl: Change types of the map layer

    The type is named `MapLayer` and another type `LayerConfiguration` is used
    to configure the layer by the application. The configuration is meant to
    be fixed by the application and does not change, except through
    Preferences, if necessary.
    tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    55c230e View commit details
    Browse the repository at this point in the history
  8. Make AnimatedArrowPathLayer work

    Performance could be improved, but it works sufficiently well for now
    davidmurray authored and tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    2cc3086 View commit details
    Browse the repository at this point in the history
  9. LineLayer's should just be PathLayer, not TripsLayer

    TripsLayer is for animating a fading path, but we don't need that for general transit lines.
    davidmurray authored and tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    adc0f5b View commit details
    Browse the repository at this point in the history
  10. deck.gl: Support events on map and map layers

    * Change the API of the event handlers
    * Drop support of mapbox types in event handling
    * Change the events to use the new API
    * mouseDown/Move/Up are now onDrag and onDragEnd events, which happen
      only with a specific feature, these are easier
    * There are simple tooltip events, which simplify popup management when
      only a simple text is required
    * The `click` event is separate in `leftClick` and `rightClick`
    
    TODO: The `path.hoverNode` and `path.unhoverNode` are not yet
    functional, as they programatically need to create a popup or menu at a
    specific location.
    
    TODO2: Aesthetic changes are not taken into account, as zoom events (and
    other layout events) are not yet properly handled
    
    TODO3: Not all layers are refreshed, even though the collection they
    display has elements that have changed. For example, saving a path does
    not show the updated path. Deck.GL does a shallow comparison to
    determine if the layer needs to be refreshed and probably the shallow
    comparison does not show any change if the coordinates changed.
    tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    d3320ac View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    09371d3 View commit details
    Browse the repository at this point in the history
  12. deck.gl: Add an updateCount to trigger map updates on layers

    Deck gl does a shallow comparison of the data to determine if the layer
    needs to be updated. So the data is not refreshed by default if one of
    the features in the collection changed position.
    
    We could add a `dataComparator` function, but this
    will be executed for every re-render of the map. We instead use an
    updateCount to save the number of times a layer has been updated
    throught the `map.updateLayer[s]` event. This will cause the data to be
    refreshed whenever the count is incremented.
    tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    21eeb0a View commit details
    Browse the repository at this point in the history
  13. deck.gl: Set styles for circle layers

    Bring back all mapbox styles for circle-type layers.
    Type the layer description for circle layers, with fields being either a
    number/color, a function receiving the feature in parameter, or a
    property getter to retrieve the value from a geojson property.
    tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    1ca5d7c View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    fa2fca6 View commit details
    Browse the repository at this point in the history
  15. deck.gl: Set styles for line layers

    Bring back most of mapbox styles for line-type layers. The highlight
    uses autoHighlight instead of changing the line width.
    
    The 'animatedArrowPath' also share a good part of the configuration and
    re-use the same logic for the PathLayer's data.
    tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    7a27614 View commit details
    Browse the repository at this point in the history
  16. deck.gl: Set styles for polygon layers

    Bring back the mapbox styles for the polygon layers. With the lineColor
    and fillColor, it is not necessary to have both a polygon and a stroke
    layer, one layer does them all.
    tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    31b7eb9 View commit details
    Browse the repository at this point in the history
  17. deck.gl: Remove the original proof of concept

    Deck.gl is now implemented in mainline Transition and the poc is not
    necessary anymore.
    tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    bac4147 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    a9762e4 View commit details
    Browse the repository at this point in the history
  19. deck.gl: Support filtering of features based on zoom

    Add the `featureMinZoom` property, which can be a function that takes
    the feature in parameter and return the minimum zoom at which this
    feature should be displayed.
    
    Use this property for the transitPaths layer to recover the
    functionality previously handled by the defaultFilter of mapbox.
    tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    9d8bdfe View commit details
    Browse the repository at this point in the history
  20. deck.gl: Support filtering lines and agencies

    Add the `canFilter` layer property. Because we need to know from the
    start the number of filters to enable for a layer, as it is sent to the
    shader and not updatable, even with the updateTrigger, this property
    allows to set a placeholder filter for all features when no other filter
    is set. See if this can be prevented somehow.
    
    The PathMapLayerManager is renamed to TransitPathFilterManager because
    it does not involve layers, but manages the filters. This class emits
    the filter update events. The event is caught by the map, which updates
    the layer accordingly.
    tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    073b7bb View commit details
    Browse the repository at this point in the history
  21. deck.gl: Remove dependencies to mapbox

    What remains that still depended on mapbox are the popup manager, which
    tracks which popup are currently opened and where, and the polygon draw
    tool, which is a little known feature of transition and only used for
    node selection.
    
    Some code was commented, other removed, but those features are expected
    to come back soon, tuned for deck.gl.
    tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    65b9bba View commit details
    Browse the repository at this point in the history
  22. preferences: Add an option to enable map animations

    Defaults to `true`, but can be set in the user preferences. Layers can
    then use the `map.enableMapAnimations` preferences value to disable
    animations.
    tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    e451f59 View commit details
    Browse the repository at this point in the history
  23. animated path: Allow to disable animations for the layer

    Add a prop to disable animation on the `AnimatedArrowPathLayer`. This
    deactivates the animated frame request and arrow path time step, thus
    saving the GPU from calculations. The previous speed divider of 0 also
    had the effect of making the path not move, but the layer was still
    refreshed for every frame, impacting GPU performances.
    tahini committed May 24, 2024
    Configuration menu
    Copy the full SHA
    3a8bd2b View commit details
    Browse the repository at this point in the history