Search this API

y.layout
Class LabelCandidate

java.lang.Object
  extended by y.layout.LabelCandidate
All Implemented Interfaces:
PlaneObject
Direct Known Subclasses:
EdgeLabelCandidate, NodeLabelCandidate

public class LabelCandidate
extends Object
implements PlaneObject

Base class for candidate positions for labels.


Constructor Summary
LabelCandidate(OrientedRectangle labelBox, Object param, LabelLayout owner)
          Returns a new instance of LabelCandidate.
LabelCandidate(OrientedRectangle labelBox, Object param, LabelLayout owner, boolean internal)
          Returns a new instance of LabelCandidate.
LabelCandidate(YPoint pos, YDimension size, Object param, LabelLayout owner)
          Returns a new instance of LabelCandidate.
LabelCandidate(YPoint pos, YDimension size, Object param, LabelLayout owner, boolean internal)
          Returns a new instance of LabelCandidate.
 
Method Summary
 YRectangle getBoundingBox()
          Returns the bounding box of this label candidate.
 OrientedRectangle getBox()
          Returns the real bounds of this label candidate.
 double getCustomProfit()
          Returns the custom profit for this label candidate.
 double getEdgeOverlapPenalty()
          Returns the penalty value for a candidate position that overlaps the path of an edge.
 double getHeight()
          Returns the height of the label candidate bounds.
 YPoint getLocation()
          Returns the upper left corner of the label candidate bounds.
 Object getModelParameter()
          Returns the model parameter that was used by the underlying model to generate this label candidate.
 double getNodeOverlapPenalty()
          Returns the penalty for a candidate position that overlaps the bounds of a node.
 double getOverlapPenalty()
          Returns the sum of node overlap penalty and edge overlap penalty.
 LabelLayout getOwner()
          Returns the LabelLayout to which this candidate box belongs.
 Object getParameter()
          Returns the model parameter that was used by the underlying model to generate this label candidate.
 YDimension getSize()
          Returns the width and height of the label candidate bounds.
 double getWidth()
          Returns the width of the label candidate bounds.
 double getX()
          Returns the minimal x-coordinate of the label candidate bounds.
 double getY()
          Returns the minimal y-coordinate of the label candidate bounds.
 boolean isInternal()
          Returns whether this candidate is an internal node label, i.e. an label which resides inside the boundaries of a node.
 boolean isPropagated()
          Returns if this box had been chosen by the labeling algorithm.
 void propagate()
          Sets the model parameters of the owner of this label candidate to the model parameters of this candidate box.
 void setCustomProfit(double customProfit)
          Specifies the custom profit for this label candidate.
 void setEdgeOverlapPenalty(double pen)
          Sets the penalty value for a candidate position that overlaps the path of an edge.
 void setNodeOverlapPenalty(double pen)
          Sets the penalty for a candidate position that overlaps the bounds of a node.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LabelCandidate

public LabelCandidate(YPoint pos,
                      YDimension size,
                      Object param,
                      LabelLayout owner)
Returns a new instance of LabelCandidate.

Parameters:
pos - the location of the upper left corner of the candidate.
size - the size of the candidate.
param - the parameters of the labeling model associated with this candidate.
owner - the label associated to the candidate.

LabelCandidate

public LabelCandidate(YPoint pos,
                      YDimension size,
                      Object param,
                      LabelLayout owner,
                      boolean internal)
Returns a new instance of LabelCandidate.

Parameters:
pos - the location of the upper left corner of the candidate.
size - the size of the candidate.
param - the parameters of the labeling model with this candidate.
owner - the label associated to the candidate.
internal - flag whether the candidate is allowed to overlap its own feature.

LabelCandidate

public LabelCandidate(OrientedRectangle labelBox,
                      Object param,
                      LabelLayout owner,
                      boolean internal)
Returns a new instance of LabelCandidate.

Parameters:
labelBox - the box that specifies the candidate's size and position.
param - the parameters of the labeling model with this candidate.
owner - the label associated to the candidate.
internal - flag whether the candidate is allowed to overlap its own feature.

LabelCandidate

public LabelCandidate(OrientedRectangle labelBox,
                      Object param,
                      LabelLayout owner)
Returns a new instance of LabelCandidate.

Parameters:
labelBox - the box that specifies the candidate's size and position.
param - the parameters of the labeling model with this candidate.
owner - the label associated to the candidate.
Method Detail

getCustomProfit

public double getCustomProfit()
Returns the custom profit for this label candidate. The value is restricted to the interval [0,1] where 1 specifies the highest possible profit (default is 0). Note: the value is only considered if the labeling algorithm uses an optimization strategy (see MISLabelingAlgorithm.setOptimizationStrategy(byte)).

Returns:
the custom profit for this label candidate.
See Also:
setCustomProfit(double)

setCustomProfit

public void setCustomProfit(double customProfit)
Specifies the custom profit for this label candidate. The value is restricted to the interval [0,1] where 1 specifies the highest possible profit (default is 0). Note: the value is only considered if the labeling algorithm uses an optimization strategy (see MISLabelingAlgorithm.setOptimizationStrategy(byte)).

Throws:
IllegalArgumentException - if the value lies not in the interval [0,1].
Parameters:
customProfit - the custom profit for this label candidate.

getModelParameter

public Object getModelParameter()
Returns the model parameter that was used by the underlying model to generate this label candidate.


getLocation

public YPoint getLocation()
Returns the upper left corner of the label candidate bounds.


getSize

public YDimension getSize()
Returns the width and height of the label candidate bounds.


getX

public double getX()
Returns the minimal x-coordinate of the label candidate bounds.


getY

public double getY()
Returns the minimal y-coordinate of the label candidate bounds.


getWidth

public double getWidth()
Returns the width of the label candidate bounds.


getHeight

public double getHeight()
Returns the height of the label candidate bounds.


getBoundingBox

public YRectangle getBoundingBox()
Returns the bounding box of this label candidate.

Specified by:
getBoundingBox in interface PlaneObject

getBox

public OrientedRectangle getBox()
Returns the real bounds of this label candidate.


getOwner

public LabelLayout getOwner()
Returns the LabelLayout to which this candidate box belongs.


isInternal

public boolean isInternal()
Returns whether this candidate is an internal node label, i.e. an label which resides inside the boundaries of a node.


propagate

public void propagate()
Sets the model parameters of the owner of this label candidate to the model parameters of this candidate box.


setNodeOverlapPenalty

public void setNodeOverlapPenalty(double pen)
Sets the penalty for a candidate position that overlaps the bounds of a node.


setEdgeOverlapPenalty

public void setEdgeOverlapPenalty(double pen)
Sets the penalty value for a candidate position that overlaps the path of an edge.


getNodeOverlapPenalty

public double getNodeOverlapPenalty()
Returns the penalty for a candidate position that overlaps the bounds of a node.


getEdgeOverlapPenalty

public double getEdgeOverlapPenalty()
Returns the penalty value for a candidate position that overlaps the path of an edge.


getOverlapPenalty

public double getOverlapPenalty()
Returns the sum of node overlap penalty and edge overlap penalty.

See Also:
getEdgeOverlapPenalty(), getNodeOverlapPenalty()

getParameter

public Object getParameter()
Returns the model parameter that was used by the underlying model to generate this label candidate.


isPropagated

public boolean isPropagated()
Returns if this box had been chosen by the labeling algorithm.


toString

public String toString()
Overrides:
toString in class Object

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