@Equality public class PlotPlacement extends java.lang.Object
Note instances of this class are not immutable, since the decoration list may be changed.
Constructor and Description |
---|
PlotPlacement(java.awt.Rectangle bounds,
Surface surface)
Constructs a placement with no decorations.
|
PlotPlacement(java.awt.Rectangle bounds,
Surface surface,
Decoration[] decorations)
Constructs a placement with an initial list of decorations.
|
Modifier and Type | Method and Description |
---|---|
static <P,A> java.awt.Rectangle |
calculateDataBounds(java.awt.Rectangle extBounds,
Padding padding,
SurfaceFactory<P,A> surfFact,
P profile,
A aspect,
boolean withScroll,
javax.swing.Icon legend,
float[] legPos,
java.lang.String title,
ShadeAxis shadeAxis)
Determines the bounds for the data part of a plot given its
external dimensions and other information about it.
|
static <P,A> java.awt.Insets |
calculateDataInsets(java.awt.Rectangle extBounds,
SurfaceFactory<P,A> surfFact,
P profile,
A aspect,
boolean withScroll,
javax.swing.Icon legend,
float[] legPos,
java.lang.String title,
ShadeAxis shadeAxis,
int pad)
Determines the required insets for a plot to accommodate
axis annotations etc.
|
static <P,A> PlotPlacement |
createPlacement(java.awt.Rectangle extBounds,
Padding padding,
SurfaceFactory<P,A> surfFact,
P profile,
A aspect,
boolean withScroll,
javax.swing.Icon legend,
float[] legPos,
java.lang.String title,
ShadeAxis shadeAxis)
Convenience method to create a plot placement given various inputs.
|
static Decoration[] |
createPlotDecorations(Surface surf,
javax.swing.Icon legend,
float[] legPos,
java.lang.String title,
ShadeAxis shadeAxis)
Returns a list of plot decorations for things like the legend
and shade colour ramp.
|
javax.swing.Icon |
createPlotIcon(javax.swing.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(java.lang.Object o) |
java.awt.Rectangle |
getBounds()
Returns the external bounds of this placement.
|
java.util.List<Decoration> |
getDecorations()
Returns a list of decorations to be painted over the finished plot.
|
Surface |
getSurface()
Returns the plot surface.
|
int |
hashCode() |
public PlotPlacement(java.awt.Rectangle bounds, Surface surface)
bounds
- external bounds within which plot is to be placedsurface
- plot surfacepublic PlotPlacement(java.awt.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 java.awt.Rectangle getBounds()
public Surface getSurface()
public java.util.List<Decoration> getDecorations()
public javax.swing.Icon createPlotIcon(javax.swing.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 boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public static <P,A> PlotPlacement createPlacement(java.awt.Rectangle extBounds, Padding padding, SurfaceFactory<P,A> surfFact, P profile, A aspect, boolean withScroll, javax.swing.Icon legend, float[] legPos, java.lang.String title, 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 scrollinglegend
- legend icon if required, or nulllegPos
- legend position if intenal legend is required;
2-element (x,y) array, each element in range 0-1title
- title text, or nullshadeAxis
- shader axis if required, or nullpublic static <P,A> java.awt.Insets calculateDataInsets(java.awt.Rectangle extBounds, SurfaceFactory<P,A> surfFact, P profile, A aspect, boolean withScroll, javax.swing.Icon legend, float[] legPos, java.lang.String title, 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 scrollinglegend
- legend icon if required, or nulllegPos
- legend position if intenal legend is required;
2-element (x,y) array, each element in range 0-1title
- title text, or nullshadeAxis
- shader axis if required, or nullpad
- extra padding in pixels around the outsidepublic static <P,A> java.awt.Rectangle calculateDataBounds(java.awt.Rectangle extBounds, Padding padding, SurfaceFactory<P,A> surfFact, P profile, A aspect, boolean withScroll, javax.swing.Icon legend, float[] legPos, java.lang.String title, 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 scrollinglegend
- legend icon if required, or nulllegPos
- legend position if intenal legend is required;
2-element (x,y) array, each element in range 0-1title
- title text, or nullshadeAxis
- shader axis if required, or nullpublic static Decoration[] createPlotDecorations(Surface surf, javax.swing.Icon legend, float[] legPos, java.lang.String title, ShadeAxis shadeAxis)
surf
- plot surfacelegend
- legend icon if required, or nulllegPos
- legend position if intenal legend is required;
2-element (x,y) array, each element in range 0-1title
- title text, or nullshadeAxis
- shader axis if required, or nullCopyright © 2017 Central Laboratory of the Research Councils. All Rights Reserved.