Package detectionPlotFX.plots
Class SpectrumPlot<D extends PamDataUnit>
java.lang.Object
detectionPlotFX.plots.SpectrumPlot<D>
- Type Parameters:
D
- - the input data unit type
- All Implemented Interfaces:
DetectionPlot<D>
- Direct Known Subclasses:
CTSpectrumPlot
,RawSpectrumPlot
,TemplateSpectrumPane.SpectrumTemplatePlot
public abstract class SpectrumPlot<D extends PamDataUnit>
extends Object
implements DetectionPlot<D>
Plot for the spectrum of a waveform.
- Author:
- Jamie Macaulay
-
Field Summary
Fields inherited from interface detectionPlotFX.layout.DetectionPlot
SCROLLPANE_DRAW, STANDARD_DRAW
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
drawLogSpectrum
(javafx.scene.canvas.GraphicsContext g2, javafx.scene.shape.Rectangle clipRect, double[][] clickLineData, DetectionPlotProjector projector) Draw the shapes for the log spectrum.abstract double[][]
getCepstrum
(D data, int minSample, int maxSample) Get the cepstrum for the detectiongetName()
Get the name of the plot e.g.abstract double[][]
getPowerSpectrum
(D data, int minSample, int maxSample) Get the power spectrum for the detectiondouble
getSampleRate
(D currentDetection) Get the sample rate in samples per second of the last data unit.javafx.scene.layout.Pane
Get the settings pane for the particular plot.Get spectrum params.boolean
Check whether the spectrum is filled with a transparent polygon/void
paintPlot
(D data, javafx.scene.canvas.GraphicsContext gc, javafx.scene.shape.Rectangle rectangle, DetectionPlotProjector projector, int flag) Plot the relevent data from a detection.void
Re paint the last data unit.void
setFillSpectrum
(boolean fillSpectrum) Set whether the spectrum is filled with a transparent polygonvoid
setupAxis
(D data, double sR, DetectionPlotProjector plotProjector) Setup the axis.void
Setup the plot.
-
Constructor Details
-
SpectrumPlot
-
-
Method Details
-
getName
Description copied from interface:DetectionPlot
Get the name of the plot e.g. waveform, spectrum etc.- Specified by:
getName
in interfaceDetectionPlot<D extends PamDataUnit>
-
getPowerSpectrum
Get the power spectrum for the detection- Parameters:
data
- - the pamDetection- Returns:
- the power spectrum for each channel.
-
getCepstrum
Get the cepstrum for the detection- Parameters:
data
- - the pamDetection- Returns:
- the cepstrum for each channel.
-
setupPlot
public void setupPlot()Description copied from interface:DetectionPlot
Setup the plot. This may, for example, involve changing axis etc.- Specified by:
setupPlot
in interfaceDetectionPlot<D extends PamDataUnit>
-
setupAxis
Description copied from interface:DetectionPlot
Setup the axis. This is called before paintPlot. Ensures axis are correct values- Specified by:
setupAxis
in interfaceDetectionPlot<D extends PamDataUnit>
- Parameters:
data
- - the data of every channel. e.g. might be a waveform with each point representing a sample.sR
- - the sample rate. Primarily used to convert bins into time values.
-
paintPlot
public void paintPlot(D data, javafx.scene.canvas.GraphicsContext gc, javafx.scene.shape.Rectangle rectangle, DetectionPlotProjector projector, int flag) Description copied from interface:DetectionPlot
Plot the relevent data from a detection.- Specified by:
paintPlot
in interfaceDetectionPlot<D extends PamDataUnit>
- Parameters:
data
- - the data of every channel. e.g. might be a waveform with each point representing a sample.gc
- - the graphics handle to draw on.
-
drawLogSpectrum
public void drawLogSpectrum(javafx.scene.canvas.GraphicsContext g2, javafx.scene.shape.Rectangle clipRect, double[][] clickLineData, DetectionPlotProjector projector) Draw the shapes for the log spectrum. This function should eventually be integrated with the drawSpectrum() function.- Parameters:
clipRect
-clickLineData
-g
-eventLineData
-
-
getSettingsPane
public javafx.scene.layout.Pane getSettingsPane()Description copied from interface:DetectionPlot
Get the settings pane for the particular plot. This sits on the right hand side of the display inside a hiding pane.- Specified by:
getSettingsPane
in interfaceDetectionPlot<D extends PamDataUnit>
- Returns:
- a pane with controls for changing settings in a node.
-
getSampleRate
Get the sample rate in samples per second of the last data unit.- Parameters:
the
- detection to find sample rate for.- Returns:
- the sample rate in samples per second.
-
getSpectrumParams
Get spectrum params.- Returns:
- the spectrum params.
-
reDrawLastUnit
public void reDrawLastUnit()Re paint the last data unit. -
isFillSpectrum
public boolean isFillSpectrum()Check whether the spectrum is filled with a transparent polygon/- Returns:
- true if spectum is filled.
-
setFillSpectrum
public void setFillSpectrum(boolean fillSpectrum) Set whether the spectrum is filled with a transparent polygon- Parameters:
fillSpectrum
- - true to fill spectrum
-