|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.ttools.plot2.PlotPlacement
@Equality public class PlotPlacement
Aggregates a Surface and the Rectangle that it is placed within. It may also store decorations to be painted on top of the plot. Class instances themselves may be compared for equality, but don't do much else. Several static methods however are provided to assist in creating instances, in particular doing the non-trivial work to determine how much external space is required for legends etc.
Note instances of this class are not immutable, since the decoration list may be changed.
Constructor Summary | |
---|---|
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. |
Method Summary | ||
---|---|---|
static
|
calculateDataBounds(Rectangle extBounds,
SurfaceFactory<P,A> surfFact,
P profile,
A aspect,
boolean withScroll,
Icon legend,
float[] legPos,
String title,
ShadeAxis shadeAxis)
Determines the bounds for the data part of a plot given its external dimensions and other information about it. |
|
static
|
createPlacement(Rectangle extBounds,
SurfaceFactory<P,A> surfFact,
P profile,
A aspect,
boolean withScroll,
Icon legend,
float[] legPos,
String title,
ShadeAxis shadeAxis)
Convenience method to create a plot placement given various inputs. |
|
static Decoration[] |
createPlotDecorations(Surface surf,
Icon legend,
float[] legPos,
String title,
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()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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 laterMethod Detail |
---|
public 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 boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public static <P,A> PlotPlacement createPlacement(Rectangle extBounds, SurfaceFactory<P,A> surfFact, P profile, A aspect, boolean withScroll, Icon legend, float[] legPos, String title, ShadeAxis shadeAxis)
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 null
public static <P,A> Rectangle calculateDataBounds(Rectangle extBounds, SurfaceFactory<P,A> surfFact, P profile, A aspect, boolean withScroll, Icon legend, float[] legPos, String title, ShadeAxis shadeAxis)
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 null
public static Decoration[] createPlotDecorations(Surface surf, Icon legend, float[] legPos, 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 null
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |