Package drawit.shapes1
Class ShapeGroupShape
java.lang.Object
drawit.shapes1.ShapeGroupShape
- All Implemented Interfaces:
Shape
public class ShapeGroupShape extends Object
Each instance of this class stores a reference to a ShapeGroup object.
We define this object's shape coordinate system as its shape group's outer coordinate system.
-
Constructor Summary
Constructors Constructor Description ShapeGroupShape(drawit.shapegroups1.ShapeGroup group)Initializes this object to store the given ShapeGroup reference. -
Method Summary
Modifier and Type Method Description booleancontains(drawit.IntPoint p)Returns whether this shape group's extent contains the given point, expressed in shape coordinates.ControlPoint[]createControlPoints()Returns one control point for this shape group's upper-left corner, and one control point for its lower-right corner.StringgetDrawingCommands()Returns this shape group's drawing commands.drawit.shapegroups1.ShapeGroupgetParent()Returns this shape group's parent, ornullif it has no parent.drawit.shapegroups1.ShapeGroupgetShapeGroup()Returns the ShapeGroup reference stored by this object.drawit.IntPointtoGlobalCoordinates(drawit.IntPoint p)Given the coordinates of a point in the shape coordinate system, returns the coordinates of the point in the global coordinate system.drawit.IntPointtoShapeCoordinates(drawit.IntPoint p)Given the coordinates of a point in the global coordinate system, returns the coordinates of the point in the shape coordinate system.
-
Constructor Details
-
ShapeGroupShape
public ShapeGroupShape(drawit.shapegroups1.ShapeGroup group)Initializes this object to store the given ShapeGroup reference.
-
-
Method Details
-
getShapeGroup
public drawit.shapegroups1.ShapeGroup getShapeGroup()Returns the ShapeGroup reference stored by this object.- Immutable
- Any two calls of this method on the same target object return equal values.
-
getParent
public drawit.shapegroups1.ShapeGroup getParent()Returns this shape group's parent, ornullif it has no parent. -
contains
public boolean contains(drawit.IntPoint p)Returns whether this shape group's extent contains the given point, expressed in shape coordinates. -
getDrawingCommands
Returns this shape group's drawing commands.- Specified by:
getDrawingCommandsin interfaceShape
-
createControlPoints
Returns one control point for this shape group's upper-left corner, and one control point for its lower-right corner. If, after calling this method, a client mutates the shape group graph referenced by this object, it shall no longer call any methods on the returned ControlPoint objects. That is, any mutation of the shape group graph referenced by this object invalidates the ControlPoint objects returned by any preceding createControlPoints call. This is true even if the mutation occurred through the returned ControlPoint objects themselves. For example, after callingmoveon one of the returned ControlPoint objects, a client is no longer allowed to callgetLocationorremoveon any of the returned ControlPoint objects, and after callingremoveon one of the returned ControlPoint objects, a client is no longer allowed to callgetLocationormoveon any of the returned ControlPoint objects. There is one exception: a client can perform any number of consecutivemovecalls on the same ControlPoint object.- Specified by:
createControlPointsin interfaceShape- Creates:
- This method creates the returned array, as well as its elements.
result, ...result
-
toShapeCoordinates
public drawit.IntPoint toShapeCoordinates(drawit.IntPoint p)Description copied from interface:ShapeGiven the coordinates of a point in the global coordinate system, returns the coordinates of the point in the shape coordinate system.- Specified by:
toShapeCoordinatesin interfaceShape
-
toGlobalCoordinates
public drawit.IntPoint toGlobalCoordinates(drawit.IntPoint p)Description copied from interface:ShapeGiven the coordinates of a point in the shape coordinate system, returns the coordinates of the point in the global coordinate system.- Specified by:
toGlobalCoordinatesin interfaceShape
-