feat(editable-layers): EditModeCoordinateSystem abstraction aligned with deck.gl COORDINATE_SYSTEM#516
feat(editable-layers): EditModeCoordinateSystem abstraction aligned with deck.gl COORDINATE_SYSTEM#516
Conversation
|
@copilot It feels like we are not using enough from https://deck.gl/docs/developer-guide/coordinate-systems - this should be better shared |
Done in commit 4533e6d. Three changes align with deck.gl's coordinate system:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
…-geographic editing Co-authored-by: charlieforward9 <62311337+charlieforward9@users.noreply.github.com>
…ORDINATE_SYSTEM constants Co-authored-by: charlieforward9 <62311337+charlieforward9@users.noreply.github.com>
4533e6d to
2a10d9d
Compare
All
editable-layersedit modes hard-code turf.js (WGS84 geodesic) math, making them unusable withOrthographicViewor any non-geographic coordinate system. This PR introduces anEditModeCoordinateSysteminterface, integrates it with deck.gl's ownCOORDINATE_SYSTEMconstants, and migrates key modes to use it, decoupling editing logic from geographic assumptions.New:
EditModeCoordinateSysteminterface + implementationsThe interface is named
EditModeCoordinateSystem(notCoordinateSystem) to avoid collision with deck.gl's ownCoordinateSystemtype (-1 | 0 | 1 | 2 | 3from@deck.gl/core), which describes rendering projection.EditModeCoordinateSystemdescribes geometric math for edit modes.Four geometric primitives, consistent bearing convention (compass: 0°=north, CW, [-180°, 180°]):
Integration with deck.gl
COORDINATE_SYSTEMA new
fromDeckCoordinateSystem()utility maps deck.gl'sCOORDINATE_SYSTEMenum to the correct math implementation:COORDINATE_SYSTEM.LNGLAT/DEFAULT/LNGLAT_OFFSETSGeoCoordinateSystemCOORDINATE_SYSTEM.CARTESIAN/METER_OFFSETSCartesianCoordinateSystemEditableGeoJsonLayer.getModeProps()now automatically derivescoordinateSystemfrom the layer's ownthis.props.coordinateSystem(the standard deck.gl layer prop) viafromDeckCoordinateSystem(). Users just setcoordinateSystem={COORDINATE_SYSTEM.CARTESIAN}on the layer and edit modes automatically use Euclidean math — no separate configuration needed.ModePropsextendedModes migrated
translateFromCenter— removes@turf/rhumb-bearing/distance/destinationin favour of the coordinate system abstractionTranslateMode— usesprops.coordinateSystemfor drag distance/bearing andtranslateFromCenterMeasureDistanceMode— usesprops.coordinateSystemfor segment distance and midpoint tooltipsExports
EditModeCoordinateSystem,GeoCoordinateSystem,CartesianCoordinateSystem,geoCoordinateSystem,cartesianCoordinateSystem,getEditModeCoordinateSystem,fromDeckCoordinateSystemare all exported from the package root.Remaining modes (
RotateMode,ScaleMode, circle/measurement modes) still call turf directly; follow-up PRs can migrate them one-by-one using the same pattern.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.