Skip to content

editorGlobalsAbstractMeshAnchor

Class: AbstractMeshAnchor

The AbstractMeshAnchor is the default base for implementing an IMeshAnchor.

Hierarchy

  • AbstractMeshAnchor

MeshElementAnchor

MeshAnchor

Implements

Index

Properties

Methods

Properties

Protected Readonly changeEventEmitter

changeEventEmitter: EventEmitterIMeshAnchorChangeEvent = new EventEmitter()

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:33


Protected isDestroyed

isDestroyed: boolean = false

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:24


Protected lastMeshAdaptionWasSuccessful

lastMeshAdaptionWasSuccessful: boolean = false

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:31

During initialization, subclasses need to take care of setting this value to true, if the anchor became valid before the first meshChangeEvent was fired. Else, the anchor will stay invalid until the first meshChangeEvent is fired.


Protected mesh

mesh: Mesh | null

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:23

Methods

Protected Abstract _adaptToChangedMesh

_adaptToChangedMesh(event: MeshChangeEvent, requiresExactMatch: boolean): object

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:95

In this method, the anchor should update itself to adapt to the changed mesh or in worst case, become invalid.

Parameters:

Name Type Description
event MeshChangeEvent incoming change event from the mesh
requiresExactMatch boolean if true, only change to candidates that match the current element(signature) perfectly

Returns: object

If the mesh changed but the relevant part/element for the anchor did not, the event field must be null. If the anchor became invalid, the invalid flag must be set to true. In this case, event must be null.


Protected _checkIfAnchorCanBeValid

_checkIfAnchorCanBeValid(): boolean

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:105

Override in subclasses: check if the anchor can be valid given the current (instance variable) state. For the overall validity check, the (cached) result of _adaptToChangedMesh is used as well, so it is not required to re-check concrete geometric constraints here.

Returns: boolean


Protected _onMeshChange

_onMeshChange(meshEvent: MeshChangeEvent): void

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:127

Parameters:

Name Type
meshEvent MeshChangeEvent

Returns: void


Protected _refindSelfAndEmit

_refindSelfAndEmit(meshEvent: MeshChangeEvent, requiresExactMatch: boolean): void

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:134

Parameters:

Name Type Default
meshEvent MeshChangeEvent -
requiresExactMatch boolean false

Returns: void


Protected _setMesh

_setMesh(newMesh: Mesh | null): void

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:115

Updates the mesh reference and event bindings.

This is protected as you should only change the mesh during initialization or updates handled in child classes - users should not be able to arbitrarily change the mesh and thus corrupt state.

Parameters:

Name Type
newMesh Mesh | null

Returns: void


Abstract clone

clone(): AbstractMeshAnchor

Implementation of IMeshAnchor

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:35

Returns: AbstractMeshAnchor


destroy

destroy(): void

Implementation of IMeshAnchor

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:70

Returns: void


getChangeEventEmitter

getChangeEventEmitter(): IPublicEventEmitterInterfaceIMeshAnchorChangeEvent

Implementation of IMeshAnchor

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:81

Returns: IPublicEventEmitterInterfaceIMeshAnchorChangeEvent


Abstract getInMeshTarget

getInMeshTarget(): MeshElement

Implementation of IMeshAnchor

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:40

Usually, subclasses of MeshAnchor point to something more fine-granular inside the mesh than only the mesh itself.

Returns: MeshElement


getIsValid

getIsValid(): boolean

Implementation of IMeshAnchor

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:62

Returns: boolean


getMesh

getMesh(): Mesh‹›

Implementation of IMeshAnchor

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:47

This should initialize the anchor with the necessary positionable arguments.

Returns: Mesh‹›


getTargets

getTargets(): [Mesh] | []

Implementation of IMeshAnchor

Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:54

Returns: [Mesh] | []

the target mesh this anchor points to or an empty list if the mesh is not set