Package dataPlotsFX.data
Class TDDataInfoFX
java.lang.Object
dataPlotsFX.data.TDDataInfoFX
- Direct Known Subclasses:
ArrayTDDataInfo
,ClickPlotInfoFX
,GenericDataPlotInfo
,GenericLinePlotInfo
,GPLDetPlotinfo
,GPLStatePlotInfo
,IshamelFnPlotInfo
,LinePlotDataInfo
,RawSoundDataInfo
,Scrolling2DPlotInfo
,TriggerDataPlotFX
,WhistlePlotInfoFX
Information about a type of data that can be displayed on any of the plots.
Life is complicated since many data types can display many different things, e.g. amplitude / bearing / ICI, etc.
Therefore getDataUnits() can return multiple types of units
Life is even more complicated since data cannot only be identified by their units, e.g. three channels of accelerometer data in Dtag data.
Life is complicated since many data types can display many different things, e.g. amplitude / bearing / ICI, etc.
Therefore getDataUnits() can return multiple types of units
Life is even more complicated since data cannot only be identified by their units, e.g. three channels of accelerometer data in Dtag data.
- Author:
- Doug Gillespie, Jamie Macaulay
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionThe data pluginsint
-
Constructor Summary
ConstructorDescriptionTDDataInfoFX
(TDDataProviderFX tdDataProvider, TDGraphFX tdGraph, PamDataBlock pamDataBlock) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addScaleInfo
(TDScaleInfo scaleInfo) Add a scale info.void
Clear any residual drawing objects that get held between calls, e.g.void
drawAllDataUnits
(int plotNumber, javafx.scene.canvas.GraphicsContext g, double scrollStart, TDProjectorFX tdProjector) Paint individual data units in the graphics window.void
drawData
(int plotNumber, javafx.scene.canvas.GraphicsContext g, double scrollStart, TDProjectorFX tdProjector) Paint data into the graphics window.javafx.scene.shape.Polygon
drawDataUnit
(int plotNumber, PamDataUnit pamDataUnit, javafx.scene.canvas.GraphicsContext g, double scrollStart, TDProjectorFX tdProjector, int type) Draw a data unit.void
drawHighLightData
(int plotNumber, javafx.scene.canvas.GraphicsContext g, double scrollStart, TDProjectorFX tdProjector) Draw highlighted data.boolean
Edit options - generally involves throwing up a dialog of some sort.Get the current scale info.Get the data block for this informationint
Get the number of data dimensions being displayed.final String
A longer data name, more descriptive than the data units.final TDDataProviderFX
abstract Double
getDataValue
(PamDataUnit pamDataUnit) Gets a value for a specific data unit which should be in the same units as the scale information.getDDataProvider
(DetectionPlotDisplay detectionPlotDisplay) Deprecated.int
Get a colour flag for the background display.Return a hiding settings node which will get incorporated into a larger tabbed sliding pane.javafx.geometry.Point2D[]
Get the last draw points.long
The TDDisplayFX scroller is based on a master clock update from PAMGuard.Get TD specific menu items which are added to pop up menus if a data unit or data unit within a selected group of data units belongs to the data info.javafx.geometry.Point2D
getPreviousDataUnit
(TDProjectorFX generalProjector, PamDataUnit pamDataUnit) Get the previous data unit for drawing a line from.long
getRequiredDataHistory
(PamObservable o, Object arg, long nonminalTime) Get how long data of this type needs to be held in memory during real time operation.getScaleInfo
(boolean autoScale) Get scale information based on the min max values of units in the data block or fixed scale informationint
The index of the current scale info for the TDDataInfoGet all TDScaleInfos for the TDDataInfo.Get a shorter name for use in displays.Get the source data block.Get an object that will be packed up with the serialised settings when information about a plot get's stored.abstract TDSymbolChooserFX
Get the TDGraphFX associated with this TDDataInfoFXgetToolTipText
(PamDataUnit pamDataUnit) boolean
hasAxisName
(GeneralProjector.ParameterType dataType, GeneralProjector.ParameterUnits dataUnits) boolean
Has options that will result in a dialog.boolean
isPaused()
Function to check whether PAMGUARD is paused.boolean
True if the scroller is changingboolean
Check whether the data is currently being displayed in the current graph window.boolean
isViewer()
Check whether in viewer mode.void
lastUnitDrawn
(javafx.scene.canvas.GraphicsContext g, double scrollStart, TDProjectorFX tdProjector, int plotnumber) Indicates that the last data unit has been drawn.void
notifyChange
(int changeType) Notify of changes from PamController.void
Called whenever a data line is removed from a graph, or when a graph is removed from a plot.void
removeScaleInfo
(TDScaleInfo scaleInfo) Remove a scale info.void
selectScaleInfo
(TDScaleInfo dataLine) Called when the user selects a specific data lineboolean
setCurrentAxisName
(GeneralProjector.ParameterType dataType, GeneralProjector.ParameterUnits dataUnits) Set the current data units - this is an enum which matches an enum in dataLineInfos() or all will go horribly wrong.static TDScaleInfo
setNPlotPanes
(TDScaleInfo tdScaleInfo, PamDataBlock dataBlock, boolean singlePane) Sets the scale info to tell TD graph to show the correct number of plot panes and the correct channels in those plot panes.void
setShowing
(boolean isShowing) Set whether or not data is showing in current graph window.boolean
setStoredSettings
(Serializable storedSettings) Set settings which have been read back from storage (the psf file).boolean
shouldDraw
(int plotNumber, int sequenceMap) Do we want to draw this channel on this panel ?boolean
shouldDraw
(int plotNumber, PamDataUnit dataUnit) Do we want to draw this data unit on this plot ?void
timeRangeSpinnerChange
(double oldValue, double newValue) Called when the time range spinner on the main display panel changes.void
timeScrollRangeChanged
(double minimumMillis, double maximumMillis) Called in viewer mode when the time scroll range moves.void
timeScrollValueChanged
(double valueMillis) Called in viewer mode when the time scroller moves.
-
Field Details
-
dataPlugIns
The data plugins -
scaleInfoIndex
public int scaleInfoIndex
-
-
Constructor Details
-
TDDataInfoFX
-
-
Method Details
-
getDataBlock
Get the data block for this information- Returns:
- the data block.
-
getDDataProvider
Deprecated.The detection display data info. This allows detection to be plotted in right click panes- Returns:
- the data info for the detection type.
-
getDataValue
Gets a value for a specific data unit which should be in the same units as the scale information. This will then be converted into a plot position by the TDGraph.- Parameters:
pamDataUnit
-- Returns:
- data value or null if this data point should not be plotted.
-
setCurrentAxisName
public boolean setCurrentAxisName(GeneralProjector.ParameterType dataType, GeneralProjector.ParameterUnits dataUnits) Set the current data units - this is an enum which matches an enum in dataLineInfos() or all will go horribly wrong.- Parameters:
AxisName
- - the type of axis.
-
getCurrentScaleInfo
Get the current scale info.- Returns:
- the currentScaleInfo
-
hasAxisName
public boolean hasAxisName(GeneralProjector.ParameterType dataType, GeneralProjector.ParameterUnits dataUnits) - Parameters:
axisName
-- Returns:
- true if the data have a datalineinfo with the given name
-
getDataName
A longer data name, more descriptive than the data units. Note that a single data block may have many different types of data it can plot !
This is now taken only from the data provider so that they can remain matched up as settings are serialized and de-serialized.- Returns:
- a name for the data.
-
getShortName
Get a shorter name for use in displays. This is used because a lot of the default names are quite long since they are based on standard data block names.- Returns:
- a short name for use in the display.
-
getDataProvider
- Returns:
- Get the data provider. References to this are needed when settings are serialised and de-serialised.
-
getScaleInfo
Get scale information based on the min max values of units in the data block or fixed scale information- Parameters:
autoScale
- . Create a scale information which is based on min/max value of data units in data block. False to use fixed scale information.orientation
- . Orientation of the display.- Returns:
- Information about the scales of the data.
-
addScaleInfo
Add a scale info. ScaleInfo is used to define which y-axis the data is compatible with. e.g. a TDDataINfo may be able to plot amplitude and frequency.- Parameters:
scaleInfo
- - the scale info to add.
-
removeScaleInfo
Remove a scale info. ScaleInfo objects are used to define which y-axis the data is compatible with. e.g. a TDDataINfo may be able to plot amplitude and frequency.- Parameters:
scaleInfo
- - the scale info to add.
-
getScaleInfo
- Returns:
- the fixedScaleInformation
-
getDataDimensions
public int getDataDimensions()Get the number of data dimensions being displayed.- Returns:
- 1 or 2 for the data (lines are 1, things that will make a 3D plot, such as spectrograms, get 2.
-
getScaleInfos
Get all TDScaleInfos for the TDDataInfo.- Returns:
- a list of TDScaleInfos.
-
getSymbolChooser
- Parameters:
tdProjector
-- Returns:
- a class containing functions to chose a symbol to plot.
-
getToolTipText
- Parameters:
pamDataUnit
- data unit- Returns:
- text to display in tooltip if mouse hovered over symbol
-
clearDraw
public void clearDraw()Clear any residual drawing objects that get held between calls, e.g. the point of the previous unit plotted which may have been held so that lines can be drawn between points. -
drawData
public void drawData(int plotNumber, javafx.scene.canvas.GraphicsContext g, double scrollStart, TDProjectorFX tdProjector) Paint data into the graphics window.- Parameters:
plotNumber
- plot numberg
- graphicswindowRect
- Window rectangle to draw inorientation
- orientationpamAxis
- scroll start time in millisecondstScale
- time scale in pixels per millisecond.graphAxis
- graph data axis for scaling.wrap
- . true to wrap display, false to show display scrolling.
-
drawAllDataUnits
public void drawAllDataUnits(int plotNumber, javafx.scene.canvas.GraphicsContext g, double scrollStart, TDProjectorFX tdProjector) Paint individual data units in the graphics window.Note the scroll start is a double instead of a long. The maximum time value for a double is 17 August 292278994 at 07:12:55 UTC. If PAMGuard is going by then soomeone else can sort out timing.
- Parameters:
plotNumber
- - plot number i.e. which subplot the data should be drawn on.g
- - the graphics handle.scrollStart
- - the start of the display in milliseconds. Note that this is a double value.tdProjector
- - the projector which handles unit to pixel conversion.
-
lastUnitDrawn
public void lastUnitDrawn(javafx.scene.canvas.GraphicsContext g, double scrollStart, TDProjectorFX tdProjector, int plotnumber) Indicates that the last data unit has been drawn. This can be useful in TDDataInfo's which have more bespoke drawing mechanisms.- Parameters:
plotnumber
- - plot number i.e. which sub plot the data should be drawn on.
-
shouldDraw
Do we want to draw this data unit on this plot ?- Parameters:
plotNumber
-dataUnit
-- Returns:
- true if unit should be drawn.
-
shouldDraw
public boolean shouldDraw(int plotNumber, int sequenceMap) Do we want to draw this channel on this panel ?- Parameters:
plotNumber
- panel numbersequenceMap
- channel map- Returns:
- true if data unit should be drawn.
-
drawHighLightData
public void drawHighLightData(int plotNumber, javafx.scene.canvas.GraphicsContext g, double scrollStart, TDProjectorFX tdProjector) Draw highlighted data.- Parameters:
plotNumber
-g
-scrollStart
-windowRect
-orientation
-timeAxis
-graphAxis
-
-
drawDataUnit
public javafx.scene.shape.Polygon drawDataUnit(int plotNumber, PamDataUnit pamDataUnit, javafx.scene.canvas.GraphicsContext g, double scrollStart, TDProjectorFX tdProjector, int type) Draw a data unit.- Parameters:
pamDataUnit
- data unit to drawg
- graphicsContext handle to draw ontype
- flag for which type of symbol to draw. e.g normal or highlighted.windowRect
- the rectangle describing the window.orientation
- orientation of the displaytimeAxis
- start time of the displaytimeScale
- time scale in pixels per millisecondyAxis
- yAxis (used for scale information for the data point)true
- if it is the last data unit in the list which is being drawn.- Returns:
- polygon of area drawn on.
-
getPreviousDataUnit
public javafx.geometry.Point2D getPreviousDataUnit(TDProjectorFX generalProjector, PamDataUnit pamDataUnit) Get the previous data unit for drawing a line from. This can be overriden for data units.- Returns:
- the previous point on the display to draw from.
-
selectScaleInfo
Called when the user selects a specific data line- Parameters:
dataLine
-
-
getScaleInfoIndex
public int getScaleInfoIndex()The index of the current scale info for the TDDataInfo- Returns:
- the current index of the scale info.
-
hasOptions
public boolean hasOptions()Has options that will result in a dialog.- Returns:
- true if there are options.
-
editOptions
public boolean editOptions()Edit options - generally involves throwing up a dialog of some sort.- Returns:
- true if options dialog OK button was pressed.
-
getGraphSettingsPane
Return a hiding settings node which will get incorporated into a larger tabbed sliding pane.- Returns:
- sliding dialog component.
-
getTDGraph
Get the TDGraphFX associated with this TDDataInfoFX- Returns:
- the tdGraph
-
getStoredSettings
Get an object that will be packed up with the serialised settings when information about a plot get's stored.
The Object MUST implement serializable and ideally also cloneable or it will go belly up !
This only gets called when settings are to be saved so there is no need to keep parameters this returns up to date except right at settings save time (when this is called)- Returns:
- serializable object to save.
-
setStoredSettings
Set settings which have been read back from storage (the psf file). Assume these are of the right type and cast into whatever is needed !- Parameters:
storedSettings
-- Returns:
- true if all OK.
-
removeData
public void removeData()Called whenever a data line is removed from a graph, or when a graph is removed from a plot.
Is a good opportunity for the DataInfo to unsubscribe itself from any data blocks it might be observing. -
timeScrollValueChanged
public void timeScrollValueChanged(double valueMillis) Called in viewer mode when the time scroller moves.Most data won't need to do anything here since they are already subscribed to the scroller and will get their data loaded from psf automatically.
- Parameters:
valueMillis
- new scroll value in millis
-
timeScrollRangeChanged
public void timeScrollRangeChanged(double minimumMillis, double maximumMillis) Called in viewer mode when the time scroll range moves.Most data won't need to do anything here since they are already subscribed to the scroller and will get their data loaded from psf automatically.
- Parameters:
minimumMillis
- new minimum in millismaximumMillis
- new maximum in millis.
-
setShowing
public void setShowing(boolean isShowing) Set whether or not data is showing in current graph window.- Parameters:
isShowing
- true if showing
-
isShowing
public boolean isShowing()Check whether the data is currently being displayed in the current graph window.- Returns:
- true if showing.
-
timeRangeSpinnerChange
public void timeRangeSpinnerChange(double oldValue, double newValue) Called when the time range spinner on the main display panel changes.- Parameters:
oldValue
- old value (seconds)newValue
- new value (seconds)
-
isViewer
public boolean isViewer()Check whether in viewer mode.- Returns:
- true if in viewer mode.
-
isPaused
public boolean isPaused()Function to check whether PAMGUARD is paused.- Returns:
- true if paused - note do not use in viewer mode.
-
getDisplayColType
public int getDisplayColType()Get a colour flag for the background display. This is only ever used if the data units displayed change the overall background colour of the display e.g. a spectrogram would do this.- Returns:
- flag indicating the background colour of the display. Option are LIGHT_TD_DISPLAY or DARK_TD_DISPLAY
-
getSourceDataBlock
Get the source data block.
Generally the source data block is used in viewer mode to load data. e.g. FFT uses raw sound acquisition for source data block. The source data block can cause issues e.g. the whistle and moan contours use noise free FFT data as a source data block. Thus if this function is is not overridden in WhistlePlotInfo then raw FFT data will be saved, something which uses large amounts of memory.- Returns:
- the source data block.
- See Also:
-
-
invalid @see
WhistlePlotInfo
-
-
setNPlotPanes
public static TDScaleInfo setNPlotPanes(TDScaleInfo tdScaleInfo, PamDataBlock dataBlock, boolean singlePane) Sets the scale info to tell TD graph to show the correct number of plot panes and the correct channels in those plot panes. e.g. if 'dataBlock' is a RawDataBlock and 'singlePane' is false then the TDScaleInformation will be set so that there is a single plot for each channel in the dataBlock. For data blocks with grouped channels then each group will get it's own pane if singlePane is set to false.- Parameters:
dataBlock
- - data block to find channels in.singlePane
- true to plot on single pane. False means every channel gets it's own pane. If channels are grouped then this may produce some weird effects.
-
notifyChange
public void notifyChange(int changeType) Notify of changes from PamController.- Parameters:
changeType
- - the chnage type.
-
isScrollChanging
public boolean isScrollChanging()True if the scroller is changing- Returns:
- true if the scroller is changing.
-
getRequiredDataHistory
Get how long data of this type needs to be held in memory during real time operation. the third argument is the standard history length of the display scroller so most often it can simply return this value. Occasionally, such as in the case of spectrogram data which we don't want to save because they go into a separate store as an image, we can return 0.- Parameters:
o
- PamObservable - what's observing the dataarg
- optional argumentnonminalTime
- nominal storage time in milliseconds.- Returns:
- storage time in milliseconds.
-
getLastDrawPoints
public javafx.geometry.Point2D[] getLastDrawPoints()Get the last draw points. The array represents all channels (plot panes) in sequential order- Returns:
- the lastPoint
-
getDataObserver
-
getMenuNodes
Get TD specific menu items which are added to pop up menus if a data unit or data unit within a selected group of data units belongs to the data info.- Returns:
- a list of data info specific menu items to add.
-
getMasterClockOverride
public long getMasterClockOverride()The TDDisplayFX scroller is based on a master clock update from PAMGuard. This can be irritating because the master clock will always be slighter greater than the the processed data leaving a gap at the scroller end. Some data infos with continuous data can act as a better clock (for example the spectrgram or raw data). Data which is discrete like the click detector cannot because they don't have contious data.
-