Package com.nomagic.awt
Class ContainerShape
java.lang.Object
com.nomagic.awt.ContainerShape
This shape can have rectangles, ellipses and lines.
The shape form is the union of all contained shapes.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEllipse
(Rectangle el) Add ellipse.void
Add line.void
addShape
(RoundRectangle2D rect) Add rectangle shape.void
Add Polygon.void
Add rectangle shape.static ContainerShape
createPolygonContainerShape
(int[] x, int[] y) Creates container shape from polygon points.static ContainerShape
createPolygonContainerShape
(ContainerShape shape, int[] x, int[] y) Creates container shape from polygon points.Returns contained ellipsesgetLines()
Returns contained lines.Returns polygonsReturns contained rectangles.Returns round rectanglesintersection
(int ax, int ay, int bx, int by) Computes the intersection of this shape (intersection with any of contained shapes) with the specified line.intersection
(Point a, Point b) boolean
intersects
(Rectangle bounds) Indicates if container shape intersects with specified bounds.
-
Constructor Details
-
ContainerShape
public ContainerShape()
-
-
Method Details
-
intersection
-
intersection
Computes the intersection of this shape (intersection with any of contained shapes) with the specified line. Returns a new point that represents the intersection of two shapes.- Parameters:
ax
- first point of lineay
- first point of linebx
- second point of lineby
- second point of line- Returns:
- the shapes intersection point
-
addShape
Add rectangle shape. -
addShape
Add rectangle shape. -
addShape
Add line. -
addEllipse
Add ellipse. -
addShape
Add Polygon. -
getEllipses
Returns contained ellipses- Returns:
- ellipses
-
getRectangles
Returns contained rectangles.- Returns:
- rectangle
-
getLines
Returns contained lines.- Returns:
- lines
-
getRoundRectangles
Returns round rectangles- Returns:
- round rectangles
-
getPolygons
Returns polygons- Returns:
- polygons
-
createPolygonContainerShape
Creates container shape from polygon points.- Parameters:
x
- array of x coordinates.y
- array of y coordinates.- Returns:
- created container shape.
-
createPolygonContainerShape
Creates container shape from polygon points.- Parameters:
shape
- container shape to modify.x
- array of x coordinates.y
- array of y coordinates.- Returns:
- created container shape.
-
intersects
Indicates if container shape intersects with specified bounds.- Parameters:
bounds
- bounds to check.- Returns:
- true if container shape intersects with specified bounds, false otherwise.
-