C

CompositeLabelModel

An implementation of ILabelModel that can be used to create custom label models out of existing ILabelModel and ILabelModelParameter instances.
ImplementsInheritance Hierarchy

Remarks

This class holds a number of models and parameters and can provide all of their parameters in parameters. A custom model can easily be created that way:
Creating a CompositeLabelModel
const compositeLabelModel = new CompositeLabelModel()
compositeLabelModel.addModel(new ExteriorNodeLabelModel())
compositeLabelModel.addModel(new StretchNodeLabelModel())
compositeLabelModel.addParameter(InteriorNodeLabelModel.CENTER)

Members

No filters for this type

Constructors

Creates a new instance of this label model with no label models or parameters added.

Properties

Gets a list of CompositeLabelModelParameter that were created by addParameter.
readonlyfinal

Methods

Adds another ILabelModel to this model's collection of label models.

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.

final

Parameters

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.

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.

final

Parameters

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

Return Value

CompositeLabelModelParameter
The given labelModelParameter wrapped in a CompositeLabelModelParameter.
Adds another parameter to this model's collection of parameters.

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.

final

Parameters

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

Return Value

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.
This implementation tests all parameters added via addParameter and created from all models added via addModel.
final

Parameters

label: ILabel
The label to find a parameter for.
layout: IOrientedRectangle
The anticipated layout for the label.

Return Value

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.
final

Parameters

label: ILabel
The label to use in the context.

Return Value

ILookup
An implementation of the ILookup interface that can be used to query additional aspects of the label.
Calculates the geometry of the given label using the given model parameter.
final

Parameters

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.

Return Value

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.
Returns an enumerator over a set of possible ILabelModelParameter instances that can be used for the given label and model.
This implementation returns all parameters added via addParameter and created from all models added via addModel.
final

Parameters

label: ILabel
The label instance to use.

Return Value

IEnumerable<ILabelModelParameter>
A possibly empty enumerator over a set of label model parameters.