- I
Remarks
Default Values of Properties
| Name | Default |
|---|---|
| weight | 1.0 |
Members
Constructors
Returns a new instance of ExtendedNodeLabelCandidate.
Parameters
- orientedBox: OrientedRectangle
- the label size and orientation
- parameter: any
- the parameters of the labeling model associated with this candidate.
- allowOwnerOverlap: boolean
trueif the candidate is allowed to lie inside the node, i.e. overlaps with the owner are not penalized,falseotherwise.- weight?: number
- the weight associated with the label candidate
Throws
- Exception ({ name: 'ArgumentError' })
- if the weight does not lie in the interval [0,1]
Properties
Gets the bounds of this candidate.
Defined in
LabelCandidate.boundsProperty Value
true if the candidate intersects an edge that is not the owner of the label, false otherwiseExamples
layoutData.nodeLabelCandidateProcessors.constant = (
candidates: IEnumerable<LabelCandidate>,
_: ILabel | LayoutNodeLabel,
) => {
for (const candidate of candidates.filter((c) => c.intersectsEdge)) {
// candidates that intersect edges should not be selected
candidate.weight = 0
}
}Defined in
LabelCandidate.intersectsEdgeProperty Value
true if the candidate intersects a layout grid line, false otherwiseExamples
layoutData.nodeLabelCandidateProcessors.constant = (
candidates: IEnumerable<LabelCandidate>,
_: ILabel | LayoutNodeLabel,
) => {
for (const candidate of candidates.filter(
(c) => c.intersectsLayoutGridLine,
)) {
// candidates that intersect a layout grid line should not be selected
candidate.weight = 0
}
}Defined in
LabelCandidate.intersectsLayoutGridLineProperty Value
true if the candidate intersects a node that is not the owner of the label, false otherwiseExamples
layoutData.nodeLabelCandidateProcessors.constant = (
candidates: IEnumerable<LabelCandidate>,
_: ILabel | LayoutNodeLabel,
) => {
for (const candidate of candidates.filter((c) => c.intersectsNode)) {
// candidates that intersect nodes should not be selected
candidate.weight = 0
}
}Defined in
LabelCandidate.intersectsNodeThe value is set at the beginning of the run of GenericLabeling and can be subsequently used for customizing the weight of the candidate; see also nodeLabelCandidateProcessors and nodeLabelCandidateProcessors.
This property is only relevant for labels of edges. Further, if the label candidate intersects its owner edge, but no other edge of the owner's edge group, this property is false; see also intersectsOwner.
An edge group is a set of edges which share a common bus near the target or source node. They are defined with sourceGroupIds and targetGroupIds.
Property Value
true if the label candidate intersects with an edge of an edge that is grouped with the label's edge, false otherwiseExamples
layoutData.edgeLabelCandidateProcessors.constant = (
candidates: IEnumerable<LabelCandidate>,
_: ILabel | LayoutEdgeLabel,
) => {
for (const candidate of candidates.filter(
(c) => c.intersectsOwnEdgeGroup,
)) {
// candidates that intersect an edge of the owner's edge group should not be selected
candidate.weight = 0
}
}Sample Graphs
true (assume that labels need to be placed left of edges)Defined in
LabelCandidate.intersectsOwnEdgeGroupProperty Value
true if the candidate intersects the label's owner, false otherwiseExamples
layoutData.nodeLabelCandidateProcessors.constant = (
candidates: IEnumerable<LabelCandidate>,
_: ILabel | LayoutNodeLabel,
) => {
for (const candidate of candidates.filter((c) => c.intersectsOwner)) {
// candidates that intersect the owner of the label node should not be selected
candidate.weight = 0
}
}Defined in
LabelCandidate.intersectsOwnerGets the oriented box of this candidate.
Defined in
LabelCandidate.layoutThe weight describes the priority of this candidate with respect to other candidates. Labeling algorithms will use the weight to decide which candidate to choose. Positions with a higher weight are more likely chosen.
The value is restricted to the interval [0,1], where 1 specifies the highest possible weight.
The labeling algorithm automatically calculates the weights for each valid label position considering user specified properties like the associated LabelingCosts and EdgeLabelPreferredPlacement. There are also multiple ways to manually specify the weight values, e.g., as a parameter of a predefined candidate set (see addDiscreteCandidates) or by means of property edge label candidate processor and node label candidate processor.
Throws
- Exception ({ name: 'ArgumentError' })
- if the specified value lies outside of
[0,1]