com.touchgraph.graphlayout
Class Edge

java.lang.Object
  extended by com.touchgraph.graphlayout.Edge
Direct Known Subclasses:
GraphEdge

public class Edge
extends Object

Edge.

Version:
1.21 $Id: Edge.java,v 3.1 2005/02/17 16:56:14 altheim Exp $
Author:
Alexander Shapiro

Field Summary
static boolean arrowForward
          By default (true) visually the "arrow" is a thinning line.
protected  Color col
           
static Color DEFAULT_COLOR
           
static int DEFAULT_LENGTH
           
 Node from
           
 Color HILIGHT_COLOR
           
protected  String id
           
protected  int length
           
static Color MOUSE_OVER_COLOR
           
static boolean simpleDraw
           
 Node to
           
protected  boolean visible
           
 
Constructor Summary
Edge(Node f, Node t)
          Constructor with two Nodes, which uses a default length.
Edge(Node f, Node t, int len)
          Constructor with two Nodes and a length.
 
Method Summary
 boolean containsPoint(double px, double py)
           
 double distFromPoint(double px, double py)
           
 Color getColor()
          Returns the color of this edge as Color.
 Node getFrom()
          Returns the starting "from" node of this edge as Node.
 String getID()
          Returns the ID of this Edge as a String.
 int getLength()
          Returns the length of this Edge as a double.
 Node getOtherEndpt(Node n)
          Return the other end of this edge provided with one end, the Node n.
 Node getTo()
          Returns the terminating "to" node of this edge as Node.
 boolean intersects(Dimension d)
           
 boolean isVisible()
          Return the visibility of this Edge as a boolean.
 void paint(Graphics g, TGPanel tgPanel)
           
 void paintArrow(Graphics g, int x1, int y1, int x2, int y2, Color c)
           
 void reverse()
          Switches the endpoints of the edge
 void setColor(Color color)
          Set the color of this Edge to the Color color.
static void setEdgeDefaultColor(Color color)
           
static void setEdgeDefaultLength(int length)
           
static void setEdgeMouseOverColor(Color color)
           
 void setID(String id)
          Set the ID of this Edge to the String id.
 void setLength(int len)
          Set the length of this Edge to the int len.
 void setVisible(boolean v)
          Set the visibility of this Edge to the boolean v.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_COLOR

public static Color DEFAULT_COLOR

MOUSE_OVER_COLOR

public static Color MOUSE_OVER_COLOR

DEFAULT_LENGTH

public static int DEFAULT_LENGTH

arrowForward

public static boolean arrowForward
By default (true) visually the "arrow" is a thinning line. Some people find this counterintuitive, that the line should thicken toward its target. Setting this false draws the arrow in this alternative manner.


simpleDraw

public static boolean simpleDraw

from

public Node from

to

public Node to

HILIGHT_COLOR

public Color HILIGHT_COLOR

col

protected Color col

length

protected int length

visible

protected boolean visible

id

protected String id
Constructor Detail

Edge

public Edge(Node f,
            Node t,
            int len)
Constructor with two Nodes and a length.


Edge

public Edge(Node f,
            Node t)
Constructor with two Nodes, which uses a default length.

Method Detail

setEdgeDefaultColor

public static void setEdgeDefaultColor(Color color)

setEdgeMouseOverColor

public static void setEdgeMouseOverColor(Color color)

setEdgeDefaultLength

public static void setEdgeDefaultLength(int length)

getFrom

public Node getFrom()
Returns the starting "from" node of this edge as Node.


getTo

public Node getTo()
Returns the terminating "to" node of this edge as Node.


getColor

public Color getColor()
Returns the color of this edge as Color.


setColor

public void setColor(Color color)
Set the color of this Edge to the Color color.


getID

public String getID()
Returns the ID of this Edge as a String.


setID

public void setID(String id)
Set the ID of this Edge to the String id.


getLength

public int getLength()
Returns the length of this Edge as a double.


setLength

public void setLength(int len)
Set the length of this Edge to the int len.


setVisible

public void setVisible(boolean v)
Set the visibility of this Edge to the boolean v.


isVisible

public boolean isVisible()
Return the visibility of this Edge as a boolean.


getOtherEndpt

public Node getOtherEndpt(Node n)
Return the other end of this edge provided with one end, the Node n. Returns null if n is not connected to this Edge.


reverse

public void reverse()
Switches the endpoints of the edge


intersects

public boolean intersects(Dimension d)

distFromPoint

public double distFromPoint(double px,
                            double py)

containsPoint

public boolean containsPoint(double px,
                             double py)

paintArrow

public void paintArrow(Graphics g,
                       int x1,
                       int y1,
                       int x2,
                       int y2,
                       Color c)

paint

public void paint(Graphics g,
                  TGPanel tgPanel)


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.