|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
uk.ac.starlink.ttools.plot.TablePlot
uk.ac.starlink.ttools.plot.Plot3D
public abstract class Plot3D
Component which paints a 3d plot.
Nested Class Summary | |
---|---|
protected static class |
Plot3D.RangeChecker
Interface for checking that a 3-d coordinate is in range. |
protected static class |
Plot3D.Transformer3D
Transforms points in 3d data space to points in 3d graphics space. |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected double[] |
hiBounds_
|
protected double[] |
hiBoundsG_
|
protected double[] |
loBounds_
|
protected double[] |
loBoundsG_
|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
Plot3D()
Constructor. |
Method Summary | |
---|---|
protected abstract Plot3D.RangeChecker |
configureRanges(Plot3DState state)
Provides notification that the range constraints are now as described in a supplied state object. |
protected abstract boolean |
frontOnly(Plot3DState state)
Indicates whether only the front part of the plot should be plotted. |
protected abstract boolean[] |
get3DLogFlags()
Returns an array of 3 flags which indicate whether logarithmic scaling is in force on the X, Y and Z axes respectively. |
Rectangle |
getDisplayBounds()
Returns the bounds of the apparent display area. |
protected abstract double |
getPadding(Plot3DState state,
Graphics g,
int[] padBorders)
Works out padding factors to be used for the plot volume. |
Rectangle |
getPlotBounds()
Returns the bounds of the actual plotting area. |
PointIterator |
getPlottedPointIterator()
Returns an iterator over the points plotted last time this component painted itself. |
PointPlacer |
getPointPlacer()
Returns a point placer for mapping 3D data points to the screen. |
protected static boolean |
logize(double[] coords,
boolean[] logFlags)
Converts coordinates to logarithmic values if necessary. |
protected boolean |
paintMemoryError(OutOfMemoryError e)
Hook for handling OutOfMemoryErrors which may be generated during plotting. |
protected abstract void |
plotAxes(Plot3DState state,
Graphics g,
Plot3D.Transformer3D trans,
PlotVolume vol,
boolean front)
Draws grid lines which contain all the known points. |
static double[] |
rotate(double[] base,
double[] screenAxis,
double theta)
Calculates a rotation matrix for rotating around a screen axis by a given angle. |
static double[] |
rotateXY(double[] base,
double phi,
double psi)
Takes a view rotation matrix and adds to it the effect of rotations about X and Y directions. |
void |
setState(PlotState state)
Sets the plot state for this plot. |
protected static boolean |
transformErrors(Plot3D.Transformer3D trans,
Plot3D.RangeChecker ranger,
boolean[] logFlags,
double[][] errors,
double[] xerrs,
double[] yerrs,
double[] zerrs)
Transforms errors from the form they assume in input data (offsets to a central data point in data space) to a set of absolute coordinates of points in the transformed graphics space. |
Methods inherited from class uk.ac.starlink.ttools.plot.TablePlot |
---|
addPlotListener, calculateBounds, firePlotChangedLater, getState, isVectorContext, removePlotListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected double[] loBounds_
protected double[] hiBounds_
protected double[] loBoundsG_
protected double[] hiBoundsG_
Constructor Detail |
---|
public Plot3D()
Method Detail |
---|
protected abstract Plot3D.RangeChecker configureRanges(Plot3DState state)
state
object.
A suitable Plot3D.RangeChecker
object should be returned,
but the implementation should take care of any other updates to
its internal state which are required as well.
state
- plot state
state
's range
constraintsprotected abstract double getPadding(Plot3DState state, Graphics g, int[] padBorders)
padFactor
; the amount of
space outside the unit cube in both dimensions. 1 means no
extra space. The padBorders
array is a 4-element
array whose values on entry are ignored; on exit it should contain
space, additional to padFactor
, to be left around
the edges of the plot. The order is (left,right,bottom,top).
state
- plot stateg
- graphics contextpadBorders
- 4-element array, filled on return
PlotVolume.PlotVolume(java.awt.Component, java.awt.Graphics, uk.ac.starlink.ttools.plot.MarkStyle[], double, int[], double)
protected abstract boolean frontOnly(Plot3DState state)
state
- plot state
protected abstract boolean[] get3DLogFlags()
protected abstract void plotAxes(Plot3DState state, Graphics g, Plot3D.Transformer3D trans, PlotVolume vol, boolean front)
front
parameter,
either the lines which are behind all the data points,
or the lines which are in front of all the data points are drawn.
Thus, the routine needs to be called twice to plot all the lines.
The graphics context has had all the customisation it needs.
state
- plot stateg
- graphics contexttrans
- transformer which maps data space to 3d graphics spacevol
- the plotting volume onto which the plot is donefront
- true for lines in front of data, false for lines behindpublic void setState(PlotState state)
TablePlot
setState
in class TablePlot
state
- plot statepublic Rectangle getPlotBounds()
getPlotBounds
in class TablePlot
public Rectangle getDisplayBounds()
public PointIterator getPlottedPointIterator()
public PointPlacer getPointPlacer()
protected static boolean logize(double[] coords, boolean[] logFlags)
coords
array holds the input values on entry,
and each of these will be turned into logarithms of themselves
on exit iff the corresponding element of the logFlags array is
true.
The return value will be true if the conversion went OK, and
false if it couldn't be done for at least one coordinate,
because it was non-positive.
coords
- 3-element coordinate arrayprotected static boolean transformErrors(Plot3D.Transformer3D trans, Plot3D.RangeChecker ranger, boolean[] logFlags, double[][] errors, double[] xerrs, double[] yerrs, double[] zerrs)
loErrs
, hiErrs
) is as determined by the
PlotData
object.
The number and ordering of the output data points
(xerrs
, yerrs
, zerrs
)
are as required by ErrorRenderer
objects.
Points which don't represent errors, either because they have
zero offsets or because they fall outside of the range of this 3D plot,
are represented in the output coordinates as Double.NaN
.
The return value indicates whether any of the transformed values
have non-blank values - if false, then error drawing is pointless.
trans
- data space -> graphics space transformerranger
- range checker - anything out of range will be discardedlogFlags
- flags for which axes will be plotted logarithmicallyerrors
- data space error points, in pairsxerrs
- graphics space X coordinates for error pointsyerrs
- graphics space Y coordinates for error pointszerrs
- graphics space Z coordinates for error points
public static double[] rotateXY(double[] base, double phi, double psi)
base
- 9-element array giving initial view rotation matrixphi
- angle to rotate around Y axispsi
- angle to rotate around X axis
public static double[] rotate(double[] base, double[] screenAxis, double theta)
base
- rotation matrix defining the view orientation
(9-element array)screenAxis
- axis in view space about which rotation is required
(3-element array)theta
- rotation angle in radiansprotected boolean paintMemoryError(OutOfMemoryError e)
e
- error
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |