package jeql.awt.geom; import java.awt.Rectangle; import java.awt.Shape; import java.awt.geom.AffineTransform; import java.awt.geom.PathIterator; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.Iterator; public class GeometryCollectionShape implements Shape { private ArrayList shapes = new ArrayList(); public GeometryCollectionShape() { } public void add(Shape shape) { shapes.add(shape); } public Rectangle getBounds() { /**@todo Implement this java.awt.Shape method*/ throw new java.lang.UnsupportedOperationException( "Method getBounds() not yet implemented."); } public Rectangle2D getBounds2D() { Rectangle2D rectangle = null; for (Iterator i = shapes.iterator(); i.hasNext();) { Shape shape = (Shape) i.next(); if (rectangle == null) { rectangle = shape.getBounds2D(); } else { rectangle.add(shape.getBounds2D()); } } return rectangle; } public boolean contains(double x, double y) { /**@todo Implement this java.awt.Shape method*/ throw new java.lang.UnsupportedOperationException( "Method contains() not yet implemented."); } public boolean contains(Point2D p) { /**@todo Implement this java.awt.Shape method*/ throw new java.lang.UnsupportedOperationException( "Method contains() not yet implemented."); } public boolean intersects(double x, double y, double w, double h) { /**@todo Implement this java.awt.Shape method*/ throw new java.lang.UnsupportedOperationException( "Method intersects() not yet implemented."); } public boolean intersects(Rectangle2D r) { /**@todo Implement this java.awt.Shape method*/ throw new java.lang.UnsupportedOperationException( "Method intersects() not yet implemented."); } public boolean contains(double x, double y, double w, double h) { /**@todo Implement this java.awt.Shape method*/ throw new java.lang.UnsupportedOperationException( "Method contains() not yet implemented."); } public boolean contains(Rectangle2D r) { /**@todo Implement this java.awt.Shape method*/ throw new java.lang.UnsupportedOperationException( "Method contains() not yet implemented."); } public PathIterator getPathIterator(AffineTransform at) { return new ShapeCollectionPathIterator(shapes, at); } public PathIterator getPathIterator(AffineTransform at, double flatness) { // since we don't support curved geometries, can simply delegate to the simple method return getPathIterator(at); } }