Reference Source
public class | source

MetaScene

Metadata corresponding to a Scene.

Member Summary

Public Members
public

metaModels: {String: MetaModel}

The MetaModels belonging to this MetaScene, each mapped to its MetaModel#modelId.

public

metaObjects: {String: MetaObject}

The MetaObjects belonging to this MetaScene, each mapped to its MetaObject#id.

public

The MetaObjects belonging to this MetaScene, each mapped to its MetaObject#type.

public

The PropertySets belonging to this MetaScene, each mapped to its PropertySet#id.

public

The root MetaObjects belonging to this MetaScene, each mapped to its MetaObject#id.

public

The Scene.

public

The Viewer.

Method Summary

Public Methods
public

createMetaModel(modelId: String, metaModelData: Object, options: Object): MetaModel

Creates a MetaModel in this MetaScene.

public

destroyMetaModel(metaModelId: String)

Removes a MetaModel from this MetaScene.

public

fire(event: String, value: Object)

Fires an event at this Viewer.

public

Gets the MetaObject#ids of the MetaObjects that have the given MetaObject#type.

public

getObjectIDsInSubtree(id: String, includeTypes: String[], excludeTypes: String[]): String[]

Gets the MetaObject#ids of the MetaObjects within the given subtree.

public

off(event: *)

Unsubscribes from an event fired at this Viewer.

public

on(event: String, callback: Function)

Subscribes to an event fired at this Viewer.

public

Iterates over the MetaObjects within the subtree.

Public Members

public metaModels: {String: MetaModel} source

The MetaModels belonging to this MetaScene, each mapped to its MetaModel#modelId.

public metaObjects: {String: MetaObject} source

The MetaObjects belonging to this MetaScene, each mapped to its MetaObject#id.

public metaObjectsByType: {String: MetaObject} source

The MetaObjects belonging to this MetaScene, each mapped to its MetaObject#type.

public propertySets: {String: PropertySet} source

The PropertySets belonging to this MetaScene, each mapped to its PropertySet#id.

public rootMetaObjects: {String: MetaObject} source

The root MetaObjects belonging to this MetaScene, each mapped to its MetaObject#id.

public scene: Scene source

The Scene.

Properties:

NameTypeAttributeDescription
scene *

public viewer: Viewer source

The Viewer.

Properties:

NameTypeAttributeDescription
viewer *

Public Methods

public createMetaModel(modelId: String, metaModelData: Object, options: Object): MetaModel source

Creates a MetaModel in this MetaScene.

The MetaModel will contain a hierarchy of MetaObjects, created from the meta objects in metaModelData.

The meta object hierarchy in metaModelData is expected to be non-cyclic, with a single root. If the meta objects are cyclic, then this method will log an error and attempt to recover by creating a dummy root MetaObject of type "Model" and connecting all other MetaObjects as its direct children. If the meta objects contain multiple roots, then this method similarly attempts to recover by creating a dummy root MetaObject of type "Model" and connecting all the root MetaObjects as its children.

Params:

NameTypeAttributeDescription
modelId String

ID for the new MetaModel, which will have MetaModel#id set to this value.

metaModelData Object

Data for the MetaModel.

options Object
  • optional

Options for creating the MetaModel.

options.includeTypes Object
  • optional

When provided, only create MetaObjects with types in this list.

options.excludeTypes Object
  • optional

When provided, never create MetaObjects with types in this list.

options.globalizeObjectIds Boolean
  • optional
  • default: false

Whether to globalize each MetaObject#id. Set this true when you need to load multiple instances of the same meta model, to avoid ID clashes between the meta objects in the different instances.

Return:

MetaModel

The new MetaModel.

public destroyMetaModel(metaModelId: String) source

Removes a MetaModel from this MetaScene.

Fires a "metaModelDestroyed" event with the value of the MetaModel#id.

Params:

NameTypeAttributeDescription
metaModelId String

ID of the target MetaModel.

public fire(event: String, value: Object) source

Fires an event at this Viewer.

Params:

NameTypeAttributeDescription
event String

Event name

value Object

Event parameters

public getObjectIDsByType(type: String): String[] source

Gets the MetaObject#ids of the MetaObjects that have the given MetaObject#type.

Params:

NameTypeAttributeDescription
type String

The type.

Return:

String[]

Array of MetaObject#ids.

public getObjectIDsInSubtree(id: String, includeTypes: String[], excludeTypes: String[]): String[] source

Gets the MetaObject#ids of the MetaObjects within the given subtree.

Params:

NameTypeAttributeDescription
id String

ID of the root MetaObject of the given subtree.

includeTypes String[]
  • optional

Optional list of types to include.

excludeTypes String[]
  • optional

Optional list of types to exclude.

Return:

String[]

Array of MetaObject#ids.

public off(event: *) source

Unsubscribes from an event fired at this Viewer.

Params:

NameTypeAttributeDescription
event *

public on(event: String, callback: Function) source

Subscribes to an event fired at this Viewer.

Params:

NameTypeAttributeDescription
event String

The event

callback Function

Callback fired on the event

public withMetaObjectsInSubtree(id: String, callback: Function) source

Iterates over the MetaObjects within the subtree.

Params:

NameTypeAttributeDescription
id String

ID of root MetaObject.

callback Function

Callback fired at each MetaObject.