Search this API

y.layout
Interface EdgeLabelModel

All Known Implementing Classes:
AutoRotationSliderEdgeLabelModel, DiscreteEdgeLabelModel, FreeEdgeLabelModel, RotatedDiscreteEdgeLabelModel, RotatedSliderEdgeLabelModel, SliderEdgeLabelModel, SmartEdgeLabelModel

public interface EdgeLabelModel

This interface defines the properties of the model associated with an edge label layout.

An edge label model provides a set of possible candidates for the placement of an edge label.


Method Summary
 Object createModelParameter(OrientedRectangle labelBounds, EdgeLayout edgeLayout, NodeLayout sourceLayout, NodeLayout targetLayout)
          Creates a model parameter that represents the given edge label context best within this model.
 Object getDefaultParameter()
          Returns a model parameter that encodes the default position of this model's allowed edge label positions.
 YList getLabelCandidates(EdgeLabelLayout labelLayout, EdgeLayout edgeLayout, NodeLayout sourceLayout, NodeLayout targetLayout)
          Returns a list of EdgeLabelCandidate objects each of which describes a valid label position within this model.
 OrientedRectangle getLabelPlacement(YDimension labelSize, EdgeLayout edgeLayout, NodeLayout sourceLayout, NodeLayout targetLayout, Object param)
          Returns the bounds of the label for the position encoded by the given model parameter.
 

Method Detail

getDefaultParameter

Object getDefaultParameter()
Returns a model parameter that encodes the default position of this model's allowed edge label positions.

Returns:
A model parameter that can be passed to the getLabelPlacement(YDimension, EdgeLayout, NodeLayout, NodeLayout, Object) method.

getLabelPlacement

OrientedRectangle getLabelPlacement(YDimension labelSize,
                                    EdgeLayout edgeLayout,
                                    NodeLayout sourceLayout,
                                    NodeLayout targetLayout,
                                    Object param)
Returns the bounds of the label for the position encoded by the given model parameter.

Parameters:
labelSize - The size of the label that should be placed.
edgeLayout - The layout of the edge to which the label belongs.
sourceLayout - The layout of the source node of the label owning edge.
targetLayout - The layout of the target node of the label owning edge.
param - The model parameter that describes the abstract position of the label within this model. The parameter must have been generated by this model.
Returns:
The bounds of the label.

getLabelCandidates

YList getLabelCandidates(EdgeLabelLayout labelLayout,
                         EdgeLayout edgeLayout,
                         NodeLayout sourceLayout,
                         NodeLayout targetLayout)
Returns a list of EdgeLabelCandidate objects each of which describes a valid label position within this model.

Parameters:
labelLayout - The label for which candidates should be generated.
edgeLayout - The layout of the edge to which the label belongs.
sourceLayout - The layout of the source node of the label owning edge.
targetLayout - The layout of the target node of the label owning edge.
Returns:
A list of EdgeLabelCandidate objects.

createModelParameter

Object createModelParameter(OrientedRectangle labelBounds,
                            EdgeLayout edgeLayout,
                            NodeLayout sourceLayout,
                            NodeLayout targetLayout)
Creates a model parameter that represents the given edge label context best within this model. The created model parameter represents the closest parameter representation of the given label location that can be achieved within this model.

Parameters:
labelBounds - The bounds of the label for which a parameter representation is sought.
edgeLayout - The layout of the edge to which the label belongs.
sourceLayout - The layout of the source node of the label owning edge.
targetLayout - The layout of the target node of the label owning edge.
Returns:
A model parameter that can be passed to the getLabelPlacement(YDimension, EdgeLayout, NodeLayout, NodeLayout, Object) method.

© Copyright 2000-2013,
yWorks GmbH.
All rights reserved.