Search this API

y.layout
Class LabelRanking

java.lang.Object
  extended by y.layout.LabelRanking
All Implemented Interfaces:
ProfitModel

public class LabelRanking
extends java.lang.Object
implements ProfitModel

LabelRanking implements the ranking for edge and node labels.

In this implementation node label positions have no ranking, the profit for all candidates is 1.

The ranking of edge label positions depends on the locations described in the PreferredPlacementDescriptor associated with an edge. Note that this implementation only works correctly if the label model is either a SliderEdgeLabelModel or a DiscreteEdgeLabelModel.

 
Your browser does not support SVG content.

Constructor Summary
LabelRanking()
          Creates a new instance of LabelRanking.
 
Method Summary
 double getProfit(LabelCandidate candidate)
          Returns the profit for placing a label using the given LabelCandidate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LabelRanking

public LabelRanking()
Creates a new instance of LabelRanking.

Method Detail

getProfit

public double getProfit(LabelCandidate candidate)
Description copied from interface: ProfitModel
Returns the profit for placing a label using the given LabelCandidate.

Higher profit means better candidates. Hence, there is a higher probability that the candidate is chosen by a labeling algorithm.

Profits need to have a value between 0 and 1.

Specified by:
getProfit in interface ProfitModel
Parameters:
candidate - the candidate
Returns:
the profit of the candidate

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.