Skip to content

editorGlobalsIPositioningAnchor

Interface: IPositioningAnchor

A PositioningAnchor defines a coordinate system that can be used by IPositionableElement as their local coordinate system and is the default implementation proposal to realize a IPositionableElementTransformsDefiner.

In addition to being a IPositionableElementTransformsDefiner, this anchor also offers a transforms change event. This is supposed to be used by the IPositionablElement itself to emit events on its own when this anchor changes.

You can chain and combine different positioning anchors to achieve complex positioning/alignment scenarios. In this chain, each anchor should do only one specialized thing, and do this well. Be aware of different semantics: for most cases, you want your anchor to depend its transform on an IPositionableElement, and not its transforms definer, although this is usually an anchor as well - @see IPositionableElement.getTransformsDefiner().

Hierarchy

IPositionableElementTransformsDefiner

IAnchor

IPositioningAnchor

IOrientedPositioningAnchor

IPositionableAnchor

Implemented by

Index

Methods

Methods

clone

clone(): IPositioningAnchor

Overrides IAnchor.clone

Defined in src/model/data/Concepts/Anchors/IPositioningAnchor.ts:43

see IAnchor.clone()

Returns: IPositioningAnchor


destroy

destroy(): any

Inherited from IAnchor.destroy

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

Inherited from IAnchor.getChangeEventEmitter

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

Overrides 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

Overrides 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[]


getTransforms

getTransforms(): IReadOnlyTransforms

Inherited from IOrientedPositioningAnchor.getTransforms

Defined in src/model/data/Concepts/Anchors/IPositioningAnchor.ts:85

Use the transforms to read out the current alignment in space.

The "local" part of the transforms should always be understood as a the object-local coordinate system of the IPositionableElement that uses this anchor to position itself, while the "global" part (and getPosition()/getRotation()) should be understood as assembly space coordinates.

Returns: IReadOnlyTransforms


getTransformsChangeEventEmitter

getTransformsChangeEventEmitter(): IPublicEventEmitterInterfaceITransformsChangeEvent

Defined in src/model/data/Concepts/Anchors/IPositioningAnchor.ts:38

IPositionableElement that use this anchor must subscribe to this event in order to react to transform changes (and emit a change event themselves). Consequently, the anchor must emit this event if its transforms change.

see TransformsChangeEvent to check what fields have to be provided

If only the transforms change, the anchors getChangeEventEmitter() event must not be fired.

Returns: IPublicEventEmitterInterfaceITransformsChangeEvent


getTransformsTargets

getTransformsTargets(): IPositionableElementTransformsDefiner[]

Inherited from IOrientedPositioningAnchor.getTransformsTargets

Defined in src/model/data/Concepts/Anchors/IPositioningAnchor.ts:75

Similar to IModelElementDependencyDefiner.getTargets(), the transforms targets are those transformsDefiner that influence this transformsDefiner's transforms.

If the transformsDefiner's target element is an IPositionableElement, it probably also influences the transforms. Thus, in this case, target.getTransformsDefiner() must be contained in the returned list.

Only direct dependencies should be returned, so if you have a chain A -> B -> C and call A.getTransformsTargets() this method only returns [B]. For a complete list of all transitive dependencies @see ModelElementGraphAnalyzer.getAllModelElementThisDependsOn.

If the transformsDefiner does not define any transforms targets and has no IModelElement as a target, it is considered self-sustainable, i.e. being able of defining a coordinate system on its own without external input.

Returns: IPositionableElementTransformsDefiner[]