-
Notifications
You must be signed in to change notification settings - Fork 64
front: map level crossings #14508
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
base: dev
Are you sure you want to change the base?
front: map level crossings #14508
Conversation
Signed-off-by: Benoit Simard <contact@bsimard.com>
Import a sample data
Map renderQuestionIn this example, we have one level crossing group I checked maplibre possibilities for grouping point by an attribute and it's not possible. I can't do it in JS because we use a vector layer (in opposition of a geojson layer on which is doable). So if this result is not good enought, we need to add a new geo layer in editoast, which groups the level crossing. |
a492d1a to
3759ef8
Compare
|
Normally, this situation should not occur; there will never be such a large distance between two “parts” of the PN. If this is the case, too bad, I think we can leave it as it is for now, it's fine for me ! |
Signed-off-by: Benoit Simard <contact@bsimard.com>
3759ef8 to
b5b43d0
Compare
woshilapin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty straightforward review for editoast, I love those PR 😄
|
Thanks for this PR. It's really cool to see the feature come to life. I agree with @Tguisnet this example is not realistic at all. Level crossing points should be very close. Note This comment is a challenge of what was decided during design workshop. So don't block the merging of this PR for that. Ping @thibautsailly @Tguisnet @SharglutDev for your point of view on this feature. UI assumption: The first icon is for a part of the level crossing and the second one for a group of level crossing (note that it was named like that in this PR). Original desicion: We adapt the icon according to the zoom level. My point of view: I imagined that the display of the icon would depend on whether snapping had been performed. With the little knowledge I have of maplibre I believe the API allows this easily. Based on my point of view on this feature in the second screenshot taken by @sim51, we should have a group icon on the left and a part icon on the right. Which makes more sense (even with a weird example like this one). |
|
I see what you’re aiming for—this is essentially how clustering works (see this example). Here are the solutions I’m considering:
That said, I’m not convinced this is the approach we want to take. From my understanding of MapLibre styling, you can define:
The styling system itself doesn’t know whether features actually overlap. Overlap handling happens at render time: MapLibre shows or hides features based on the style’s overlap rules. As a result, there is no “overlap” variable available in the styling expressions (unlike zoom, for example). |
|
Note from discussion with @sim51 : it is not possible to group level crossings by object and perform clustering.
A solution that could be explored at a later stage is to do the clustering on the backend with Postgis. The layer exposure framework may need to be adapted slightly. |
Synar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work thanks!
Just a few minor comments ^^
| import bufferStopIcon from 'assets/pictures/layersicons/bufferstop.svg'; | ||
| import detectorsIcon from 'assets/pictures/layersicons/detectors.svg'; | ||
| import trackSectionsIcon from 'assets/pictures/layersicons/layer_adv.svg'; | ||
| import levelCorssingIcon from 'assets/pictures/layersicons/layer_level_crossing.svg'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| @@ -0,0 +1,9 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | |||
| <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="20"> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the same svg as in the back? Why do we need some svgs in the back and some in the front? (I've never worked with our svgs so I have no clue.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For maps we need a sprite, and editoast handles this part. It takes every icons that we need on maps, and create a sprite. That's why we have the SVG on editoast and on the front (when we need it in front part, like for this one).
| import OrderedLayer from '../OrderedLayer'; | ||
|
|
||
| export function getLevelCrossingsLayerProps(params: { | ||
| sourceTable?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to not have a sourceTable? (Same question for other optional arguments here and below). If it's just that the value can be undefined during init, I would rather explicitly have undefined in the type than an optional parameter.
In general I believe optional arguments should be used sparingly, especially when there is no use case in mind where they should not be passed. I've fixed multiple bugs where we forgot to pass values to optional arguments which probably should not have been optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For highlightedArea, minZoom & maxZoom, yes it's normal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| ...pick(params, ['minzoom', 'maxzoom']), | ||
| }; | ||
|
|
||
| if (typeof params.sourceTable === 'string') res['source-layer'] = params.sourceTable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the goal is just to guard against undefined, I think typeof is a bit overkill. "!== undefined" is more in line with our current codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be honest, we have the same code on each layer, and here it's a copy/paste.
And the sourceTable is always defined, so I'm changing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Signed-off-by: Benoit Simard <contact@bsimard.com>
5c41baa to
29f27d4
Compare



Displaying level crossings on maps and be able to turn on/off the layer.
Fix #14509