Source of SceneShape.java


  1: import java.awt.*;
  2: import java.awt.geom.*;

  4: /**
  5:    A shape that is a part of a scene.
  6: */
  7: public interface SceneShape
  8: {
  9:    /**
 10:       Draws this item.
 11:       @param g2 the graphics context
 12:    */
 13:    void draw(Graphics2D g2);
 14:    /**
 15:       Draws the selection adornment of this item.
 16:       @param g2 the graphics context
 17:    */
 18:    void drawSelection(Graphics2D g2);
 19:    /**
 20:       Sets the selection state of this item.
 21:       @param b true if this item is selected
 22:    */
 23:    void setSelected(boolean b);
 24:    /**
 25:       Gets the selection state of this item.
 26:       @return true if this item is selected
 27:    */
 28:    boolean isSelected();
 29:    /**
 30:       Translates this item by a given amount.
 31:       @param dx the amount to translate in x-direction
 32:       @param dy the amount to translate in y-direction
 33:    */
 34:    void translate(int dx, int dy);
 35:    /**
 36:       Tests whether this item contains a given point.
 37:       @param p a point
 38:       @return true if this item contains p
 39:    */
 40:    boolean contains(Point2D p);
 41: }