deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.graphics.optimizers
Class LabelChoice

java.lang.Object
  extended by org.deegree.graphics.optimizers.LabelChoice

public class LabelChoice
extends Object

Represents different possibilities (candidates) to draw a LabelDisplayElement.

A LabelChoice has several Label candidates, one of this candidates is selected and represents the best choice.

Version:
$Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
Author:
Andreas Poth, Markus Schneider, last edited by: $Author: mschneider $

Constructor Summary
LabelChoice(LabelDisplayElement element, Label[] candidates, float[] qualities, int selected, int maxX, int maxY, int minX, int minY)
          Creates a new instance of LabelChoice.
 
Method Summary
 LabelDisplayElement getElement()
          Returns the associated LabelDisplayElement.
 int getMaxX()
          Returns the max x value of the bounding box of all Label candidates.
 int getMaxY()
          Returns the max y value of the bounding box of all Label candidates.
 int getMinX()
          Returns the min x value of the bounding box of all Label candidates.
 int getMinY()
          Returns the min y value of the bounding box of all Label candidates.
 float getQuality()
          Returns the quality measure of the currently selected Label
 int getSelected()
          Returns the index of the currently selected Label.
 Label getSelectedLabel()
          Returns the currently selected Label (which is the best choice of the candidates).
 boolean intersects(LabelChoice that)
          Determines if this LabelChoice can intersect with another LabelChoice by any chance, i.e. whether there are at least two Label candidates from each choice that intersect.
 void selectLabelRandomly()
          Selects one of the contained Label candidates randomly.
 void setSelected(int selected)
          Sets the selected Label candidate.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LabelChoice

public LabelChoice(LabelDisplayElement element,
                   Label[] candidates,
                   float[] qualities,
                   int selected,
                   int maxX,
                   int maxY,
                   int minX,
                   int minY)
Creates a new instance of LabelChoice.

Parameters:
element -
candidates -
qualities -
selected -
maxX -
maxY -
minX -
minY -
Method Detail

selectLabelRandomly

public void selectLabelRandomly()
Selects one of the contained Label candidates randomly.


setSelected

public void setSelected(int selected)
Sets the selected Label candidate.

Parameters:
selected - the index of the Label to be selected

getSelected

public int getSelected()
Returns the index of the currently selected Label.

Returns:
the index of the currently selected Label

getQuality

public float getQuality()
Returns the quality measure of the currently selected Label

Returns:
the quality of the currently selected Label

getSelectedLabel

public Label getSelectedLabel()
Returns the currently selected Label (which is the best choice of the candidates).

Returns:
the currently selected Label

getElement

public LabelDisplayElement getElement()
Returns the associated LabelDisplayElement.

Returns:
the associated LabelDisplayElement

getMaxX

public int getMaxX()
Returns the max x value of the bounding box of all Label candidates.

Returns:
max x value of the bounding box

getMaxY

public int getMaxY()
Returns the max y value of the bounding box of all Label candidates.

Returns:
max y value of the bounding box

getMinX

public int getMinX()
Returns the min x value of the bounding box of all Label candidates.

Returns:
min x value of the bounding box

getMinY

public int getMinY()
Returns the min y value of the bounding box of all Label candidates.

Returns:
min y value of the bounding box

intersects

public boolean intersects(LabelChoice that)
Determines if this LabelChoice can intersect with another LabelChoice by any chance, i.e. whether there are at least two Label candidates from each choice that intersect.

Parameters:
that - LabelChoice to be tested against this LabelChoice
Returns:
true if the two LabelChoices can intersect

toString

public String toString()
Overrides:
toString in class Object

deegree 2.3 (2010/04/09 10:10 build-4-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org