Class: RelationshipComponent

THING.RelationshipComponent()

RelationshipComponent The relationship component.

Constructor

new RelationshipComponent()

The relationship of object.
Source:

Extends

Members

active :Boolean

Active or deactive component.
Type:
  • Boolean
Overrides:
Source:

app :THING.App

Get application.
Type:
Overrides:
Source:

object :THING.BaseObject

Get object.
Type:
Overrides:
Source:

onActiveChange :OnActiveChangeComponentCallback

When active change callback function.
Type:
Overrides:
Source:

onAfterAdd :OnAfterAddComponentCallback

After add.
Type:
Overrides:
Source:

onAfterAddChild :OnAddChildComponentCallback

When after add child callback function.
Type:
Overrides:
Source:

onAfterRemove :OnAfterRemoveComponentCallback

After remove.
Type:
Overrides:
Source:

onAfterRemoveChild :OnRemoveChildComponentCallback

When after remove child callback function.
Type:
Overrides:
Source:

onBeforeAdd :OnBeforeAddComponentCallback

Before add.
Type:
Overrides:
Source:

onBeforeAddChild :OnAddChildComponentCallback

When before add child callback function.
Type:
Overrides:
Source:

onBeforeRemove :OnBeforeRemoveComponentCallback

Before remove.
Type:
Overrides:
Source:

onBeforeRemoveChild :OnRemoveChildComponentCallback

When before remove child callback function.
Type:
Overrides:
Source:

onCopy :OnCopyComponentCallback

When copy callback function.
Type:
Overrides:
Source:

onExport :OnExportComponentCallback

When export data.
Type:
Overrides:
Source:

onImport :OnImportComponentCallback

When import data.
Type:
Overrides:
Source:

onInit :OnInitComponentCallback

When initialize callback function.
Type:
Overrides:
Source:

onLoadResource :OnLoadResourceComponentCallback

When load resource callback function.
Type:
Overrides:
Source:

onParentChange :OnParentChangeComponentCallback

When change parent callback function.
Type:
Overrides:
Source:

onRefresh :OnRefreshComponentCallback

When refresh callback function.
Type:
Overrides:
Source:

onResize :OnResizeComponentCallback

When resize callback function.
Type:
Overrides:
Source:

onUnloadResource :OnUnloadResourceComponentCallback

When unload resource callback function.
Type:
Overrides:
Source:

onUpdate :OnUpdateComponentCallback

When update callback function.
Type:
Overrides:
Source:

onVisibleChange :OnVisibleChangeComponentCallback

When visible change callback function.
Type:
Overrides:
Source:

Methods

onAdd(object)

When add component.
Parameters:
Name Type Description
object THING.BaseObject The object.
Overrides:
Source:

onRemove()

When remove component.
Overrides:
Source:

query(options) → {THING.Selector}

Query related objects.
Parameters:
Name Type Description
options Object
Properties
Name Type Description
type String The type of relationship.
name String The name of relationship.
queryDirection RelationshipDirection The query direction.
Source:
Returns:
Type
THING.Selector
Example
let source = new THING.Object3D();
let target = new THING.Object3D();
let rel = new THING.Relationship({
     type: 'control',
     source,
     target
})
let result = source.relationship.query({type: 'control'});
// @expect(result[0] == target)

queryByName(name, queryDirection) → {THING.Selector}

Query related objects by relationship name.
Parameters:
Name Type Description
name String The relationship name.
queryDirection RelationshipDirection The query direction.
Source:
Returns:
Type
THING.Selector
Example
let source = new THING.Object3D();
let target = new THING.Object3D();
let rel = new THING.Relationship({
     name: 'myControl',
     type: 'control',
     source,
     target
})
let result = source.relationship.queryByName('myControl');
// @expect(result[0] == target)

queryByType(type, queryDirection) → {THING.Selector}

Query related objects by relationship type.
Parameters:
Name Type Description
type String The relationship type.
queryDirection RelationshipDirection The query direction.
Source:
Returns:
Type
THING.Selector
Example
let source = new THING.Object3D();
let target = new THING.Object3D();
let rel = new THING.Relationship({
     type: 'control',
     source,
     target
})
let result = source.relationship.queryByType('control');
// @expect(result[0] == target)