feat(editable-layers): non-geospatial coordinate system#537
feat(editable-layers): non-geospatial coordinate system#537eKerney wants to merge 10 commits intovisgl:copilot/start-work-on-issue-496from
Conversation
|
Great proof of concept here - we certainly want to have the updated coordinate system be baked into the core modes - not create new ones per coordinate system - this would multiply our bug surface and make maintenance nearly impossible. Consider how we can update the current mode to work with non geo coordinates. or how we can pass the coordinate system into the core layer , or make a new master layer type |
…6' into copilot/start-work-on-issue-496 pull updates from DeckGL Community to sync local branch
|
Yes I agree with @charlieforward9
I haven't tried actually running the code from there. |
|
@eKerney you could try putting an agent on it and directing it towards the feedback |
|
@charlieforward9 made a very small change by swapping |
There was a problem hiding this comment.
Sweet, simple change!
Id say the real work with this coordinate task is to pull the edit mode widget into the no map example and show all the relevant modes with non-geographic values.
Basically have the editable layer operations be controlled by the active deck coordinate system
- if geo - work as is
- if non geo - handle that maths without turf.js.
Non non geo situation could have editable layers pulling in way less dependencies
|
@charlieforward9 - I've updated modify-mode and corresponding functions in utils.ts - helper func |
charlieforward9
left a comment
There was a problem hiding this comment.
Good progress here. The projectOrUnprojectPoints abstraction is the right call. Main blocker: nearestPointOnLine now constructs WebMercatorViewport unconditionally which will blow up in cartesian-only usage where theres no viewport. Fix that + the test typo and this is ready to merge into #516.
| let closestPoint: any = point([Infinity, Infinity], {dist: Infinity}); | ||
|
|
||
| if (!lines.geometry?.coordinates.length || lines.geometry?.coordinates.length < 2) { | ||
| return closestPoint; |
There was a problem hiding this comment.
new WebMercatorViewport(viewport) is now unconditional but viewport can be undefined. Old code guarded this with if (viewport). In cartesian-only usage (no map) this will throw. Need the guard back or make viewport optional and skip projection when its absent.
There was a problem hiding this comment.
This was throwing an error for Geomode editing, most edit modes don't pass a viewport to nearestPointOnLine. Not wanting to change the function signature since this is implemented in many places, I've added a rather inelegant viewportCheck which returns the viewport or a viewport placeholder. No errors testing with no-map & editor examples
There was a problem hiding this comment.
Now that wmViewport is optional in projectOrUnprojectPoints (nice fix btw), the placeholder object isn't needed anymore. Should be able to just do:
const wmViewport = viewport ? new WebMercatorViewport(viewport) : undefined;and let the cartesian early-return in projectOrUnprojectPoints handle the rest.
There was a problem hiding this comment.
@charlieforward9 removed placeholder object, needed to add check for early return with wmViewport === undefined in projectOrUnprojectPoints - throwing an error in edit mode with editor demo.
|
@charlieforward9 comments have been addressed in commit 9d2cf6c |
Combines EditModeCoordinateSystem abstraction (#516) with OrthographicView example and edit-mode fixes (#537). - Add EditModeCoordinateSystem interface with Geo (turf.js) and Cartesian (Euclidean) implementations - Integrate with deck.gl COORDINATE_SYSTEM via fromDeckCoordinateSystem() - Migrate TranslateMode, MeasureDistanceMode, ModifyMode, DrawLineStringMode to use coordinate system abstraction - Update no-map example to use OrthographicView + COORDINATE_SYSTEM.CARTESIAN - Add coordinate-system tests and update existing test snapshots Closes #496 Co-authored-by: ekerney <eric.m.kerney@wmich.edu>
Related to RFC: Non-geospatial coordinate support for editable-layers #496
Discussion here at: feat(editable-layers): EditModeCoordinateSystem abstraction aligned with deck.gl COORDINATE_SYSTEM #516
Replaced TranslateMode with TranslateModeEx from @xinaesthete thank you!
Added OrthographicView, adjusted background image bounds and INITIAL_VIEW_STATE accordingly.
Added
COORDINATE_SYSTEM.CARTESIANto background and editableLayers.Changed selected feature color to make more obvious to user.
Note: Running
yarn start-localresulted inFailed to resolve importerror, resolved by commenting line 22 invite.config.local.mjsno-map-editable.mp4