uk.ac.starlink.ttools.plot2.paper
Class PaperTypeSelector

java.lang.Object
  extended by uk.ac.starlink.ttools.plot2.paper.PaperTypeSelector

public abstract class PaperTypeSelector
extends Object

Provides interface and logic for determining what PaperType (rendering machinery) to use to render a given selection of plot layers to a given output medium. A PlotType provides an instance of this class.

Since:
14 Feb 2013
Author:
Mark Taylor

Field Summary
static PaperTypeSelector SELECTOR_2D
          Default selector for 2d output.
static PaperTypeSelector SELECTOR_3D
          Default selector for 3d output.
 
Constructor Summary
PaperTypeSelector()
           
 
Method Summary
static PaperTypeSelector createSingleSelector(PaperType ptype)
          Returns a selector which always returns a fixed paper type.
static LayerOpt[] getOpts(PlotLayer[] layers)
          Returns an array of layer options corresponding to an array of layers.
abstract  PaperType getPixelPaperType(LayerOpt[] opts, Compositor compositor, Component component)
          Supplies a PaperType appropriate for rendering to a bitmap (pixellated) output medium.
abstract  PaperType getVectorPaperType(LayerOpt[] opts)
          Supplies a PaperType appropriate for rendering to a vector (non-pixellated) output medium.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECTOR_2D

public static PaperTypeSelector SELECTOR_2D
Default selector for 2d output.


SELECTOR_3D

public static PaperTypeSelector SELECTOR_3D
Default selector for 3d output.

Constructor Detail

PaperTypeSelector

public PaperTypeSelector()
Method Detail

getVectorPaperType

public abstract PaperType getVectorPaperType(LayerOpt[] opts)
Supplies a PaperType appropriate for rendering to a vector (non-pixellated) output medium.

Parameters:
opts - layer options
Returns:
paper type

getPixelPaperType

public abstract PaperType getPixelPaperType(LayerOpt[] opts,
                                            Compositor compositor,
                                            Component component)
Supplies a PaperType appropriate for rendering to a bitmap (pixellated) output medium.

If a component is supplied, it indicates the component on which this paper will be rendered. It is legal to supply a null component if the destination component is unavailable (including if it is headless). Note the supplied component need not be the actual one it's going to be rendered on, but it should be similar in terms of graphics configuration, background colour etc.

Parameters:
opts - layer options
compositor - compositor for combining colours (relevant only if some transparency is present)
component - destination component, or component similar to destination component, or null
Returns:
paper type

createSingleSelector

public static PaperTypeSelector createSingleSelector(PaperType ptype)
Returns a selector which always returns a fixed paper type. This is only useful for debugging.

Parameters:
ptype - fixed paper type
Returns:
selector

getOpts

public static LayerOpt[] getOpts(PlotLayer[] layers)
Returns an array of layer options corresponding to an array of layers.

Parameters:
layers - layers
Returns:
layer options, same length as layers array


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.