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

Rebase deck gl poc on main #1027

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

kaligrafy
Copy link
Collaborator

No description provided.

florencelauer and others added 27 commits August 1, 2024 15:31
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]>
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
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.
READMEs remain to be updated
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.
Performance could be improved, but it works sufficiently well for now
TripsLayer is for animating a fading path, but we don't need that for general transit lines.
* 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.
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.
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.
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.
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.
Deck.gl is now implemented in mainline Transition and the poc is not
necessary anymore.
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.
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.
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.
Defaults to `true`, but can be set in the user preferences. Layers can
then use the `map.enableMapAnimations` preferences value to disable
animations.
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.
fixes chairemobilite#974

The `maxRadiusPixels` and `minRadiusPixels` can be set in the layer
description to prevent the points from getting too big/small when
zooming in/out. If the property is a number, the lineWidth min/max
pixels are also set to 1/3 of the corresponding radius.
fixes chairemobilite#966

This moves all map related preferences to a separate section in the
preferences edit form.

Add a preference called `mapTileLayerOpacity`, which is a value between
0 and 1 representing the percentage opacity of the xyz tile layer.

Extract the tile layer getter in the `TransitionMainMap` so it can be
reset when the layer opacity is changed. If the opacity is 0
(invisible), the layer is not present.
@kaligrafy kaligrafy requested a review from tahini August 7, 2024 16:37
@tahini
Copy link
Collaborator

tahini commented Aug 7, 2024

Pas besoin de PR pour ça, fait juste un rebase de la branche sur main et push manuellement. Ici, tu demandes de merger la branche deck-gl-poc, on n'est pas prêt!

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.

4 participants