Class PolygonShape


  • @Equality
    public abstract class PolygonShape
    extends java.lang.Object
    Object that knows how to draw a polygon.
    Since:
    5 Oct 2021
    Author:
    Mark Taylor
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static PolygonShape[] POLYSHAPES
      Array of known shape instances.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected PolygonShape​(java.lang.String name, java.lang.String description)
      Constructor.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract Glyph createPolygonGlyph​(int x0, int y0, int[] xs, int[] ys, int np)
      Returns a glyph representing a polygon with the given vertices.
      java.lang.String getDescription()
      Returns a short description for this shape.
      java.lang.String getName()
      Returns this shape's name.
      java.lang.String toString()  
      abstract PolygonShape toThicker​(int nthick)
      Returns a version of this shape with thicker lines; may be this object if line thickening would have no effect.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • POLYSHAPES

        public static final PolygonShape[] POLYSHAPES
        Array of known shape instances.
    • Constructor Detail

      • PolygonShape

        protected PolygonShape​(java.lang.String name,
                               java.lang.String description)
        Constructor.
        Parameters:
        name - name
        description - short human-readable description
    • Method Detail

      • createPolygonGlyph

        public abstract Glyph createPolygonGlyph​(int x0,
                                                 int y0,
                                                 int[] xs,
                                                 int[] ys,
                                                 int np)
        Returns a glyph representing a polygon with the given vertices.
        Parameters:
        x0 - X coordinate of nominal center
        y0 - Y coordinate of nominal center
        xs - X coordinates of vertices
        ys - Y coordinates of vertices
        np - number of vertices
      • toThicker

        public abstract PolygonShape toThicker​(int nthick)
        Returns a version of this shape with thicker lines; may be this object if line thickening would have no effect.
        Parameters:
        nthick - line thickness index >=0
        Returns:
        thicker shape
      • getName

        public java.lang.String getName()
        Returns this shape's name.
        Returns:
        name
      • getDescription

        public java.lang.String getDescription()
        Returns a short description for this shape.
        Returns:
        human-readable plain-text description
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object