Skip to content

editorGlobalsIAnchor

Interface: IAnchor

IAnchor are the default implementation proposal to realize IModelElementDependencyDefiner, that is: to realize the dependency between two IModelElement. In other words: an IAnchor points to something in the target IModelElement that whoever is referencing the IAnchor depends on.

Anchors should be implemented to be stable, i.e. even if the underlying IModelElement changes, the anchor should try to still point to the (conceptually) right entity within the IModelElement.

Based on the idea that anchors often point to something locatable, an anchor may define a coordinate system - @see IPositionableElementTransformsDefiner and @see IPositioningAnchor

Anchors must not be shared, as destroy() assumes that one entity can arbitrarily remove/replace the anchor.

Hierarchy

IAnchor

IPositioningAnchor

IMeshAnchor

Index

Methods

Methods

clone

clone(): IAnchor

Defined in src/model/data/Concepts/Anchors/IAnchor.ts:30

Anchors should be able to create a clone which can then be used in addition to this instance. This means: 1. The whole anchor chain must be cloned, as one single anchor may only be used by one "user" 2. Referenced model elements must not be cloned, rather, in the end, there should be two anchors with similar structure referencing the same model element.

Returns: IAnchor


destroy

destroy(): any

Defined in src/model/data/Concepts/Anchors/IAnchor.ts:41

Once an anchor is not used anymore, it should be destroyed in order to prevent memory leaks (as anchors might bind to other events and this prevents garbage collection).

The destroy() call must unbind from all events to remove all references to the anchor, but first make sure that no one listens to the anchor's own events to prevent wrong usage.

A destroyed anchor must not be valid anymore, and must not be used anymore.

Returns: any


getChangeEventEmitter

getChangeEventEmitter(): IPublicEventEmitterInterfaceIAnchorChangeEvent

Defined in src/model/data/Concepts/Anchors/IAnchor.ts:22

Changes of the getTargets can result in an onChange event of the anchor.

Returns: IPublicEventEmitterInterfaceIAnchorChangeEvent


getIsValid

getIsValid(): boolean

Inherited from IAnchor.getIsValid

Defined in src/model/data/Concepts/Anchors/IAnchor.ts:68

Whether this instance is valid, a.k.a. has a valid target assigned and points to something useful within that target. IModelElementDependencyDefiner might invalidate if the target changes.

If the IModelElementDependencyDefiner does not need a target, it can be valid even without having one defined.

Validity should be lazily evaluated and not destructive action should be (automatically) taken if the anchor is invalid. Only high level control classes (Realizers, Tools, BoxelCSG) should clean up invalid anchors and model elements. An anchor becoming invalid should not trigger any events.

Returns: boolean


getTargets

getTargets(): IModelElement[]

Inherited from IAnchor.getTargets

Defined in src/model/data/Concepts/Anchors/IAnchor.ts:55

The targets this IModelElementDependencyDefiner points to. This means that the IModelElementDependencyDefiner itself depends on some specifics of the target IModelElements.

Usually, there will be one target. Some implementations, however, may define zero or multiple targets.

Returns: IModelElement[]