Class StackGanger<P,A>

java.lang.Object
uk.ac.starlink.ttools.plot2.geom.StackGanger<P,A>
All Implemented Interfaces:
Ganger<P,A>
Direct Known Subclasses:
TimeStackGanger

public abstract class StackGanger<P,A> extends Object implements Ganger<P,A>
Ganger implementation for a vertically stacked gang of plots, all sharing the same horizontal axis.
Since:
25 Jan 2016
Author:
Mark Taylor
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    StackGanger(String[] zoneNames, boolean isUp, Padding padding)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    A[]
    adjustAspects(A[] aspects, int index)
    Adjusts plot surface aspects as required to ensure that plot data regions in a ganged set of zones are consistent.
    P[]
    adjustProfiles(P[] profiles)
    Adjusts plot surface profiles as required for plots appearing in multiple plots within a gang.
    Constructs an approximate gang instance given only minimal information.
    createGang(Rectangle[] zonePlotBounds)
    Creates a gang given the graphics coordinates of the individual zones.
    createGang(Rectangle gangExtBox, SurfaceFactory<P,A> surfFact, ZoneContent<P,A>[] contents, Trimming[] trimmings, ShadeAxis[] shadeAxes, boolean withScroll)
    Creates a gang given the external bounds for the whole plotting area and other required information that characterises each zone.
    abstract A
    fixXLimits(A aspect, double xmin, double xmax)
    Modifies an aspect object to give it fixed data limits on the horizontal axis.
    abstract double[]
    getXLimits(A aspect)
    Returns the data limits of the horizontal axis defined by a given aspect.
    int
    Returns the number of zones in gangs produced by this ganger.
    Returns a list of identifiers, one for each zone in gangs produced by this ganger.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface uk.ac.starlink.ttools.plot2.Ganger

    isShadingGlobal, isTrimmingGlobal
  • Constructor Details

    • StackGanger

      protected StackGanger(String[] zoneNames, boolean isUp, Padding padding)
      Constructor. The supplied padding is currently applied outside each plot zone. That's not the only way to do it; you could imagine wanting to apply this padding outside the union of plot zones, or to be able to supply different paddings for each zone.
      Parameters:
      zoneNames - one string identifier for each required zone
      isUp - true if zones are ordered upwards on the graphics plane, false if they go down
      padding - defines user preferences, if any, for space reserved outside each plot zone
  • Method Details

    • getXLimits

      public abstract double[] getXLimits(A aspect)
      Returns the data limits of the horizontal axis defined by a given aspect.
      Parameters:
      aspect - surface aspect
      Returns:
      2-element array giving (min,max) values of data coordinates on the horizontal axis
    • fixXLimits

      public abstract A fixXLimits(A aspect, double xmin, double xmax)
      Modifies an aspect object to give it fixed data limits on the horizontal axis.
      Parameters:
      aspect - input surface aspect
      xmin - required lower limit on horizontal axis
      xmax - required upper limit on horizontal axis
      Returns:
      new aspect resembling input aspect but with supplied horizontal axis limits
    • getZoneCount

      public int getZoneCount()
      Description copied from interface: Ganger
      Returns the number of zones in gangs produced by this ganger.
      Specified by:
      getZoneCount in interface Ganger<P,A>
      Returns:
      zone count
    • getZoneNames

      public String[] getZoneNames()
      Returns a list of identifiers, one for each zone in gangs produced by this ganger.
      Returns:
      zone names
    • createGang

      public Gang createGang(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(Rectangle gangExtBox, SurfaceFactory<P,A> surfFact, ZoneContent<P,A>[] contents, Trimming[] trimmings, 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.

      The form of the trimmings and shadeAxes arrays are as determined by the Ganger.isTrimmingGlobal() and Ganger.isShadingGlobal() methods; the length of each respective array must be one for the global case, and the same as the length of the zoneContents array in the per-zone case.

      Specified by:
      createGang in interface Ganger<P,A>
      Parameters:
      gangExtBox - total area enclosing all zones and associated axis labels, annotations etc
      surfFact - surface factory
      contents - plot content for each zone (nz-element array)
      trimmings - additional decorations (1- or nz-element array, elements may be null)
      shadeAxes - shading axes (1- or nz-element array, elements may be null)
      withScroll - true if the positioning should work well even after some user scrolling
      Returns:
      new gang
    • createApproxGang

      public Gang createApproxGang(Rectangle extBounds)
      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
      Returns:
      new approximate gang
    • adjustAspects

      public A[] adjustAspects(A[] aspects, int index)
      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 reference index greater than or equal to 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:
      aspects - unadjusted aspects
      index - 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[] profiles)
      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:
      profiles - unadjusted profiles
      Returns:
      array of consistent profiles based on input array, same size as input