Class ShapeDelegate

    • Constructor Summary

      Constructors 
      Constructor Description
      ShapeDelegate()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract boolean alterShape​(java.awt.geom.Rectangle2D newRect)
      Directly modify the shape's frame so that it fits tightly within the new framing rectangle.
      java.awt.geom.GeneralPath convertToPath()
      Convert this shape to a GeneralPath
      java.awt.geom.Area createArea​(java.awt.Shape shape, float strokeWidth, boolean filled)
      Gives the delegate a chance to create the hit-testing area appropriate for it's shape.
      java.awt.geom.Rectangle2D getBounds2D​(java.awt.Shape shape)
      Provides a way for the delegate to do custom calculation of the shape's bounds.
      java.awt.geom.Point2D getCenterpoint​(java.awt.geom.Rectangle2D bounds, java.awt.geom.Point2D rv)  
      abstract java.awt.Shape getShape()
      The AWT shape this delegate produces
      abstract java.lang.String getToolKey()  
      boolean isRotatable()
      Some shape delegates prefer to handle rotation themselves, instead of having the PathBasedVisionShape parent rotate their shape after the fact.
      abstract boolean isSymmetric()  
      void rotate​(double angle, java.awt.geom.Point2D anchor)  
      void translateShape​(double dX, double dY)
      Move the shape using the provided offsets.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ShapeDelegate

        public ShapeDelegate()
    • Method Detail

      • getShape

        public abstract java.awt.Shape getShape()
        The AWT shape this delegate produces
      • alterShape

        public abstract boolean alterShape​(java.awt.geom.Rectangle2D newRect)
        Directly modify the shape's frame so that it fits tightly within the new framing rectangle.
        Parameters:
        newRect - The new bounding rectangle for the shape.
        Returns:
        false if the shape was unable to alter itself into the given rectangle.
      • translateShape

        public void translateShape​(double dX,
                                   double dY)
        Move the shape using the provided offsets. Default implementation calls alterShape.
      • getBounds2D

        public java.awt.geom.Rectangle2D getBounds2D​(java.awt.Shape shape)
        Provides a way for the delegate to do custom calculation of the shape's bounds. Default implementation is:

         return shape.getBounds2D();
         
      • createArea

        public java.awt.geom.Area createArea​(java.awt.Shape shape,
                                             float strokeWidth,
                                             boolean filled)
        Gives the delegate a chance to create the hit-testing area appropriate for it's shape.
        Parameters:
        shape - The shape, after applying rotation transform.
        strokeWidth - The width of the stroke, of 0 if the path isn't stroked
        filled - Whether or not the shape will be filled with a paint.
      • getCenterpoint

        public java.awt.geom.Point2D getCenterpoint​(java.awt.geom.Rectangle2D bounds,
                                                    java.awt.geom.Point2D rv)
      • convertToPath

        public java.awt.geom.GeneralPath convertToPath()
        Convert this shape to a GeneralPath
      • isSymmetric

        public abstract boolean isSymmetric()
      • isRotatable

        public boolean isRotatable()
        Some shape delegates prefer to handle rotation themselves, instead of having the PathBasedVisionShape parent rotate their shape after the fact. Delegates that do this should return true from this method, and then handle the rotate method appropriately. Note that all rotations must go through the PathBasedVisionShape so that it can update the angle property.
      • rotate

        public void rotate​(double angle,
                           java.awt.geom.Point2D anchor)
      • getToolKey

        public abstract java.lang.String getToolKey()