Squashed commit of the following:

commit 687220dad5
Author: Douglas Gillespie <50671166+douggillespie@users.noreply.github.com>
Date:   Mon Jul 22 11:42:19 2024 +0100

    Change click data selector

    Change Click BT display so it can handle CompoundDataSelectors

commit 577670ccd0
Merge: 6510d226 8b5b5b2f
Author: Douglas Gillespie <50671166+douggillespie@users.noreply.github.com>
Date:   Mon Jul 22 09:35:01 2024 +0100

    Merge branch 'main' of https://github.com/PAMGuard/PAMGuard

commit 6510d2260e
Author: Douglas Gillespie <50671166+douggillespie@users.noreply.github.com>
Date:   Mon Jul 22 09:34:58 2024 +0100

    Remove unnecessary text output

commit 3da8401756
Author: Douglas Gillespie <50671166+douggillespie@users.noreply.github.com>
Date:   Mon Jul 22 09:29:38 2024 +0100

    updates to Daq

    New DLL, and some LED control, but hasn't fixed stalling problem.

commit 8b5b5b2f18
Author: Douglas Gillespie <50671166+douggillespie@users.noreply.github.com>
Date:   Fri Jul 19 17:14:28 2024 +0100

    Updated data selectors for BT display

    Merging old status bar and new DataSelector options so that they work more consistently on the BT display.

commit bad2255710
Author: Douglas Gillespie <50671166+douggillespie@users.noreply.github.com>
Date:   Thu Jul 18 09:47:47 2024 +0100

    Better symbol options

    Add clearer options button to multi option symbol manager panel.
This commit is contained in:
Jamie Mac 2024-07-22 11:53:11 +01:00
parent a993b27155
commit 120b1eb56f
5 changed files with 68 additions and 10 deletions

View File

@ -108,4 +108,25 @@ public class CompoundDataSelector extends DataSelector {
return selectorList; return selectorList;
} }
@Override
public DataSelector findDataSelector(Class selectorClass) {
/**
* Check this, then all in the selector list. Should iterate happily back to
* a basic data selector as required even if there are multiple Compound ones.
*/
if (this.getClass() == selectorClass) {
return this;
}
if (selectorList == null) {
return null;
}
for (DataSelector aSelector : selectorList) {
DataSelector subSel = aSelector.findDataSelector(selectorClass);
if (subSel != null) {
return subSel;
}
}
return null;
}
} }

View File

@ -97,6 +97,23 @@ public abstract class DataSelector {
*/ */
abstract public DynamicSettingsPane<Boolean> getDialogPaneFX(); abstract public DynamicSettingsPane<Boolean> getDialogPaneFX();
/**
* Find a data selector within a data selector. This is primarily for use with
* ComoundDataSelector objects which may encapsulate multiple other selectors,
* particularly when annotations are in use. but it's needed here so that it
* can be called on any DataSelector object.
* @param selectorClass class to data selector to find.
* @return DataSelector or null if that class of data selector doesn't exist.
*/
public DataSelector findDataSelector(Class selectorClass) {
if (this.getClass() == selectorClass) {
return this;
}
else {
return null;
}
}
/** /**
* Get a menu item for the data selector that can be easily added * Get a menu item for the data selector that can be easily added
* to any other menu. * to any other menu.

View File

@ -68,7 +68,7 @@ public class BTAmplitudeSelector implements PamDialogPanel {
super(); super();
this.clickControl = clickControl; this.clickControl = clickControl;
this.btDisplay = btDisplay; this.btDisplay = btDisplay;
dataSelector = btDisplay.getDataSelector(); dataSelector = btDisplay.getClickDataSelector();
clickDataBlock = clickControl.getClickDataBlock(); clickDataBlock = clickControl.getClickDataBlock();
histoPlot = new HistogramDisplay(); histoPlot = new HistogramDisplay();
histoPlot.setGraphicsOverLayer(histoOverLayer = new HistoOverLayer()); histoPlot.setGraphicsOverLayer(histoOverLayer = new HistoOverLayer());

View File

@ -117,6 +117,7 @@ import PamguardMVC.PamDataUnit;
import PamguardMVC.PamObservable; import PamguardMVC.PamObservable;
import PamguardMVC.PamObserver; import PamguardMVC.PamObserver;
import PamguardMVC.dataSelector.DataSelectDialog; import PamguardMVC.dataSelector.DataSelectDialog;
import PamguardMVC.dataSelector.DataSelector;
import PamguardMVC.superdet.SuperDetection; import PamguardMVC.superdet.SuperDetection;
import clickDetector.ClickClassifiers.ClickIdInformation; import clickDetector.ClickClassifiers.ClickIdInformation;
import clickDetector.ClickClassifiers.ClickIdentifier; import clickDetector.ClickClassifiers.ClickIdentifier;
@ -2244,11 +2245,15 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
if (btDisplayParameters.amplitudeSelect == false) { if (btDisplayParameters.amplitudeSelect == false) {
return; return;
} }
ClickDataSelector clickDataSelector = getClickDataSelector();
if (clickDataSelector == null) {
return;
}
int n = countAmplitudeDeselected(); int n = countAmplitudeDeselected();
PamDataBlock<ClickDetection> clickData = clickControl.getClickDataBlock(); PamDataBlock<ClickDetection> clickData = clickControl.getClickDataBlock();
int nAll = clickData.getUnitsCount(); int nAll = clickData.getUnitsCount();
String txt = String.format("%d of %d loaded clicks will not be displayed because their amplitude is < %3.1fdB", String txt = String.format("%d of %d loaded clicks will not be displayed because their amplitude is < %3.1fdB",
n, nAll, getDataSelector().getParams().minimumAmplitude); n, nAll, clickDataSelector.getParams().minimumAmplitude);
Insets insets = getInsets(); Insets insets = getInsets();
int x = insets.left; int x = insets.left;
int y = getHeight()-5; int y = getHeight()-5;
@ -2789,7 +2794,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
BTDisplayParameters newParameters = BTDisplayParameters newParameters =
ClickDisplayDialog.showDialog(clickControl, ClickDisplayDialog.showDialog(clickControl,
clickControl.getGuiFrame(), btDisplayParameters, getDataSelector().getClickAlarmParameters()); clickControl.getGuiFrame(), btDisplayParameters, getClickDataSelector().getClickAlarmParameters());
if (newParameters != null){ if (newParameters != null){
btDisplayParameters = newParameters.clone(); btDisplayParameters = newParameters.clone();
if (getVScaleManager() != null) { if (getVScaleManager() != null) {
@ -2812,8 +2817,23 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
* Get a data selector specific to this display. * Get a data selector specific to this display.
* @return click data selector specific to this display. * @return click data selector specific to this display.
*/ */
public ClickDataSelector getDataSelector() { public DataSelector getDataSelector() {
return (ClickDataSelector) clickControl.getClickDataBlock().getDataSelector(getUnitName(), false); return clickControl.getClickDataBlock().getDataSelector(getUnitName(), false);
}
/**
* get the click specific data selector which may now be burried in a
* CompoundDataSelector if annotations have been used.
* @return ClickDataSelector.
*/
public ClickDataSelector getClickDataSelector() {
DataSelector baseSel = getDataSelector();
if (baseSel == null) {
return null;
}
else {
return (ClickDataSelector) baseSel.findDataSelector(ClickDataSelector.class);
}
} }
class AmplitudeSelector implements ActionListener { class AmplitudeSelector implements ActionListener {
@ -3403,7 +3423,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
else if (btDisplayParameters.colourScheme == BTDisplayParameters.COLOUR_BY_HYDROPHONE) { else if (btDisplayParameters.colourScheme == BTDisplayParameters.COLOUR_BY_HYDROPHONE) {
keyPanel.add(new TextKeyItem("Colour by hydrophone")); keyPanel.add(new TextKeyItem("Colour by hydrophone"));
} }
ClickAlarmParameters selectParams = getDataSelector().getParams(); ClickAlarmParameters selectParams = getClickDataSelector().getParams();
// if (btDisplayParameters.getShowSpecies(0)) { // if (btDisplayParameters.getShowSpecies(0)) {
if (selectParams.onlineAutoEvents | selectParams.onlineManualEvents) { if (selectParams.onlineAutoEvents | selectParams.onlineManualEvents) {
keyPanel.add(symbolChooser.getDefaultSymbol(true).makeKeyItem("Unidentified species")); keyPanel.add(symbolChooser.getDefaultSymbol(true).makeKeyItem("Unidentified species"));
@ -3487,7 +3507,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
PamDataBlock<ClickDetection> clickData = clickControl.getClickDataBlock(); PamDataBlock<ClickDetection> clickData = clickControl.getClickDataBlock();
ClickDetection click; ClickDetection click;
int n = 0; int n = 0;
double minAmpli = getDataSelector().getParams().minimumAmplitude; double minAmpli = getClickDataSelector().getParams().minimumAmplitude;
synchronized (clickData.getSynchLock()) { synchronized (clickData.getSynchLock()) {
ListIterator<ClickDetection> clickIterator = clickData.getListIterator(0); ListIterator<ClickDetection> clickIterator = clickData.getListIterator(0);
while (clickIterator.hasNext()) { while (clickIterator.hasNext()) {
@ -4151,7 +4171,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
amplitudeSelectorLabel.setText(""); amplitudeSelectorLabel.setText("");
} }
else { else {
String txt = String.format(" Amplitude Selector showing clicks > %3.1fdB", getDataSelector().getParams().minimumAmplitude); String txt = String.format(" Amplitude Selector showing clicks > %3.1fdB", getClickDataSelector().getParams().minimumAmplitude);
amplitudeSelectorLabel.setText(txt); amplitudeSelectorLabel.setText(txt);
} }
} }

View File

@ -255,7 +255,7 @@ public class OfflineToolbar {
return; return;
} }
try { try {
ClickDataSelector clickDataSelector = currentBTDisplay.getDataSelector(); ClickDataSelector clickDataSelector = currentBTDisplay.getClickDataSelector();
ClickAlarmParameters selectParams = clickDataSelector.getParams(); ClickAlarmParameters selectParams = clickDataSelector.getParams();
BTDisplayParameters btDisplayParameters = currentBTDisplay.getBtDisplayParameters(); BTDisplayParameters btDisplayParameters = currentBTDisplay.getBtDisplayParameters();
@ -288,7 +288,7 @@ public class OfflineToolbar {
} }
private void checkButtons(BTDisplayParameters btDisplayParameters) { private void checkButtons(BTDisplayParameters btDisplayParameters) {
ClickDataSelector clickDataSelector = currentBTDisplay.getDataSelector(); ClickDataSelector clickDataSelector = currentBTDisplay.getClickDataSelector();
ClickAlarmParameters selectParams = clickDataSelector.getParams(); ClickAlarmParameters selectParams = clickDataSelector.getParams();
showEchoes.setSelected(selectParams.useEchoes); showEchoes.setSelected(selectParams.useEchoes);
showNonSpecies.setSelected(selectParams.getUseSpecies(0)); showNonSpecies.setSelected(selectParams.getUseSpecies(0));