public abstract class Plot3D extends TablePlot
Modifier and Type | Class and Description |
---|---|
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.
|
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected double[] |
hiBounds_ |
protected double[] |
hiBoundsG_ |
protected double[] |
loBounds_ |
protected double[] |
loBoundsG_ |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
Plot3D()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
addPlotListener, calculateBounds, firePlotChangedLater, getState, isVectorContext, removePlotListener
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected double[] loBounds_
protected double[] hiBounds_
protected double[] loBoundsG_
protected double[] hiBoundsG_
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 statestate
'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 returnPlotVolume.PlotVolume(java.awt.Component, java.awt.Graphics, uk.ac.starlink.ttools.plot.MarkStyle[], double, int[], double)
protected abstract boolean frontOnly(Plot3DState state)
state
- plot stateprotected 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
public 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 pointspublic 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 axispublic 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
- errorCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.