| 
 | Préférences Moteurs de recherche | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| JavaTM 2 Platform Std. Ed. v1.4.2 
java.awt
 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Field Summary | |
| protected  Rectangle | boundsBounds of the polygon. | 
|  int | npointsThe total number of points. | 
|  int[] | xpointsThe array of x coordinates. | 
|  int[] | ypointsThe array of y coordinates. | 
| Constructor Summary | |
| Polygon()Creates an empty polygon. | |
| Polygon(int[] xpoints,
        int[] ypoints,
        int npoints)Constructs and initializes a Polygonfrom the specified 
 parameters. | |
| Method Summary | |
|  void | addPoint(int x,
         int y)Appends the specified coordinates to this Polygon. | 
|  boolean | contains(double x,
         double y)Determines if the specified coordinates are inside this Polygon. | 
|  boolean | contains(double x,
         double y,
         double w,
         double h)Tests if the interior of this Polygonentirely
 contains the specified set of rectangular coordinates. | 
|  boolean | contains(int x,
         int y)Determines whether the specified coordinates are inside this Polygon. | 
|  boolean | contains(Point p)Determines whether the specified Pointis inside thisPolygon. | 
|  boolean | contains(Point2D p)Tests if a specified Point2Dis inside the boundary of thisPolygon. | 
|  boolean | contains(Rectangle2D r)Tests if the interior of this Polygonentirely
 contains the specifiedRectangle2D. | 
|  Rectangle | getBoundingBox()Deprecated. As of JDK version 1.1, replaced by getBounds(). | 
|  Rectangle | getBounds()Gets the bounding box of this Polygon. | 
|  Rectangle2D | getBounds2D()Returns the high precision bounding box of the Shape. | 
|  PathIterator | getPathIterator(AffineTransform at)Returns an iterator object that iterates along the boundary of this Polygonand provides access to the geometry
 of the outline of thisPolygon. | 
|  PathIterator | getPathIterator(AffineTransform at,
                double flatness)Returns an iterator object that iterates along the boundary of the Shapeand provides access to the geometry of the 
 outline of theShape. | 
|  boolean | inside(int x,
       int y)Deprecated. As of JDK version 1.1, replaced by contains(int, int). | 
|  boolean | intersects(double x,
           double y,
           double w,
           double h)Tests if the interior of this Polygonintersects the 
 interior of a specified set of rectangular coordinates. | 
|  boolean | intersects(Rectangle2D r)Tests if the interior of this Polygonintersects the
 interior of a specifiedRectangle2D. | 
|  void | invalidate()Invalidates or flushes any internally-cached data that depends on the vertex coordinates of this Polygon. | 
|  void | reset()Resets this Polygonobject to an empty polygon. | 
|  void | translate(int deltaX,
          int deltaY)Translates the vertices of the PolygonbydeltaXalong the x axis and bydeltaYalong the y axis. | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
public int npoints
npoints
 represents the number of valid points in this Polygon
 and might be less than the number of elements in 
 xpoints or ypoints.
 This value can be NULL.
addPoint(int, int)public int[] xpoints
Polygon.  The extra elements allow new points
 to be added to this Polygon without re-creating this
 array.  The value of npoints is equal to the
 number of valid points in this Polygon.
addPoint(int, int)public int[] ypoints
Polygon.  The extra elements allow new points    
 to be added to this Polygon without re-creating this
 array.  The value of npoints is equal to the
 number of valid points in this Polygon.
addPoint(int, int)protected Rectangle bounds
getBoundingBox(), 
getBounds()| Constructor Detail | 
public Polygon()
public Polygon(int[] xpoints,
               int[] ypoints,
               int npoints)
Polygon from the specified 
 parameters.
xpoints - an array of x coordinatesypoints - an array of y coordinatesnpoints - the total number of points in the    
				Polygon
NegativeArraySizeException - if the value of
                       npoints is negative.
IndexOutOfBoundsException - if npoints is
             greater than the length of xpoints
             or the length of ypoints.
NullPointerException - if xpoints or
             ypoints is null.| Method Detail | 
public void reset()
Polygon object to an empty polygon.
 The coordinate arrays and the data in them are left untouched
 but the number of points is reset to zero to mark the old
 vertex data as invalid and to start accumulating new vertex
 data at the beginning.
 All internally-cached data relating to the old vertices
 are discarded.
 Note that since the coordinate arrays from before the reset
 are reused, creating a new empty Polygon might
 be more memory efficient than resetting the current one if
 the number of vertices in the new polygon data is significantly
 smaller than the number of vertices in the data from before the
 reset.
invalidate()public void invalidate()
Polygon.
 This method should be called after any direct manipulation
 of the coordinates in the xpoints or
 ypoints arrays to avoid inconsistent results
 from methods such as getBounds or contains
 that might cache data from earlier computations relating to
 the vertex coordinates.
getBounds()
public void translate(int deltaX,
                      int deltaY)
Polygon by 
 deltaX along the x axis and by 
 deltaY along the y axis.
deltaX - the amount to translate along the x axisdeltaY - the amount to translate along the y axis
public void addPoint(int x,
                     int y)
Polygon. 
 
 If an operation that calculates the bounding box of this     
 Polygon has already been performed, such as  
 getBounds or contains, then this 
 method updates the bounding box.
x - the specified x coordinatey - the specified y coordinategetBounds(), 
contains(java.awt.Point)public Rectangle getBounds()
Polygon. 
 The bounding box is the smallest Rectangle whose
 sides are parallel to the x and y axes of the 
 coordinate space, and can completely contain the Polygon.
Rectangle that defines the bounds of this 
 Polygon.Shape.getBounds2D()public Rectangle getBoundingBox()
getBounds().
Polygon.
Polygon.public boolean contains(Point p)
Point is inside this 
 Polygon.
p - the specified Point to be tested
true if the Polygon contains the
 			Point; false otherwise.contains(double, double)
public boolean contains(int x,
                        int y)
Polygon.   
 
x - the specified x coordinate to be testedy - the specified y coordinate to be tested
true if this Polygon contains
 			the specified coordinates, (x, y);  
 			false otherwise.contains(double, double)
public boolean inside(int x,
                      int y)
contains(int, int).
Polygon.
x - the specified x coordinate to be testedy - the specified y coordinate to be tested
true if this Polygon contains
 		the specified coordinates, (x, y);  
 		false otherwise.contains(double, double)public Rectangle2D getBounds2D()
Shape.
getBounds2D in interface ShapeRectangle2D that precisely
		bounds the Shape.Shape.getBounds()
public boolean contains(double x,
                        double y)
Polygon.  For the definition of
 insideness, see the class comments of Shape.
x - the specified x coordinatey - the specified y coordinate
true if the Polygon contains the
 specified coordinates; false otherwise.public boolean contains(Point2D p)
Point2D is inside the boundary of this 
 Polygon.
p - a specified Point2D
true if this Polygon contains the 
 		specified Point2D; false
          otherwise.contains(double, double)
public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
Polygon intersects the 
 interior of a specified set of rectangular coordinates.
intersects in interface Shapex - the x coordinate of the specified rectangular
			shape's top-left cornery - the y coordinate of the specified rectangular
			shape's top-left cornerw - the width of the specified rectangular shapeh - the height of the specified rectangular shape
true if the interior of this 
			Polygon and the interior of the
			specified set of rectangular 
 			coordinates intersect each other;
			false otherwise.Areapublic boolean intersects(Rectangle2D r)
Polygon intersects the
 interior of a specified Rectangle2D.
intersects in interface Shaper - a specified Rectangle2D
true if this Polygon and the
 			interior of the specified Rectangle2D
 			intersect each other; false
 			otherwise.Shape.intersects(double, double, double, double)
public boolean contains(double x,
                        double y,
                        double w,
                        double h)
Polygon entirely
 contains the specified set of rectangular coordinates.
x - the x coordinate of the top-left corner of the
 			specified set of rectangular coordinatesy - the y coordinate of the top-left corner of the
 			specified set of rectangular coordinatesw - the width of the set of rectangular coordinatesh - the height of the set of rectangular coordinates
true if this Polygon entirely
 			contains the specified set of rectangular
 			coordinates; false otherwise.Area, 
Shape.intersects(double, double, double, double)public boolean contains(Rectangle2D r)
Polygon entirely
 contains the specified Rectangle2D.
r - the specified Rectangle2D
true if this Polygon entirely
 			contains the specified Rectangle2D;
			false otherwise.contains(double, double, double, double)public PathIterator getPathIterator(AffineTransform at)
Polygon and provides access to the geometry
 of the outline of this Polygon.  An optional
 AffineTransform can be specified so that the coordinates 
 returned in the iteration are transformed accordingly.
getPathIterator in interface Shapeat - an optional AffineTransform to be applied to the
 		coordinates as they are returned in the iteration, or 
		null if untransformed coordinates are desired
PathIterator object that provides access to the
		geometry of this Polygon.public PathIterator getPathIterator(AffineTransform at, double flatness)
Shape and provides access to the geometry of the 
 outline of the Shape.  Only SEG_MOVETO, SEG_LINETO, and 
 SEG_CLOSE point types are returned by the iterator.
 Since polygons are already flat, the flatness parameter
 is ignored.  An optional AffineTransform can be specified 
 in which case the coordinates returned in the iteration are transformed
 accordingly.
getPathIterator in interface Shapeat - an optional AffineTransform to be applied to the
 		coordinates as they are returned in the iteration, or 
		null if untransformed coordinates are desiredflatness - the maximum amount that the control points
 		for a given curve can vary from colinear before a subdivided
		curve is replaced by a straight line connecting the 
 		endpoints.  Since polygons are already flat the
 		flatness parameter is ignored.
PathIterator object that provides access to the
 		Shape object's geometry.