JDK-4375332 : java.awt.geom.Polygon only supports integer vertices
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.2.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2000-09-30
  • Updated: 2001-03-31
  • Resolved: 2001-03-31
Related Reports
Duplicate :  
Description

Name: rmT116609			Date: 09/29/2000


java version 1.2.2

The Polygon class only supports integer vertices. It does not allow a polygon
to be constructed where the vertices lie on a float or double; nor are there
any methods in the Ploygon class to support adding Point objects or other ways
of constructing an enclosed Shape.

The classes in the java.awt.geom package are not suitable for creating an
arbitary shape with a number of vertices where the vertices are not exactly on
an integer location. Modifying the Polygon class, or providing an alternative,
would seem to be a useful addition.
(Review ID: 109533) 
======================================================================

Comments
WORK AROUND Use the java.awt.geom.GeneralPath class which supports floating point coordinates and arbitrary geometry with multiple disjoint subpaths possible. jim.graham@Eng 2001-03-30
30-03-2001

EVALUATION First, the comment in the description that the classes in the java.awt.geom package are not suitable for creating an arbitrary shape is incorrect. The java.awt.geom.GeneralPath class supports arbitrary paths expressed in floating point coordinates. The GeneralPath class even supports multiple disjoint subpaths in a single Shape which the Polygon class cannot express. There is already another RFE requesting that we add specific Polyline and Polygon oriented classes to java.awt.geom for supporting floating point Poly's when the generality of GeneralPath is not needed. This RFE will be closed out as a duplicate of that existing RFE. jim.graham@Eng 2001-03-30
30-03-2001