Class Anchor

java.lang.Object
  |
  +--Symbol
        |
        +--PointSym
              |
              +--Anchor
All Implemented Interfaces:
Aligner, AlignmentListener, DragableSymbol, Element, java.io.Serializable

public class Anchor
extends PointSym
implements DragableSymbol

A control point on a Curve. Consists of a point and two tangent directions determined by guide points.

See Also:
Serialized Form

Field Summary
(package private) static int ALL
          Indicates that the anchor as a whole is selected.
 Arrow arrow
          The arrow head to draw at this point.
(package private)  javax.swing.JComboBox arrowfield
           
 boolean arrowreverse
          Reverse the direction of the arrow?.
(package private) static int CONSISTANT
          Indicates guide and guidelocal are valid and consistant
(package private) static int GLOBAL
          Indicates guide is valid but not guidelocal
 java.awt.geom.Point2D[] guide
          The two guide points.
(package private) static int GUIDE0
          Indictes that the first guide point is selected.
(package private) static int GUIDE1
          Indictes that the second guide point is selected.
 java.awt.geom.Point2D[] guidelocal
          The two guide points in local coords.
(package private)  int guidestate
          Indicates which form of the guide point is official.
(package private)  boolean kink
          If true, curve has a kink at this point.
(package private) static int LOCAL
          Indicates guidelocal is valid but not guide
(package private)  javax.swing.JCheckBox reversebox
           
(package private)  int selmode
          The selection state of this anchor.
private static long serialVersionUID
           
(package private) static int SMOOTH
          Indicates smooth mode.
 
Fields inherited from class PointSym
dragpoint, position, trans, valid
 
Fields inherited from class Symbol
makenames, name, namefield
 
Fields inherited from interface Aligner
absolute, datum, floating
 
Constructor Summary
Anchor(java.awt.geom.Point2D where, View view, java.lang.Object arg)
          Creates a new anchor at the specified location.
 
Method Summary
 void abandonPropertyEdit()
           
 void acceptPropertyEdit()
           
 void alignmentChanged()
          Take notice of change in position,
caused by alignment.
(package private)  java.awt.Container anchorPropertyEdit()
           
 void drag(int command, java.awt.geom.Point2D where, View view)
          Drag the Anchor.
 void endDrag(int comand, java.awt.geom.Point2D pos, View view)
          Ends drag.
 int getLevel()
           
 void getPropertyEdit(java.lang.Object[] edits, int slot, java.util.Set sub, Symbol parent)
           
 void guideUpdate()
          sets the local and global coords to match.
 void paint(View view)
          Paint the Anchor.
private  void readObject(java.io.ObjectInputStream stream)
          Read the anchor and re-constitute its transient variables.
 boolean selectProbe(java.awt.geom.Point2D where, View view)
          Determines if a mouse press selects this anchor.
 void showSelected(View view)
          Draw the drag box of the Anchor as selected.
 void startDrag(int command, java.awt.geom.Point2D where, View view)
          Start dragging this Anchor.
private  void writeObject(java.io.ObjectOutputStream stream)
          Writes the anchor and the positions of its guide points.
 
Methods inherited from class PointSym
defaultPosition, getAlignTransform, getBounds, pointPropertyEdit, showAlignee, showAligner
 
Methods inherited from class Symbol
checkName, editProperties, getName, getNew, importSym, prepareForSurveyUpdate, recursiveDelete, setName, stripSurveys, toString, useSurveyUpdate, valid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID

SMOOTH

static int SMOOTH
Indicates smooth mode. Where the guide points are slaved to each other so that the curve stays smooth


ALL

static int ALL
Indicates that the anchor as a whole is selected. As when the central point is clicked


GUIDE0

static int GUIDE0
Indictes that the first guide point is selected.


GUIDE1

static int GUIDE1
Indictes that the second guide point is selected.


GLOBAL

static int GLOBAL
Indicates guide is valid but not guidelocal


LOCAL

static int LOCAL
Indicates guidelocal is valid but not guide


CONSISTANT

static int CONSISTANT
Indicates guide and guidelocal are valid and consistant


guide

public transient java.awt.geom.Point2D[] guide
The two guide points. must be transient because Point2D is not Serializable


guidelocal

public transient java.awt.geom.Point2D[] guidelocal
The two guide points in local coords. must be transient because Point2D is not Serializable Except for storage in a file, guide is derived from guidelocal


guidestate

transient int guidestate
Indicates which form of the guide point is official. Posible values are LOCAL, GLOBAL, or CONSISTANT. Before using guide points use guideUpdate() to make it CONSISTANT.


kink

boolean kink
If true, curve has a kink at this point.


arrow

public Arrow arrow
The arrow head to draw at this point.


arrowreverse

public boolean arrowreverse
Reverse the direction of the arrow?.


selmode

int selmode
The selection state of this anchor. Possible values are SMOOTH, ALL, GUIDE0, and GUIDE1.


arrowfield

transient javax.swing.JComboBox arrowfield

reversebox

transient javax.swing.JCheckBox reversebox
Constructor Detail

Anchor

public Anchor(java.awt.geom.Point2D where,
              View view,
              java.lang.Object arg)
Creates a new anchor at the specified location. The new anchor will be in SMOOTH mode, and its guide points will be at its central point (the place that was clicked)

Method Detail

readObject

private void readObject(java.io.ObjectInputStream stream)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Read the anchor and re-constitute its transient variables. That is, its goude points.

java.io.IOException
java.lang.ClassNotFoundException

writeObject

private void writeObject(java.io.ObjectOutputStream stream)
                  throws java.io.IOException
Writes the anchor and the positions of its guide points.

java.io.IOException

alignmentChanged

public void alignmentChanged()
Take notice of change in position,
caused by alignment.

Specified by:
alignmentChanged in interface AlignmentListener
Overrides:
alignmentChanged in class PointSym

guideUpdate

public void guideUpdate()
sets the local and global coords to match. Which is taken as primary depends on guidestate


getLevel

public int getLevel()
Overrides:
getLevel in class PointSym

getPropertyEdit

public void getPropertyEdit(java.lang.Object[] edits,
                            int slot,
                            java.util.Set sub,
                            Symbol parent)
Overrides:
getPropertyEdit in class PointSym

anchorPropertyEdit

java.awt.Container anchorPropertyEdit()

acceptPropertyEdit

public void acceptPropertyEdit()
Overrides:
acceptPropertyEdit in class PointSym

abandonPropertyEdit

public void abandonPropertyEdit()
Overrides:
abandonPropertyEdit in class PointSym

selectProbe

public boolean selectProbe(java.awt.geom.Point2D where,
                           View view)
Determines if a mouse press selects this anchor. If so remembers which part of the anchor was pressed (by setting selmode), so that the same part can be dragged if needed

Overrides:
selectProbe in class PointSym

startDrag

public void startDrag(int command,
                      java.awt.geom.Point2D where,
                      View view)
Start dragging this Anchor.

Specified by:
startDrag in interface DragableSymbol
Overrides:
startDrag in class PointSym

drag

public void drag(int command,
                 java.awt.geom.Point2D where,
                 View view)
Drag the Anchor. Which part will actually move depends on the valeue of selmode

Specified by:
drag in interface DragableSymbol
Overrides:
drag in class PointSym

endDrag

public void endDrag(int comand,
                    java.awt.geom.Point2D pos,
                    View view)
Ends drag. Alerts alignees that may depend on this point.

Specified by:
endDrag in interface DragableSymbol
Overrides:
endDrag in class Symbol

showSelected

public void showSelected(View view)
Draw the drag box of the Anchor as selected. The box is shown filled with its guide points. Draw the guide point that can be dragged (if any) as a filled circle.

Overrides:
showSelected in class PointSym

paint

public void paint(View view)
Paint the Anchor. The only visible part of an anchor is it's drag box. When not selected anchors are only visible by their effect on the curve

Overrides:
paint in class PointSym