An implementation of ILabelModel that can be used to create custom label models out of existing ILabelModel and ILabelModelParameter instances.
Remarks
const compositeLabelModel = new CompositeLabelModel()
compositeLabelModel.addModel(new ExteriorNodeLabelModel())
compositeLabelModel.addModel(new StretchNodeLabelModel())
compositeLabelModel.addParameter(InteriorNodeLabelModel.CENTER)
Type Details
- yFiles module
- view
Constructors
Properties
Gets a list of CompositeLabelModelParameter that were created by addParameter.
Methods
Adds another ILabelModel to this model's collection of label models.
Remarks
Note that parameters created from the labelModel
will be wrapped by this class and the resulting parameters will use this model instance as its model.
The model is stored by reference and subsequent modification of the model will be reflected by this instance.
Also, the method allows for associating a weight that will be associated with each parameter created by the labelModel
.
Parameters
A map of options to pass to the method.
- labelModel - ILabelModel
- The label model to add to this instance.
- weight - number
- The weight to associate with parameters created by this model. If the value is not set, the default is
1.0
Adds the model of the labelModelParameter
to this model's collection of label models and returns the labelModelParameter
wrapped in a CompositeLabelModelParameter.
Remarks
Note that parameters created from the added model will also be wrapped by this class and the resulting parameters will use this model instance as its model.
The model is stored by reference and subsequent modification of the model will be reflected by this instance.
Also, the method allows for associating a profit that will be associated with the return parameter as well as with each parameter created by the added model.
Parameters
A map of options to pass to the method.
- labelModelParameter - ILabelModelParameter
- The parameter whose model should be added to this instance and which is wrapped and returned.
- profit - number
- The profit to associate with the wrapped parameters and all parameters created by this model. If the value is not set, the default is
1.0
Returns
- ↪CompositeLabelModelParameter
- The given
labelModelParameter
wrapped in a CompositeLabelModelParameter.
Adds another parameter to this model's collection of parameters.
Remarks
Note that the parameter will be wrapped by this class and the resulting parameter, which will use this model instance as its model, will be returned. The parameter is stored by reference, and subsequent modification of the parameter or its associated model will be reflected by this instance.
Also, the method allows for associating a weight with each parameter.
Parameters
A map of options to pass to the method.
- layoutParameter - ILabelModelParameter
- The parameter to add to this instance.
- weight - number
- The weight to associate with the parameter. If the value is not set, the default is
1.0
Returns
- ↪CompositeLabelModelParameter
- A new parameter that wraps the provided parameter and uses this instance as its model.
Tries to find a parameter that best matches the given layout for the provided label instance.
Remarks
Parameters
A map of options to pass to the method.
- label - ILabel
- The label to find a parameter for.
- layout - 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.
Provides a lookup context for the given label.
Calculates the geometry of the given label using the given model parameter.
Parameters
A map of options to pass to the method.
- label - ILabel
- The label to calculate the geometry for.
- layoutParameter - ILabelModelParameter
- A parameter that is compatible with this model. Typically, this is a parameter that has been created by this model, and its property model returns this instance.
Returns
- ↪IOrientedRectangle
- An IOrientedRectangle that describes the geometry of the label. This is typically designed as a flyweight, therefore clients should not cache the instance but store the values if they need a snapshot for later use.
Implements
Returns an enumerator over a set of possible ILabelModelParameter instances that can be used for the given label and model.
Remarks
Parameters
A map of options to pass to the method.
- label - ILabel
- The label instance to use.
Returns
- ↪IEnumerable<ILabelModelParameter>
- A possibly empty enumerator over a set of label model parameters.