math.geom2d.domain
Class DomainArray2D<T extends Domain2D>

java.lang.Object
  extended by math.geom2d.ShapeArray2D<T>
      extended by math.geom2d.domain.DomainArray2D<T>
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Iterable<T>, Domain2D, DomainSet2D<T>, GeometricObject2D, Shape2D, ShapeSet2D<T>

public class DomainArray2D<T extends Domain2D>
extends ShapeArray2D<T>
implements DomainSet2D<T>

An array of domains. Note that this class if different from a generic domain whose boundary is a set of contours. In the latter case, the shape is itself a domain, not in the former.

Author:
dlegland

Field Summary
 
Fields inherited from interface math.geom2d.Shape2D
ACCURACY
 
Constructor Summary
DomainArray2D()
           
DomainArray2D(java.util.Collection<T> domains)
           
DomainArray2D(int n)
           
DomainArray2D(T... domains)
           
 
Method Summary
 Polygon2D asPolygon(int n)
          Returns an approximation of the domain as a polygon, or a MultiPolygon.
 Boundary2D boundary()
          Returns the boundary of the set.
 Domain2D clip(Box2D box)
          Clip the shape with the given box, and returns a new shape.
 DomainSet2D<? extends Domain2D> complement()
          Returns the domain which complements this domain in the plane.
 java.util.Collection<? extends Contour2D> contours()
          Returns the set of contours that enclose this domain.
static
<D extends Domain2D>
DomainArray2D<D>
create(java.util.Collection<D> array)
           
static
<D extends Domain2D>
DomainArray2D<D>
create(D... array)
           
 boolean equals(java.lang.Object obj)
          Returns true if obj is a CurveSet2D with the same number of shapes, and such that each shape belongs to both objects.
 void fill(java.awt.Graphics2D g2)
          Fills the interior of the domain, using the Graphics current Paint.
 DomainArray2D<? extends Domain2D> transform(AffineTransform2D trans)
          Transforms the shape by an affine transform.
 
Methods inherited from class math.geom2d.ShapeArray2D
add, add, almostEquals, boundingBox, clear, clone, contains, contains, contains, create, create, distance, distance, draw, get, indexOf, isBounded, isEmpty, iterator, remove, remove, shapes, size
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface math.geom2d.ShapeSet2D
add, add, clear, contains, get, indexOf, remove, remove, size
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface math.geom2d.domain.Domain2D
draw
 
Methods inherited from interface math.geom2d.Shape2D
boundingBox, contains, contains, distance, distance, isBounded, isEmpty
 
Methods inherited from interface math.geom2d.GeometricObject2D
almostEquals
 

Constructor Detail

DomainArray2D

public DomainArray2D()

DomainArray2D

public DomainArray2D(int n)
Parameters:
n -

DomainArray2D

public DomainArray2D(java.util.Collection<T> domains)
Parameters:
domains - the initial set of domains that constitutes this array.

DomainArray2D

public DomainArray2D(T... domains)
Parameters:
domains - the initial set of domains that constitutes this array.
Method Detail

create

public static <D extends Domain2D> DomainArray2D<D> create(java.util.Collection<D> array)

create

public static <D extends Domain2D> DomainArray2D<D> create(D... array)

boundary

public Boundary2D boundary()
Description copied from interface: Domain2D
Returns the boundary of the set. This boundary is either a continuous non intersecting curve (connected domain), or a set of non intersecting continuous curve (one continuous non-intersection for each connected part of the domain).

The returned curve is oriented, with an interior and an exterior.

Specified by:
boundary in interface Domain2D
Returns:
the boundary of the domain

contours

public java.util.Collection<? extends Contour2D> contours()
Description copied from interface: Domain2D
Returns the set of contours that enclose this domain. The result is a collection of shapes that implement the Contour2D interface.

Specified by:
contours in interface Domain2D
See Also:
Contour2D

complement

public DomainSet2D<? extends Domain2D> complement()
Description copied from interface: Domain2D
Returns the domain which complements this domain in the plane.

Specified by:
complement in interface Domain2D
Returns:
the complement of this domain.

asPolygon

public Polygon2D asPolygon(int n)
Description copied from interface: Domain2D
Returns an approximation of the domain as a polygon, or a MultiPolygon.

Specified by:
asPolygon in interface Domain2D
Returns:
a polygon

fill

public void fill(java.awt.Graphics2D g2)
Description copied from interface: Domain2D
Fills the interior of the domain, using the Graphics current Paint.

Specified by:
fill in interface Domain2D
Parameters:
g2 - the Graphics to fill on

transform

public DomainArray2D<? extends Domain2D> transform(AffineTransform2D trans)
Description copied from interface: Shape2D
Transforms the shape by an affine transform. Subclasses may override the type of returned shape.

Specified by:
transform in interface Domain2D
Specified by:
transform in interface Shape2D
Overrides:
transform in class ShapeArray2D<T extends Domain2D>
Parameters:
trans - an affine transform
Returns:
the transformed shape

clip

public Domain2D clip(Box2D box)
Description copied from interface: Shape2D
Clip the shape with the given box, and returns a new shape. The box must be bounded.

Specified by:
clip in interface Domain2D
Specified by:
clip in interface Shape2D
Overrides:
clip in class ShapeArray2D<T extends Domain2D>
Parameters:
box - the clipping box
Returns:
the clipped shape

equals

public boolean equals(java.lang.Object obj)
Description copied from class: ShapeArray2D
Returns true if obj is a CurveSet2D with the same number of shapes, and such that each shape belongs to both objects.

Overrides:
equals in class ShapeArray2D<T extends Domain2D>