new VectorLayersCacheManager( [opt_options])
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
opt_options |
Object |
<optional> |
Options. |
- Source:
- mapspace/vectorlayerscache.js
Extends
- ol.Object
Methods
-
addItem(item, parent)
-
Adds a layer or a layer group to the list of vector layers. Triggers a change event if item is added.
Parameters:
Name Type Argument Description item
Mapspace.LayerGroup | Mapspace.LayerGroupLayer Item object.
parent
Mapspace.LayerGroupLayer <nullable>
Optional. Parent object. If not present the item is considered a root item.
- Source:
- mapspace/vectorlayerscache.js
-
findItem(id, type, cloned)
-
Finds an item in current cache by ID.
Parameters:
Name Type Argument Description id
number ID of item to search.
type
Mapspace.LayerGroupItemType Type of item.
cloned
boolean <nullable>
Optional. If return a shallow copy or the reference. By default is false.
- Source:
- mapspace/vectorlayerscache.js
Returns:
-
findItemByName(name, type, cloned)
-
Finds an item in current cache by name.
Parameters:
Name Type Argument Description name
string Name of item to search.
type
Mapspace.LayerGroupItemType Type of item.
cloned
boolean <nullable>
Optional. If return a shallow copy or the reference. By default is false.
- Source:
- mapspace/vectorlayerscache.js
Returns:
-
findRoot(id, type, cloned)
-
Finds the root group item of an item in current cache by ID.
Parameters:
Name Type Argument Description id
number ID of item to search.
type
Mapspace.LayerGroupItemType Type of item.
cloned
boolean <nullable>
Optional. If return a shallow copy or the reference. By default is false.
- Source:
- mapspace/vectorlayerscache.js
Returns:
- Type
- Mapspace.LayerGroup
-
getContent(cloned)
-
Returns the array with the content of vector layers or a copy of it.
Parameters:
Name Type Description cloned
boolean If return a shallow copy or the reference.
- Source:
- mapspace/vectorlayerscache.js
Returns:
- Type
- Array.<(Mapspace.LayerGroupLayer|Mapspace.LayerGroup)>
-
getError()
-
Returns the last error after an update from the server.
- Source:
- mapspace/vectorlayerscache.js
Returns:
- Type
- Error
-
isEqual(info1, info2)
-
Compares two objects with layer information and returns if they are the same or not.
Parameters:
Name Type Description info1
Array.<(Mapspace.LayerGroupLayer|Mapspace.LayerGroup)> First object to compare.
info2
Array.<(Mapspace.LayerGroupLayer|Mapspace.LayerGroup)> Second object to compare.
- Source:
- mapspace/vectorlayerscache.js
Returns:
- Type
- boolean
-
removeItem(item, parent)
-
Removes a layer or a layer group from the list of vector layers. Trigger a event if item is removed.
Parameters:
Name Type Argument Description item
Mapspace.LayerGroup | Mapspace.LayerGroupLayer Item object.
parent
Mapspace.LayerGroupLayer <nullable>
Optional. Parent object. If not present the item is considered a root item.
- Source:
- mapspace/vectorlayerscache.js
-
renameItem(id, type, name)
-
Renames a layer or layer group in the list of vector layers, if it is found. Triggers a change event if name is changed.
Parameters:
Name Type Description id
number ID of item to search.
type
Mapspace.LayerGroupItemType Type of item.
name
string New name.
- Source:
- mapspace/vectorlayerscache.js
-
toString(info)
-
Returns a simple string representation of the array of layer information.
Parameters:
Name Type Argument Description info
Array.<(Mapspace.LayerGroupLayer|Mapspace.LayerGroup)> <nullable>
Optional layer information to convert to string. If not present the current layer information in the cache is used.
- Source:
- mapspace/vectorlayerscache.js
Returns:
- Type
- string
-
update()
-
Returns a Promise that retrieves layer group information from Mapspace server and stores it. This information can be obtained through
getContent
. Error can be obtained throughgetError
if any error happened.- Source:
- mapspace/vectorlayerscache.js
Returns:
A Promise that returns a clone of layer group information in the resolve function or an Error in the reject function.
- Type
- Promise