Class: ModifyFeature

ol.interaction. ModifyFeature

Interaction for modifying feature geometries. Similar to the core ol/interaction/Modify. The interaction is more suitable to use to handle feature modification: only features concerned by the modification are passed to the events (instead of all feature with ol/interaction/Modify)

  • the modifystart event is fired before the feature is modified (no points still inserted)
  • the modifyend event is fired after the modification
  • it fires a modifying event

new ModifyFeature(options)

Parameters:
Name Type Description
options *
Properties
Name Type Description
source ol.source.Vector

a source to modify (configured with useSpatialIndex set to true)

sources ol.source.Vector | Array.<ol.source.Vector>

a list of source to modify (configured with useSpatialIndex set to true)

features ol.Collection.<ol.Feature>

collection of feature to modify

pixelTolerance integer

Pixel tolerance for considering the pointer close enough to a segment or vertex for editing. Default is 10.

filter function | undefined

a filter that takes a feature and return true if it can be modified, default always true.

style ol.style.Style | Array.<ol.style.Style> | undefined

Style for the sketch features.

condition ol.EventsConditionType | undefined

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event will be considered to add or move a vertex to the sketch. Default is ol.events.condition.primaryAction.

deleteCondition ol.EventsConditionType | undefined

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether that event should be handled. By default, ol.events.condition.singleClick with ol.events.condition.altKeyOnly results in a vertex deletion.

insertVertexCondition ol.EventsConditionType | undefined

A function that takes an ol.MapBrowserEvent and returns a boolean to indicate whether a new vertex can be added to the sketch features. Default is ol.events.condition.always

wrapX boolean

Wrap the world horizontally on the sketch overlay, default false

Fires:
  • event:modifystart
  • event:modifying
  • event:modifyend
  • event:select

Extends

  • ol.interaction.Interaction

Methods


getArcs(geom, coord)

Get arcs concerned by a modification

Parameters:
Name Type Description
geom ol.geom

the geometry concerned

coord ol.coordinate

pointed coordinates


getCurrentFeature()

Get the current feature to modify

Returns:
Type
ol.Feature

getModifiedFeatures()

Get modified features

Returns:

list of modified features

Type
Array.<ol.Feature>

getNearestCoord(pt, coords)

Get nearest coordinate in a list

Parameters:
Name Type Description
pt ol.coordinate

the point to find nearest

coords ol.geom

list of coordinates

Returns:

the nearest point with a coord (projected point), dist (distance to the geom), ring (if Polygon)

Type
*

handleDownEvent(evt)

Parameters:
Name Type Description
evt ol.MapBrowserEvent

Map browser event.

Returns:

true to start the drag sequence.

Type
boolean

removePoint()

Removes the vertex currently being pointed.


setActive()

Activate or deactivate the interaction + remove the sketch.

Parameters:
Name Type Description
active. boolean

setFilter()

Change the filter function

Parameters:
Name Type Description
options.filter function | undefined

a filter that takes a feature and return true if it can be modified, default always true.


setMap(map)

Remove the interaction from its current map, if any, and attach it to a new map, if any. Pass null to just remove the interaction from the current map.

Parameters:
Name Type Description
map ol.Map

Map.