Package drawit.shapegroups1
Class ShapeGroup
java.lang.Object
drawit.shapegroups1.ShapeGroup
- Direct Known Subclasses:
LeafShapeGroup
,NonleafShapeGroup
public abstract class ShapeGroup extends Object
Each instance of this class represents a shape group. A shape group is either a leaf group,
in which case it directly contains a single shape, or it is a non-leaf group, in which case it directly contains
two or more subgroups, which are themselves shape groups.
-
Method Summary
Modifier and Type Method Description void
bringToFront()
Moves this shape group to the front of its parent's list of subgroups.abstract List<RoundedPolygon>
getAllShapes()
Returns a list of all RoundedPolygon objects contained directly or indirectly by this shape group, in some unspecified order.Map<RoundedPolygon,IntPoint[]>
getAllVertices()
Returns a map that maps each RoundedPolygon object contained directly or indirectly by this shape group to its current list of vertices.abstract Extent
getBoundingBox()
Returns the smallest axis-aligned rectangle that contains all shapes contained directly or indirectly by this shape group.abstract String
getDrawingCommands()
Returns a textual representation of a sequence of drawing commands for drawing the shapes contained directly or indirectly by this shape group.NonleafShapeGroup
getParentGroup()
Returns the shape group that directly contains this shape group, ornull
if no shape group directly contains this shape group.void
scale(IntPoint origin, double xFactor, double yFactor)
Scales the shapes contained directly or indirectly by this shape group by the given factors in the X and Y direction, respectively.void
sendToBack()
Moves this shape group to the back of its parent's list of subgroups.void
translate(IntVector delta)
Translates (= displaces) the shapes contained directly or indirectly by this shape group along the given vector.
-
Method Details
-
getParentGroup
Returns the shape group that directly contains this shape group, ornull
if no shape group directly contains this shape group. -
getAllShapes
Returns a list of all RoundedPolygon objects contained directly or indirectly by this shape group, in some unspecified order. -
getAllVertices
Returns a map that maps each RoundedPolygon object contained directly or indirectly by this shape group to its current list of vertices. -
getBoundingBox
Returns the smallest axis-aligned rectangle that contains all shapes contained directly or indirectly by this shape group. -
getDrawingCommands
Returns a textual representation of a sequence of drawing commands for drawing the shapes contained directly or indirectly by this shape group. For the syntax of the drawing commands, seeRoundedPolygon.getDrawingCommands()
. -
bringToFront
public void bringToFront()Moves this shape group to the front of its parent's list of subgroups. -
sendToBack
public void sendToBack()Moves this shape group to the back of its parent's list of subgroups. -
translate
Translates (= displaces) the shapes contained directly or indirectly by this shape group along the given vector. -
scale
Scales the shapes contained directly or indirectly by this shape group by the given factors in the X and Y direction, respectively. The scaling is done with respect to the given origin.
-