att.grappa
Class GrappaShape

java.lang.Object
  extended by att.grappa.GrappaShape
All Implemented Interfaces:
GrappaConstants, java.awt.Shape, java.lang.Cloneable

public class GrappaShape
extends java.lang.Object
implements GrappaConstants, java.lang.Cloneable, java.awt.Shape

This class provides a flexible, parameterized polygonal shape builder. The guts of a GrappaShape is a GeneralPath object.

Version:
1.2, 21 Aug 2005; Copyright 1996 - 2005 by AT&T Corp.
Author:
John Mocenigo, Research @ AT&T Labs

Field Summary
private static double CIRCLE_XDIAG
           
private static double CIRCLE_YDIAG
           
protected  java.awt.geom.GeneralPath path
          path that defines shape
private static double RBCONST
           
private static double RBCURVE
           
 
Fields inherited from interface att.grappa.GrappaConstants
_NO_TYPE, ANONYMOUS_PREFIX, BBOX_ATTR, BBOX_HASH, BOX_SHAPE, BOX_TYPE, CLUSTERRANK_ATTR, COLOR_ATTR, COLOR_HASH, COLOR_TYPE, CUSTOM_ATTR, CUSTOM_HASH, CUSTOM_SHAPE, DELETION_MASK, DIAMOND_SHAPE, DIR_ATTR, DIR_HASH, DIR_TYPE, DISTORTION_ATTR, DISTORTION_HASH, DOUBLE_TYPE, DOUBLECIRCLE_SHAPE, DOUBLEOCTAGON_SHAPE, EDGE, EGG_SHAPE, FILLCOLOR_ATTR, FILLCOLOR_HASH, FONTCOLOR_ATTR, FONTCOLOR_HASH, FONTNAME_ATTR, FONTNAME_HASH, FONTSIZE_ATTR, FONTSIZE_HASH, FONTSTYLE_ATTR, FONTSTYLE_HASH, FONTSTYLE_TYPE, GRAPPA_BACKGROUND_COLOR_ATTR, GRAPPA_BACKGROUND_COLOR_HASH, GRAPPA_DELETION_STYLE_ATTR, GRAPPA_DELETION_STYLE_HASH, GRAPPA_FONTSIZE_ADJUSTMENT_ATTR, GRAPPA_FONTSIZE_ADJUSTMENT_HASH, GRAPPA_SELECTION_STYLE_ATTR, GRAPPA_SELECTION_STYLE_HASH, GRAPPA_SHAPE, HASHLIST_TYPE, HEADLABEL_ATTR, HEADLABEL_HASH, HEADLP_ATTR, HEADLP_HASH, HEIGHT_ATTR, HEIGHT_HASH, HEXAGON_SHAPE, HIGHLIGHT_MASK, HIGHLIGHT_OFF, HIGHLIGHT_ON, HIGHLIGHT_TOGGLE, HOUSE_SHAPE, IDENTXFRM, IMAGE_ATTR, IMAGE_HASH, INTEGER_TYPE, INVERTEDHOUSE_SHAPE, INVERTEDTRAPEZIUM_SHAPE, INVERTEDTRIANGLE_SHAPE, LABEL_ATTR, LABEL_HASH, LINE_SHAPE, LINE_TYPE, LOG10, LP_ATTR, LP_HASH, MARGIN_ATTR, MARGIN_HASH, MCIRCLE_SHAPE, MCLIMIT_ATTR, MCLIMIT_HASH, MDIAMOND_SHAPE, MINBOX_ATTR, MINBOX_HASH, MINLEN_ATTR, MINLEN_HASH, MINSIZE_ATTR, MINSIZE_HASH, MRECORD_SHAPE, MSQUARE_SHAPE, NBSP, NEW_LINE, NO_SHAPE, NODE, NODESEP_ATTR, NODESEP_HASH, OCTAGON_SHAPE, ORIENTATION_ATTR, ORIENTATION_HASH, OVAL_SHAPE, PACKAGE_PREFIX, PARALLELOGRAM_SHAPE, PATCH_ATTR, PATCH_HASH, PENTAGON_SHAPE, PERIPHERIES_ATTR, PERIPHERIES_HASH, PERIPHERY_GAP, PKG_LOWER, PKG_UPLOW, PKG_UPPER, PLAINTEXT_SHAPE, POINT_SHAPE, POINT_TYPE, PointsPerInch, POLYGON_SHAPE, POS_ATTR, POS_HASH, PRINTLIST_ATTR, PRINTLIST_HASH, RANKDIR_ATTR, RANKDIR_HASH, RANKSEP_ATTR, RANKSEP_HASH, RECORD_SHAPE, RECTS_ATTR, RECTS_HASH, ROTATION_ATTR, ROTATION_HASH, ROUNDEDBOX_SHAPE, SELECTION_MASK, SHAPE_ATTR, SHAPE_HASH, SHAPE_MASK, SHAPE_TYPE, SIDES_ATTR, SIDES_HASH, SIZE_ATTR, SIZE_HASH, SIZE_TYPE, SKEW_ATTR, SKEW_HASH, STRING_TYPE, STYLE_ATTR, STYLE_HASH, STYLE_TYPE, SUBGRAPH, SYSTEM, TAG_ATTR, TAG_HASH, TAILLABEL_ATTR, TAILLABEL_HASH, TAILLP_ATTR, TAILLP_HASH, TIP_ATTR, TIP_HASH, TRAPEZIUM_SHAPE, TRIANGLE_SHAPE, TRIPLEOCTAGON_SHAPE, TYPES_SHIFT, WEIGHT_ATTR, WEIGHT_HASH, WIDTH_ATTR, WIDTH_HASH
 
Constructor Summary
GrappaShape(int type, double x, double y, double width, double height, int sidesArg, int peripheriesArg, double distortionArg, double skewArg, double orientationArg, boolean roundedArg, boolean diagonalsArg, java.lang.Object extra)
          Constructs a new GrappaShape object.
 
Method Summary
 java.lang.Object clone()
          Creates a new object of the same class as this object.
 boolean contains(double x, double y)
           
 boolean contains(double x, double y, double width, double height)
           
 boolean contains(java.awt.geom.Point2D p)
           
 boolean contains(java.awt.geom.Rectangle2D r)
           
 java.awt.Rectangle getBounds()
           
 java.awt.geom.Rectangle2D getBounds2D()
           
 java.awt.geom.PathIterator getPathIterator()
          Equivalent to getPathIterator(null).
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
           
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
           
 boolean intersects(double x, double y, double width, double height)
           
 boolean intersects(java.awt.geom.Rectangle2D r)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

path

protected java.awt.geom.GeneralPath path
path that defines shape


RBCONST

private static final double RBCONST
See Also:
Constant Field Values

RBCURVE

private static final double RBCURVE
See Also:
Constant Field Values

CIRCLE_XDIAG

private static final double CIRCLE_XDIAG

CIRCLE_YDIAG

private static final double CIRCLE_YDIAG
See Also:
Constant Field Values
Constructor Detail

GrappaShape

public GrappaShape(int type,
                   double x,
                   double y,
                   double width,
                   double height,
                   int sidesArg,
                   int peripheriesArg,
                   double distortionArg,
                   double skewArg,
                   double orientationArg,
                   boolean roundedArg,
                   boolean diagonalsArg,
                   java.lang.Object extra)
Constructs a new GrappaShape object. The winding rule for this path is defaulted (from Grappa.windingRule).

Parameters:
type - the shape specifier (.e.g., EGG_SHAPE).
x - the x-coordinate of the polygon center point.
y - the y-coordinate of the polygon center point.
width - the overall width of the polygon bounding box.
height - the overall height of the polygon bounding box.
sidesArg - the number of sides of the polygon.
peripheriesArg - the number of peripheries (outlines) of the polygon.
distortionArg - a distortion factor applied to the polygon shape, when non-zero
skewArg - a skewing factor applied to the polygon shape, when non-zero
orientationArg - an orientation angle in radians.
roundedArg - a directive to round the corners.
diagonalsArg - a directive to draw catercorners at the vertices.
extra - used only with the record shape at present, it provides a string of tuples giving interior partition information.
Method Detail

clone

public java.lang.Object clone()
Creates a new object of the same class as this object.

Overrides:
clone in class java.lang.Object
Returns:
a clone of this instance.
Throws:
java.lang.OutOfMemoryError - if there is not enough memory.
See Also:
Cloneable

contains

public final boolean contains(double x,
                              double y)
Specified by:
contains in interface java.awt.Shape

contains

public final boolean contains(double x,
                              double y,
                              double width,
                              double height)
Specified by:
contains in interface java.awt.Shape

contains

public final boolean contains(java.awt.geom.Point2D p)
Specified by:
contains in interface java.awt.Shape

contains

public final boolean contains(java.awt.geom.Rectangle2D r)
Specified by:
contains in interface java.awt.Shape

getBounds

public final java.awt.Rectangle getBounds()
Specified by:
getBounds in interface java.awt.Shape

getBounds2D

public final java.awt.geom.Rectangle2D getBounds2D()
Specified by:
getBounds2D in interface java.awt.Shape

getPathIterator

public final java.awt.geom.PathIterator getPathIterator()
Equivalent to getPathIterator(null).

See Also:
getPathIterator(AffineTransform)

getPathIterator

public final java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
Specified by:
getPathIterator in interface java.awt.Shape

getPathIterator

public final java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at,
                                                        double flatness)
Specified by:
getPathIterator in interface java.awt.Shape

intersects

public final boolean intersects(double x,
                                double y,
                                double width,
                                double height)
Specified by:
intersects in interface java.awt.Shape

intersects

public final boolean intersects(java.awt.geom.Rectangle2D r)
Specified by:
intersects in interface java.awt.Shape