com.partnersoft.geometry.xy
Class XyShapeList<T extends XyShape>

java.lang.Object
  extended by com.partnersoft.geometry.xy.XyShapeList<T>
All Implemented Interfaces:
Immutable, XyShape<XyShapeList>, java.lang.Iterable<XyPoint>

public class XyShapeList<T extends XyShape>
extends java.lang.Object
implements XyShape<XyShapeList>

An ordered list of XyShapes. Useful for handling nonhomogenous collections of shapes, or for dealing with the results when regular shapes get demolished by cropping or transformations.

Copyright 2008 Partner Software, Inc.

Version:
$Id$
Author:
Paul Reavis

Constructor Summary
XyShapeList(java.util.List<T> shapes)
           
 
Method Summary
 XyBounds getBounds()
          Returns an XyBounds object representing the rectangular extents of this shape.
 java.util.Iterator<XyPoint> iterator()
           
 java.util.List<T> listShapes()
           
 XyShapeList<T> scaledBy(double factor)
          Return a scaled version of the shape by multiplying all coordinates by the given factor in both dimensions.
 XyShape transformedBy(XyTransform transform)
          Transform the shape using the given transform.
 XyShapeList<T> translatedBy(double offsetX, double offsetY)
          Translate the shape by adding all coordinates to the given x and y offsets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XyShapeList

public XyShapeList(java.util.List<T> shapes)
Method Detail

listShapes

public java.util.List<T> listShapes()

getBounds

public XyBounds getBounds()
Description copied from interface: XyShape
Returns an XyBounds object representing the rectangular extents of this shape.

Specified by:
getBounds in interface XyShape<XyShapeList>

scaledBy

public XyShapeList<T> scaledBy(double factor)
Description copied from interface: XyShape
Return a scaled version of the shape by multiplying all coordinates by the given factor in both dimensions. This resulting shape must be of the same class as the original.

Specified by:
scaledBy in interface XyShape<XyShapeList>
Parameters:
factor - scaling factor
Returns:
scaled result

transformedBy

public XyShape transformedBy(XyTransform transform)
Description copied from interface: XyShape
Transform the shape using the given transform. Due to potential distortion the result may be a different type of shape than this one.

Specified by:
transformedBy in interface XyShape<XyShapeList>
Parameters:
transform - affine transform to apply.
Returns:
transformed result

translatedBy

public XyShapeList<T> translatedBy(double offsetX,
                                   double offsetY)
Description copied from interface: XyShape
Translate the shape by adding all coordinates to the given x and y offsets. The resulting shape must be of the same class as the original.

Specified by:
translatedBy in interface XyShape<XyShapeList>
Parameters:
offsetX - offset for the x dimension
offsetY - offset for the y dimension
Returns:
offset result

iterator

public java.util.Iterator<XyPoint> iterator()
Specified by:
iterator in interface java.lang.Iterable<XyPoint>