Packagecom.yworks.graph.model
Classpublic class FreeEdgeLabelModel
InheritanceFreeEdgeLabelModel Inheritance Object
Implements ILabelModel, ILabelModelParameterFinder

An edge label model that can be used to describe any position and orientation of a label.

The position of the label is stored relative to the positions of the ports of the edge the label belongs to.



Public Properties
 PropertyDefined By
  edgeRelativeAngle : Boolean
Gets or sets a property that indicates whether the angle used by the createEdgeAnchored parameter should be interpreted relative to the edge's orientation or as an absolute angle in the coordinate system.
FreeEdgeLabelModel
Public Methods
 MethodDefined By
  
Creates a default parameter that can be used for this model.
FreeEdgeLabelModel
  
createEdgeAnchored(ratio:Number, distance:Number, angle:Number):ILabelModelParameter
Creates a parameter for the given location.
FreeEdgeLabelModel
  
Tries to find a parameter that best matches the given layout for the provided label instance.
FreeEdgeLabelModel
  
FreeEdgeLabelModel
  
Calculates the geometry in form of an IOrientedRectangle for a given label using the given model parameter.
FreeEdgeLabelModel
  
lookup(type:Class):Object
Returns an instance that implements the given type or null.
FreeEdgeLabelModel
Property Detail
edgeRelativeAngleproperty
edgeRelativeAngle:Boolean

Gets or sets a property that indicates whether the angle used by the createEdgeAnchored parameter should be interpreted relative to the edge's orientation or as an absolute angle in the coordinate system.


Implementation
    public function get edgeRelativeAngle():Boolean
    public function set edgeRelativeAngle(value:Boolean):void

See also

Method Detail
createDefaultParameter()method
public function createDefaultParameter():ILabelModelParameter

Creates a default parameter that can be used for this model.

Returns
ILabelModelParameter — A parameter for this model instance.
createEdgeAnchored()method 
public function createEdgeAnchored(ratio:Number, distance:Number, angle:Number):ILabelModelParameter

Creates a parameter for the given location.

Parameters

ratio:Number — The ratio at which the label will be anchored between the location of the source port and the location of the target port.
 
distance:Number — The distance orthogonally to the connection between the source and target point.
 
angle:Number — The angle by which the label should be rotated.

Returns
ILabelModelParameter — A parameter that describes the position.

See also

findBestParameter()method 
public function findBestParameter(label:ILabel, model:ILabelModel, labelLayout:IOrientedRectangle):ILabelModelParameter

Tries to find a parameter that best matches the given layout for the provided label instance.

This method may not necessarily find a parameter that matches the provided layout exactly. Implementations may choose to simply return the model's default parameter but may never return null.

Parameters

label:ILabel — The label to find a parameter for.
 
model:ILabelModel — The model instance to use. This should be the instance this instance has been obtained from.
 
labelLayout:IOrientedRectangle — The anticipated layout for the label.

Returns
ILabelModelParameter — A non-null parameter that can be used for the label to approximate the provided layout.
getContext()method 
public function getContext(label:ILabel, parameter:ILabelModelParameter):ILookup

Parameters

label:ILabel
 
parameter:ILabelModelParameter

Returns
ILookup
getGeometry()method 
public function getGeometry(modelParameter:ILabelModelParameter, label:ILabel):IOrientedRectangle

Calculates the geometry in form of an IOrientedRectangle for a given label using the given model parameter.

Parameters

modelParameter:ILabelModelParameter — A parameter that has been created by this model. This is typically the parameter that yielded this instance through its ILabelModelParameter.model property.
 
label:ILabel — The label to calculate the geometry for

Returns
IOrientedRectangle — An instance that describes the geometry. This is typically an instance designed as a flyweight, so clients should not cache the instance but store the values if they need a snapshot for later use
lookup()method 
public function lookup(type:Class):Object

Returns an instance that implements the given type or null.

Typically, this method will be called in order to obtain a different view or aspect of the current instance. This is quite similar to casting or using a super type or interface of this instance, but is not limited to inheritance or compile time constraints. An instance implementing this method is not required to return non-null implementations for the types, nor does it have to return the same instance any time. Also it depends on the type and context whether the instance returned stays up to date or needs to be reobtained for subsequent use.

Parameters

type:Class — the type for which an instance shall be returned

Returns
Object — an instance that is assignable to type or null