Class: MetaManager
Class: MetaManager
Loads model`s metadata (properties) from buckets and provides functions to manage elements properties.
Hierarchy
EventTarget
↳
MetaManager
Properties
instanceId
• instanceId: string
Unique instance id.
isIdbInstanceIncorrect
• isIdbInstanceIncorrect: boolean
Is if the ID of this Meta Manager matches the one stored in the IndexedDb "meta" table.
isShared
• isShared: boolean
Fetch model data from shared endpoints.
linkId
• Optional
linkId: string
Shared link id.
metaTree
• metaTree: ModelNode
[]
Tree with metadata nodes structure.
models
• models: Map
<string
, MetaModel
>
Loaded model GUIDs.
useCache
• useCache: boolean
Deprecated
Cache is always on.
Methods
addAutoEventListener
▸ addAutoEventListener(eventType
, eventListener
, signal
): void
Add event listener with automatic dispose.
Parameters
Name | Type | Description |
---|---|---|
eventType | MetaEvents | event type. |
eventListener | EventListenerOrEventListenerObject | event listener. |
signal | AbortSignal | optional abort signal for manual aborting event listener. |
Returns
void
addModelNodes
▸ addModelNodes(versionIds
): void
Add new model nodes in model tree.
Parameters
Name | Type | Description |
---|---|---|
versionIds | { geomNum? : number ; id : string ; name? : string ; status? : ModelStatus }[] | model version GUIDS and names list. |
Returns
void
clearAllNodes
▸ clearAllNodes(): void
Clear all nodes in model tree.
Returns
void
collect
▸ collect(elNums?
): any
[]
Collects tree nodes by element nums.
Parameters
Name | Type | Description |
---|---|---|
elNums? | number | number [] | Element number or array of element numbers. |
Returns
any
[]
collectEndNodes
▸ collectEndNodes(node?
): any
[]
Collect all element nodes for any parent node in meta tree.
Parameters
Name | Type | Description |
---|---|---|
node? | any | Any parent node. |
Returns
any
[]
destroy
▸ destroy(): void
Destroy MetaManager and delete all data from browser store.
Returns
void
fetchByModelVersionGuids
▸ fetchByModelVersionGuids(versionIds
): Promise
<{ isError
: boolean
; modelVersionId
: string
; tree
: any
}[]>
Fetch meta trees by version GUIDs list. Meta tree will not be inserted into model node.
Parameters
Name | Type | Description |
---|---|---|
versionIds | { id : string ; name : string }[] | version GUIDs list. |
Returns
Promise
<{ isError
: boolean
; modelVersionId
: string
; tree
: any
}[]>
getElementGuid
▸ getElementGuid(elNum
): string
Get element GUID by element geometry number and local number.
Parameters
Name | Type | Description |
---|---|---|
elNum | number | element Number. |
Returns
string
getElementMetaByGuid
▸ getElementMetaByGuid(guid
): Promise
<any
>
Get element metadata by GUID.
Parameters
Name | Type | Description |
---|---|---|
guid | string | element GUID. |
Returns
Promise
<any
>
getElementMetaByNumbers
▸ getElementMetaByNumbers(elNum
): Promise
<any
>
Get element metadata by element numbers.
Parameters
Name | Type | Description |
---|---|---|
elNum | number | Element number. |
Returns
Promise
<any
>
getElementNums
▸ getElementNums(guid
): number
Get element numbers by GUID.
Parameters
Name | Type | Description |
---|---|---|
guid | string | element GUID. |
Returns
number
getElementsMetasByGuids
▸ getElementsMetasByGuids(guids
, excludeModelRefs?
): Promise
<any
[]>
Get full metadata for specified elements.
Parameters
Name | Type | Description |
---|---|---|
guids | string [] | Elements GUIDs. |
excludeModelRefs? | boolean | - |
Returns
Promise
<any
[]>
load
▸ load(versionIds
, isShared?
, linkId?
): Promise
<void
>
Load meta trees by version GUIDs list and create new model nodes.
Parameters
Name | Type | Description |
---|---|---|
versionIds | { id : any ; name : string }[] | version GUIDs list. |
isShared? | boolean | meta trees are loaded by external link GUIDs or model version GUIDs. |
linkId? | string |
Returns
Promise
<void
>
loadByModelVersionGuids
▸ loadByModelVersionGuids(versionIds
): Promise
<void
>
Load meta trees by version GUIDS into existing model nodes.
Parameters
Name | Type | Description |
---|---|---|
versionIds | { id : string ; name : string }[] | version GUIDs list. |
Returns
Promise
<void
>
setByModelVersionGuid
▸ setByModelVersionGuid(versionId
, status
, progress
, tree
): void
Set meta tree to model node with specified version GUID.
Parameters
Name | Type | Description |
---|---|---|
versionId | string | model version GUID. |
status | ModelStatus | new status for model node. |
progress | number | new progress for model node. |
tree | GroupNode [] | meta tree for inserting into model node. |
Returns
void
setCacheServerPath
▸ setCacheServerPath(path?
): MetaManager
Set server path to REST point for cache data loading.
Parameters
Name | Type | Description |
---|---|---|
path? | string | path to server REST point. |
Returns
setElementDatas
▸ setElementDatas(elementDatas
): void
Set element datas map to MetaManager.
Parameters
Name | Type | Description |
---|---|---|
elementDatas | Map <number , ElementData > | element datas map. |
Returns
void
setServer
▸ setServer(server?
, cacheServer?
): MetaManager
Set server URI for data loading.
Parameters
Name | Type | Description |
---|---|---|
server? | string | server URI. |
cacheServer? | string | cache server URI |
Returns
setServerPath
▸ setServerPath(path?
): MetaManager
Set server path to REST point for data loading.
Parameters
Name | Type | Description |
---|---|---|
path? | string | path to server REST point. |
Returns
setToken
▸ setToken(token
): MetaManager
Set access token for manager`s requests.
Parameters
Name | Type | Description |
---|---|---|
token | string | access token. |
Returns
traverse
▸ traverse(onNodeCallback?
, elNums?
, startNode?
, isReversed?
): any
[]
Traverse all nodes in meta tree and search element node with given geometry number and element number. If geometry or element number undefined then traverse will scan and call callback function for every element node.
Parameters
Name | Type | Description |
---|---|---|
onNodeCallback? | Function | Callback function for founded node. |
elNums? | number | number [] | Element numbers list or single number. |
startNode? | any | Start node for traversing children nodes. |
isReversed? | boolean | If true then callback function will be called from inner to outer nodes. |
Returns
any
[]
Callbacks
onChanged
▸ onChanged(changedCallback
): MetaManager
Set callback function for event when models list are changed.
Parameters
Name | Type | Description |
---|---|---|
changedCallback | Function | function with plain Function signature. |
Returns
onError
▸ onError(errorCallback
): MetaManager
Set a callback for an event when a model will not be loaded due to an error.
Parameters
Name | Type | Description |
---|---|---|
errorCallback | ErrorCallbackFunction | function with ErrorCallbackFunction signature. |
Returns
onLoaded
▸ onLoaded(loadedCallback
): MetaManager
Set callback function for event when each model is loaded.
Parameters
Name | Type | Description |
---|---|---|
loadedCallback | LoadedCallbackFunction | function with LoadedCallbackFunction signature. |