Packagecom.yworks.graph.model
Classpublic class SliderEdgeLabelModel
ImplementsILabelModel, ILabelModelParameterProvider

An edge label model that can be used for labels along the path of an edge. This model allows for specifying the index of the segment of the edge and the distance from the edge, as well as the angle of the label.



Public Properties
 PropertyDefined by
  angle : Number
The angle the labels are rotated about.
SliderEdgeLabelModel
  distance : Number
Gets or sets the distance between the label and the edge's path.
SliderEdgeLabelModel
  edgeRelativeDistance : Boolean
Whether distance to the edge is interpreted relatively to the edge's path.
SliderEdgeLabelModel
Public Methods
 MethodDefined by
  
SliderEdgeLabelModel(distance:Number = 0, angle:Number = 0, edgeRelativeDistance:Boolean = true)
Creates a new instance of this.
SliderEdgeLabelModel
  
Creates a default parameter that can be used for this model.
SliderEdgeLabelModel
  
createParameterFromSource(segmentIndex:int, segmentRatio:Number):ILabelModelParameter
Creates a parameter that measures the provided segment index from the source side of the edge path.
SliderEdgeLabelModel
  
createParameterFromTarget(segmentIndex:int, segmentRatio:Number):ILabelModelParameter
Creates a parameter that measures the provided segment index from the target side of the edge path.
SliderEdgeLabelModel
  
Calculates the geometry in form of an IOrientedRectangle for a given label using the given model parameter.
SliderEdgeLabelModel
  
Returns an iterator over a set of possible ILabelModelParameter instances that can be used for the given label and model.
SliderEdgeLabelModel
  
lookup(type:Class):Object
Returns an instance that implements the given type or null.
SliderEdgeLabelModel
Property detail
angleproperty
angle:Number  [read-write]

The angle the labels are rotated about. The angle is measured relative to the x-axis. The default value is 0.0.

Implementation
    public function get angle():Number
    public function set angle(value:Number):void
distanceproperty 
distance:Number  [read-write]

Gets or sets the distance between the label and the edge's path. A positive value will make the label appear above or right of the edge, whereas negative values will make it appear on the opposite side of the edge's path. A value of 0 will make the label's appear centered on the edge's path.

Implementation
    public function get distance():Number
    public function set distance(value:Number):void
edgeRelativeDistanceproperty 
edgeRelativeDistance:Boolean  [read-write]

Whether distance to the edge is interpreted relatively to the edge's path. If this is set to false, positive distance values will make the label appear above the edge, otherwise they will appear left of the edge.

Implementation
    public function get edgeRelativeDistance():Boolean
    public function set edgeRelativeDistance(value:Boolean):void
Constructor detail
SliderEdgeLabelModel()constructor
public function SliderEdgeLabelModel(distance:Number = 0, angle:Number = 0, edgeRelativeDistance:Boolean = true)

Creates a new instance of this.

Parameters
distance:Number (default = 0) — The distance between the label and the edge's path.
 
angle:Number (default = 0) — The angle, the labels are rotated about, relative to the x axis
 
edgeRelativeDistance:Boolean (default = true) — Whether the labels distance is interpreted relatively to the edge's path
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.
createParameterFromSource()method 
public function createParameterFromSource(segmentIndex:int, segmentRatio:Number):ILabelModelParameter

Creates a parameter that measures the provided segment index from the source side of the edge path.

Parameters
segmentIndex:int — The zero-based index of the segment beginning from the source side.
 
segmentRatio:Number — The ratio at which to place the label at the segment.

Returns
ILabelModelParameter — A label parameter that describes the provided parameters for this model instance.
createParameterFromTarget()method 
public function createParameterFromTarget(segmentIndex:int, segmentRatio:Number):ILabelModelParameter

Creates a parameter that measures the provided segment index from the target side of the edge path.

Parameters
segmentIndex:int — The zero-based index of the segment beginning from the target side.
 
segmentRatio:Number — The ratio at which to place the label at the segment.

Returns
ILabelModelParameter — A label parameter that describes the provided parameters for this model instance.
getGeometry()method 
public function getGeometry(parameter:ILabelModelParameter, label:ILabel):IOrientedRectangle

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

Parameters
parameter: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
getParameters()method 
public function getParameters(label:ILabel, model:ILabelModel):Iterator

Returns an iterator over a set of possible ILabelModelParameter instances that can be used for the given label and model.

Parameters
label:ILabel — The label instance to use.
 
model:ILabelModel — The model to provide parameters for.

Returns
Iterator — A possibly empty iterator over a set of label model parameters.
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