Class PolygonShape

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String TOOL_KEY  
    • Constructor Summary

      Constructors 
      Constructor Description
      PolygonShape()  
      PolygonShape​(boolean star, int vertices, float radius, double startingAngle, float starRadius, double starStartingAngle, java.awt.geom.Point2D center)
      Sets all polygon props and then creates the shape.
    • Constructor Detail

      • PolygonShape

        public PolygonShape()
      • PolygonShape

        public PolygonShape​(boolean star,
                            int vertices,
                            float radius,
                            double startingAngle,
                            float starRadius,
                            double starStartingAngle,
                            java.awt.geom.Point2D center)
        Sets all polygon props and then creates the shape. Used by serialization.
    • Method Detail

      • getShape

        public java.awt.Shape getShape()
        Description copied from class: ShapeDelegate
        The AWT shape this delegate produces
        Specified by:
        getShape in class ShapeDelegate
      • getCenterpoint

        public java.awt.geom.Point2D getCenterpoint​(java.awt.geom.Rectangle2D bounds,
                                                    java.awt.geom.Point2D rv)
        Overrides:
        getCenterpoint in class ShapeDelegate
      • alterShape

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

        public void updateShape()
      • translateShape

        public void translateShape​(double dX,
                                   double dY)
        Description copied from class: ShapeDelegate
        Move the shape using the provided offsets. Default implementation calls alterShape.
        Overrides:
        translateShape in class ShapeDelegate
      • convertToPath

        public java.awt.geom.GeneralPath convertToPath()
        Description copied from class: ShapeDelegate
        Convert this shape to a GeneralPath
        Overrides:
        convertToPath in class ShapeDelegate
      • getCenter

        public java.awt.geom.Point2D getCenter()
      • setCenter

        public void setCenter​(java.awt.geom.Point2D center)
      • getRadius

        public float getRadius()
      • setRadius

        public void setRadius​(float radius)
      • getStarRadius

        public float getStarRadius()
      • setStarRadius

        public void setStarRadius​(float starRadius)
      • getStarStartingAngle

        public double getStarStartingAngle()
      • setStarStartingAngle

        public void setStarStartingAngle​(double starStartingAngle)
      • getStartingAngle

        public double getStartingAngle()
      • setStartingAngle

        public void setStartingAngle​(double startingAngle)
      • isStar

        public boolean isStar()
      • setStar

        public void setStar​(boolean star)
      • getVertices

        public int getVertices()
      • setVertices

        public void setVertices​(int vertices)
      • getTipPoint

        public java.awt.geom.Point2D getTipPoint()
      • getStarRadiusPoint

        public java.awt.geom.Point2D getStarRadiusPoint()
      • setByCenter

        public void setByCenter​(java.awt.geom.Point2D center)
      • isRotatable

        public boolean isRotatable()
        Description copied from class: ShapeDelegate
        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.
        Overrides:
        isRotatable in class ShapeDelegate
      • rotate

        public void rotate​(double angle,
                           java.awt.geom.Point2D anchor)
        Overrides:
        rotate in class ShapeDelegate