Package | com.yworks.graph.model |
Class | public class FreeNodeLabelModel |
Inheritance | FreeNodeLabelModel Object |
Implements | ILabelModel, ILabelModelParameterFinder |
The position of the label is stored relative to the layout of the node the label belongs to.
Property | Defined By | ||
---|---|---|---|
instance : FreeNodeLabelModel [static] [read-only] | FreeNodeLabelModel |
Method | Defined By | ||
---|---|---|---|
Creates a default parameter that can be used for this model. | FreeNodeLabelModel | ||
createNodeCenterAnchored(offsetX:Number, offsetY:Number, angle:Number):ILabelModelParameter
Creates a parameter instance that is anchored to the node's INode.layout's center. | FreeNodeLabelModel | ||
createNodeLayoutAnchored(offsetX:Number, offsetY:Number, angle:Number):ILabelModelParameter
Creates a parameter instance that is anchored to the node's INode.layout. | FreeNodeLabelModel | ||
createNodeRatioAnchored(layoutXRatio:Number, layoutYRatio:Number, layoutXOffset:Number, layoutYOffset:Number, labelXRatio:Number, labelYRatio:Number, labelXOffset:Number, labelYOffset:Number, angle:Number):ILabelModelParameter
Creates a parameter instance that anchors the label to the node at a given position. | FreeNodeLabelModel | ||
findBestParameter(label:ILabel, model:ILabelModel, labelLayout:IOrientedRectangle):ILabelModelParameter
Tries to find a parameter that best matches the given layout for the provided label instance. | FreeNodeLabelModel | ||
Provides a lookup context for the given combination of label and parameter. | FreeNodeLabelModel | ||
Calculates the geometry in form of an IOrientedRectangle
for a given label using the given model parameter. | FreeNodeLabelModel | ||
lookup(type:Class):Object
Returns an instance that implements the given type or null. | FreeNodeLabelModel |
instance | property |
instance:FreeNodeLabelModel
[read-only] public static function get instance():FreeNodeLabelModel
createDefaultParameter | () | method |
public function createDefaultParameter():ILabelModelParameter
Creates a default parameter that can be used for this model.
ReturnsILabelModelParameter — A parameter for this model instance.
|
createNodeCenterAnchored | () | method |
public function createNodeCenterAnchored(offsetX:Number, offsetY:Number, angle:Number):ILabelModelParameter
Creates a parameter instance that is anchored to the node's INode.layout
's center.
Parameters
offsetX:Number — The x offset to the layout's center.
| |
offsetY:Number — The y offset to the layout's center.
| |
angle:Number — The angle to rotate the label by.
|
ILabelModelParameter — A parameter that exactly fits the described location.
|
See also
createNodeLayoutAnchored | () | method |
public function createNodeLayoutAnchored(offsetX:Number, offsetY:Number, angle:Number):ILabelModelParameter
Creates a parameter instance that is anchored to the node's INode.layout
.
Parameters
offsetX:Number — The x offset to the layout's top left corner
| |
offsetY:Number — The y offset to the layout's top left corner.
| |
angle:Number — The angle to rotate the label by.
|
ILabelModelParameter — A parameter that exactly fits the described location.
|
See also
createNodeRatioAnchored | () | method |
public function createNodeRatioAnchored(layoutXRatio:Number, layoutYRatio:Number, layoutXOffset:Number, layoutYOffset:Number, labelXRatio:Number, labelYRatio:Number, labelXOffset:Number, labelYOffset:Number, angle:Number):ILabelModelParameter
Creates a parameter instance that anchors the label to the node at a given position.
The parameter will use the ratio and offset values to determine a point on both the label and the node. It will place the label in such a way that both points coincide.
Parameters
layoutXRatio:Number — The ratio that describes the point on the node's layout relative to its width.
| |
layoutYRatio:Number — The ratio that describes the point on the node's layout relative to its height.
| |
layoutXOffset:Number — The x offset to apply to the point on the node after the ratio has been determined.
| |
layoutYOffset:Number — The y offset to apply to the point on the node after the ratio has been determined.
| |
labelXRatio:Number — The ratio that describes the point on the label's layout relative to its width.
| |
labelYRatio:Number — The ratio that describes the point on the label's layout relative to its height.
| |
labelXOffset:Number — The x offset to apply to the point on the label after the ratio has been determined.
| |
labelYOffset:Number — The y offset to apply to the point on the label after the ratio has been determined.
| |
angle:Number — The angle by which the label should be rotated around the point described using the ratio and offset.
|
ILabelModelParameter — A parameter that exactly fits the described location.
|
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 implementation will match the provided layout perfectly.
Parameters
label:ILabel — The label to find a parameter for.
| |
model:ILabelModel — The model instance to use. This should be this instance.
| |
labelLayout:IOrientedRectangle — The anticipated layout for the label.
|
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
Provides a lookup context for the given combination of label and parameter.
Parameters
label:ILabel — The label to use in the context.
| |
parameter:ILabelModelParameter — The parameter to use for the label in the context.
|
ILookup — An implementation of the ILookup interface that can be used to query
additional aspects of the label/parameter combination.
|
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
|
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
|
Object — an instance that is assignable to type or null
|