com.tensegrity.graph.layout.edge
Class LabelPlacement

java.lang.Object
  extended bycom.tensegrity.graph.layout.edge.LabelPlacement

public class LabelPlacement
extends java.lang.Object

This class uses a labeling algorithm to position labels on edges .

Author:
SharokhKhani

Field Summary
static int BESTFIT
          Place a label on the best detected area.
 int distanceBetweenLabels
          The value of this member determines the distance of labels boundary to each other.
 int distanceToLine
          The value of this member determines the distance of label boundary to the edge.
static int FIRSTFIT
          Place a label on the first detected area that is big enough for it
 int strategy
          The value of this member determines the using strategy of placing labels
 
Constructor Summary
LabelPlacement()
          The Constructor.
 
Method Summary
 void arrangeLabel(LayoutableEdge edge)
          This method arranges the label of the edge specified by edge
 void arrangeLabel(LayoutableEdge edge, Coordinate[] coords)
          This method arranges the label of the edge specified by edge.
 void arrangeLabel(LayoutableEdge edge, Coordinate[] coords, int anchor, int placement)
          /** This method arranges the label of the edge specified by edge.
 void arrangeLabels(com.tensegrity.graph.layout.edge.EdgeElement[] edges, java.util.ArrayList obstacles, boolean autodetect)
          This method arranges labels of all edges specified by edges
 void arrangeLabels(LayoutableEdge[] edges, java.util.ArrayList obstacles, boolean autodetect, int strategy)
          This method arranges labels of all edges specified by edges
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

strategy

public int strategy
The value of this member determines the using strategy of placing labels


FIRSTFIT

public static final int FIRSTFIT
Place a label on the first detected area that is big enough for it

See Also:
Constant Field Values

BESTFIT

public static final int BESTFIT
Place a label on the best detected area.

See Also:
Constant Field Values

distanceToLine

public int distanceToLine
The value of this member determines the distance of label boundary to the edge.


distanceBetweenLabels

public int distanceBetweenLabels
The value of this member determines the distance of labels boundary to each other.

Constructor Detail

LabelPlacement

public LabelPlacement()
The Constructor.

Method Detail

arrangeLabels

public void arrangeLabels(LayoutableEdge[] edges,
                          java.util.ArrayList obstacles,
                          boolean autodetect,
                          int strategy)
This method arranges labels of all edges specified by edges

Parameters:
edges - the list of edges of which the labels are to be placed.
obstacles - the list of all obstacles that must be avoided.
autodetect - a boolean to determine whether the position of the labels should differ from the default to ensure an overlapping drawing of them.
strategy - the strategy that is to be used. It can be:

arrangeLabels

public void arrangeLabels(com.tensegrity.graph.layout.edge.EdgeElement[] edges,
                          java.util.ArrayList obstacles,
                          boolean autodetect)
This method arranges labels of all edges specified by edges

Parameters:
edges - the list of edges of which the labels are to be placed.
obstacles - the list of all obstacles that must be avoided.
autodetect - a boolean to determine whether the position of the labels should differ from the default to ensure an overlapping drawing of them.

arrangeLabel

public void arrangeLabel(LayoutableEdge edge)
This method arranges the label of the edge specified by edge

Parameters:
edge - the edge of which the label is to be placed.

arrangeLabel

public void arrangeLabel(LayoutableEdge edge,
                         Coordinate[] coords)
This method arranges the label of the edge specified by edge. It ignores the internal edge coordinates which can be gotten by LayoutableEdge.getCoordinates()

Parameters:
edge - the edge of which the label is to be placed.
coords - the coordinates that should be taken into consideration. The internal edge coordinates will be ignored.

arrangeLabel

public void arrangeLabel(LayoutableEdge edge,
                         Coordinate[] coords,
                         int anchor,
                         int placement)
/** This method arranges the label of the edge specified by edge. It ignores the internal edge coordinates.

Parameters:
edge - the edge of which the label is to be placed.
coords - the coordinates that should be taken into consideration. The
anchor - the default anchor.
placement - the default placement.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.