Class: Relationship

THING.Relationship(param)

Relationship The Relationship between objects.

Constructor

new Relationship(param)

The relationship between objects.
Parameters:
Name Type Description
param Object
Properties
Name Type Attributes Description
type String The relationship type.
name String The relationship name.
source THING.BaseObject | Array.<THING.BaseObject> | THING.Selector The source object(s) of relation.
target THING.BaseObject | Array.<THING.BaseObject> | THING.Selector The target object(s) of relation.
queryDirection String <optional>
The default query relationship direction.
Source:

Members

name :String

Get/Set the relationship name.
Type:
  • String
Source:
Example
let source = new THING.Object3D()();
let target = new THING.Object3D()();
let rel = new THING.Relationship({
     type: 'control',
		name: 'myRelationship',
     source: source,
     target: target
});
// @expect(rel.name == 'myRelationship')

queryDirection :RelationshipDirection

Get/Set the relationship default query direction.
Type:
Source:
Example
let source = new THING.Object3D()();
let target = new THING.Object3D()();
let rel = new THING.Relationship({
     type: 'control',
		name: 'myRelationship',
     source: source,
     target: target
});
// @expect(rel.queryDirection == THING.RelationshipDirection.OUT)

source :THING.BaseObject|Array.<THING.BaseObject>|THING.Selector

Get/Set the relationship source object.
Type:
Source:
Example
let source = new THING.Object3D()();
let target = new THING.Object3D()();
let rel = new THING.Relationship({
     type: 'control',
		name: 'myRelationship',
     source: source,
     target: target
});
// @expect(rel.source == source)

target :THING.BaseObject|Array.<THING.BaseObject>|THING.Selector

Get/Set the relationship target.
Type:
Source:
Example
let source = new THING.Object3D()();
let target = new THING.Object3D()();
let rel = new THING.Relationship({
     type: 'control',
		name: 'myRelationship',
     source: source,
     target: target
});
// @expect(rel.target == target)

type :String

Get/Set the relationship type.
Type:
  • String
Source:
Example
let source = new THING.Object3D()();
let target = new THING.Object3D()();
let rel = new THING.Relationship({
     type: 'control',
     source: source,
     target: target
});
// @expect(rel.type == 'control')

uuid :String

Get/Set uuid.
Type:
  • String
Source:
Example
relationship.uuid = THING.Math.generateUUID();
console.log(object.uuid);

Methods

destroy()

destroy relationship
Source:
Example
let source = new THING.Object3D()();
let target = new THING.Object3D()();
let rel = new THING.Relationship({
     type: 'control',
     source: source,
     target: target
});
rel.destroy()
// @expect(source.relationships.length == 0)