Class SingleGanger<P,​A>

  • All Implemented Interfaces:
    Ganger<P,​A>

    public class SingleGanger<P,​A>
    extends java.lang.Object
    implements Ganger<P,​A>
    Ganger implementation for single-zone gangs.
    Since:
    25 Jan 2016
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      SingleGanger()
      Constructs a ganger with no specified padding.
      SingleGanger​(Padding padding)
      Constructs a ganger with specified padding.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      A[] adjustAspects​(A[] oldAspects, int iz)
      Adjusts plot surface aspects as required to ensure that plot data regions in a ganged set of zones are consistent.
      P[] adjustProfiles​(P[] oldProfiles)
      Adjusts plot surface profiles as required for plots appearing in multiple plots within a gang.
      Gang createApproxGang​(java.awt.Rectangle extBounds, int nz)
      Constructs an approximate gang instance given only minimal information.
      static <P,​A>
      GangerFactory<P,​A>
      createFactory​(PlotType<P,​A> plotType)
      Returns a factory that creates SingleGangers.
      Gang createGang​(java.awt.Rectangle[] zonePlotBounds)
      Creates a gang given the graphics coordinates of the individual zones.
      Gang createGang​(java.awt.Rectangle extBounds, SurfaceFactory<P,​A> surfFact, int nz, ZoneContent[] contents, P[] profiles, A[] aspects, ShadeAxis[] shadeAxes, boolean withScroll)
      Creates a gang given the external bounds for the whole plotting area and other required information that characterises each zone.
      • Methods inherited from class java.lang.Object

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

      • SingleGanger

        public SingleGanger()
        Constructs a ganger with no specified padding.
      • SingleGanger

        public SingleGanger​(Padding padding)
        Constructs a ganger with specified padding.
        Parameters:
        padding - defines user preferences, if any, for space reserved for annotations
    • Method Detail

      • createGang

        public Gang createGang​(java.awt.Rectangle[] zonePlotBounds)
        Description copied from interface: Ganger
        Creates a gang given the graphics coordinates of the individual zones. This can be used if the layout of the zones is already known.

        The supplied rectangle arguments give the bounds of the data area for each zone. This does not include any space for axis labels and other annotations, which are assumed to be available as required.

        Specified by:
        createGang in interface Ganger<P,​A>
        Parameters:
        zonePlotBounds - array of data bounds, one for each zone
        Returns:
        new gang
      • createGang

        public Gang createGang​(java.awt.Rectangle extBounds,
                               SurfaceFactory<P,​A> surfFact,
                               int nz,
                               ZoneContent[] contents,
                               P[] profiles,
                               A[] aspects,
                               ShadeAxis[] shadeAxes,
                               boolean withScroll)
        Description copied from interface: Ganger
        Creates a gang given the external bounds for the whole plotting area and other required information that characterises each zone. The supplied aspects are not modified by this method; any required aspect resolution should be performed before calling it.
        Specified by:
        createGang in interface Ganger<P,​A>
        Parameters:
        extBounds - total area enclosing all zones and associated axis labels, annotations etc
        surfFact - surface factory
        nz - number of zones
        contents - plot content for each zone (nz-element array)
        profiles - profile for each zone (nz-element array)
        aspects - aspect for each zone (nz-element array)
        shadeAxes - shading axis for each zone (nz-element array, elements may be empty)
        withScroll - true if the positioning should work well even after some user scrolling
        Returns:
        new gang
      • createApproxGang

        public Gang createApproxGang​(java.awt.Rectangle extBounds,
                                     int nz)
        Description copied from interface: Ganger
        Constructs an approximate gang instance given only minimal information. This may be sufficient for passing the user a visual indication of roughly how zones are arranged, or making initial guesses at zone dimensions.
        Specified by:
        createApproxGang in interface Ganger<P,​A>
        Parameters:
        extBounds - total area enclosing all zones and associated axis labels, annotations etc
        nz - number of zones
        Returns:
        new approximate gang
      • adjustAspects

        public A[] adjustAspects​(A[] oldAspects,
                                 int iz)
        Description copied from interface: Ganger
        Adjusts plot surface aspects as required to ensure that plot data regions in a ganged set of zones are consistent.

        If a zero reference index greater than zero is supplied, this denotes the "master" zone, to which the other aspects should be adjusted. Otherwise, the aspects should be adjusted more democratically, treating all their requirements equally. With a reference index the other aspects might be adjusted to equal the master one, and without they might all be adjusted to cover the union of the ranges defined. If the reference index is >= the number of zones, behaviour is undefined.

        Specified by:
        adjustAspects in interface Ganger<P,​A>
        Parameters:
        oldAspects - unadjusted aspects
        iz - index of reference aspect in array, or -1 for no reference
        Returns:
        array of consistent aspects based on input array, same size as input
      • adjustProfiles

        public P[] adjustProfiles​(P[] oldProfiles)
        Description copied from interface: Ganger
        Adjusts plot surface profiles as required for plots appearing in multiple plots within a gang.
        Specified by:
        adjustProfiles in interface Ganger<P,​A>
        Parameters:
        oldProfiles - unadjusted profiles
        Returns:
        array of consistent profiles based on input array, same size as input
      • createFactory

        public static <P,​A> GangerFactory<P,​A> createFactory​(PlotType<P,​A> plotType)
        Returns a factory that creates SingleGangers.
        Parameters:
        plotType - plot type, only used for generic typing
        Returns:
        ganger factory