<FeatureEditor />

A component to edit geometries

Constructor

# <FeatureEditor editOpts editFeature addEditFeatureToContext map onEditBegin onEditFinish onEditCancel editStyle areaUOM distanceUOM translations />

PropTypes:
Name Type Required Description Default
editOpts exact No {}
editFeature object No
addEditFeatureToContext func No
map object No
onEditBegin func No (feature) => { feature.setStyle(new olStyleStyle({})) }
onEditFinish func No (feature, updatedFeature, addEditFeatureToContext, style) => { const geom = updatedFeature.getGeometry() if (!feature) return feature.setGeometry(geom) feature.setStyle(style || null) // restore the original feature's style addEditFeatureToContext(null) }
onEditCancel func No (feature, addEditFeatureToContext, style) => { feature.setStyle(style || null) // restore the original feature's style addEditFeatureToContext(null) }
editStyle union No (feature, map, showMeasurements = false, { areaUOM, distanceUOM }, translations) => { // eslint-disable-line return immediateEditStyle( { areaUOM, distanceUOM, showMeasurements, map, translations, language: navigator.language }, feature, map.getView().getResolution() ) }
areaUOM string No
distanceUOM string No
translations object No
Since:
  • 1.16.0

View Source FeatureEditor/FeatureEditor.js, line 60

Members

# _renderFeature

In the past we've used temporary layers added to the map to avoid modifying the original features directly. However, this leads to a lot of cleanup since those layers need to be added/removed from both the map and state. That is fine as long as everything goes smoothly but if there is additional logic listening to the map for changes to it's features or layers than we can get left in a broken state that requires a reload. Using vectorContext.drawFeature instead of a layer added to the map alleviates at least some of this risk.

View Source FeatureEditor/FeatureEditor.js, line 77