new DistanceTool(optionsopt) [source]
var distanceTool = new DistanceTool({
'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
clear() [source]
Clear the measurements
Returns:
DistanceTool: thisgetMeasureLayers() [source]
Get the VectorLayers with the geometries drawn on the map during measuring.
Returns:
Array.<Layer>:getLastMeasure() [source]
Get last measuring result
Returns:
Number:(inherited) getMode() [source]
Get current mode of draw tool
Inherited From:
Returns:
String: mode(inherited) setMode(mode) [source]
Set mode of the draw tool
Parameter | Type | Description |
---|---|---|
mode
|
String | mode of the draw tool |
Inherited From:
(inherited) getSymbol() [source]
Get symbol of the draw tool
Inherited From:
Returns:
Object: symbol(inherited) setSymbol(symbol) [source]
Set draw tool's symbol
Parameter | Type | Description |
---|---|---|
symbol
|
Object | symbol set |
Inherited From:
Returns:
DrawTool: this(inherited) getCurrentGeometry() [source]
Get geometry is currently drawing
Inherited From:
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 |
Inherited From:
Returns:
DrawTool: this(inherited) addTo(map) [source]
Adds the map tool to a map.
Parameter | Type | Description |
---|---|---|
map
|
Map |
Inherited From:
Fires:
Returns:
MapTool: this(inherited) getMap() [source]
Gets the map it added to.
Inherited From:
Returns:
Map: map(inherited) enable() [source]
Enable the map tool.
Inherited From:
Fires:
Returns:
MapTool: this(inherited) disable() [source]
Disable the map tool
Inherited From:
Fires:
Returns:
MapTool: this(inherited) isEnabled() [source]
Returns whether the tool is enabled
Inherited From:
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:
Inherited 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:
Inherited 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:
Inherited 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:
Inherited 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:
Inherited 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:
Inherited From:
Returns:
Number:(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:
Inherited 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:
Inherited From:
Returns:
: this(inherited) callInitHooks() [source]
Visit and call all the init hooks defined on Class and its parents.
Inherited From:
Returns:
Class: this(inherited) setOptions(options) [source]
Merges options with the default options of the object.
Parameter | Type | Description |
---|---|---|
options
|
Object | options to set |
Inherited From:
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 |
Inherited From:
Returns:
Class: this(inherited) onConfig() [source]
Default callback when config is called
Inherited From:
Events
(inherited) drawvertex [source]
drawvertex event.
Inherited From:
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 |
- Inherited From:
- Source:
(inherited) drawstart [source]
drawstart event.
Inherited From:
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 |
- Inherited From:
- Source:
(inherited) mousemove [source]
mousemove event.
Inherited From:
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 |
- Inherited From:
- Source:
(inherited) drawend [source]
drawend event.
Inherited From:
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 |
- Inherited From:
- Source:
(inherited) add [source]
add event.
Inherited From:
Properties:
Name | Type | Description |
---|---|---|
type
|
String | add |
target
|
MapTool | map tool |
- Inherited From:
- Source:
(inherited) enable [source]
enable event.
Inherited From:
Properties:
Name | Type | Description |
---|---|---|
type
|
String | enable |
target
|
MapTool | map tool |
- Inherited From:
- Source:
(inherited) disable [source]
disable event.
Inherited From:
Properties:
Name | Type | Description |
---|---|---|
type
|
String | disable |
target
|
MapTool | map tool |
- Inherited From:
- Source:
(inherited) remove [source]
remove event.
Inherited From:
Properties:
Name | Type | Description |
---|---|---|
type
|
String | remove |
target
|
MapTool | map tool |
- Inherited From:
- Source: