new CacheManager( [opt_options])
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
opt_options |
Object |
<optional> |
Options. |
- Source:
- mapspace-nvdb/cache.js
Extends
- ol.Object
Methods
-
addBackupFeatures(clearCache)
-
Returns a Promise that requests features in Field Group backup storage and adds them to the cache. This function checks if current cache is empty, and if it is not empty resolves with an empty array.
Parameters:
Name Type Description clearCache
boolean If clear any previous features cached from Field Group storage.
- Source:
- mapspace-nvdb/cache.js
Returns:
A Promise that returns an array of
ol.Feature
with the resolve function or an error for the reject function. The features are the full list of features that are in the backup for current user or empty if the cache has already downloaded the backup features.- Type
- Promise
-
addFeature(feature)
-
Adds a feature to cache, cloning it. Only Road objects features are cached. If the feature is not a Road object, then it is not cached. The feature passed replaces current existing feature with same ID. Features that has a 'blomaction' or a 'blomstatus' attribute are modified ones and are stored in the backup cache. Features must have a 'metadata' attribute with the type ID or the feature will not be cached.
Parameters:
Name Type Description feature
ol.Feature The feature.
- Source:
- mapspace-nvdb/cache.js
-
findInCache(id, cache, layerID, subindex)
-
Finds a feature in a given cache object and returns a clone of the feature.
Parameters:
Name Type Description id
string ID of the feature.
cache
Object The cache object to use.
layerID
string The string that identifies the type of object.
subindex
string The string that is a subindex inside a type of object.
- Source:
- mapspace-nvdb/cache.js
Returns:
- Type
- ol.Feature
-
getChangesetUUIDs(onlyInProgress)
-
Returns the UUIDs of changesets of the current user.
Parameters:
Name Type Description onlyInProgress
boolean If get UUIDs of all changesets or only of those changesets in progress.
- Source:
- mapspace-nvdb/cache.js
Returns:
- Type
- Array.<string>
-
getClosedFeature(feature)
-
Returns the NVDB feature in the backup cache with same ID than given one and status CLOSED. If not found then returns null.
Parameters:
Name Type Description feature
ol.Feature Feature.
- Source:
- mapspace-nvdb/cache.js
Returns:
- Type
- ol.Feature
-
getFeature(objectTypeId, id [, useBackup] [, ignoreClosed])
-
Gets a clone of a feature from cache. Returns null if feature is not in cache.
Parameters:
Name Type Argument Description objectTypeId
number Object type ID.
id
string ID of feature.
useBackup
boolean <optional>
If true the feature will be searched in Field Group storage backup first and then in NVDB cache. If false the feature will be searched in NVDB cache only. By default is true.
ignoreClosed
boolean <optional>
If true and feature exists in backup with a CLOSED status then feature is returned from NVDB cache. If false CLOSED features are not ignored. By default is true.
- Source:
- mapspace-nvdb/cache.js
Returns:
- Type
- ol.Feature
-
getFeaturesFromBackup( [ignoreClosed])
-
Gets all the features in Field Group backup cache. We return clones and not the reference contained in the cache because each viewer can need to modify the feature in geometry attributes.
Parameters:
Name Type Argument Description ignoreClosed
boolean <optional>
If true and feature exists in backup with a CLOSED status then feature is returned from NVDB cache. If false CLOSED features are not ignored. By default is true.
- Source:
- mapspace-nvdb/cache.js
Returns:
- Type
- Array.<ol.Feature>
-
getFeaturesFromBackupByExtent(objectTypeId, extent [, ignoreClosed])
-
Gets the features in Field Group backup cache using a type and a extent. We return clones and not the reference contained in the cache because each viewer can need to modify the feature in geometry attributes.
Parameters:
Name Type Argument Description objectTypeId
number Object type ID.
extent
ol.Extent The extent.
ignoreClosed
boolean <optional>
If true and feature exists in backup with a CLOSED status then feature is returned from NVDB cache. If false CLOSED features are not ignored. By default is true.
- Source:
- mapspace-nvdb/cache.js
Returns:
- Type
- Array.<ol.Feature>
-
getFeaturesObjectTypes( [ignoreClosed])
-
Returns the different objects types of modified features.
Parameters:
Name Type Argument Description ignoreClosed
boolean <optional>
If true and feature exists in backup with a CLOSED status then feature is returned from NVDB cache. If false CLOSED features are not ignored. By default is true.
- Source:
- mapspace-nvdb/cache.js
Returns:
- Type
- Array.<Mapspace.nvdb.ObjectTypeDefinitionShort>
-
getObjectTypeDescriptor()
-
Returns the object type descriptor for the given feature, if the object type descriptor is available in cache, or null if not.
- Source:
- mapspace-nvdb/cache.js
Returns:
-
getOriginalFeatures(features)
-
Returns a new array of features with the original ones stored in cache for the given ones. Features passed are supposed to be modified features and never created ones. If a created feature is passed the returned value for it in the array will be null.
Parameters:
Name Type Description features
Array.<ol.Feature> Array of features.
- Source:
- mapspace-nvdb/cache.js
Returns:
- Type
- Array.<ol.Feature>
-
removeFeature(feature, fromBackup, fromNVDB)
-
Removes a feature from cache.
Parameters:
Name Type Argument Description feature
ol.Feature The feature to remove.
fromBackup
boolean <nullable>
Optional. If true feature is removed from the backup cache. By default is true.
fromNVDB
boolean <nullable>
Optional. If true feature is removed from the NVDB cache. By default is true.
- Source:
- mapspace-nvdb/cache.js