|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.LabelCandidate
public class LabelCandidate
A LabelCandidate
describes one valid placement for a label considering the label model.
Generic labeling algorithms place labels according to their label model. To get valid locations for the label, the
label model generates various LabelCandidate
s. One of these candidates will be chosen to provide the actual
placement of the label.
NodeLabelModel
,
EdgeLabelModel
,
SALabeling
,
GreedyMISLabeling
Constructor Summary | |
---|---|
LabelCandidate(OrientedRectangle labelBox,
java.lang.Object param,
LabelLayout owner)
Creates a new instance of LabelCandidate described by its box and model parameter. |
|
LabelCandidate(OrientedRectangle labelBox,
java.lang.Object param,
LabelLayout owner,
boolean internal)
Creates a new instance of LabelCandidate described by its box, model parameter and internal flag. |
|
LabelCandidate(YPoint pos,
YDimension size,
java.lang.Object param,
LabelLayout owner)
Creates a new instance of LabelCandidate described by location, size and model parameter. |
|
LabelCandidate(YPoint pos,
YDimension size,
java.lang.Object param,
LabelLayout owner,
boolean internal)
Creates a new instance of LabelCandidate described by location, size, model parameter and internal flag. |
Method Summary | |
---|---|
YRectangle |
getBoundingBox()
Returns the bounding box of this candidate. |
OrientedRectangle |
getBox()
Returns the oriented box of this candidate. |
double |
getCustomProfit()
Returns the custom profit for this candidate. |
double |
getEdgeOverlapPenalty()
Returns a penalty for a candidate position that overlaps the path of an edge. |
double |
getHeight()
Returns the height of the candidate's bounding box. |
YPoint |
getLocation()
Returns the coordinates of the upper-left corner of the candidate's bounds. |
java.lang.Object |
getModelParameter()
Returns the model parameter that was used by the underlying model to generate this label candidate. |
double |
getNodeOverlapPenalty()
Returns a penalty for a candidate position that overlaps the box of a node. |
double |
getOverlapPenalty()
Returns the sum of node overlap penalty and edge overlap penalty. |
LabelLayout |
getOwner()
Returns the LabelLayout for which this candidate was created. |
java.lang.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 candidate's bounds. |
double |
getWidth()
Returns the width of the candidate's bounds. |
double |
getX()
Returns the minimum x-coordinate of the candidate's bounds. |
double |
getY()
Returns the minimum y-coordinate of the candidate's bounds. |
boolean |
isInternal()
Returns whether or not this candidate describes an internal label. |
boolean |
isPropagated()
Returns whether or not this candidate's box had already been chosen by the labeling algorithm. |
void |
propagate()
Replaces the model parameter and box of the owner with the model parameter and box of this candidate. |
void |
setCustomProfit(double customProfit)
Specifies the custom profit for this candidate. |
void |
setEdgeOverlapPenalty(double penalty)
Specifies a penalty for a candidate position that overlaps the path of an edge. |
void |
setNodeOverlapPenalty(double penalty)
Specifies a penalty for a candidate position that overlaps the box of a node. |
java.lang.String |
toString()
Returns a String representation of this LabelCandidate . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LabelCandidate(YPoint pos, YDimension size, java.lang.Object param, LabelLayout owner)
LabelCandidate
described by location, size and model parameter.
pos
- the location of the upper left corner of the candidatesize
- the size of the candidateparam
- the parameters of the label model associated with this candidateowner
- the label associated with the candidatepublic LabelCandidate(YPoint pos, YDimension size, java.lang.Object param, LabelLayout owner, boolean internal)
LabelCandidate
described by location, size, model parameter and internal flag.
pos
- the location of the upper left corner of the candidatesize
- the size of the candidateparam
- the parameters of the label model associated with this candidateowner
- the label associated with the candidateinternal
- true
if the candidate is allowed to overlap with its owner, false
otherwisepublic LabelCandidate(OrientedRectangle labelBox, java.lang.Object param, LabelLayout owner, boolean internal)
LabelCandidate
described by its box, model parameter and internal flag.
labelBox
- the box that specifies the candidate's size and positionparam
- the parameters of the label model associated with this candidateowner
- the label associated with the candidateinternal
- true
if the candidate is allowed to overlap with its owner, false
otherwisepublic LabelCandidate(OrientedRectangle labelBox, java.lang.Object param, LabelLayout owner)
LabelCandidate
described by its box and model parameter.
labelBox
- the box that specifies the candidate's size and positionparam
- the parameters of the label model associated with this candidateowner
- the label associated with the candidateMethod Detail |
---|
public double getCustomProfit()
The value is restricted to the interval [0,1]
, where 1
specifies the highest possible profit.
optimization strategy
.setCustomProfit(double)
public void setCustomProfit(double customProfit)
The value is restricted to the interval [0,1]
, where 1
specifies the highest possible profit.
optimization strategy
.customProfit
- the custom profit for this candidate
java.lang.IllegalArgumentException
- if the specified value lies outside of [0,1]
public java.lang.Object getModelParameter()
public YPoint getLocation()
The bounds are the smallest paraxial box that contains the candidate.
getBoundingBox()
public YDimension getSize()
The bounds are the smallest paraxial box that contains the candidate.
getBoundingBox()
public double getX()
The bounds are the smallest paraxial box that contains the candidate.
getLocation()
,
getBoundingBox()
public double getY()
The bounds are the smallest paraxial box that contains the candidate.
getLocation()
,
getBoundingBox()
public double getWidth()
The bounds are the smallest paraxial box that contains the candidate.
getSize()
,
getBoundingBox()
public double getHeight()
The bounding box is the smallest paraxial box that contains the candidate.
getSize()
,
getBoundingBox()
public YRectangle getBoundingBox()
The bounding box describes the smallest paraxial box that contains the candidate.
getBoundingBox
in interface PlaneObject
public OrientedRectangle getBox()
If the label is rotated, this box will be oriented accordingly.
public LabelLayout getOwner()
LabelLayout
for which this candidate was created.
public boolean isInternal()
true
if the candidate represents an internal label, false
otherwisepublic void propagate()
When this candidate is chosen to provide the placement of the label, this method transfers the model parameter
and the candidate box to the LabelLayout
.
getOwner()
,
getModelParameter()
,
getBox()
public void setNodeOverlapPenalty(double penalty)
The penalty should be a factor between 0
and 1
, where 0
means that an
overlap is considered unimportant and 1
means that an overlap is considered severe.
penalty
- the penalty for overlaps with nodes
java.lang.IllegalArgumentException
- if the specified penalty is outside [0,1]
public void setEdgeOverlapPenalty(double penalty)
The penalty should be a factor between 0
and 1
, where 0
means that an
overlap is considered unimportant and 1
means that an overlap is considered severe.
penalty
- the penalty for overlaps with edges
java.lang.IllegalArgumentException
- if the specified penalty is outside [0,1]
public double getNodeOverlapPenalty()
The penalty should be a factor between 0
and 1
, where 0
means that an
overlap is considered unimportant and 1
means that an overlap is considered severe.
setNodeOverlapPenalty(double)
public double getEdgeOverlapPenalty()
The penalty should be a factor between 0
and 1
, where 0
means that an
overlap is considered unimportant and 1
means that an overlap is considered severe.
setEdgeOverlapPenalty(double)
public double getOverlapPenalty()
getEdgeOverlapPenalty()
,
getNodeOverlapPenalty()
public java.lang.Object getParameter()
public boolean isPropagated()
If this candidate is propagated, its model parameter and box were transferred to the label
.
true
if this candidate was chosen, false
otherwisepropagate()
public java.lang.String toString()
String
representation of this LabelCandidate
.
The String
contains the owning label and the coordinates of the candidate's bounds.
toString
in class java.lang.Object
getOwner()
,
getLocation()
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |