public class ClippableShape extends Object implements Shape
ShapeNormalizer
class, so you have to be
aware that the conversion can have some imperfections, due to the conversion from a set of curves to
arcs.
However, as this class is mostly useful for converting to graphic formats that don't deal well
with clipping paths, and considering that most of the times, these formats don't handle curves (for
example, see WMF format), this is not really a problem.Modifier and Type | Field and Description |
---|---|
static double |
ASSUME_ZERO
1.0E-4: Constant used for coordinates equality.
|
protected Shape |
shape
The internal clipped Shape.
|
Constructor and Description |
---|
ClippableShape(Shape shape)
Create a new ClippableShape.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double x,
double y)
Defer to
Shape.contains(double, double) with the resulting clipped Shape. |
boolean |
contains(double x,
double y,
double w,
double h)
Defer to
Shape.contains(double, double, double, double) with the resulting clipped Shape. |
boolean |
contains(Point2D p)
Defer to
Shape.contains(java.awt.geom.Point2D) with the resulting clipped Shape. |
boolean |
contains(Rectangle2D r)
Defer to
Shape.contains(java.awt.geom.Rectangle2D) with the resulting clipped Shape. |
Rectangle |
getBounds()
Return the bounds of the resulting clipped Shape.
|
Rectangle2D |
getBounds2D()
Return the bounds of the resulting clipped Shape.
|
PathIterator |
getPathIterator(AffineTransform at) |
PathIterator |
getPathIterator(AffineTransform at,
double flatness) |
Shape |
getPeerShape()
Return the peer shape.
|
Shape |
getUnclosedShape(Shape shape,
boolean closeProperty)
Return the associated unclosed shape.
|
void |
intersect(Area rhs)
Perform the intersection of this shape with the area.
|
void |
intersectAsArea(Area rhs)
Perform the intersection of the area associated to this shape with the area, after transforming
this shape to an Area.
|
boolean |
intersects(double x,
double y,
double w,
double h) |
boolean |
intersects(Rectangle2D r) |
protected Shape shape
public static final double ASSUME_ZERO
public ClippableShape(Shape shape)
shape
- the peer shapepublic void intersect(Area rhs)
intersect(Area)
:
ShapeNormalizer
to normalize the resulting Shape and get the associated
Vector of elementary shapes : Line2D, Polygon2D, Polyline2D, ArC2Drhs
- the area to intersectpublic void intersectAsArea(Area rhs)
rhs
- the area to intersectpublic Shape getPeerShape()
public Shape getUnclosedShape(Shape shape, boolean closeProperty)
shape
- the shape to convert to an unclosed ShapecloseProperty
- true if the CLOSE segment will result in a Line, false if it will be omittedpublic boolean contains(Rectangle2D r)
Shape.contains(java.awt.geom.Rectangle2D)
with the resulting clipped Shape.public boolean contains(Point2D p)
Shape.contains(java.awt.geom.Point2D)
with the resulting clipped Shape.public boolean contains(double x, double y)
Shape.contains(double, double)
with the resulting clipped Shape.public boolean contains(double x, double y, double w, double h)
Shape.contains(double, double, double, double)
with the resulting clipped Shape.public Rectangle getBounds()
public Rectangle2D getBounds2D()
getBounds2D
in interface Shape
public PathIterator getPathIterator(AffineTransform at)
getPathIterator
in interface Shape
public PathIterator getPathIterator(AffineTransform at, double flatness)
getPathIterator
in interface Shape
public boolean intersects(Rectangle2D r)
intersects
in interface Shape
public boolean intersects(double x, double y, double w, double h)
intersects
in interface Shape