new VectorLayer(id, geometriesopt, optionsopt) [source]
Parameter | Type | Default | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id
|
String | Number | layer's id | |||||||||||||
geometries
opt
|
Geometry | Array.<Geometry> | null | geometries to add | ||||||||||||
options
opt
|
Object | null | construct options
Properties
|
Extends:
Fires:
- setstyle
- removestyle
- addgeo
- removegeo
- clear
- idchange
- setzindex
- setopacity
- show
- hide
- renderercreate
- visiblechange
- resourceload
- canvascreate
- renderstart
- renderend
Members
(constant) options
Properties:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options
|
Object | VectorLayer's options
Properties
|
- Overrides:
- Source:
Methods
identify(coordinate, optionsopt) [source]
Identify the geometries on the given coordinate
Parameter | Type | Default | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
coordinate
|
maptalks.Coordinate | coordinate to identify | |||||||||||||
options
opt
|
Object | null | options
Properties
|
Returns:
Array.<Geometry>: geometries identifiedidentifyAtPoint(point, optionsopt) [source]
Identify the geometries on the given container point
Parameter | Type | Default | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
point
|
maptalks.Point | container point to identify | |||||||||||||
options
opt
|
Object | null | options
Properties
|
Returns:
Array.<Geometry>: geometries identifiedtoJSON(optionsopt) [source]
Export the VectorLayer's JSON.
Parameter | Type | Default | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options
opt
|
Object | null | export options
Properties
|
Returns:
Object: layer's JSON(inherited) getGeometryById(id) [source]
Get a geometry by its id
Parameter | Type | Description |
---|---|---|
id
|
String | Number | id of the geometry |
Returns:
Geometry:(inherited) getGeometries(filteropt, contextopt) [source]
Get all the geometries or the ones filtered if a filter function is provided.
Parameter | Type | Description |
---|---|---|
filter
opt
|
function | a function to filter the geometries |
context
opt
|
Object | context of the filter function, value to use as this when executing filter. |
Returns:
Array.<Geometry>:(inherited) getFirstGeometry() [source]
Get the first geometry, the geometry at the bottom.
Returns:
Geometry: first geometry(inherited) getLastGeometry() [source]
Get the last geometry, the geometry on the top
Returns:
Geometry: last geometry(inherited) getCount() [source]
Get count of the geometries
Returns:
Number: count(inherited) getExtent() [source]
Get extent of all the geometries in the layer, return null if the layer is empty.
Returns:
Extent: - extent of the layer(inherited) forEach(fn, contextopt) [source]
Executes the provided callback once for each geometry present in the layer in order.
Parameter | Type | Description |
---|---|---|
fn
|
function | a callback function |
context
opt
|
* | callback's context, value to use as this when executing callback. |
Returns:
OverlayLayer: this(inherited) filter(fn, contextopt) [source]
Creates a GeometryCollection with all the geometries that pass the test implemented by the provided function.
Parameter | Type | Description |
---|---|---|
fn
|
function | Function to test each geometry |
context
opt
|
* | Function's context, value to use as this when executing function. |
Returns:
GeometryCollection: A GeometryCollection with all the geometries that pass the test(inherited) isEmpty() [source]
Whether the layer is empty.
Returns:
Boolean:(inherited) addGeometry(geometries, fitViewopt) [source]
Adds one or more geometries to the layer
Parameter | Type | Default | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
geometries
|
Geometry | Array.<Geometry> | one or more geometries | |||||||||||||||||
fitView
opt
|
Boolean | Object | false | automatically set the map to a fit center and zoom for the geometries
Properties
|
Returns:
OverlayLayer: this(inherited) getGeoMinZIndex() [source]
Get minimum zindex of geometries
(inherited) getGeoMaxZIndex() [source]
Get maximum zindex of geometries
(inherited) removeGeometry(geometries) [source]
Removes one or more geometries from the layer
Parameter | Type | Description |
---|---|---|
geometries
|
String | Array.<String> | Geometry | Array.<Geometry> | geometry ids or geometries to remove |
Returns:
OverlayLayer: this(inherited) clear() [source]
Clear all geometries in this layer
Returns:
OverlayLayer: this(protected) (inherited) onRemoveGeometry(geometry) [source]
Called when geometry is being removed to clear the context concerned.
Parameter | Type | Description |
---|---|---|
geometry
|
Geometry | the geometry instance to remove |
(inherited) getStyle() [source]
Gets layer's style.
Returns:
Object|Array.<Object>: layer's style(inherited) setStyle(style) [source]
Sets style to the layer, styling the geometries satisfying the condition with style's symbol.
Based on filter type in [mapbox-gl-js's style specification]{https://www.mapbox.com/mapbox-gl-js/style-spec/#types-filter}.
Based on filter type in [mapbox-gl-js's style specification]{https://www.mapbox.com/mapbox-gl-js/style-spec/#types-filter}.
layer.setStyle([
{
'filter': ['==', 'count', 100],
'symbol': {'markerFile' : 'foo1.png'}
},
{
'filter': ['==', 'count', 200],
'symbol': {'markerFile' : 'foo2.png'}
}
]);
Parameter | Type | Description |
---|---|---|
style
|
Object | Array.<Object> | layer's style |
Fires:
Returns:
VectorLayer: this(inherited) removeStyle() [source]
Removes layers' style
Fires:
Returns:
VectorLayer: this(inherited) load() [source]
load the tile layer, can't be overrided by sub-classes
(inherited) getId() [source]
Get the layer id
Returns:
String: id(inherited) setId(id) [source]
Set a new id to the layer
Parameter | Type | Description |
---|---|---|
id
|
String | new layer id |
Fires:
Returns:
Layer: this(inherited) addTo(map) [source]
Adds itself to a map.
Parameter | Type | Description |
---|---|---|
map
|
Map | map added to |
Returns:
Layer: this(inherited) setZIndex(zIndex) [source]
Set a z-index to the layer
Parameter | Type | Description |
---|---|---|
zIndex
|
Number | layer's z-index |
Returns:
Layer: this(inherited) getZIndex() [source]
Get the layer's z-index
Returns:
Number:(inherited) getMinZoom() [source]
Get Layer's minZoom to display
Returns:
Number:(inherited) getMaxZoom() [source]
Get Layer's maxZoom to display
Returns:
Number:(inherited) getOpacity() [source]
Get layer's opacity
Returns:
Number:(inherited) setOpacity(opacity) [source]
Set opacity to the layer
Parameter | Type | Description |
---|---|---|
opacity
|
Number | layer's opacity |
Returns:
Layer: this(protected) (inherited) isCanvasRender() [source]
If the layer is rendered by HTML5 Canvas.
Returns:
Boolean:(inherited) getMap() [source]
Get the map that the layer added to
Returns:
Map:(inherited) getProjection() [source]
Get projection of layer's map
Returns:
Object:(inherited) bringToFront() [source]
Brings the layer to the top of all the layers
Returns:
Layer: this(inherited) bringToBack() [source]
Brings the layer under the bottom of all the layers
Returns:
Layer: this(inherited) show() [source]
Show the layer
Returns:
Layer: this(inherited) hide() [source]
Hide the layer
Returns:
Layer: this(inherited) isVisible() [source]
Whether the layer is visible now.
Returns:
Boolean:(inherited) remove() [source]
Remove itself from the map added to.
Returns:
Layer: this(inherited) getMask() [source]
Get the mask geometry of the layer
Returns:
Geometry:(inherited) setMask(mask) [source]
Set a mask geometry on the layer, only the area in the mask will be displayed.
Parameter | Type | Description |
---|---|---|
mask
|
Geometry | mask geometry, can only be a Marker with vector symbol, a Polygon or a MultiPolygon |
Returns:
Layer: this(inherited) removeMask() [source]
Remove the mask
Returns:
Layer: this(protected) (inherited) onLoad() [source]
Prepare Layer's loading, this is a method intended to be overrided by subclasses.
Returns:
Boolean: true to continue loading, false to cease.(inherited) isLoaded() [source]
Whether the layer is loaded
Returns:
Boolean:(inherited) getCollisionIndex() [source]
Get layer's collision index
Returns:
CollisionIndex:(inherited) clearCollisionIndex() [source]
Clear layer's collision index.
Will ignore if collisionScope is not layer
(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) registerJSONType(type) [source]
It is a static method.
Register layer for JSON serialization and assign a JSON type.
Register layer for JSON serialization and assign a JSON type.
Parameter | Type | Description |
---|---|---|
type
|
String | JSON type |
Mixes From:
(inherited) getJSONClass(type) [source]
It is a static method.
Get class of input JSON type
Get class of input JSON type
Parameter | Type | Description |
---|---|---|
type
|
String | JSON type |
Mixes From:
Returns:
Class: Class(inherited) getJSONType() [source]
Get object's JSON Type
Mixes From:
Returns:
String:(inherited) registerRenderer(name, clazz) [source]
Register a renderer class with the given name.
Parameter | Type | Description |
---|---|---|
name
|
String | renderer's register key |
clazz
|
function | renderer's class, a function (not necessarily a Class). |
Mixes From:
Returns:
*: this(inherited) getRendererClass(name) [source]
Get the registered renderer class by the given name
Parameter | Type | Description |
---|---|---|
name
|
String | renderer's register key |
Mixes From:
Returns:
function: renderer's class(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
setstyle [source]
setstyle event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | setstyle |
target
|
VectorLayer | layer |
style
|
Object | Array.<Object> | style to set |
- Source:
removestyle [source]
removestyle event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | removestyle |
target
|
VectorLayer | layer |
- Source:
(inherited) addgeo [source]
addgeo event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | addgeo |
target
|
OverlayLayer | layer |
geometries
|
Array.<Geometry> | the geometries to add |
- Overrides:
- Source:
(inherited) removegeo [source]
removegeo event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | removegeo |
target
|
OverlayLayer | layer |
geometries
|
Array.<Geometry> | the geometries to remove |
- Overrides:
- Source:
(inherited) clear [source]
clear event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | clear |
target
|
OverlayLayer | layer |
- Overrides:
- Source:
(inherited) idchange [source]
idchange event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | idchange |
target
|
Layer | the layer fires the event |
old
|
String | value of the old id |
new
|
String | value of the new id |
- Overrides:
- Source:
(inherited) setzindex [source]
setzindex event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | setzindex |
target
|
Layer | the layer fires the event |
zIndex
|
Number | value of the zIndex |
- Overrides:
- Source:
(inherited) setopacity [source]
setopacity event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | setopacity |
target
|
Layer | the layer fires the event |
opacity
|
Number | value of the opacity |
- Overrides:
- Source:
(inherited) show [source]
show event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | show |
target
|
Layer | the layer fires the event |
- Overrides:
- Source:
(inherited) hide [source]
hide event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | hide |
target
|
Layer | the layer fires the event |
- Overrides:
- Source:
(inherited) renderercreate [source]
renderercreate event, fired when renderer is created.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | renderercreate |
target
|
Layer | the layer fires the event |
renderer
|
Any | renderer of the layer |
- Overrides:
- Source:
(inherited) visiblechange [source]
visiblechange event.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | visiblechange |
target
|
Layer | the layer fires the event |
visible
|
Boolean | value of visible |
- Overrides:
- Source:
(inherited) resourceload [source]
resourceload event, fired when external resources of the layer complete loading.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | resourceload |
target
|
Layer | layer |
- Overrides:
- Source:
(inherited) canvascreate [source]
canvascreate event, fired when canvas created.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | canvascreate |
target
|
Layer | layer |
context
|
CanvasRenderingContext2D | canvas's context |
gl
|
WebGLRenderingContext2D | canvas's webgl context |
- Overrides:
- Source:
(inherited) renderstart [source]
renderstart event, fired when layer starts to render.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | renderstart |
target
|
Layer | layer |
context
|
CanvasRenderingContext2D | canvas's context |
- Overrides:
- Source:
(inherited) renderend [source]
renderend event, fired when layer ends rendering.
Properties:
Name | Type | Description |
---|---|---|
type
|
String | renderend |
target
|
Layer | layer |
context
|
CanvasRenderingContext2D | canvas's context |
- Overrides:
- Source: