ch.hearc.I04_05s08.GUI.Graph
Class Arrow

java.lang.Object
  extended bych.hearc.I04_05s08.GUI.Graph.Element
      extended bych.hearc.I04_05s08.GUI.Graph.Arrow
Direct Known Subclasses:
RdfArrow, RdfsArrow

public abstract class Arrow
extends Element

Arrow between nodes

Author:
Blanc, Yoan
Licence:
MIT
Copyright:
2005 Yoan Blanc, HE-ARC Ing�nierie

Field Summary
private  Polygon arrow
          The arrow
private  Point2D[] contactPoints
          Point of contact with the nodes
private  Line2D line
          The line
private  Node[] nodes
          Nodes connected
private  Rectangle2D rectangle
          The rectangle (background of the title)
 
Fields inherited from class ch.hearc.I04_05s08.GUI.Graph.Element
 
Constructor Summary
Arrow()
          Build a new arrow without anything
Arrow(Arrow a)
          Build a new arrow from another
Arrow(Node from, Node to)
          Build a new arrow without a title
Arrow(String title, Node from, Node to)
          Build a new arrow
 
Method Summary
 void calcLine(Graphics2D g2d)
          Caluculate the line
 boolean contains(Point2D p)
          If the line is near (3) the point
 void draw(Graphics2D g2d)
          Draw
 void drawLine(Graphics2D g2d)
          Drawing the line between the two nodes
 void drawTitle(Graphics2D g2d)
          Draw the title's Node
 double getAngle()
          Get the angle of the line (between 0 and 2*PI)
 Point2D[] getContactPoints()
          Get the point of contact with other nodes
 Line2D getLine()
          Get the line
 Node[] getNodes()
          Get the nodes
 void setArrow(Polygon arrow)
          Define the arrow
 boolean setNodes(Node from, Node to)
          Set the nodes
 boolean unconnect()
          Disconnect the arrow from its nodes
 
Methods inherited from class ch.hearc.I04_05s08.GUI.Graph.Element
clone, getBackgroundColor, getForegroundColor, getGraph, getPadding, getTitle, isSelected, select, setBackgroundColor, setForegroundColor, setPadding, setSelectedBackgroundColor, setSelectedForegroundColor, setTitle, showDialog, update
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

line

private Line2D line
The line


rectangle

private Rectangle2D rectangle
The rectangle (background of the title)


nodes

private Node[] nodes
Nodes connected


contactPoints

private Point2D[] contactPoints
Point of contact with the nodes


arrow

private Polygon arrow
The arrow

Constructor Detail

Arrow

public Arrow(String title,
             Node from,
             Node to)
Build a new arrow

Parameters:
title - the title
from - the node where it comes
to - the node where it goes

Arrow

public Arrow(Node from,
             Node to)
Build a new arrow without a title

Parameters:
from - the node where it comes
to - the node where it goes

Arrow

public Arrow()
Build a new arrow without anything


Arrow

public Arrow(Arrow a)
Build a new arrow from another

Parameters:
a - arrow
Method Detail

setNodes

public boolean setNodes(Node from,
                        Node to)
Set the nodes

Parameters:
from - the node where it comes
to - the node where it goes
Returns:
true

getNodes

public Node[] getNodes()
Get the nodes

Returns:
the nodes

contains

public boolean contains(Point2D p)
If the line is near (3) the point

Specified by:
contains in class Element
Parameters:
p - the point
Returns:
if the point is close to the Arrow

getContactPoints

public Point2D[] getContactPoints()
Get the point of contact with other nodes

Returns:
points where the line touches the nodes

getLine

public Line2D getLine()
Get the line

Returns:
the line

calcLine

public void calcLine(Graphics2D g2d)
Caluculate the line

Parameters:
g2d - Graphic context

draw

public void draw(Graphics2D g2d)
Draw

Specified by:
draw in class Element
Parameters:
g2d - Graphic context

drawTitle

public void drawTitle(Graphics2D g2d)
Draw the title's Node

Parameters:
g2d - Graphic context

drawLine

public void drawLine(Graphics2D g2d)
Drawing the line between the two nodes

Parameters:
g2d - Graphic context

getAngle

public double getAngle()
Get the angle of the line (between 0 and 2*PI)

Returns:
the angle

setArrow

public void setArrow(Polygon arrow)
Define the arrow

Parameters:
arrow - the arrow

unconnect

public boolean unconnect()
Disconnect the arrow from its nodes

Returns:
the success of operation


A project by Blanc, Yoan – supervised by Dr. Ghorbel, Hatem.
2004 © Blanc, Yoan - HE-ARC