editor › Globals › IMeshAnchor
Interface: IMeshAnchor
A IMeshAnchor is a stable reference to a certain position in a mesh. Stable meaning that even if the mesh changes (and e.g. surfaces are replaced), the anchor tries to stay correct. Whenever possible, anchors should be used instead of referencing surfaces, edges or points directly, as they may become invalid at any time.
Hierarchy
↳ IAnchor
↳ IMeshAnchor
Implemented by
- AbstractMeshAnchor
- BackSideAnchor
- MeshAnchor
- MeshEdgeAnchor
- MeshElementAnchor
- MeshSurfaceAnchor
- PointOnEdgeAnchor
- PointOnSurfaceAnchor
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
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(): IPublicEventEmitterInterface‹IAnchorChangeEvent›
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: IPublicEventEmitterInterface‹IAnchorChangeEvent›
getInMeshTarget
▸ getInMeshTarget(): MeshElement
Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:16
Returns: MeshElement
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
getMesh
▸ getMesh(): Mesh
Defined in src/model/data/Concepts/Anchors/AbstractMeshAnchor.ts:15
Returns: Mesh
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[]