java.awt.Shape
public class PolylineShape
extends java.lang.Object
implements java.awt.Shape
Modifier and Type | Field | Description |
---|---|---|
protected int |
np |
The total number of points.
|
protected int[] |
x |
All the X-values of the coordinates in the polyline.
|
protected int[] |
y |
All the Y-values of the coordinates in the polyline.
|
Constructor | Description |
---|---|
PolylineShape(int[] x,
int[] y,
int nPoints) |
Creates a PolylineShape.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
contains(double x,
double y) |
A polyline can't contain a point.
|
boolean |
contains(double x,
double y,
double w,
double h) |
A polyline can't contain a point.
|
boolean |
contains(java.awt.geom.Point2D p) |
A polyline can't contain a point.
|
boolean |
contains(java.awt.geom.Rectangle2D r) |
A polyline can't contain a point.
|
java.awt.Rectangle |
getBounds() |
Returns the bounding box of this polyline.
|
java.awt.geom.Rectangle2D |
getBounds2D() |
Returns the bounding box of this polyline.
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at) |
Returns an iteration object that defines the boundary of the polyline.
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at,
double flatness) |
There's no difference with getPathIterator(AffineTransform at);
we just need this method to implement the Shape interface.
|
boolean |
intersects(double x,
double y,
double w,
double h) |
Checks if one of the lines in the polyline intersects
with a given rectangle.
|
boolean |
intersects(java.awt.geom.Rectangle2D r) |
Checks if one of the lines in the polyline intersects
with a given rectangle.
|
protected int[] x
protected int[] y
protected int np
public PolylineShape(int[] x, int[] y, int nPoints)
public java.awt.geom.Rectangle2D getBounds2D()
getBounds2D
in interface java.awt.Shape
Rectangle2D
that is the high-precision
bounding box of this line.Shape.getBounds2D()
public java.awt.Rectangle getBounds()
getBounds
in interface java.awt.Shape
Shape.getBounds()
public boolean contains(double x, double y)
contains
in interface java.awt.Shape
Shape.contains(double, double)
public boolean contains(java.awt.geom.Point2D p)
contains
in interface java.awt.Shape
Shape.contains(java.awt.geom.Point2D)
public boolean contains(double x, double y, double w, double h)
contains
in interface java.awt.Shape
Shape.contains(double, double, double, double)
public boolean contains(java.awt.geom.Rectangle2D r)
contains
in interface java.awt.Shape
Shape.contains(java.awt.geom.Rectangle2D)
public boolean intersects(double x, double y, double w, double h)
intersects
in interface java.awt.Shape
Shape.intersects(double, double, double, double)
public boolean intersects(java.awt.geom.Rectangle2D r)
intersects
in interface java.awt.Shape
Shape.intersects(java.awt.geom.Rectangle2D)
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
getPathIterator
in interface java.awt.Shape
at
- the specified AffineTransform
PathIterator
that defines the boundary of this polyline.Shape.intersects(java.awt.geom.Rectangle2D)
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
getPathIterator
in interface java.awt.Shape
Copyright © 1998–2018. All rights reserved.