new Draw(options)
A class to provide the user with drawing tools
Parameters:
| Name | Type | Description |
|---|---|---|
options |
nyc.ol.Draw.Options | Constructor options |
- Source:
Fires:
- nyc.ol.Draw#event:addfeature
- nyc.ol.Draw#event:changefeature
- nyc.ol.Draw#event:removefeature
Extends
Members
(static) Type :string
Enumeration for feature event types
Type:
- string
Properties:
| Name | Type | Description |
|---|---|---|
POINT |
string | The point drawing type |
LINE |
string | The line drawing type |
POLYGON |
string | The polugon drawing type |
CIRCLE |
string | The circle drawing type |
SQUARE |
string | The square drawing type |
BOX |
string | The box drawing type |
NONE |
string | No drawing type |
- Source:
Methods
activate(type)
Activate to begin adding drawings of the specified type
Parameters:
| Name | Type | Description |
|---|---|---|
type |
nyc.ol.Draw.Type | The drawing type to activate |
- Source:
active() → {boolean}
Return the active state
- Source:
Returns:
The active state
- Type
- boolean
clear()
Remove all drawn features
- Source:
deactivate()
Deactivate to stop drawing
- Source:
getFeatures() → {Object.<string, Array.<ol.Feature>>}
Get the features that have been drawn
- Source:
Returns:
The features
- Type
- Object.<string, Array.<ol.Feature>>
off(eventName, evtHdlr, hdlrScopeopt)
Remove a previously connected event handler
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
eventName |
string | The name of the event to which the handler will be connected | |
evtHdlr |
function | The event handler function | |
hdlrScope |
Object |
<optional> |
The scope in which to invoke the event handler |
- Inherited From:
- Source:
on(eventName, evtHdlr, hdlrScopeopt)
Connect a function to an event
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
eventName |
string | The name of the event to which the handler will be connected | |
evtHdlr |
function | The event handler function | |
hdlrScope |
Object |
<optional> |
The scope in which to invoke the event handler |
- Inherited From:
- Source:
one(eventName, evtHdlr, hdlrScopeopt)
Connect a function to an event for a single invocation
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
eventName |
string | The name of the event to which the handler will be connected | |
evtHdlr |
function | The event handler function | |
hdlrScope |
Object |
<optional> |
The scope in which to invoke the event handler |
- Inherited From:
- Source:
removeFeature(feature)
Parameters:
| Name | Type | Description |
|---|---|---|
feature |
ol.Feature |
- Source:
setFeatures(The)
Get the features that have been drawn
Parameters:
| Name | Type | Description |
|---|---|---|
The |
Array.<nyc.ol.Feature> | features |
- Source:
trigger(eventName, dataopt)
Trigger a named event with event data
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
eventName |
string | The name of the event to trigger | |
data |
Object |
<optional> |
The event data |
- Inherited From:
- Source:
Type Definitions
Options
Constructor options for nyc.ol.Draw
Type:
- Object
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
map |
ol.Map | The OpenLayers map with which the user will interact | |
style |
ol.style.Style |
<optional> |
The style to use for features added to the map |
- Source: