|
|||||||||
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.plot2.task.PlotDisplay<P,A>
public class PlotDisplay<P,A>
Graphical component which displays a plot. The plot is in general 'live', and may repaint itself differently over its lifetime according to user navigation actions, window size, and underlying data, depending on how it is configured.
This class can be used as-is, or as a template.
Nested Class Summary |
---|
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 | |
---|---|
static String |
ASPECT_PROPERTY
Name of property that changes when plot Aspect is reset. |
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 | |
---|---|
PlotDisplay(PlotLayer[] layers,
SurfaceFactory<P,A> surfFact,
P profile,
A aspect,
Icon legend,
float[] legPos,
String title,
ShadeAxisFactory shadeFact,
Range shadeFixRange,
PaperTypeSelector ptSel,
Compositor compositor,
DataStore dataStore,
boolean surfaceAuxRange,
Navigator<A> navigator,
boolean caching)
Constructor. |
Method Summary | ||
---|---|---|
void |
addPointSelectionListener(PointSelectionListener psl)
Adds a listener which will be notified when the user clicks on the plot region to select a point. |
|
void |
clearPlot()
Clears the current cached plot image, if any, so that regeneration of the image from the data is forced when the next paint operation is performed; otherwise it may be copied from a cached image. |
|
static Icon |
createIcon(PlotPlacement placer,
PlotLayer[] layers,
Map<AuxScale,Range> auxRanges,
DataStore dataStore,
PaperType paperType,
boolean cached)
Creates an icon which will paint the content of this plot. |
|
static
|
createPlotDisplay(PlotLayer[] layers,
SurfaceFactory<P,A> surfFact,
ConfigMap config,
Icon legend,
float[] legPos,
String title,
ShadeAxisFactory shadeFact,
Range shadeFixRange,
PaperTypeSelector ptSel,
Compositor compositor,
DataStore dataStore,
boolean surfaceAuxRange,
boolean navigable,
boolean caching)
Creates a new PlotDisplay, interrogating a supplied ConfigMap object. |
|
A |
getAspect()
Returns the most recently set aspect. |
|
static Map<AuxScale,Range> |
getAuxRanges(PlotLayer[] layers,
Surface surface,
Range shadeFixRange,
ShadeAxisFactory shadeFact,
DataStore dataStore)
Gathers requested ranging information from data. |
|
Surface |
getSurface()
Returns the most recently used plot surface. |
|
void |
invalidate()
|
|
protected void |
paintComponent(Graphics g)
|
|
void |
removePointSelectionListener(PointSelectionListener psl)
Removes a previously added point selection listener. |
|
void |
setAspect(A aspect)
Sets the surface aspect. |
|
void |
setDataInsets(Insets dataInsets)
Sets the geometry of the region between the external bound of this component (excluding component borders) and the data region of the plot. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String ASPECT_PROPERTY
Constructor Detail |
---|
public PlotDisplay(PlotLayer[] layers, SurfaceFactory<P,A> surfFact, P profile, A aspect, Icon legend, float[] legPos, String title, ShadeAxisFactory shadeFact, Range shadeFixRange, PaperTypeSelector ptSel, Compositor compositor, DataStore dataStore, boolean surfaceAuxRange, Navigator<A> navigator, boolean caching)
layers
- layers constituting plot contentsurfFact
- surface factoryprofile
- surface profileaspect
- initial surface aspect (may get changed by zooming etc)legend
- legend icon, or null if none requiredlegPos
- 2-element array giving x,y fractional legend placement
position within plot (elements in range 0..1),
or null for external legendtitle
- plot title, or nullshadeFact
- makes shader axes, or null if not requiredshadeFixRange
- fixed shader range,
or null for auto-range where requiredptSel
- paper type selectorcompositor
- compositor for pixel compositiondataStore
- data storage objectsurfaceAuxRange
- determines whether aux ranges are recalculated
when the surface changesnavigator
- user gesture navigation controller,
or null for a non-interactive plotcaching
- if true, plot image will be cached where applicable,
if false it will be regenerated from the data
on every repaintMethod Detail |
---|
public void clearPlot()
invalidate()
,
but may also be called manually, for instance if the data in the
data store may have changed.
This method has no effect if caching is not in force.
public void addPointSelectionListener(PointSelectionListener psl)
psl
- listener to addpublic void removePointSelectionListener(PointSelectionListener psl)
psl
- listener to removepublic void invalidate()
invalidate
in class Container
protected void paintComponent(Graphics g)
paintComponent
in class JComponent
public void setAspect(A aspect)
aspect
- new aspectpublic A getAspect()
public Surface getSurface()
public void setDataInsets(Insets dataInsets)
dataInsets
- geometry of the region outside the actual data plot@Slow public static <P,A> PlotDisplay createPlotDisplay(PlotLayer[] layers, SurfaceFactory<P,A> surfFact, ConfigMap config, Icon legend, float[] legPos, String title, ShadeAxisFactory shadeFact, Range shadeFixRange, PaperTypeSelector ptSel, Compositor compositor, DataStore dataStore, boolean surfaceAuxRange, boolean navigable, boolean caching)
layers
- layers constituting plot contentsurfFact
- surface factoryconfig
- map containing surface profile, initial aspect
and navigator configurationlegend
- legend icon, or null if none requiredlegPos
- 2-element array giving x,y fractional legend placement
position within plot (elements in range 0..1),
or null for external legendtitle
- plot title, or nullshadeFact
- makes shader axis, or null if not requiredshadeFixRange
- fixed shader range,
or null for auto-range where requiredptSel
- paper type selectorcompositor
- compositor for pixel compositiondataStore
- data storage objectsurfaceAuxRange
- determines whether aux ranges are recalculated
when the surface changesnavigable
- true for an interactive plotcaching
- if true, plot image will be cached where applicable,
if false it will be regenerated from the data
on every repaint
@Slow public static Icon createIcon(PlotPlacement placer, PlotLayer[] layers, Map<AuxScale,Range> auxRanges, DataStore dataStore, PaperType paperType, boolean cached)
placer
- plot placementlayers
- layers constituting plot contentauxRanges
- requested range information calculated from datadataStore
- data storage objectpaperType
- rendering typecached
- whether to cache pixels for future use@Slow public static Map<AuxScale,Range> getAuxRanges(PlotLayer[] layers, Surface surface, Range shadeFixRange, ShadeAxisFactory shadeFact, DataStore dataStore)
layers
- plot layerssurface
- plot surfaceshadeFixRange
- fixed shade range limits, if anyshadeFact
- makes shader axis, or nulldataStore
- data storage object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |