An options object hash containing CreateController options.
An event that fires whenever the user edited the shape.
The CSS cursor to use on the map, for this controller.
If null
, the map will fall back to the previous cursor that was set on the map.
Note that changing this cursor will update the cursor on the map's DOM node. When using multiple controllers (e.g. in a CompositeController), the controller that updates the cursor last (to a non-null value), will override any other non-null cursors of active controllers on the map.
The CSS cursor to use on the map, for this controller.
If null
, the map will fall back to the previous cursor that was set on the map.
Note that changing this cursor will update the cursor on the map's DOM node. When using multiple controllers (e.g. in a CompositeController), the controller that updates the cursor last (to a non-null value), will override any other non-null cursors of active controllers on the map.
The map on which this controller is currently active or null
if this controller is not currently active.
This property is read-only.
The map on which this controller is currently active or null
if this controller is not currently active.
This property is read-only.
Return the maximum number of points that should be created.
The maximum number of points to create.
Return the minimum number of points that should be created.
The minimum number of points to create.
Returns the settings configured on this CreateController. These settings are passed to the Editor and its handles, through EditContext.settings.
Call this method to indicate that the controller's appearance has changed. Calling this method ensures the onDraw will be called during the next rendering pass.
This method is called when this controller needs to determine in which
layer an object should be created. This method can be overridden to choose
a specific layer. If this method returns null
then the object creation will
not be started. This controller will remain the active controller though.
the map
the layer to create objects for or null
Called when a new feature instance needs to be created.
the map view
the layer
a new feature
Called when a key event has been received. This method must return a HandleEventResult value to indicate if the event was handled or not, If this method returns EVENT_IGNORED, the map will be given the opportunity to perform default key event behaviour. If default event handling is not desired, this method should return EVENT_HANDLED. (See the Controller class description for the default behavior.)
The key event to be handled. Note that this is a KeyEvent and not a DOMEvent. You can access the corresponding DOMEvent through KeyEvent.domEvent.
The key event handling result.
Called when a complete object has been created.
The default implementation of this method adds the created object to the model of the given layer. When the return istrue
, the controller will deactivate immediately.
When the return is a Promise
, the controller will deactivate when the promise is resolved or when the promise is rejected.
the map view
the layer
the feature that was created
When a Promise
is returned, the controller will deactivate when the promise is resolved or when the promise is rejected.
When no Promise
is returned, the controller will deactivate immediately.
Set the minimum and maximum number of points that should be created using this controller. Once the maximum number of points is reached, the controller will automatically disable itself. Note that this method should be called before the creation controller is activated on the map, subsequent calls to this method will be ignored.
The minimum number of points that should be created. Has to be positive.
The maximum number of points that should be created. Set to -1 if not specified.
This controller enables creating a new shape on the map. To specify the layer in which the object should be created, override the
onChooseLayer
method callback.If you want to change the way creation behaves, check out the Customizing creation and editing guide.