new AreaTool(optionsopt) [source]
var areaTool = new AreaTool({
'once' : true,
'symbol': {
'lineColor' : '#34495e',
'lineWidth' : 2
},
'vertexSymbol' : {
'markerType' : 'ellipse',
'markerFill' : '#1bbc9b',
'markerLineColor' : '#000',
'markerLineWidth' : 3,
'markerWidth' : 10,
'markerHeight' : 10
},
'language' : 'en-US'
}).addTo(map);
Parameter | Type | Default | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options
opt
|
options | null | construct options
Properties
|
Extends:
Fires:
Members
(constant) options
Properties:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options
|
options |
Properties
|
- Overrides:
- Source:
Methods
(inherited) clear() [source]
Clear the measurements
Returns:
DistanceTool: this(inherited) getMeasureLayers() [source]
Get the VectorLayers with the geometries drawn on the map during measuring.
Returns:
Array.<Layer>:(inherited) getLastMeasure() [source]
Get last measuring result
Returns:
Number:(inherited) getMode() [source]
Get current mode of draw tool
Returns:
String: mode(inherited) setMode(mode) [source]
Set mode of the draw tool
Parameter | Type | Description |
---|---|---|
mode
|
String | mode of the draw tool |
(inherited) getSymbol() [source]
Get symbol of the draw tool
Returns:
Object: symbol(inherited) setSymbol(symbol) [source]
Set draw tool's symbol
Parameter | Type | Description |
---|---|---|
symbol
|
Object | symbol set |
Returns:
DrawTool: this(inherited) getCurrentGeometry() [source]
Get geometry is currently drawing
Returns:
Geometry: geometry currently drawing(inherited) undo() [source]
Undo drawing, only applicable for click/dblclick mode
Returns:
DrawTool: this(inherited) redo() [source]
Redo drawing, only applicable for click/dblclick mode
Returns:
DrawTool: this(inherited) endDraw(paramopt) [source]
End current draw
Parameter | Type | Default | Description |
---|---|---|---|
param
opt
|
Object | null | params of drawend event |
Returns:
DrawTool: this(inherited) setLayerZIndex(zIndex) [source]
set draw inner layers zIndex
Parameter | Type | Description |
---|---|---|
zIndex
|
Number | draw layer zIndex |
Returns:
this:(inherited) addTo(map) [source]
Adds the map tool to a map.
Parameter | Type | Description |
---|---|---|
map
|
Map |
Fires:
Returns:
MapTool: this(inherited) getMap() [source]
Gets the map it added to.
Returns:
Map: map(inherited) enable() [source]
Enable the map tool.
Fires:
Returns:
MapTool: this(inherited) disable() [source]
Disable the map tool
Fires:
Returns:
MapTool: this(inherited) isEnabled() [source]
Returns whether the tool is enabled
Returns:
Boolean: true | false(inherited) on(eventsOn, handler, contextopt) [source]
Register a handler function to be called whenever this event is fired.
foo.on('mousedown mousemove mouseup', onMouseEvent, foo);
Parameter | Type | Default | Description |
---|---|---|---|
eventsOn
|
String | event types to register, seperated by space if more than one. | |
handler
|
function | handler function to be called | |
context
opt
|
Object | null | the context of the handler |
Mixes From:
Returns:
Any: this(inherited) addEventListener(eventTypes, handler, contextopt) [source]
Alias for on
Parameter | Type | Default | Description |
---|---|---|---|
eventTypes
|
String | event types to register, seperated by space if more than one. | |
handler
|
function | handler function to be called | |
context
opt
|
Object | null | the context of the handler |
Mixes From:
Returns:
: this(inherited) once(eventTypes, handler, contextopt) [source]
Same as on, except the listener will only get fired once and then removed.
foo.once('mousedown mousemove mouseup', onMouseEvent, foo);
Parameter | Type | Default | Description |
---|---|---|---|
eventTypes
|
String | event types to register, seperated by space if more than one. | |
handler
|
function | listener handler | |
context
opt
|
Object | null | the context of the handler |
Mixes From:
Returns:
: this(inherited) off(eventsOff, handler, contextopt) [source]
Unregister the event handler for the specified event types.
foo.off('mousedown mousemove mouseup', onMouseEvent, foo);
Parameter | Type | Default | Description |
---|---|---|---|
eventsOff
|
String | event types to unregister, seperated by space if more than one. | |
handler
|
function | listener handler | |
context
opt
|
Object | null | the context of the handler |
Mixes From:
Returns:
: this(inherited) removeEventListener(eventTypes, handler, contextopt) [source]
Alias for off
Parameter | Type | Default | Description |
---|---|---|---|
eventTypes
|
String | event types to unregister, seperated by space if more than one. | |
handler
|
function | listener handler | |
context
opt
|
Object | null | the context of the handler |
Mixes From:
Returns:
: this(inherited) listens(eventType, hanlderopt, contextopt) [source]
Returns listener's count registered for the event type.
Parameter | Type | Default | Description |
---|---|---|---|
eventType
|
String | an event type | |
hanlder
opt
|
function | null | listener function |
context
opt
|
Object | null | the context of the handler |
Mixes From:
Returns:
Number:(inherited) getListeningEvents() [source]
Get all the listening event types
Mixes From:
Returns:
Array.<String>: events(inherited) copyEventListeners(target) [source]
Copy all the event listener to the target object
Parameter | Type | Description |
---|---|---|
target
|
Object | target object to copy to. |
Mixes From:
Returns:
: this(inherited) fire(eventType, param) [source]
Fire an event, causing all handlers for that event name to run.
Parameter | Type | Description |
---|---|---|
eventType
|
String | an event type to fire |
param
|
Object | parameters for the listener function. |
Mixes From:
Returns:
: this(inherited) callInitHooks() [source]
Visit and call all the init hooks defined on Class and its parents.
Returns:
Class: this(inherited) setOptions(options) [source]
Merges options with the default options of the object.
Parameter | Type | Description |
---|---|---|
options
|
Object | options to set |
Returns:
Class: this(inherited) config(conf) [source]
1. Return object's options if no parameter is provided.
2. update an option and enable/disable the handler if a handler with the same name existed.
2. update an option and enable/disable the handler if a handler with the same name existed.
// Get marker's options;
var options = marker.config();
// Set map's option "draggable" to false and disable map's draggable handler.
map.config('draggable', false);
// You can update more than one options like this:
map.config({
'scrollWheelZoom' : false,
'doubleClickZoom' : false
});
Parameter | Type | Description |
---|---|---|
conf
|
Object | config to update |
Returns:
Class: this(inherited) onConfig() [source]
Default callback when config is called
Events
(inherited) drawvertex [source]
drawvertex event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | drawvertex |
target
|
DrawTool | draw tool |
geometry
|
Geometry | geometry drawn |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Overrides:
- Source:
(inherited) drawprepare [source]
drawprepare event.Note that it occurs before drawstart
Properties:
Name | Type | Description |
---|---|---|
type
|
String | drawprepare |
target
|
DrawTool | draw tool |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Overrides:
- Source:
(inherited) drawstart [source]
drawstart event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | drawstart |
target
|
DrawTool | draw tool |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Overrides:
- Source:
(inherited) mousemove [source]
mousemove event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | mousemove |
target
|
DrawTool | draw tool |
geometry
|
Geometry | geometry drawn |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Overrides:
- Source:
(inherited) drawend [source]
drawend event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | drawend |
target
|
DrawTool | draw tool |
geometry
|
Geometry | geometry drawn |
coordinate
|
Coordinate | coordinate of the event |
containerPoint
|
Point | container point of the event |
viewPoint
|
Point | view point of the event |
domEvent
|
Event | dom event |
- Overrides:
- Source:
(inherited) add [source]
add event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | add |
target
|
MapTool | map tool |
- Overrides:
- Source:
(inherited) enable [source]
enable event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | enable |
target
|
MapTool | map tool |
- Overrides:
- Source:
(inherited) disable [source]
disable event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | disable |
target
|
MapTool | map tool |
- Overrides:
- Source:
(inherited) remove [source]
remove event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | remove |
target
|
MapTool | map tool |
- Overrides:
- Source: