Class MultiPointShape


  • public abstract class MultiPointShape
    extends java.lang.Object
    Defines a graphical shape with coordinates supplied by a number of offset points.

    This code is a reworked version of the class ErrorRenderer, originally intended for drawing error bars, but the usage is more general than that.

    Since:
    21 Sep 2021
    Author:
    Mark Taylor
    • Field Detail

      • NONE

        public static final MultiPointShape NONE
        Multi-point shape which draws nothing.
      • DEFAULT

        public static final MultiPointShape DEFAULT
        General purpose multi-point shape.
      • EXAMPLE

        public static final MultiPointShape EXAMPLE
        Shape suitable for use in user controls.
    • Constructor Detail

      • MultiPointShape

        protected MultiPointShape​(java.lang.String name,
                                  int iconDim,
                                  boolean canThick)
        Constructor.
        Parameters:
        name - user-directed shape name
        iconDim - dimensionality to use for basic icon generation
        canThick - true iff this shape is available in different line thicknesses
    • Method Detail

      • getLegendIcon

        public javax.swing.Icon getLegendIcon()
        Returns an icon giving a general example of what this shape looks like.
        Returns:
        example icon
      • getLegendIcon

        public javax.swing.Icon getLegendIcon​(MultiPointScribe scribe,
                                              ErrorMode[] modes,
                                              int width,
                                              int height,
                                              int xpad,
                                              int ypad)
        Returns an icon giving an example of what this shape looks like in a detailed context.
        Parameters:
        scribe - shape painter
        modes - array of ErrorModes, one per error dimension (x, y, ...)
        width - total width of icon
        height - total height of icon
        xpad - internal horizontal padding of icon
        ypad - internal vertical padding of icon
      • supportsDimensionality

        public abstract boolean supportsDimensionality​(int ndim)
        Reports whether this shape can be used in a given dimensionality.
        Parameters:
        ndim - number of error dimensions to be used
        Returns:
        true iff this object can do rendering
      • createScribe

        public abstract MultiPointScribe createScribe​(int nthick)
        Returns an object that can turn offset arrays into painted shapes with configurable line thickness. If canThick() returns false, the parameter makes no difference.
        Parameters:
        nthick - non-negative line thickness, 0 is single-pixel
        Returns:
        shape painter
      • canThick

        public boolean canThick()
        Indicates whether variants of this shape with different line thicknesses are available. For some shapes, for instance filled rectangles, the line thickness makes no difference.
        Returns:
        true iff the argument to createScribe(int) makes any difference
      • getName

        public java.lang.String getName()
        Returns a user-readable name for this shape.
        Returns:
        shape name
      • toString

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

        public static MultiPointShape[] getOptionsError1d()
        Returns an array of instances which can render 1-dimensional (vertical) errors.
        Returns:
        selection of shapes
      • getOptionsError2d

        public static MultiPointShape[] getOptionsError2d()
        Returns an array of instances which can render 2-dimensional errors.
        Returns:
        selection of shapes
      • getOptionsError3d

        public static MultiPointShape[] getOptionsError3d()
        Returns an array of instances which can render 3-dimensional errors.
        Returns:
        selection of shapes
      • getOptionsEllipse

        public static MultiPointShape[] getOptionsEllipse()
        Returns an array of instances which is suitable for 2d ellipse-like applications.
        Returns:
        selection of shapes
      • getOptionsVector

        public static MultiPointShape[] getOptionsVector()
        Returns an array of instances which is suitable for vector-like applications.
        Returns:
        selection of shapes