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
    boolean contains​(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.
    String getDrawingCommands()
    Returns this shape group's drawing commands.
    drawit.shapegroups1.ShapeGroup getParent()
    Returns this shape group's parent, or null if it has no parent.
    drawit.shapegroups1.ShapeGroup getShapeGroup()
    Returns the ShapeGroup reference stored by this object.
    drawit.IntPoint toGlobalCoordinates​(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.IntPoint toShapeCoordinates​(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.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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, or null if it has no parent.
      Specified by:
      getParent in interface Shape
      Immutable
      Any two calls of this method on the same target object return equal values.
    • contains

      public boolean contains​(drawit.IntPoint p)
      Returns whether this shape group's extent contains the given point, expressed in shape coordinates.
      Specified by:
      contains in interface Shape
    • getDrawingCommands

      public String getDrawingCommands()
      Returns this shape group's drawing commands.
      Specified by:
      getDrawingCommands in interface Shape
    • createControlPoints

      public ControlPoint[] 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 calling move on one of the returned ControlPoint objects, a client is no longer allowed to call getLocation or remove on any of the returned ControlPoint objects, and after calling remove on one of the returned ControlPoint objects, a client is no longer allowed to call getLocation or move on any of the returned ControlPoint objects. There is one exception: a client can perform any number of consecutive move calls on the same ControlPoint object.
      Specified by:
      createControlPoints in interface Shape
      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: Shape
      Given the coordinates of a point in the global coordinate system, returns the coordinates of the point in the shape coordinate system.
      Specified by:
      toShapeCoordinates in interface Shape
    • toGlobalCoordinates

      public drawit.IntPoint toGlobalCoordinates​(drawit.IntPoint p)
      Description copied from interface: Shape
      Given the coordinates of a point in the shape coordinate system, returns the coordinates of the point in the global coordinate system.
      Specified by:
      toGlobalCoordinates in interface Shape