ConForM.CoopnTools.CoKer.AspectMgr
Class ArcAspect

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.AspectMgr.Aspect
        |
        +--ConForM.CoopnTools.CoKer.AspectMgr.ArcAspect
All Implemented Interfaces:
java.lang.Cloneable

public class ArcAspect
extends Aspect

Arc Aspect. This class implements concrete aspects, for arc in the graphical visual. Arc aspects are simple aspects with an optionnal set of intermediary points, and with a flag indicating if the arc is smooth.


Field Summary
static int ANGULAR
           
static int CONCAVE
           
static int CONVEX
           
static int SMOOTH
           
 
Constructor Summary
ArcAspect(java.awt.Point location, java.lang.String info, java.awt.Point labelLocation, java.awt.Point infoLocation, boolean shown, boolean labelShown, boolean infoShown, java.awt.Color color, java.awt.Point[] intermediaryPoints, int type)
          Simple constructor.
 
Method Summary
 void addIntermediaryPoint(java.awt.Point point, int index)
          Add an intermediary points.
 java.lang.Object clone()
          Cloning method.
 boolean equals(java.lang.Object obj)
          Equality method.
 java.awt.Point[] getIntermediaryPoints()
          Get the intermediary points.
 int getType()
          Get the type.
 boolean isControlPoint(int index)
          Get the control-point status of a point.
 void moveIntermediaryPoint(int index, int deltax, int deltay)
          Moves an intermediary points.
 void removeIntermediaryPoint(int index)
          Removes an intermediary points.
 void setAspect(Aspect aspect)
          Copy an aspect.
 void setIntermediaryPoints(java.awt.Point[] intermediaryPoints)
          Set the intermediary points.
 void setType(int type)
          Specify the type.
 java.lang.String toString(CoopnEnv env, int indent)
          String conversion method.
 
Methods inherited from class ConForM.CoopnTools.CoKer.AspectMgr.Aspect
getColor, getInfo, getInfoLocation, getLabelLocation, getLocation, hashCode, internalClone, internalEquals, internalToString, isInfoShown, isLabelShown, isShown, setColor, setInfo, setInfoLocation, setInfoShown, setLabelLocation, setLabelShown, setLocation, setShown, toString, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ANGULAR

public static final int ANGULAR

SMOOTH

public static final int SMOOTH

CONVEX

public static final int CONVEX

CONCAVE

public static final int CONCAVE
Constructor Detail

ArcAspect

public ArcAspect(java.awt.Point location,
                 java.lang.String info,
                 java.awt.Point labelLocation,
                 java.awt.Point infoLocation,
                 boolean shown,
                 boolean labelShown,
                 boolean infoShown,
                 java.awt.Color color,
                 java.awt.Point[] intermediaryPoints,
                 int type)
Simple constructor.
Method Detail

getIntermediaryPoints

public java.awt.Point[] getIntermediaryPoints()
Get the intermediary points.
Returns:
The intermediary points, as an array of points, never null. If no intermediary points are defined, it returns an array of size 0.

setIntermediaryPoints

public void setIntermediaryPoints(java.awt.Point[] intermediaryPoints)
Set the intermediary points. For angular arcs, intermediary points (along with terminating ones) are connected by line segments. For smooth arc, intermediary points are used to draw Bezier cubic curves, which are computed as follows: the starting point is logically added to the intermediary points along with its control point, then iteratively groups of three points are formed, where the first and last points are the control points while the middle one is the step point, and finally the last control point as well as the last step; the number of intermediary points should be 2+(s-2)*3, where s is the number of segments and if this is not the case, last point is duplified 1 ou 2 times to satisfy the condition. For convex or concave arcs, intermediary points are not used.
Parameters:
intermediaryPoints - The intermediary points, as an array of points; a null value means no intermediary points.

addIntermediaryPoint

public void addIntermediaryPoint(java.awt.Point point,
                                 int index)
Add an intermediary points. For smooth arcs, if the new point lies between two control points, nothing happens, else (the points lies between a control point and a step point) the points marks the location of the new two control points, while a new step point is added in the direction of the involved control point.
Parameters:
point - The point to add.
index - The index of the point to add.

removeIntermediaryPoint

public void removeIntermediaryPoint(int index)
Removes an intermediary points. For smooth arcs, if the point is a control points, nothing happens, else (the points is a step point) the step point as well as its control points are removed.
Parameters:
index - The index of the point to remove.

moveIntermediaryPoint

public void moveIntermediaryPoint(int index,
                                  int deltax,
                                  int deltay)
Moves an intermediary points. For smooth arcs, if the point is a control points, the associated control point is rotated accordingly, else (the points is a step point) the step point as well as its control points are moved.
Parameters:
index - The index of the point to remove.

isControlPoint

public boolean isControlPoint(int index)
Get the control-point status of a point.
Parameters:
index - the index of the intermediary point ot check
Returns:
true iff the arc is smooth and the index denotes a control point.

getType

public int getType()
Get the type.
Returns:
the type as an integer.

setType

public void setType(int type)
Specify the type. If the type pass from (not smooth) to smooth, intermediary points are expanded to reflect a smooth shape. if the type pass from smooth to (not smooth), intermediary points are compressed to get an angular curve.
Parameters:
type - the type

toString

public java.lang.String toString(CoopnEnv env,
                                 int indent)
String conversion method. This routine converts an element into a string representing it.
Overrides:
toString in class Aspect
Parameters:
env - the environment deciding the form of the display
indent - the identation factor
Returns:
a String image of the element.

equals

public boolean equals(java.lang.Object obj)
Equality method. Must be defined in the inherited classes.
Overrides:
equals in class Aspect
Parameters:
obj - the object to compare
Returns:
true iff this object and the parameter are equals.

setAspect

public void setAspect(Aspect aspect)
Copy an aspect.
Overrides:
setAspect in class Aspect
Parameters:
aspect - the aspect to copy.

clone

public java.lang.Object clone()
Cloning method.
Overrides:
clone in class Aspect
Returns:
a clone object.