|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.ttools.plot.PlotVolume
public abstract class PlotVolume
Plots 3D points on a 2D graphics context. This is an abstract class which does much of the common work but stops short of actually drawing the points. The main problem to be solved by concrete subclasses is that of ensuring that pixels 'in front' (ones with larger Z coordinates) obscure those 'behind'.
To enable strategies which may require some kind of sorting on a
full set of points prior to doing any plotting, clients of this class
must first submit all the points to be plotted using the
plot3D
methods,
and finally call flush()
to ensure that the plotting has
taken place.
Constructor Summary | |
---|---|
protected |
PlotVolume(Component c,
Graphics g,
MarkStyle[] styles,
double padFactor,
int[] padBorders,
double fogginess)
Constructor. |
Method Summary | |
---|---|
DataColorTweaker |
createFoggingTweaker(DataColorTweaker tweaker)
|
abstract void |
flush()
Ensures that all points submitted through the plot
method have been painted on the graphics context. |
Fogger |
getFogger()
Returns the fogger used for rendering depth effects. |
Graphics |
getGraphics()
Returns this object's graphics context. |
int |
getScale()
Returns the scaling constant for this volume. |
MarkStyle[] |
getStyles()
Returns the array of styles whose markers can be plotted on this volume. |
static int |
packRgba(float[] rgba)
Utility method to convert an RGBA float[] array into an integer. |
protected abstract void |
plot2d(int px,
int py,
double z,
double[] coords,
int istyle,
boolean showPoint,
String label,
int nerr,
int[] xoffs,
int[] yoffs,
double[] zerrs)
Plots an marker and optional associated error values at a given point in graphics coordinates with given additional Z coordinates. |
boolean |
plot3d(double[] centre,
int istyle,
boolean showPoint,
String label,
int nerr,
double[] xerrs,
double[] yerrs,
double[] zerrs)
Submits a point with associated errors for plotting. |
int |
projectX(double x)
Determines the integer X value in graphics space from an X value in normalised 3d space. |
int |
projectY(double y)
Determines the integer Y value in graphics space from a Y value in normalised 3d space. |
static void |
unpackRgba(int rgba,
float[] buf)
Utility method to convert an RGBA integer into a float[] array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected PlotVolume(Component c, Graphics g, MarkStyle[] styles, double padFactor, int[] padBorders, double fogginess)
c
- component on which points will be plottedg
- graphics context on which points will be plottedstyles
- array of marker styles which may be used to plotpadFactor
- minimum amount of space outside the unit cube
in both dimensions - 1 means no extra spacepadBorders
- space, additional to padFactor, to be left around
the edges of the plot; order is (left,right,bottom,top)fogginess
- thickness of fog for depth shadingMethod Detail |
---|
public MarkStyle[] getStyles()
public int getScale()
public Fogger getFogger()
public boolean plot3d(double[] centre, int istyle, boolean showPoint, String label, int nerr, double[] xerrs, double[] yerrs, double[] zerrs)
flush()
.
The 3D point coordinates (one central point in centre
and
nerr
additional points in
xerrs
, yerrs
, zerrs
) are in
normalised coordinates, in which points inside the unit cube
centred at (.5,.5,.5) are intended to be visible under normal
circumstances.
The ordering of the error points is that required by the
ErrorRenderer
class.
Note that the centre
array is not guaranteed to retain
its contents after this call returns; this method must make copies
of the values if it needs to retain them.
The return value indicates whether the point was actually plotted; it may be false if the point was known to be off screen. This isn't guaranteed to be exact; there may be false positives or false negatives near the edge of the plotting area.
centre
- normalised (x,y,z) coordinates of main pointistyle
- index into the array of styles set up for this volume
which will define how the marker is plottedshowPoint
- whether the central point is to be plottedlabel
- label for point, or nullnerr
- the number of error points, or zero for no errorsxerrs
- nerr
-element array of X coordinates of
error pointsyerrs
- nerr
-element array of Y coordinates of
error pointszerrs
- nerr
-element array of Z coordinates of
error points
public int projectX(double x)
x
- normalised space X coordinate
public int projectY(double y)
y
- normalised space Y coordinate
protected abstract void plot2d(int px, int py, double z, double[] coords, int istyle, boolean showPoint, String label, int nerr, int[] xoffs, int[] yoffs, double[] zerrs)
ErrorRenderer
class.
Most implementations currently ignore the Z values associated with the error points, and put everything at the depth of the central point, because it's too hard to do otherwise. Does this produce seriously confusing visualisation?
px
- graphics space X coordinate of the central pointpy
- graphics space Y coordinate of the central pointz
- depth of point; a point with a greater z
should obscure a point with a lesser onecoords
- original coordinate array; as well as (redundant)
x,y,z values it may contain auxiliary axis coordinatesistyle
- index of the style used to plot the pointshowPoint
- whether the central point is to be plottedlabel
- label for point, or nullnerr
- number of error points, or zero for no errorsxoffs
- nerr
-element array of graphics space
X coordinates for error pointsyoffs
- nerr
-element array of graphics space
Y coordinates for error pointszerrs
- nerr
-element array of depths for
error pointspublic abstract void flush()
plot
method have been painted on the graphics context.
public Graphics getGraphics()
public DataColorTweaker createFoggingTweaker(DataColorTweaker tweaker)
public static int packRgba(float[] rgba)
rgba
- float array
public static void unpackRgba(int rgba, float[] buf)
rgba
- integerbuf
- 4-element float array to receive result
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |