prefuse.util.display
Class Clip

java.lang.Object
  extended by prefuse.util.display.Clip

public class Clip
extends java.lang.Object

Represents a clipping rectangle in a prefuse Display.

Author:
jeffrey heer

Constructor Summary
Clip()
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 void expand(double b)
          Expand the clip in all directions by the given value.
 void expandToIntegerLimits()
          Minimally expand the clip such that each coordinate is an integer.
 double getHeight()
          Get the clip's height
 double getMaxX()
          Get the maximum x-coordinate.
 double getMaxY()
          Get the maximum y-coordinate.
 double getMinX()
          Get the minimum x-coordinate.
 double getMinY()
          Get the minimum y-coordinate.
 double getWidth()
          Get the clip's width
 void grow(double b)
          Grow the clip width and height by the given value.
 void intersection(Clip c)
          Intersect this clip with another region.
 void intersection(double x, double y, double w, double h)
          Intersect this clip with another region.
 void intersection(java.awt.geom.Rectangle2D r)
          Intersect this clip with another region.
 boolean intersects(java.awt.geom.Rectangle2D r, double margin)
          Indicates if this Clip intersects the given rectangle expanded by the additional margin pace.
 void invalidate()
          Invalidate the clip.
 boolean isEmpty()
          Indicates if the clip is set to an empty status.
 boolean isInvalid()
          Indicates if the clip is set to an invalid status.
 void limit(double x1, double y1, double x2, double y2)
          Limit the clip such that it fits within the specified region.
 void reset()
          Reset the clip to an empty status.
 void setClip(Clip c)
          Set the clip contents, and set the status to valid and in use.
 void setClip(double x, double y, double w, double h)
          Set the clip contents, and set the status to valid and in use.
 void setClip(java.awt.geom.Rectangle2D r)
          Set the clip contents, and set the status to valid and in use.
 java.lang.String toString()
           
 void transform(java.awt.geom.AffineTransform at)
          Transform the clip contents.
 void union(Clip c)
          Union this clip with another clip.
 void union(double x, double y, double w, double h)
          Union this clip with another region.
 void union(java.awt.geom.Rectangle2D r)
          Union this clip with another region.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Clip

public Clip()
Method Detail

reset

public void reset()
Reset the clip to an empty status.


invalidate

public void invalidate()
Invalidate the clip. In this state, the clip contents have no meaning.


setClip

public void setClip(Clip c)
Set the clip contents, and set the status to valid and in use.

Parameters:
c - the clip whose contents should be copied

setClip

public void setClip(java.awt.geom.Rectangle2D r)
Set the clip contents, and set the status to valid and in use.

Parameters:
r - the clip contents to copy

setClip

public void setClip(double x,
                    double y,
                    double w,
                    double h)
Set the clip contents, and set the status to valid and in use.

Parameters:
x - the minimum x-coordinate
y - the minimum y-coorindate
w - the clip width
h - the clip height

transform

public void transform(java.awt.geom.AffineTransform at)
Transform the clip contents. A new clip region will be created which is the bounding box of the transformed region.

Parameters:
at - the affine transform

limit

public void limit(double x1,
                  double y1,
                  double x2,
                  double y2)
Limit the clip such that it fits within the specified region.

Parameters:
x1 - the minimum x-coordinate
y1 - the minimum y-coorindate
x2 - the maximum x-coordinate
y2 - the maximum y-coorindate

intersects

public boolean intersects(java.awt.geom.Rectangle2D r,
                          double margin)
Indicates if this Clip intersects the given rectangle expanded by the additional margin pace.

Parameters:
r - the rectangle to test for intersect
margin - additional margin "bleed" to include in the intersection
Returns:
true if the clip intersects the expanded region, false otherwise

union

public void union(Clip c)
Union this clip with another clip. As a result, this clip will become a bounding box around the two original clips.

Parameters:
c - the clip to union with

union

public void union(java.awt.geom.Rectangle2D r)
Union this clip with another region. As a result, this clip will become a bounding box around the two original regions.

Parameters:
r - the rectangle to union with

union

public void union(double x,
                  double y,
                  double w,
                  double h)
Union this clip with another region. As a result, this clip will become a bounding box around the two original regions.

Parameters:
x - the x-coordinate of the region to union with
y - the y-coordinate of the region to union with
w - the width of the region to union with
h - the height of the region to union with

intersection

public void intersection(Clip c)
Intersect this clip with another region. As a result, this clip will become the intersecting area of the two regions.

Parameters:
c - the clip to intersect with

intersection

public void intersection(java.awt.geom.Rectangle2D r)
Intersect this clip with another region. As a result, this clip will become the intersecting area of the two regions.

Parameters:
r - the rectangle to intersect with

intersection

public void intersection(double x,
                         double y,
                         double w,
                         double h)
Intersect this clip with another region. As a result, this clip will become the intersecting area of the two regions.

Parameters:
x - the x-coordinate of the region to intersect with
y - the y-coordinate of the region to intersect with
w - the width of the region to intersect with
h - the height of the region to intersect with

expandToIntegerLimits

public void expandToIntegerLimits()
Minimally expand the clip such that each coordinate is an integer.


expand

public void expand(double b)
Expand the clip in all directions by the given value.

Parameters:
b - the value to expand by

grow

public void grow(double b)
Grow the clip width and height by the given value. The minimum coordinates will be unchanged.

Parameters:
b - the value to grow the width and height by

getMinX

public double getMinX()
Get the minimum x-coordinate.

Returns:
the minimum x-coordinate

getMinY

public double getMinY()
Get the minimum y-coordinate.

Returns:
the minimum y-coordinate

getMaxX

public double getMaxX()
Get the maximum x-coordinate.

Returns:
the maximum x-coordinate

getMaxY

public double getMaxY()
Get the maximum y-coordinate.

Returns:
the maximum y-coordinate

getWidth

public double getWidth()
Get the clip's width

Returns:
the clip width

getHeight

public double getHeight()
Get the clip's height

Returns:
the clip height

isEmpty

public boolean isEmpty()
Indicates if the clip is set to an empty status.

Returns:
true if the clip is set to empty, false otherwise

isInvalid

public boolean isInvalid()
Indicates if the clip is set to an invalid status.

Returns:
true if the clip is set to invalid, false otherwise

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2007 Regents of the University of California