| Package | com.yworks.graph.model |
| Class | public class DefaultLabelModelParameterFinder |
| Implements | ILabelModelParameterFinder |
ILabelModelParameterFinder interface that uses the
ILabelModel's own ILabelModelParameterProvider instance to find the closest match.
This implementation uses a metric to find the closest of the provided parameter candidates to the layout
provided in findBestParameter.
See also
| Method | Defined by | ||
|---|---|---|---|
|
findBestParameter(label:ILabel, model:ILabelModel, labelLayout:IOrientedRectangle):ILabelModelParameter
Tries to find a parameter that best matches the given layout for the provided label instance.
| DefaultLabelModelParameterFinder | ||
| Method | Defined by | ||
|---|---|---|---|
|
Calculates a metric for the given label/parameter pair and the target label layout.
| DefaultLabelModelParameterFinder | ||
|
Returns the distance between two
IOrientedRectangle instances. | DefaultLabelModelParameterFinder | ||
|
Retrieves an enumerator over all candidates for a given label and model.
| DefaultLabelModelParameterFinder | ||
| Constant | Defined by | ||
|---|---|---|---|
| instance : DefaultLabelModelParameterFinder
[static]
A singleton instance of this class.
| DefaultLabelModelParameterFinder | ||
| calculateMetric | () | method |
protected function calculateMetric(label:ILabel, parameter:ILabelModelParameter, layout:IOrientedRectangle):NumberCalculates a metric for the given label/parameter pair and the target label layout.
This implementation gets the geometry from the parameter's model's ILabelModel.getGeometry method
and returns the result of a call to distance.
label:ILabel — The label to apply the parameter to.
|
|
parameter:ILabelModelParameter — The parameter candidate.
|
|
layout:IOrientedRectangle — The targetted layout rectangle.
|
Number — A metric that indicates the distance between the candidate's layout and the target layout.
|
| distance | () | method |
protected function distance(geometry:IOrientedRectangle, targetGeometry:IOrientedRectangle):Number
Returns the distance between two IOrientedRectangle instances.
The distance is calculated using the euclidean distance between the two centers and the angular deviation between the two up vectors.
Parametersgeometry:IOrientedRectangle |
|
targetGeometry:IOrientedRectangle |
Number |
See also
| findBestParameter | () | method |
public function findBestParameter(label:ILabel, model:ILabelModel, labelLayout:IOrientedRectangle):ILabelModelParameterTries 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.
It will first query the getCandidateParameters parameter for an enumeration of candidates
and will then find the best matching candidate using a metric calculated by CalculateMetric.
If no parameter can be found this method returns the ILabelModel.createDefaultParameter
default parameter for the model.
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.
|
ILabelModelParameter —
A non-null parameter that can be used for the label to approximate the provided layout.
|
See also
| getCandidateParameters | () | method |
protected function getCandidateParameters(label:ILabel, model:ILabelModel):IteratorRetrieves an enumerator over all candidates for a given label and model.
Parameterslabel:ILabel — The label.
|
|
model:ILabelModel — The model of the label.
|
Iterator —
An enumerator over the candidates. The enumerator may be empty.
|
| instance | constant |
public static const instance:DefaultLabelModelParameterFinderA singleton instance of this class.