|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmath.geom2d.ShapeArray2D<T>
public class ShapeArray2D<T extends Shape2D>
Default Implementation of ShapeSet2D.
| Field Summary |
|---|
| Fields inherited from interface math.geom2d.Shape2D |
|---|
ACCURACY |
| Constructor Summary | |
|---|---|
ShapeArray2D()
|
|
ShapeArray2D(java.util.Collection<? extends T> shapes)
|
|
ShapeArray2D(int n)
|
|
ShapeArray2D(T[] shapes)
|
|
| Method Summary | ||
|---|---|---|
void |
add(int index,
T shape)
Inserts the specified shape at the specified position in this set (optional operation). |
|
boolean |
add(T shape)
Adds the shape to the shape set, if it does not already belongs to the set. |
|
boolean |
almostEquals(GeometricObject2D obj,
double eps)
Checks if the two objects are similar up to a given threshold value. |
|
Box2D |
boundingBox()
Returns the bounding box of the shape. |
|
void |
clear()
Clears the inner shape collection. |
|
Shape2D |
clip(Box2D box)
Clip the shape with the given box, and returns a new shape. |
|
ShapeArray2D<? extends Shape2D> |
clone()
|
|
boolean |
contains(double x,
double y)
Checks if the shape contains the planar point defined by (x,y). |
|
boolean |
contains(Point2D p)
Checks if the shape contains the given point. |
|
boolean |
contains(T shape)
Checks if the shape set contains the given shape. |
|
static
|
create(java.util.Collection<T> shapes)
|
|
static
|
create(T... shapes)
|
|
double |
distance(double x,
double y)
Returns the distance of the shape to the given point, specified by x and y, or the distance of point to the frontier of the shape in the case of a plain (i.e. fillable) shape. |
|
double |
distance(Point2D p)
Returns the distance of the shape to the given point, or the distance of point to the frontier of the shape in the case of a plain shape. |
|
void |
draw(java.awt.Graphics2D g2)
Draws the shape on the given graphics. |
|
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. |
|
T |
get(int index)
Returns the inner shape corresponding to the given index. |
|
int |
indexOf(T shape)
Returns the index of the shape in this set. |
|
boolean |
isBounded()
Returns true if the shape is bounded, that is if we can draw a finite rectangle enclosing the shape. |
|
boolean |
isEmpty()
Returns true if the shape does not contain any point. |
|
java.util.Iterator<T> |
iterator()
|
|
T |
remove(int index)
Removes the shape at the specified position in this set (optional operation). |
|
boolean |
remove(T shape)
Removes the specified shape from the shape set. |
|
java.util.Collection<T> |
shapes()
Returns the collection of shapes |
|
int |
size()
Returns the number of shapes stored in this set. |
|
ShapeSet2D<? extends Shape2D> |
transform(AffineTransform2D trans)
Transforms the shape by an affine transform. |
|
| Methods inherited from class java.lang.Object |
|---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ShapeArray2D()
public ShapeArray2D(int n)
public ShapeArray2D(java.util.Collection<? extends T> shapes)
public ShapeArray2D(T[] shapes)
| Method Detail |
|---|
public static <T extends Shape2D> ShapeArray2D<T> create(java.util.Collection<T> shapes)
public static <T extends Shape2D> ShapeArray2D<T> create(T... shapes)
public boolean add(T shape)
add in interface ShapeSet2D<T extends Shape2D>shape - the shape to add
public void add(int index,
T shape)
ShapeSet2D
add in interface ShapeSet2D<T extends Shape2D>public T get(int index)
get in interface ShapeSet2D<T extends Shape2D>index - index of the shape
public boolean remove(T shape)
remove in interface ShapeSet2D<T extends Shape2D>shape - the shape to removepublic T remove(int index)
ShapeSet2D
remove in interface ShapeSet2D<T extends Shape2D>public boolean contains(T shape)
contains in interface ShapeSet2D<T extends Shape2D>public int indexOf(T shape)
ShapeSet2D
indexOf in interface ShapeSet2D<T extends Shape2D>public void clear()
clear in interface ShapeSet2D<T extends Shape2D>public int size()
ShapeSet2D
size in interface ShapeSet2D<T extends Shape2D>public java.util.Collection<T> shapes()
public Shape2D clip(Box2D box)
Shape2D
clip in interface Shape2Dbox - the clipping box
public boolean contains(double x,
double y)
Shape2D
contains in interface Shape2Dpublic boolean contains(Point2D p)
Shape2D
contains in interface Shape2Dpublic void draw(java.awt.Graphics2D g2)
Shape2D
draw in interface Shape2Dpublic Box2D boundingBox()
Shape2D
boundingBox in interface Shape2Dpublic double distance(Point2D p)
Shape2D
distance in interface Shape2D
public double distance(double x,
double y)
Shape2D
distance in interface Shape2Dpublic boolean isBounded()
Shape2D
isBounded in interface Shape2Dpublic boolean isEmpty()
Shape2D
isEmpty in interface Shape2Dpublic ShapeSet2D<? extends Shape2D> transform(AffineTransform2D trans)
Shape2D
transform in interface Shape2Dtrans - an affine transform
public boolean almostEquals(GeometricObject2D obj,
double eps)
GeometricObject2D
almostEquals in interface GeometricObject2Dobj - the object to compareeps - a threshold value, for example the minimal coordinate difference
public java.util.Iterator<T> iterator()
iterator in interface java.lang.Iterable<T extends Shape2D>public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic ShapeArray2D<? extends Shape2D> clone()
clone in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||