java.lang.Object
com.inductiveautomation.vision.api.client.components.shapes.ShapeDelegate
Direct Known Subclasses:
ArrowShape, EllipseShape, PathShape, PolygonShape, RectangleShape

public abstract class ShapeDelegate extends Object
  • Constructor Details

    • ShapeDelegate

      public ShapeDelegate()
  • Method Details

    • getShape

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

      public abstract boolean alterShape(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 Rectangle2D getBounds2D(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 Area createArea(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 Point2D getCenterpoint(Rectangle2D bounds, Point2D rv)
    • convertToPath

      public 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, Point2D anchor)
    • getToolKey

      public abstract String getToolKey()