Add possibility to group features for, drag / rotate / delete#104
Add possibility to group features for, drag / rotate / delete#104zxwild merged 3 commits intogeoman-io:masterfrom
Conversation
|
I've added a little extra code to implement the We just need to specify the id of the features to select: // uncomment in index.maplibre.dev.ts
geoman.features.setSelection([1, 2, 3, 4, 5, 6, 7, 151]);Translations, rotations, and deletions will be grouped if we edit one of these features; otherwise the selection is cleared. I see you have a lasso pro feature, which I think could be interesting? Alternatively, we could implement our own home-made selection method to connect to geoman. selection.prepared.mp4 |
|
Thanks a lot for the work on this one. I will be away for the next week or so, but will go through it in details when I find the time. I unfortunately broke the tests with the dev panel, i also made a fix for this to disable dev panel in tests in another branch, but great you caught it as well. |
7aea415 to
603ee5e
Compare
4b7416c to
f4f12ee
Compare
a63b5d6 to
d781b04
Compare
|
Hi! I've rebased the source code to resolve conflicts. You can find a usage example using a selection box. selection.prepared.mp4 |
…tate / delete) AI merge attempt
|
I'm trying to align the current Feel free to take the changes to your PR if they are suitable :) I'm not sure I understand completely the full code, so I'll post questions and offers, the first: Some draw modes has |
1418ce5 to
a9109e4
Compare
|
Thanks a lot @zxwild for taking the time to fix the merge conflicts! Of course we can start discussing the feature. I added the Normally all draw modes call |
Group Features Support
Closes #90
group-features.prepared.mp4
Summary
This PR implements the ability to group features of different geometry types (e.g., Polygon and LineString) to move, rotate, or delete them together as a single unit. Previously, only MultiLineString and MultiPolygon could emulate this behavior because they are the same geometry type.
Problem
Users needed a way to group different geometry types representing a single complex shape and manipulate them together while keeping the shape in sync. For example, a Polygon with a LineString representing related elements should be movable and rotatable as a cohesive unit.
Solution
Features can now be grouped using a custom
__gm_groupproperty. When features share the same group identifier, they are treated as a single entity for transformation operations.Features Implemented
Tests
Details
I needed to change the
moveFeatureimplementation to use aLngLatDiffbecause the method could be called multiple times by different features.I chose not to associate linkedFeatures directly as a property in the featureData but to compute the array when the drag/rotate/delete action begins for more flexibility. (Users can change the group shape property of one feature and they don't need to update the link between all featureData affected by the modification).
I found a broken portion of code in the EditRotate class
Conclusion
I hope this feature is of interest. Please let me know if there are any implementation details that could be improved.