Package adams.gui.visualization.spectrum
Class SpectrumPaintlet
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.visualization.core.AbstractPaintlet
-
- adams.gui.visualization.core.AbstractStrokePaintlet
-
- adams.gui.visualization.container.AbstractDataContainerPaintlet
-
- adams.gui.visualization.spectrum.AbstractSpectrumPaintlet
-
- adams.gui.visualization.spectrum.SpectrumPaintlet
-
- All Implemented Interfaces:
adams.core.Destroyable,adams.core.GlobalInfoSupporter,adams.core.logging.LoggingLevelHandler,adams.core.logging.LoggingSupporter,adams.core.option.OptionHandler,adams.core.ShallowCopySupporter<adams.gui.visualization.core.Paintlet>,adams.core.SizeOfHandler,adams.gui.core.AntiAliasingSupporter,adams.gui.visualization.core.Paintlet,adams.gui.visualization.core.PaintletWithMarkers,Serializable
- Direct Known Subclasses:
ReportColorSpectrumPaintlet,SpectrumPaintletNumericField,SpectrumPaintletStringField
public class SpectrumPaintlet extends AbstractSpectrumPaintlet implements adams.gui.core.AntiAliasingSupporter, adams.gui.visualization.core.PaintletWithMarkers
Paintlet for painting the spectral graph.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-stroke-thickness <float> (property: strokeThickness) The thickness of the stroke. default: 1.0 minimum: 0.01
-markers-extent <int> (property: markerExtent) The size of the markers in pixels. default: 7 minimum: 0
-markers-disabled <boolean> (property: markersDisabled) If set to true, the markers are disabled. default: false
-always-show-markers <boolean> (property: alwaysShowMarkers) If set to true, the markers are always displayed, not just when zoomed in. default: true
-anti-aliasing-enabled <boolean> (property: antiAliasingEnabled) If enabled, uses anti-aliasing for drawing lines. default: true
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSpectrumPaintlet.MarkerShapeEnum for the marker shape to plot around the data points.
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_AlwaysShowMarkerswhether to show markers all the time.protected booleanm_AntiAliasingEnabledwhether anti-aliasing is enabled.protected intm_MarkerExtentthe maximum width/height of the shape to plot around the points (= data point marker), if there's enough space.protected booleanm_MarkersEnabledindicates whether marker shapes are painted or not.protected booleanm_PaintAllwhether to paint all the data points (no optimization).
-
Constructor Summary
Constructors Constructor Description SpectrumPaintlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringalwaysShowMarkersTipText()Returns the tip text for this property.StringantiAliasingEnabledTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.protected voiddoPerformPaint(Graphics g, adams.gui.event.PaintEvent.PaintMoment moment)The paint routine of the paintlet.protected voiddrawData(Graphics g, Spectrum data, Color color, SpectrumPaintlet.MarkerShape marker)Draws the data with the given color.booleangetAlwaysShowMarkers()Returns whether marker shapes are always drawn.ColorgetColor(int index)Returns the color for the data with the given index.intgetMarkerExtent()Returns the current marker extent (which is the width and height of the shape).protected SpectrumPaintlet.MarkerShapegetMarkerShape(int index)Determines the shape to paint around the data points, based on the index of the data.booleangetPaintAll()Returns whether marker shapes are disabled.adams.gui.event.PaintEvent.PaintMomentgetPaintMoment()Returns when this paintlet is to be executed.SpectrumPanelgetSpectrumPanel()Returns the currently set total ion count panel, can be null.StringglobalInfo()Returns a string describing the object.booleanisAntiAliasingEnabled()Returns whether anti-aliasing is used.booleanisMarkersDisabled()Returns whether marker shapes are disabled.StringmarkerExtentTipText()Returns the tip text for this property.StringmarkersDisabledTipText()Returns the tip text for this property.StringpaintAllTipText()Returns the tip text for this property.voidsetAlwaysShowMarkers(boolean value)Sets whether to always draw markers.voidsetAntiAliasingEnabled(boolean value)Sets whether to use anti-aliasing.voidsetMarkerExtent(int value)Sets the extent (width and height of the shape around the plotted point). 0 turns the plotting off.voidsetMarkersDisabled(boolean value)Sets whether to draw markers or not.voidsetPaintAll(boolean value)Sets whether to draw markers or not.-
Methods inherited from class adams.gui.visualization.spectrum.AbstractSpectrumPaintlet
getSequencePanel
-
Methods inherited from class adams.gui.visualization.container.AbstractDataContainerPaintlet
getDataContainerPanel
-
Methods inherited from class adams.gui.visualization.core.AbstractStrokePaintlet
applyStroke, getStrokeThickness, getStrokeWidth, performPaint, setStrokeThickness, strokeThicknessTipText
-
Methods inherited from class adams.gui.visualization.core.AbstractPaintlet
canPaint, finishInit, forCommandLine, forName, getPaintlets, getPanel, getPlot, getRepaintOnChange, hasPanel, initialize, isEnabled, isInitializing, memberChanged, memberChanged, paint, repaint, setEnabled, setPanel, setPanel, setRepaintOnChange, shallowCopy, shallowCopy, updatePanel
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_MarkerExtent
protected int m_MarkerExtent
the maximum width/height of the shape to plot around the points (= data point marker), if there's enough space.
-
m_MarkersEnabled
protected boolean m_MarkersEnabled
indicates whether marker shapes are painted or not.
-
m_AlwaysShowMarkers
protected boolean m_AlwaysShowMarkers
whether to show markers all the time.
-
m_AntiAliasingEnabled
protected boolean m_AntiAliasingEnabled
whether anti-aliasing is enabled.
-
m_PaintAll
protected boolean m_PaintAll
whether to paint all the data points (no optimization).
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceadams.core.GlobalInfoSupporter- Specified by:
globalInfoin classadams.core.option.AbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceadams.core.option.OptionHandler- Overrides:
defineOptionsin classadams.gui.visualization.core.AbstractStrokePaintlet
-
getPaintMoment
public adams.gui.event.PaintEvent.PaintMoment getPaintMoment()
Returns when this paintlet is to be executed.- Specified by:
getPaintMomentin interfaceadams.gui.visualization.core.Paintlet- Specified by:
getPaintMomentin classadams.gui.visualization.core.AbstractPaintlet- Returns:
- when this paintlet is to be executed
-
getSpectrumPanel
public SpectrumPanel getSpectrumPanel()
Returns the currently set total ion count panel, can be null.- Returns:
- the panel
-
getColor
public Color getColor(int index)
Returns the color for the data with the given index.- Parameters:
index- the index of the spectrum- Returns:
- the color for the spectrum
-
isMarkersDisabled
public boolean isMarkersDisabled()
Returns whether marker shapes are disabled.- Specified by:
isMarkersDisabledin interfaceadams.gui.visualization.core.PaintletWithMarkers- Returns:
- true if marker shapes are disabled
-
setMarkersDisabled
public void setMarkersDisabled(boolean value)
Sets whether to draw markers or not.- Specified by:
setMarkersDisabledin interfaceadams.gui.visualization.core.PaintletWithMarkers- Parameters:
value- if true then marker shapes won't be drawn
-
markersDisabledTipText
public String markersDisabledTipText()
Returns the tip text for this property.- Specified by:
markersDisabledTipTextin interfaceadams.gui.visualization.core.PaintletWithMarkers- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getAlwaysShowMarkers
public boolean getAlwaysShowMarkers()
Returns whether marker shapes are always drawn.- Specified by:
getAlwaysShowMarkersin interfaceadams.gui.visualization.core.PaintletWithMarkers- Returns:
- true if marker shapes are always drawn, not just when zoomed in
-
setAlwaysShowMarkers
public void setAlwaysShowMarkers(boolean value)
Sets whether to always draw markers.- Specified by:
setAlwaysShowMarkersin interfaceadams.gui.visualization.core.PaintletWithMarkers- Parameters:
value- if true then marker are always drawn, not just when zoomed in
-
alwaysShowMarkersTipText
public String alwaysShowMarkersTipText()
Returns the tip text for this property.- Specified by:
alwaysShowMarkersTipTextin interfaceadams.gui.visualization.core.PaintletWithMarkers- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMarkerExtent
public void setMarkerExtent(int value)
Sets the extent (width and height of the shape around the plotted point). 0 turns the plotting off. Should be an odd number for centering the shape.- Specified by:
setMarkerExtentin interfaceadams.gui.visualization.core.PaintletWithMarkers- Parameters:
value- the new extent
-
getMarkerExtent
public int getMarkerExtent()
Returns the current marker extent (which is the width and height of the shape).- Specified by:
getMarkerExtentin interfaceadams.gui.visualization.core.PaintletWithMarkers- Returns:
- the current extent
-
markerExtentTipText
public String markerExtentTipText()
Returns the tip text for this property.- Specified by:
markerExtentTipTextin interfaceadams.gui.visualization.core.PaintletWithMarkers- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAntiAliasingEnabled
public void setAntiAliasingEnabled(boolean value)
Sets whether to use anti-aliasing.- Specified by:
setAntiAliasingEnabledin interfaceadams.gui.core.AntiAliasingSupporter- Parameters:
value- if true then anti-aliasing is used
-
isAntiAliasingEnabled
public boolean isAntiAliasingEnabled()
Returns whether anti-aliasing is used.- Specified by:
isAntiAliasingEnabledin interfaceadams.gui.core.AntiAliasingSupporter- Returns:
- true if anti-aliasing is used
-
antiAliasingEnabledTipText
public String antiAliasingEnabledTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getPaintAll
public boolean getPaintAll()
Returns whether marker shapes are disabled.- Returns:
- true if marker shapes are disabled
-
setPaintAll
public void setPaintAll(boolean value)
Sets whether to draw markers or not.- Parameters:
value- if true then marker shapes won't be drawn
-
paintAllTipText
public String paintAllTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
drawData
protected void drawData(Graphics g, Spectrum data, Color color, SpectrumPaintlet.MarkerShape marker)
Draws the data with the given color.- Parameters:
g- the graphics contextdata- the data to drawcolor- the color to draw inmarker- the type of marker to draw
-
getMarkerShape
protected SpectrumPaintlet.MarkerShape getMarkerShape(int index)
Determines the shape to paint around the data points, based on the index of the data.- Parameters:
index- the index of the spectrum- Returns:
- the marker shape
-
doPerformPaint
protected void doPerformPaint(Graphics g, adams.gui.event.PaintEvent.PaintMoment moment)
The paint routine of the paintlet.- Specified by:
doPerformPaintin classadams.gui.visualization.core.AbstractStrokePaintlet- Parameters:
g- the graphics context to use for paintingmoment- whatPaintEvent.PaintMomentis currently being painted
-
-