org.eu.sk.zero.acd
Class Area

java.lang.Object
  |
  +--org.eu.sk.zero.acd.Component
        |
        +--org.eu.sk.zero.acd.Area

public class Area
extends Component

Area - relation between several nodes.

Version:
$Id: Area.java,v 1.6 2003/04/10 16:00:08 robo Exp $

Field Summary
 
Fields inherited from class org.eu.sk.zero.acd.Component
id, type
 
Constructor Summary
Area(org.eu.sk.zero.acd.ComponentType t)
          Constructs a new empty area.
Area(org.eu.sk.zero.acd.ComponentType t, int[] xpoints, int[] ypoints, int npoints)
          Constructs a new area with the given boundary points.
 
Method Summary
 void addPoint(int x, int y)
          Adds a new boundary point.
 void draw(Graphics2D g)
          Draws the area using the given Graphics object.
protected  boolean farEnough(int a, int x, int y)
           
 Polygon getPolygon()
          Returns the boundary polygon.
protected  boolean isInLine(int a, int b, int x, int y)
           
protected  boolean isInLine(int a, int b, int x, int y, boolean sectionOnly)
           
 void moveOrMergePoint(int n, int x, int y)
          Moves a point elsewhere.
 void movePoint(int n, int x, int y)
          Moves a point elsewhere unconditionally.
protected  void removePoint(int n)
          Removes a point.
 
Methods inherited from class org.eu.sk.zero.acd.Component
addValue, deselect, getId, getType, hide, isError, isHidden, isSelected, select, setError, show, toString, value, value, valueIterator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Area

public Area(org.eu.sk.zero.acd.ComponentType t,
            int[] xpoints,
            int[] ypoints,
            int npoints)
Constructs a new area with the given boundary points.


Area

public Area(org.eu.sk.zero.acd.ComponentType t)
Constructs a new empty area.

Method Detail

addPoint

public void addPoint(int x,
                     int y)
Adds a new boundary point. Checks whether the point is really needed - it is not needed when is in a straight line with the last 2 points or when it is too near to them.


moveOrMergePoint

public void moveOrMergePoint(int n,
                             int x,
                             int y)
Moves a point elsewhere. Or, merges it with other points if on the new position it would be unnecesary.


movePoint

public void movePoint(int n,
                      int x,
                      int y)
Moves a point elsewhere unconditionally.


removePoint

protected void removePoint(int n)
Removes a point.


farEnough

protected boolean farEnough(int a,
                            int x,
                            int y)

isInLine

protected boolean isInLine(int a,
                           int b,
                           int x,
                           int y)

isInLine

protected boolean isInLine(int a,
                           int b,
                           int x,
                           int y,
                           boolean sectionOnly)

draw

public void draw(Graphics2D g)
Draws the area using the given Graphics object.


getPolygon

public Polygon getPolygon()
Returns the boundary polygon.