@Equality public class PlotPlacement extends Object
Note instances of this class are not immutable, since the decoration list may be changed.
Modifier and Type | Field and Description |
---|---|
static int |
PAD
Default external padding in pixels to accommodate axis line width.
|
Constructor and Description |
---|
PlotPlacement(Rectangle bounds,
Surface surface)
Constructs a placement with no decorations.
|
PlotPlacement(Rectangle bounds,
Surface surface,
Decoration[] decorations)
Constructs a placement with an initial list of decorations.
|
Modifier and Type | Method and Description |
---|---|
static Surround |
calculateApproxDecorationSurround(Rectangle extBounds,
Trimming trimming,
ShadeAxis shadeAxis,
java.util.function.Supplier<Captioner> capFact)
Calculates the space surrounding a plot required for trimming and
shade axis.
|
static <P,A> Rectangle |
calculateDataBounds(Rectangle extBounds,
Padding padding,
SurfaceFactory<P,A> surfFact,
P profile,
A aspect,
boolean withScroll,
Trimming trimming,
ShadeAxis shadeAxis)
Determines the bounds for the data part of a plot given its
external dimensions and other information about it.
|
static <P,A> Insets |
calculateDataInsets(Rectangle extBounds,
SurfaceFactory<P,A> surfFact,
P profile,
A aspect,
boolean withScroll,
Trimming trimming,
ShadeAxis shadeAxis,
int pad)
Determines the required insets for a plot to accommodate
axis annotations etc.
|
static <P,A> PlotPlacement |
createPlacement(Rectangle extBounds,
Padding padding,
SurfaceFactory<P,A> surfFact,
P profile,
A aspect,
boolean withScroll,
Trimming trimming,
ShadeAxis shadeAxis)
Convenience method to create a plot placement given various inputs.
|
static Decoration[] |
createPlotDecorations(PlotFrame frame,
Trimming trimming,
ShadeAxis shadeAxis)
Returns a list of plot decorations for things like the legend
and shade colour ramp.
|
Icon |
createPlotIcon(Icon dataIcon)
Takes an icon containing plot background and layers,
and turns it into one positioned in an external rectangle
with surface foreground (axes) and other decorations.
|
boolean |
equals(Object o) |
Rectangle |
getBounds()
Returns the external bounds of this placement.
|
List<Decoration> |
getDecorations()
Returns a list of decorations to be painted over the finished plot.
|
Surface |
getSurface()
Returns the plot surface.
|
int |
hashCode() |
public static final int PAD
public PlotPlacement(Rectangle bounds, Surface surface)
bounds
- external bounds within which plot is to be placedsurface
- plot surfacepublic PlotPlacement(Rectangle bounds, Surface surface, Decoration[] decorations)
bounds
- external bounds within which plot is to be placedsurface
- plot surfacedecorations
- initial list of decorations;
note more can be added laterpublic Rectangle getBounds()
public Surface getSurface()
public List<Decoration> getDecorations()
public Icon createPlotIcon(Icon dataIcon)
dataIcon
- icon as generated by
PaperType.createDataIcon(uk.ac.starlink.ttools.plot2.Surface, uk.ac.starlink.ttools.plot2.Drawing[], java.lang.Object[], uk.ac.starlink.ttools.plot2.data.DataStore, boolean)
public static <P,A> PlotPlacement createPlacement(Rectangle extBounds, Padding padding, SurfaceFactory<P,A> surfFact, P profile, A aspect, boolean withScroll, Trimming trimming, ShadeAxis shadeAxis)
extBounds
- external bounds of plot placementpadding
- requirements for outer padding, or nullsurfFact
- surface factoryprofile
- factory-specific surface profileaspect
- factory-specific surface aspectwithScroll
- true if the placement should work well
with future scrollingtrimming
- specification for static decorations, or nullshadeAxis
- shader axis if required, or nullpublic static Surround calculateApproxDecorationSurround(Rectangle extBounds, Trimming trimming, ShadeAxis shadeAxis, java.util.function.Supplier<Captioner> capFact)
extBounds
- external bounds of plot placementtrimming
- specification for static decorations, or nullshadeAxis
- shader axis if required, or nullcapFact
- supplier for a Captioner;
may return null if no title is requiredpublic static <P,A> Insets calculateDataInsets(Rectangle extBounds, SurfaceFactory<P,A> surfFact, P profile, A aspect, boolean withScroll, Trimming trimming, ShadeAxis shadeAxis, int pad)
extBounds
- external bounds of plot placementsurfFact
- surface factoryprofile
- factory-specific surface profileaspect
- factory-specific surface aspectwithScroll
- true if the placement should work well
with future scrollingtrimming
- specification for static decorations, or nullshadeAxis
- shader axis if required, or nullpad
- extra padding in pixels around the outsidepublic static <P,A> Rectangle calculateDataBounds(Rectangle extBounds, Padding padding, SurfaceFactory<P,A> surfFact, P profile, A aspect, boolean withScroll, Trimming trimming, ShadeAxis shadeAxis)
extBounds
- external bounds of plot placementpadding
- preferences for outer padding, or nullsurfFact
- surface factoryprofile
- factory-specific surface profileaspect
- factory-specific surface aspectwithScroll
- true if the placement should work well
with future scrollingtrimming
- specification for static decorations, or nullshadeAxis
- shader axis if required, or nullpublic static Decoration[] createPlotDecorations(PlotFrame frame, Trimming trimming, ShadeAxis shadeAxis)
frame
- geometry of area to be decoratedtrimming
- specification for static decorations, or nullshadeAxis
- shader axis if required, or nullCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.