Squashed commit of the following:

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 09:11:00 +01:00
parent 6d58cee3b3
commit cb3f4ca041
11 changed files with 347 additions and 160 deletions

View File

@ -1,12 +1,10 @@
package PamView.symbol.modifier.swing; package PamView.symbol.modifier.swing;
import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.Enumeration; import java.util.Enumeration;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.border.EmptyBorder;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import PamView.dialog.GenericSwingDialog; import PamView.dialog.GenericSwingDialog;
@ -27,10 +25,6 @@ public class OptionsTreeNode implements TreeNode {
this.optionsPanel = optionsPanel; this.optionsPanel = optionsPanel;
this.leafIndex = leafIndex; this.leafIndex = leafIndex;
optionsButton = new JButton("more ..."); optionsButton = new JButton("more ...");
Insets insets = optionsButton.getInsets();
if (insets == null) insets = new Insets(0,0,0,0);
insets.bottom = insets.top = insets.left = 1;
optionsButton.setBorder(new EmptyBorder(insets));
optionsButton.setToolTipText("More symbol options"); optionsButton.setToolTipText("More symbol options");
optionsButton.addActionListener(new ActionListener() { optionsButton.addActionListener(new ActionListener() {

View File

@ -76,6 +76,22 @@ public class DataSelectDialog extends PamDialog {
// } // }
} }
public boolean setTab(int tabIndex) {
if (tabPane == null) {
return false;
}
if (tabIndex < 0 || tabIndex >= tabPane.getTabCount()) {
return false;
}
try {
tabPane.setSelectedIndex(tabIndex);
}
catch (Exception e) {
return false;
}
return true;
}
public boolean showDialog() { public boolean showDialog() {
if (dataPanel != null) { if (dataPanel != null) {
dataPanel.setParams(); dataPanel.setParams();

View File

@ -29,6 +29,7 @@ import PamView.PamSymbolType;
import PamView.dialog.PamDialog; import PamView.dialog.PamDialog;
import PamView.dialog.PamDialogPanel; import PamView.dialog.PamDialogPanel;
import PamView.dialog.PamGridBagContraints; import PamView.dialog.PamGridBagContraints;
import clickDetector.dataSelector.ClickDataSelector;
import pamMaths.HistogramDisplay; import pamMaths.HistogramDisplay;
import pamMaths.HistogramGraphicsLayer; import pamMaths.HistogramGraphicsLayer;
import pamMaths.PamHistogram; import pamMaths.PamHistogram;
@ -59,6 +60,7 @@ public class BTAmplitudeSelector implements PamDialogPanel {
private JCheckBox amplitudeSelect; private JCheckBox amplitudeSelect;
private JTextField minAmplitude; private JTextField minAmplitude;
private JFrame ownerFrame; private JFrame ownerFrame;
private ClickDataSelector dataSelector;
/** /**
* @param btDisplay * @param btDisplay
*/ */
@ -66,6 +68,7 @@ public class BTAmplitudeSelector implements PamDialogPanel {
super(); super();
this.clickControl = clickControl; this.clickControl = clickControl;
this.btDisplay = btDisplay; this.btDisplay = btDisplay;
dataSelector = btDisplay.getDataSelector();
clickDataBlock = clickControl.getClickDataBlock(); clickDataBlock = clickControl.getClickDataBlock();
histoPlot = new HistogramDisplay(); histoPlot = new HistogramDisplay();
histoPlot.setGraphicsOverLayer(histoOverLayer = new HistoOverLayer()); histoPlot.setGraphicsOverLayer(histoOverLayer = new HistoOverLayer());
@ -125,7 +128,8 @@ public class BTAmplitudeSelector implements PamDialogPanel {
axMin = allHistogram.getScaleMinVal(); axMin = allHistogram.getScaleMinVal();
axMax = allHistogram.getScaleMaxVal(); axMax = allHistogram.getScaleMaxVal();
plotRectangle = g.getClipBounds(); plotRectangle = g.getClipBounds();
double dx = (btDisplayParameters.minAmplitude - axMin) / (axMax-axMin) * plotRectangle.width; // double dx = (btDisplayParameters.minAmplitude - axMin) / (axMax-axMin) * plotRectangle.width;
double dx = (dataSelector.getParams().minimumAmplitude - axMin) / (axMax-axMin) * plotRectangle.width;
int x = (int) Math.round(dx); int x = (int) Math.round(dx);
g.setColor(Color.RED); g.setColor(Color.RED);
g.drawLine(x, 0, x, plotRectangle.height); g.drawLine(x, 0, x, plotRectangle.height);
@ -151,7 +155,7 @@ public class BTAmplitudeSelector implements PamDialogPanel {
double newAmp = (double) mouseEvent.getX() / histoOverLayer.plotRectangle.width * double newAmp = (double) mouseEvent.getX() / histoOverLayer.plotRectangle.width *
(histoOverLayer.axMax-histoOverLayer.axMin) + histoOverLayer.axMin; (histoOverLayer.axMax-histoOverLayer.axMin) + histoOverLayer.axMin;
BTDisplayParameters btDisplayParameters = btDisplay.getBtDisplayParameters(); BTDisplayParameters btDisplayParameters = btDisplay.getBtDisplayParameters();
btDisplayParameters.minAmplitude = newAmp; dataSelector.getParams().minimumAmplitude = newAmp;
ampCtrlPanel.setParams(btDisplayParameters); ampCtrlPanel.setParams(btDisplayParameters);
redrawHisto(); redrawHisto();
// //
@ -173,7 +177,7 @@ public class BTAmplitudeSelector implements PamDialogPanel {
if (btDisplayParameters.amplitudeSelect == false) { if (btDisplayParameters.amplitudeSelect == false) {
return false; return false;
} }
double dx = (btDisplayParameters.minAmplitude - histoOverLayer.axMin) / double dx = (dataSelector.getParams().minimumAmplitude - histoOverLayer.axMin) /
(histoOverLayer.axMax-histoOverLayer.axMin) * histoOverLayer.plotRectangle.width; (histoOverLayer.axMax-histoOverLayer.axMin) * histoOverLayer.plotRectangle.width;
int x = (int) Math.round(dx); int x = (int) Math.round(dx);
if (Math.abs(e.getX()-x) > 10) { if (Math.abs(e.getX()-x) > 10) {
@ -213,14 +217,14 @@ public class BTAmplitudeSelector implements PamDialogPanel {
} }
private void setParams(BTDisplayParameters btParams) { private void setParams(BTDisplayParameters btParams) {
amplitudeSelect.setSelected(btParams.amplitudeSelect); amplitudeSelect.setSelected(btParams.amplitudeSelect);
minAmplitude.setText(String.format("%3.1f", btParams.minAmplitude)); minAmplitude.setText(String.format("%3.1f", dataSelector.getParams().minimumAmplitude));
enableControls(); enableControls();
} }
private boolean getParams(BTDisplayParameters btParams) { private boolean getParams(BTDisplayParameters btParams) {
btParams.amplitudeSelect = amplitudeSelect.isSelected(); btParams.amplitudeSelect = amplitudeSelect.isSelected();
try { try {
btParams.minAmplitude = Double.valueOf(minAmplitude.getText()); dataSelector.getParams().minimumAmplitude = Double.valueOf(minAmplitude.getText());
} }
catch (NumberFormatException e) { catch (NumberFormatException e) {
return false; return false;

View File

@ -44,17 +44,17 @@ public class BTDisplayParameters implements Serializable, Cloneable, ManagedPara
public int nBearingGridLines = 1; public int nBearingGridLines = 1;
public int nAmplitudeGridLines = 0; public int nAmplitudeGridLines = 0;
public int nICIGridLines = 0; public int nICIGridLines = 0;
public boolean showEchoes = true; // public boolean showEchoes = true;
public int minClickLength = 2, maxClickLength = 12; public int minClickLength = 2, maxClickLength = 12;
public int minClickHeight = 2, maxClickHeight = 12; public int minClickHeight = 2, maxClickHeight = 12;
private double timeRange = 10; private double timeRange = 10;
public int displayChannels = 0; public int displayChannels = 0;
public boolean view360; public boolean view360;
public boolean amplitudeSelect = false; public boolean amplitudeSelect = false;
public double minAmplitude = 0; // public double minAmplitude = 0;
public boolean showUnassignedICI = false; public boolean showUnassignedICI = false;
public boolean showEventsOnly = false; // public boolean showEventsOnly = false;
public boolean showANDEvents = true; // public boolean showANDEvents = true;
public boolean logICIScale; public boolean logICIScale;
public int angleRotation = ROTATE_TOARRAY; public int angleRotation = ROTATE_TOARRAY;
@ -65,7 +65,7 @@ public class BTDisplayParameters implements Serializable, Cloneable, ManagedPara
/* /*
* Show identified species * Show identified species
*/ */
private boolean[] showSpeciesList; // private boolean[] showSpeciesList;
public int colourScheme = COLOUR_BY_TRAIN; public int colourScheme = COLOUR_BY_TRAIN;
@ -83,7 +83,7 @@ public class BTDisplayParameters implements Serializable, Cloneable, ManagedPara
} catch (CloneNotSupportedException Ex) { } catch (CloneNotSupportedException Ex) {
Ex.printStackTrace(); Ex.printStackTrace();
} }
showSpeciesList = null; // showSpeciesList = null;
return null; return null;
} }
@ -107,49 +107,49 @@ public class BTDisplayParameters implements Serializable, Cloneable, ManagedPara
/** /**
* @return the showSpeciesList * @return the showSpeciesList
*/ */
public boolean getShowSpecies(int speciesIndex) { // public boolean getShowSpecies(int speciesIndex) {
if (showSpeciesList != null && showSpeciesList.length > speciesIndex) { // if (showSpeciesList != null && showSpeciesList.length > speciesIndex) {
return showSpeciesList[speciesIndex]; // return showSpeciesList[speciesIndex];
} // }
makeShowSpeciesList(speciesIndex); // makeShowSpeciesList(speciesIndex);
return true; // return true;
} // }
private void makeShowSpeciesList(int maxIndex) { // private void makeShowSpeciesList(int maxIndex) {
if (showSpeciesList == null) { // if (showSpeciesList == null) {
showSpeciesList = new boolean[0]; // showSpeciesList = new boolean[0];
} // }
else if (showSpeciesList.length > maxIndex) { // else if (showSpeciesList.length > maxIndex) {
return; // return;
} // }
int oldLength = showSpeciesList.length; // int oldLength = showSpeciesList.length;
showSpeciesList = Arrays.copyOf(showSpeciesList, maxIndex + 1); // showSpeciesList = Arrays.copyOf(showSpeciesList, maxIndex + 1);
for (int i = oldLength; i <= maxIndex; i++) { // for (int i = oldLength; i <= maxIndex; i++) {
showSpeciesList[i] = true; // showSpeciesList[i] = true;
} // }
} // }
/** /**
* @param showSpeciesList the showSpeciesList to set * @param showSpeciesList the showSpeciesList to set
*/ */
public void setShowSpecies(int speciesIndex, boolean showSpecies) { // public void setShowSpecies(int speciesIndex, boolean showSpecies) {
makeShowSpeciesList(speciesIndex); // makeShowSpeciesList(speciesIndex);
showSpeciesList[speciesIndex] = showSpecies; // showSpeciesList[speciesIndex] = showSpecies;
} // }
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try { // try {
Field field = this.getClass().getDeclaredField("showSpeciesList"); // Field field = this.getClass().getDeclaredField("showSpeciesList");
ps.put(new PrivatePamParameterData(this, field) { // ps.put(new PrivatePamParameterData(this, field) {
@Override // @Override
public Object getData() throws IllegalArgumentException, IllegalAccessException { // public Object getData() throws IllegalArgumentException, IllegalAccessException {
return showSpeciesList; // return showSpeciesList;
} // }
}); // });
} catch (NoSuchFieldException | SecurityException e) { // } catch (NoSuchFieldException | SecurityException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
return ps; return ps;
} }

View File

@ -34,6 +34,7 @@ import java.awt.Insets;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentEvent;
@ -115,9 +116,12 @@ import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit; import PamguardMVC.PamDataUnit;
import PamguardMVC.PamObservable; import PamguardMVC.PamObservable;
import PamguardMVC.PamObserver; import PamguardMVC.PamObserver;
import PamguardMVC.dataSelector.DataSelectDialog;
import PamguardMVC.superdet.SuperDetection; import PamguardMVC.superdet.SuperDetection;
import clickDetector.ClickClassifiers.ClickIdInformation; import clickDetector.ClickClassifiers.ClickIdInformation;
import clickDetector.ClickClassifiers.ClickIdentifier; import clickDetector.ClickClassifiers.ClickIdentifier;
import clickDetector.alarm.ClickAlarmParameters;
import clickDetector.dataSelector.ClickDataSelector;
import clickDetector.dialogs.ClickDisplayDialog; import clickDetector.dialogs.ClickDisplayDialog;
import clickDetector.offlineFuncs.OfflineEventDataBlock; import clickDetector.offlineFuncs.OfflineEventDataBlock;
import clickDetector.offlineFuncs.OfflineEventDataUnit; import clickDetector.offlineFuncs.OfflineEventDataUnit;
@ -2244,7 +2248,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
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, btDisplayParameters.minAmplitude); n, nAll, getDataSelector().getParams().minimumAmplitude);
Insets insets = getInsets(); Insets insets = getInsets();
int x = insets.left; int x = insets.left;
int y = getHeight()-5; int y = getHeight()-5;
@ -2383,19 +2387,33 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
} }
menuItem = new JMenuItem("Settings ..."); menuItem = new JMenuItem("Settings ...");
menuItem.setToolTipText("Display options");
menuItem.addActionListener(new SettingsMenuAction()); menuItem.addActionListener(new SettingsMenuAction());
menu.add(menuItem); menu.add(menuItem);
menuItem = new JMenuItem("Click data selector ...");
menuItem.setToolTipText("Detailed data selection options");
menuItem.addActionListener(new DataSelectorAction());
menu.add(menuItem);
menuItem = new JMenuItem("Show amplitude selector ..."); menuItem = new JMenuItem("Show amplitude selector ...");
menuItem.setToolTipText("Graphical amplitude selector display");
menuItem.addActionListener(new AmplitudeSelector()); menuItem.addActionListener(new AmplitudeSelector());
menu.add(menuItem); menu.add(menuItem);
menu.addSeparator(); menu.addSeparator();
ArrayList<JMenuItem> colOptList = getSymbolChooser().getQuickMenuItems(clickControl.getGuiFrame(), this, "Colour by ", SymbolModType.EVERYTHING, true); ArrayList<JMenuItem> colOptList = getSymbolChooser().getQuickMenuItems(clickControl.getGuiFrame(), this, "Colour by ", SymbolModType.EVERYTHING, false);
if (colOptList != null) { if (colOptList != null) {
for (JMenuItem menuIt : colOptList) { for (JMenuItem menuIt : colOptList) {
menu.add(menuIt); menu.add(menuIt);
} }
menu.addSeparator();
} }
menuItem = new JMenuItem("More symbol options ...");
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showDataSymbolOptions(1);
}
});
menu.add(menuItem);
menu.addSeparator();
// menuItem = new JCheckBoxMenuItem("Colour by species id", // menuItem = new JCheckBoxMenuItem("Colour by species id",
// btDisplayParameters.colourScheme == BTDisplayParameters.COLOUR_BY_SPECIES); // btDisplayParameters.colourScheme == BTDisplayParameters.COLOUR_BY_SPECIES);
@ -2470,7 +2488,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
return menu; return menu;
} }
/** /**
* Looks through the current modules and finds if there is a target motion or static localiser * Looks through the current modules and finds if there is a target motion or static localiser
*/ */
@ -2771,7 +2789,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
BTDisplayParameters newParameters = BTDisplayParameters newParameters =
ClickDisplayDialog.showDialog(clickControl, ClickDisplayDialog.showDialog(clickControl,
clickControl.getGuiFrame(), btDisplayParameters); clickControl.getGuiFrame(), btDisplayParameters, getDataSelector().getClickAlarmParameters());
if (newParameters != null){ if (newParameters != null){
btDisplayParameters = newParameters.clone(); btDisplayParameters = newParameters.clone();
if (getVScaleManager() != null) { if (getVScaleManager() != null) {
@ -2788,6 +2806,15 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
} }
} }
/**
* Get a data selector specific to this display.
* @return click data selector specific to this display.
*/
public ClickDataSelector getDataSelector() {
return (ClickDataSelector) clickControl.getClickDataBlock().getDataSelector(getUnitName(), false);
}
class AmplitudeSelector implements ActionListener { class AmplitudeSelector implements ActionListener {
@Override @Override
@ -2795,6 +2822,13 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
showAmplitudeSelector(); showAmplitudeSelector();
} }
} }
class DataSelectorAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
showDataSelector();
}
}
private void showAmplitudeSelector() { private void showAmplitudeSelector() {
@ -2814,6 +2848,38 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
// } // }
} }
/**
* Show a dialog with both data and symbol options, but go to the correct tab.
* @param selectedTab
* @return
*/
private boolean showDataSymbolOptions(int selectedTab) {
Window javaFrame = clickControl.getGuiFrame();
DataSelectDialog dataSelectDialog = new DataSelectDialog(javaFrame, clickControl.getClickDataBlock(), getDataSelector(), symbolChooser);
if (javaFrame == null) {
dataSelectDialog.moveToMouseLocation();
}
dataSelectDialog.setTab(selectedTab);
boolean ok = dataSelectDialog.showDialog();
if (ok) {
repaintBoth();
if (clickControl.getOfflineToolbar() != null) {
clickControl.getOfflineToolbar().displayActivated(clickBTDisplay);
}
}
return ok;
}
public void showDataSelector() {
// if (getDataSelector().showSelectDialog(clickControl.getGuiFrame())) {
// repaintBoth();
// if (clickControl.getOfflineToolbar() != null) {
// clickControl.getOfflineToolbar().displayActivated(clickBTDisplay);
// }
// };
showDataSymbolOptions(0);
}
private void checkBTAmplitudeSelectHisto() { private void checkBTAmplitudeSelectHisto() {
if (btAmplitudeSelector == null) { if (btAmplitudeSelector == null) {
return; return;
@ -3036,15 +3102,15 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
zoomer.paintShape(g, this, true); zoomer.paintShape(g, this, true);
} }
// long t1 = System.nanoTime(); ArrayList<ClickDetection> clickCopy = clickData.getDataCopy(displayStartMillis, displayStartMillis+displayLengthMillis, true, getDataSelector());
synchronized (clickData.getSynchLock()) { if (clickCopy.size() == 0) {
// long t2 = System.nanoTime(); return;
// double ms = ((double) (t2-t1)) / 1000000.; }
// if (btDisplayParameters.VScale == BTDisplayParameters.DISPLAY_ICI) { ListIterator<ClickDetection> clickIterator = clickCopy.listIterator(clickCopy.size()-1);
// sortTempICIs();
// }
ListIterator<ClickDetection> clickIterator = clickData.getListIterator(PamDataBlock.ITERATOR_END); // synchronized (clickData.getSynchLock()) {
//
// ListIterator<ClickDetection> clickIterator = clickData.getListIterator(PamDataBlock.ITERATOR_END);
while (clickIterator.hasPrevious()) { while (clickIterator.hasPrevious()) {
click = clickIterator.previous(); click = clickIterator.previous();
if (shouldPlot(prevPlottedClick)){ if (shouldPlot(prevPlottedClick)){
@ -3060,11 +3126,6 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
if (shouldPlot(prevPlottedClick)){ // and draw the last one ! if (shouldPlot(prevPlottedClick)){ // and draw the last one !
drawClick(g, prevPlottedClick, clipRectangle); drawClick(g, prevPlottedClick, clipRectangle);
} }
// g.drawString(String.format("Wait synch %3.3fms", ms), 0, 20);
}
// long t3 = System.nanoTime();
// g.drawString(String.format("Last draw %3.3fms", lastPaintTime), 0, 20);
// lastPaintTime = ((double) (t3-t0)) / 1000000.;
} }
@Override @Override
@ -3342,7 +3403,9 @@ 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"));
} }
if (btDisplayParameters.getShowSpecies(0)) { ClickAlarmParameters selectParams = getDataSelector().getParams();
// if (btDisplayParameters.getShowSpecies(0)) {
if (selectParams.onlineAutoEvents | selectParams.onlineManualEvents) {
keyPanel.add(symbolChooser.getDefaultSymbol(true).makeKeyItem("Unidentified species")); keyPanel.add(symbolChooser.getDefaultSymbol(true).makeKeyItem("Unidentified species"));
} }
@ -3354,7 +3417,8 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
PamSymbol[] symbols = clickControl.getClickIdentifier().getSymbols(); PamSymbol[] symbols = clickControl.getClickIdentifier().getSymbols();
if (speciesList != null) { if (speciesList != null) {
for (int i = 0; i < speciesList.length; i++) { for (int i = 0; i < speciesList.length; i++) {
if (btDisplayParameters.getShowSpecies(i+1)) { if (selectParams.getUseSpecies(i+1)) {
// if (btDisplayParameters.getShowSpecies(i+1)) {
if (btDisplayParameters.colourScheme != BTDisplayParameters.COLOUR_BY_TRAIN) { if (btDisplayParameters.colourScheme != BTDisplayParameters.COLOUR_BY_TRAIN) {
keyPanel.add(symbols[i].makeKeyItem(speciesList[i])); keyPanel.add(symbols[i].makeKeyItem(speciesList[i]));
} }
@ -3423,11 +3487,12 @@ 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;
synchronized (clickData.getSynchLock()) { synchronized (clickData.getSynchLock()) {
ListIterator<ClickDetection> clickIterator = clickData.getListIterator(0); ListIterator<ClickDetection> clickIterator = clickData.getListIterator(0);
while (clickIterator.hasNext()) { while (clickIterator.hasNext()) {
click = clickIterator.next(); click = clickIterator.next();
if (click.getAmplitudeDB() < btDisplayParameters.minAmplitude) { if (click.getAmplitudeDB() < minAmpli) {
n++; n++;
} }
} }
@ -3448,29 +3513,30 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
*/ */
synchronized boolean shouldPlot(ClickDetection click) { synchronized boolean shouldPlot(ClickDetection click) {
if (click == null) return false; if (click == null) return false;
if (!clickInTimeWindow(click)) return false; // if (!clickInTimeWindow(click)) return false;
if (btDisplayParameters.showEchoes == false && click.isEcho()) { // if (btDisplayParameters.showEchoes == false && click.isEcho()) {
return false; // return false;
} // }
if (btDisplayParameters.VScale == BTDisplayParameters.DISPLAY_ICI) { if (btDisplayParameters.VScale == BTDisplayParameters.DISPLAY_ICI) {
// if (btDisplayParameters.showUnassignedICI == false && click.getICI() < 0) return false; // if (btDisplayParameters.showUnassignedICI == false && click.getICI() < 0) return false;
if (btDisplayParameters.showUnassignedICI == false && click.getSuperDetectionsCount() <= 0) return false; if (btDisplayParameters.showUnassignedICI == false && click.getSuperDetectionsCount() <= 0) return false;
// otherwise may be ok, since will estimate all ici's on teh fly. // otherwise may be ok, since will estimate all ici's on teh fly.
} }
if (btDisplayParameters.amplitudeSelect && click.getAmplitudeDB() < btDisplayParameters.minAmplitude) { // if (btDisplayParameters.amplitudeSelect && click.getAmplitudeDB() < btDisplayParameters.minAmplitude) {
return false; // return false;
} // }
if (btDisplayParameters.displayChannels > 0 && (btDisplayParameters.displayChannels & click.getChannelBitmap()) == 0) return false; if (btDisplayParameters.displayChannels > 0 && (btDisplayParameters.displayChannels & click.getChannelBitmap()) == 0) return false;
int speciesIndex = clickControl.getClickIdentifier().codeToListIndex(click.getClickType()); // int speciesIndex = clickControl.getClickIdentifier().codeToListIndex(click.getClickType());
boolean showSpecies = btDisplayParameters.getShowSpecies(speciesIndex+1); // boolean showSpecies = btDisplayParameters.getShowSpecies(speciesIndex+1);
boolean showEvents = (btDisplayParameters.showEventsOnly == false || click.getSuperDetectionsCount() > 0); // boolean showEvents = (btDisplayParameters.showEventsOnly == false || click.getSuperDetectionsCount() > 0);
if (btDisplayParameters.showANDEvents) { // if (btDisplayParameters.showANDEvents) {
return showSpecies & showEvents; // return showSpecies & showEvents;
} // }
else { // else {
return showSpecies | showEvents; // return showSpecies | showEvents;
} // }
return true;
} }
/** /**
@ -4085,7 +4151,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", btDisplayParameters.minAmplitude); String txt = String.format(" Amplitude Selector showing clicks > %3.1fdB", getDataSelector().getParams().minimumAmplitude);
amplitudeSelectorLabel.setText(txt); amplitudeSelectorLabel.setText(txt);
} }
} }

View File

@ -17,10 +17,12 @@ public class ClickAlarmParameters extends DataSelectParams implements Cloneable,
public static final long serialVersionUID = 1L; public static final long serialVersionUID = 1L;
private boolean[] useSpeciesList; private boolean[] useSpeciesList;
private double[] speciesWeightings; private double[] speciesWeightings;
public boolean useEchoes; public boolean useEchoes = true;
public boolean scoreByAmplitude; public boolean scoreByAmplitude; // alarm options, probably not used any more.
public boolean onlineAutoEvents, onlineManualEvents; public double minimumAmplitude;
public boolean onlineAutoEvents = true, onlineManualEvents = true;
public int minICIMillis; public int minICIMillis;
private boolean clicksOREvents = false;
/* /*
* Which events to use ... * Which events to use ...
*/ */
@ -165,5 +167,30 @@ public class ClickAlarmParameters extends DataSelectParams implements Cloneable,
return ps; return ps;
} }
/**
* @return the clicksOREvents
*/
public boolean isClicksOREvents() {
return clicksOREvents;
}
/**
* @param clicksOREvents the clicksOREvents to set
*/
public void setClicksOREvents(boolean clicksOREvents) {
this.clicksOREvents = clicksOREvents;
}
/**
* @return the clicksANDEvents
*/
public boolean isClicksANDEvents() {
return !clicksOREvents;
}
public void setClicksANDEvents(boolean clicksANDEvents) {
this.clicksOREvents = !clicksANDEvents;
}
} }

View File

@ -38,9 +38,9 @@ public class ClickDataSelector extends DataSelector {
@Override @Override
public PamDialogPanel getDialogPanel() { public PamDialogPanel getDialogPanel() {
if (clickSelectPanel == null) { // if (clickSelectPanel == null) {
clickSelectPanel = new ClickSelectPanel(this, allowScores, useEventTypes); clickSelectPanel = new ClickSelectPanel(this, allowScores, useEventTypes);
} // }
return clickSelectPanel; return clickSelectPanel;
} }
@Override @Override
@ -60,19 +60,25 @@ public class ClickDataSelector extends DataSelector {
if (clickAlarmParameters.useEchoes == false && click.isEcho()) { if (clickAlarmParameters.useEchoes == false && click.isEcho()) {
return 0; return 0;
} }
/**
* First score based on whether the event panel is in use and double score = scoreClick(click);
* criteria satisfied.
*/
if (useEventTypes) { if (useEventTypes) {
if (wantEventType(click) == false) { double eventScore = scoreEventType(click);
return 0; if (clickAlarmParameters.isClicksANDEvents()) {
score = Math.min(score, eventScore);
}
else {
score = Math.max(score, eventScore);
} }
} }
return score;
/* }
* Now score based on whether or not it's individual click type is wanted.
*/ private double scoreClick(ClickDetection click) {
if (click.getAmplitudeDB() < clickAlarmParameters.minimumAmplitude) {
return 0;
}
ClickIdentifier clickIdentifier = clickControl.getClickIdentifier(); ClickIdentifier clickIdentifier = clickControl.getClickIdentifier();
int code = click.getClickType(); int code = click.getClickType();
if (code > 0 && clickIdentifier != null) { if (code > 0 && clickIdentifier != null) {
@ -81,13 +87,13 @@ public class ClickDataSelector extends DataSelector {
boolean enabled = clickAlarmParameters.getUseSpecies(code); boolean enabled = clickAlarmParameters.getUseSpecies(code);
if (enabled == false) { if (enabled == false) {
return 0; return 0;
} }if (isAllowScores()) {
if (isAllowScores()) {
return clickAlarmParameters.getSpeciesWeight(code); return clickAlarmParameters.getSpeciesWeight(code);
} }
else { else {
return 1; return 1;
} }
} }
/** /**
@ -95,7 +101,7 @@ public class ClickDataSelector extends DataSelector {
* @param click * @param click
* @return * @return
*/ */
private boolean wantEventType(ClickDetection click) { private double scoreEventType(ClickDetection click) {
OfflineEventDataUnit oev = null; OfflineEventDataUnit oev = null;
try { try {
@ -107,7 +113,7 @@ public class ClickDataSelector extends DataSelector {
int eventId = click.getOfflineEventID(); int eventId = click.getOfflineEventID();
if (oev == null) { if (oev == null) {
return clickAlarmParameters.unassignedEvents; return clickAlarmParameters.unassignedEvents ? 1 : 0;
} }
// see if there is a super detection and see if it's got a comment. // see if there is a super detection and see if it's got a comment.
@ -118,10 +124,10 @@ public class ClickDataSelector extends DataSelector {
isAutomatic = comment.startsWith("Automatic"); isAutomatic = comment.startsWith("Automatic");
} }
if (isAutomatic && clickAlarmParameters.onlineAutoEvents) { if (isAutomatic && clickAlarmParameters.onlineAutoEvents) {
return true; return 1;
} }
else if (clickAlarmParameters.onlineManualEvents) { else if (clickAlarmParameters.onlineManualEvents) {
return true; return 1;
} }
// if (clickAlarmParameters.onlineAutoEvents && comment.startsWith("Automatic")) { // if (clickAlarmParameters.onlineAutoEvents && comment.startsWith("Automatic")) {
// return true; // return true;
@ -134,7 +140,7 @@ public class ClickDataSelector extends DataSelector {
* list of event types and see if it's wanted. * list of event types and see if it's wanted.
*/ */
String evType = oev.getEventType(); String evType = oev.getEventType();
return clickAlarmParameters.isUseEventType(evType); return clickAlarmParameters.isUseEventType(evType) ? 1 : 0;
} }
@ -188,7 +194,7 @@ public class ClickDataSelector extends DataSelector {
* @see PamguardMVC.dataSelector.DataSelector#getParams() * @see PamguardMVC.dataSelector.DataSelector#getParams()
*/ */
@Override @Override
public DataSelectParams getParams() { public ClickAlarmParameters getParams() {
return clickAlarmParameters; return clickAlarmParameters;
} }

View File

@ -4,6 +4,7 @@ import generalDatabase.lookupTables.LookUpTables;
import generalDatabase.lookupTables.LookupList; import generalDatabase.lookupTables.LookupList;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints; import java.awt.GridBagConstraints;
import java.awt.GridBagLayout; import java.awt.GridBagLayout;
import java.awt.Insets; import java.awt.Insets;
@ -13,11 +14,13 @@ import java.awt.event.ActionListener;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import PamController.PamController; import PamController.PamController;
@ -42,6 +45,7 @@ public class ClickSelectPanel implements PamDialogPanel {
private ClickDataSelector clickDataSelector; private ClickDataSelector clickDataSelector;
private JPanel mainPanel; private JPanel mainPanel;
private boolean isViewer; private boolean isViewer;
private JComboBox<String> andOrBox;
public static final String mainTip = "You should select options in both the Click Type and the Event Type panels"; public static final String mainTip = "You should select options in both the Click Type and the Event Type panels";
@ -70,10 +74,12 @@ public class ClickSelectPanel implements PamDialogPanel {
public void setParams() { public void setParams() {
eventTypePanel.setParams(); eventTypePanel.setParams();
speciesPanel.setParams(); speciesPanel.setParams();
andOrBox.setSelectedIndex(clickDataSelector.getParams().isClicksANDEvents() ? 0 : 1);
} }
@Override @Override
public boolean getParams() { public boolean getParams() {
clickDataSelector.getParams().setClicksANDEvents(andOrBox.getSelectedIndex() == 0);
return (speciesPanel.getParams() & eventTypePanel.getParams()); return (speciesPanel.getParams() & eventTypePanel.getParams());
} }
@ -163,17 +169,26 @@ public class ClickSelectPanel implements PamDialogPanel {
// JRadioButton andEvents, orEvents; // JRadioButton andEvents, orEvents;
// JRadioButton anyEvents, onlyEvents; // JRadioButton anyEvents, onlyEvents;
private JCheckBox useEchoes; private JCheckBox useEchoes;
private JTextField minAmplitude;
private JCheckBox scoreByAmplitude; private JCheckBox scoreByAmplitude;
private JTextField minICI; private JTextField minICI;
SpeciesPanel () { SpeciesPanel () {
super(); super();
setLayout(new BorderLayout()); // setLayout(new BorderLayout());
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
northPanel = new JPanel(); northPanel = new JPanel();
northPanel.setLayout(new GridBagLayout()); northPanel.setLayout(new GridBagLayout());
GridBagConstraints c = new PamGridBagContraints(); GridBagConstraints c = new PamGridBagContraints();
c.gridwidth = 3; c.gridwidth = 1;
c.anchor = GridBagConstraints.WEST; c.anchor = GridBagConstraints.WEST;
northPanel.add(new JLabel("Minimum amplitude ", JLabel.RIGHT), c);
c.gridx++;
northPanel.add(minAmplitude = new JTextField(4), c);
c.gridx++;
northPanel.add(new JLabel(" dB"));
c.gridx = 0;
c.gridy++;
northPanel.add(new PamAlignmentPanel(useEchoes = new JCheckBox("Use Echoes"), BorderLayout.WEST), c); northPanel.add(new PamAlignmentPanel(useEchoes = new JCheckBox("Use Echoes"), BorderLayout.WEST), c);
c.gridwidth = 1; c.gridwidth = 1;
c.gridy++; c.gridy++;
@ -185,35 +200,50 @@ public class ClickSelectPanel implements PamDialogPanel {
// minICI.setToolTipText("Minimum ICI in milliseconds"); // minICI.setToolTipText("Minimum ICI in milliseconds");
// c.gridx++; // c.gridx++;
// northPanel.add(new JLabel(" ms", JLabel.LEFT), c); // northPanel.add(new JLabel(" ms", JLabel.LEFT), c);
c.gridwidth = 3; scoreByAmplitude = new JCheckBox("Score by amplitude");
c.gridy++; if (allowScores) {
c.gridx = 0; c.gridwidth = 3;
northPanel.add(scoreByAmplitude = new JCheckBox("Score by amplitude"), c); c.gridy++;
scoreByAmplitude.setVisible(allowScores); c.gridx = 0;
scoreByAmplitude.addActionListener(new AllSpeciesListener()); northPanel.add(scoreByAmplitude, c);
scoreByAmplitude.setVisible(allowScores);
scoreByAmplitude.addActionListener(new AllSpeciesListener());
}
WestAlignedPanel walpn; WestAlignedPanel walpn;
add(BorderLayout.NORTH, walpn = new WestAlignedPanel(northPanel)); this.add(walpn = new WestAlignedPanel(northPanel));
walpn.setBorder(new SeparatorBorder("Echoes")); walpn.setBorder(new SeparatorBorder("Click Selection"));
JPanel centralOuterPanel = new JPanel(new BorderLayout()); JPanel centralOuterPanel = new JPanel(new BorderLayout());
centralPanel.setLayout(new GridBagLayout()); centralPanel.setLayout(new GridBagLayout());
centralOuterPanel.setBorder(new SeparatorBorder("Click Type Selection")); centralOuterPanel.setBorder(new SeparatorBorder("Click Types"));
add(BorderLayout.CENTER, centralOuterPanel); this.add(centralOuterPanel);
JScrollPane scrollPane = new DialogScrollPane(new PamAlignmentPanel(centralPanel, BorderLayout.WEST), 10); JScrollPane scrollPane = new DialogScrollPane(new PamAlignmentPanel(centralPanel, BorderLayout.WEST), 10);
centralOuterPanel.add(BorderLayout.CENTER, scrollPane); centralOuterPanel.add(BorderLayout.CENTER, scrollPane);
centralEastPanel.setLayout(new GridBagLayout()); centralEastPanel.setLayout(new GridBagLayout());
c = new PamGridBagContraints(); c = new PamGridBagContraints();
centralEastPanel.add(selectAll = new JButton("Select All"), c); c.ipady = 0;
c.gridx++; c.insets.bottom = c.insets.top = c.insets.left = c.insets.right = 0;
centralEastPanel.add(clearAll = new JButton("Clear All"), c); centralEastPanel.add(selectAll = new JButton("All"), c);
c.gridy++;
centralEastPanel.add(clearAll = new JButton("None"), c);
selectAll.setBorder(new EmptyBorder(3,3,2,3));
clearAll.setBorder(new EmptyBorder(3,3,2,3));
selectAll.addActionListener(new AutoSelect(true)); selectAll.addActionListener(new AutoSelect(true));
clearAll.addActionListener(new AutoSelect(false)); clearAll.addActionListener(new AutoSelect(false));
centralOuterPanel.add(BorderLayout.SOUTH, new PamAlignmentPanel(centralEastPanel, BorderLayout.WEST)); centralOuterPanel.add(BorderLayout.EAST, new PamAlignmentPanel(centralEastPanel, BorderLayout.NORTH));
centralOuterPanel.setToolTipText(mainTip); centralOuterPanel.setToolTipText(mainTip);
this.add(andOrBox = new JComboBox<>());
andOrBox.setToolTipText("Select how to logically combine the click and event selections");
andOrBox.addItem("AND");
andOrBox.addItem("OR");
JPanel emptyPanel = new JPanel();
emptyPanel.setPreferredSize(new Dimension(10, 5));
this.add(emptyPanel);
setToolTipText(mainTip); setToolTipText(mainTip);
} }
@ -254,6 +284,7 @@ public class ClickSelectPanel implements PamDialogPanel {
} }
} }
useEchoes.setSelected(clickAlarmParameters.useEchoes); useEchoes.setSelected(clickAlarmParameters.useEchoes);
minAmplitude.setText(String.format("%3.1f", clickAlarmParameters.minimumAmplitude));
minICI.setText(String.format("%d", clickAlarmParameters.minICIMillis)); minICI.setText(String.format("%d", clickAlarmParameters.minICIMillis));
scoreByAmplitude.setSelected(clickAlarmParameters.scoreByAmplitude); scoreByAmplitude.setSelected(clickAlarmParameters.scoreByAmplitude);
allWeight.setText(String.format("%3.1f", clickAlarmParameters.getSpeciesWeight(0))); allWeight.setText(String.format("%3.1f", clickAlarmParameters.getSpeciesWeight(0)));
@ -279,6 +310,12 @@ public class ClickSelectPanel implements PamDialogPanel {
ClickAlarmParameters clickAlarmParameters = clickDataSelector.getClickAlarmParameters().clone(); ClickAlarmParameters clickAlarmParameters = clickDataSelector.getClickAlarmParameters().clone();
clickAlarmParameters.useEchoes = useEchoes.isSelected(); clickAlarmParameters.useEchoes = useEchoes.isSelected();
try {
clickAlarmParameters.minimumAmplitude = Double.valueOf(minAmplitude.getText());
}
catch (NumberFormatException e) {
return PamDialog.showWarning(null, "Minimum amplitude", "Invalid minimum amplitude value");
}
try { try {
clickAlarmParameters.minICIMillis = Integer.valueOf(minICI.getText()); clickAlarmParameters.minICIMillis = Integer.valueOf(minICI.getText());
} }

View File

@ -31,6 +31,7 @@ import PamView.dialog.warn.WarnOnce;
import clickDetector.BTDisplayParameters; import clickDetector.BTDisplayParameters;
import clickDetector.ClickControl; import clickDetector.ClickControl;
import clickDetector.ClickClassifiers.ClickIdentifier; import clickDetector.ClickClassifiers.ClickIdentifier;
import clickDetector.alarm.ClickAlarmParameters;
/** /**
* Dialog for basic click display parameters * Dialog for basic click display parameters
@ -57,6 +58,8 @@ public class ClickDisplayDialog extends PamDialog implements ActionListener {
private SizePanel sizePanel; private SizePanel sizePanel;
private SpeciesPanel speciesPanel; private SpeciesPanel speciesPanel;
private JComboBox<String> angleTypes; private JComboBox<String> angleTypes;
private ClickAlarmParameters clickSelectParams;
private ClickDisplayDialog(Window owner) { private ClickDisplayDialog(Window owner) {
@ -86,12 +89,13 @@ public class ClickDisplayDialog extends PamDialog implements ActionListener {
} }
public static BTDisplayParameters showDialog(ClickControl clickControl, Window parentFrame, BTDisplayParameters btDisplayParameters) { public static BTDisplayParameters showDialog(ClickControl clickControl, Window parentFrame, BTDisplayParameters btDisplayParameters, ClickAlarmParameters clickSelectParams) {
if (singleInstance == null || singleInstance.getOwner() != parentFrame) { if (singleInstance == null || singleInstance.getOwner() != parentFrame) {
singleInstance = new ClickDisplayDialog(parentFrame); singleInstance = new ClickDisplayDialog(parentFrame);
} }
singleInstance.clickControl = clickControl; singleInstance.clickControl = clickControl;
singleInstance.btDisplayParameters = btDisplayParameters.clone(); singleInstance.btDisplayParameters = btDisplayParameters.clone();
singleInstance.clickSelectParams = clickSelectParams;
singleInstance.setParams(btDisplayParameters); singleInstance.setParams(btDisplayParameters);
singleInstance.setVisible(true); singleInstance.setVisible(true);
return singleInstance.btDisplayParameters; return singleInstance.btDisplayParameters;
@ -514,14 +518,16 @@ public class ClickDisplayDialog extends PamDialog implements ActionListener {
} }
} }
} }
showEchoes.setSelected(btDisplayParameters.showEchoes); showEchoes.setSelected(clickSelectParams.useEchoes);
if (species == null) { if (species == null) {
showAll.setSelected(true); showAll.setSelected(true);
} }
else { else {
showAll.setSelected(btDisplayParameters.getShowSpecies(0)); // showAll.setSelected(btDisplayParameters.getShowSpecies(0));
showAll.setSelected(clickSelectParams.getUseSpecies(0));
for (int i = 0; i < species.length; i++) { for (int i = 0; i < species.length; i++) {
species[i].setSelected(btDisplayParameters.getShowSpecies(i+1)); species[i].setSelected(clickSelectParams.getUseSpecies(i+1));
// species[i].setSelected(btDisplayParameters.getShowSpecies(i+1));
} }
// if (btDisplayParameters.showSpeciesList != null) { // if (btDisplayParameters.showSpeciesList != null) {
// for (int i = 0; i < Math.min(species.length, btDisplayParameters.showSpeciesList.length);i++) { // for (int i = 0; i < Math.min(species.length, btDisplayParameters.showSpeciesList.length);i++) {
@ -529,9 +535,10 @@ public class ClickDisplayDialog extends PamDialog implements ActionListener {
// } // }
// } // }
} }
clicksInAnEvent.setSelected(clickSelectParams.onlineAutoEvents | clickSelectParams.onlineAutoEvents);
clicksInAnEvent.setSelected(btDisplayParameters.showEventsOnly);
andOrSelection.setSelectedIndex(btDisplayParameters.showANDEvents ? 0: 1); // clicksInAnEvent.setSelected(btDisplayParameters.showEventsOnly);
// andOrSelection.setSelectedIndex(btDisplayParameters.showANDEvents ? 0: 1);
// orEvents.setSelected(!btDisplayParameters.showANDEvents); // orEvents.setSelected(!btDisplayParameters.showANDEvents);
// andEvents.setSelected(btDisplayParameters.showANDEvents); // andEvents.setSelected(btDisplayParameters.showANDEvents);
// anyEvents.setSelected(!btDisplayParameters.showEventsOnly); // anyEvents.setSelected(!btDisplayParameters.showEventsOnly);
@ -540,19 +547,17 @@ public class ClickDisplayDialog extends PamDialog implements ActionListener {
enableButtons(); enableButtons();
} }
boolean getParams() { boolean getParams() {
btDisplayParameters.showEchoes = showEchoes.isSelected(); // clickSelectParams.useEchoes = showEchoes.isSelected();
btDisplayParameters.setShowSpecies(0, showAll.isSelected()); // btDisplayParameters.setShowSpecies(0, showAll.isSelected());
if (species != null) { // if (species != null) {
for (int i = 0; i < species.length; i++) { // for (int i = 0; i < species.length; i++) {
btDisplayParameters.setShowSpecies(i+1, species[i].isSelected()); // btDisplayParameters.setShowSpecies(i+1, species[i].isSelected());
} // }
//
} // }
//
btDisplayParameters.showEventsOnly = clicksInAnEvent.isSelected(); // btDisplayParameters.showEventsOnly = clicksInAnEvent.isSelected();
btDisplayParameters.showANDEvents = (andOrSelection.getSelectedIndex() == 0); // btDisplayParameters.showANDEvents = (andOrSelection.getSelectedIndex() == 0);
// btDisplayParameters.showANDEvents = andEvents.isSelected();
// btDisplayParameters.showEventsOnly = onlyEvents.isSelected();
return true; return true;
} }
class AllSpeciesListener implements ActionListener { class AllSpeciesListener implements ActionListener {

View File

@ -31,12 +31,15 @@ import clickDetector.ClickBTDisplay;
import clickDetector.ClickControl; import clickDetector.ClickControl;
import clickDetector.ClickDisplay; import clickDetector.ClickDisplay;
import clickDetector.ClickClassifiers.ClickIdentifier; import clickDetector.ClickClassifiers.ClickIdentifier;
import clickDetector.alarm.ClickAlarmParameters;
import clickDetector.dataSelector.ClickDataSelector;
import PamView.PamToolBar; import PamView.PamToolBar;
import PamView.component.PamSettingsIconButton; import PamView.component.PamSettingsIconButton;
import PamView.dialog.PamCheckBox; import PamView.dialog.PamCheckBox;
import PamView.dialog.PamLabel; import PamView.dialog.PamLabel;
import PamView.dialog.PamRadioButton; import PamView.dialog.PamRadioButton;
import PamView.panel.PamPanel; import PamView.panel.PamPanel;
import PamguardMVC.dataSelector.DataSelectParams;
public class OfflineToolbar { public class OfflineToolbar {
@ -252,19 +255,29 @@ public class OfflineToolbar {
return; return;
} }
try { try {
ClickDataSelector clickDataSelector = currentBTDisplay.getDataSelector();
ClickAlarmParameters selectParams = clickDataSelector.getParams();
BTDisplayParameters btDisplayParameters = currentBTDisplay.getBtDisplayParameters(); BTDisplayParameters btDisplayParameters = currentBTDisplay.getBtDisplayParameters();
btDisplayParameters.setShowSpecies(0, showNonSpecies.isSelected());
btDisplayParameters.showEchoes = showEchoes.isSelected(); selectParams.setUseSpecies(0, showNonSpecies.isSelected());
// btDisplayParameters.setShowSpecies(0, showNonSpecies.isSelected());
// btDisplayParameters.showEchoes = showEchoes.isSelected();
selectParams.useEchoes = showEchoes.isSelected();
if (clicksInAnEvent != null) { if (clicksInAnEvent != null) {
btDisplayParameters.showEventsOnly = clicksInAnEvent.isSelected(); // btDisplayParameters.showEventsOnly = clicksInAnEvent.isSelected();
// selectParams.onlineAutoEvents = selectParams.onlineManualEvents = true;
selectParams.unassignedEvents =clicksInAnEvent.isSelected() == false;
} }
if (andOrSelection != null) { if (andOrSelection != null) {
btDisplayParameters.showANDEvents = (andOrSelection.getSelectedIndex() == 0); selectParams.setClicksANDEvents(andOrSelection.getSelectedIndex() == 0);
// btDisplayParameters.showANDEvents = (andOrSelection.getSelectedIndex() == 0);
} }
if (speciesButtons != null) { if (speciesButtons != null) {
int n = speciesButtons.length; int n = speciesButtons.length;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
btDisplayParameters.setShowSpecies(i+1, speciesButtons[i].isSelected()); selectParams.setUseSpecies(i+1, speciesButtons[i].isSelected());
// btDisplayParameters.setShowSpecies(i+1, speciesButtons[i].isSelected());
} }
} }
currentBTDisplay.repaintTotal(); currentBTDisplay.repaintTotal();
@ -275,23 +288,35 @@ public class OfflineToolbar {
} }
private void checkButtons(BTDisplayParameters btDisplayParameters) { private void checkButtons(BTDisplayParameters btDisplayParameters) {
showEchoes.setSelected(btDisplayParameters.showEchoes); ClickDataSelector clickDataSelector = currentBTDisplay.getDataSelector();
showNonSpecies.setSelected(btDisplayParameters.getShowSpecies(0)); ClickAlarmParameters selectParams = clickDataSelector.getParams();
showEchoes.setSelected(selectParams.useEchoes);
showNonSpecies.setSelected(selectParams.getUseSpecies(0));
// showNonSpecies.setSelected(btDisplayParameters.getShowSpecies(0));
boolean anySel = false;;
if (clicksInAnEvent != null) { if (clicksInAnEvent != null) {
clicksInAnEvent.setSelected(btDisplayParameters.showEventsOnly); clicksInAnEvent.setSelected(selectParams.unassignedEvents == false);
anySel |= clicksInAnEvent.isSelected();
// clicksInAnEvent.setSelected(btDisplayParameters.showEventsOnly);
} }
if (speciesButtons != null) { if (speciesButtons != null) {
int n = speciesButtons.length; int n = speciesButtons.length;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
speciesButtons[i].setSelected(btDisplayParameters.getShowSpecies(i+1)); speciesButtons[i].setSelected(selectParams.getUseSpecies(i+1));
anySel |= speciesButtons[i].isSelected();
// speciesButtons[i].setSelected(btDisplayParameters.getShowSpecies(i+1));
} }
} }
// setting combo box fires actionlistener, so we have to make sure that all checkboxes have been properly set first // setting combo box fires actionlistener, so we have to make sure that all checkboxes have been properly set first
// or else they will get cleared later // or else they will get cleared later
if (andOrSelection != null) { if (andOrSelection != null) {
andOrSelection.setSelectedIndex(btDisplayParameters.showANDEvents ? 0: 1); andOrSelection.setSelectedIndex(selectParams.isClicksANDEvents() ? 0 : 1);
// andOrSelection.setSelectedIndex(btDisplayParameters.showANDEvents ? 0: 1);
} }
firstSetup = true; firstSetup = true;
if (anySel) {
selectParams.setCombinationFlag(DataSelectParams.DATA_SELECT_AND);
}
} }
} }

View File

@ -9,6 +9,8 @@ import clickDetector.BTDisplayParameters;
import clickDetector.ClickControl; import clickDetector.ClickControl;
import clickDetector.ClickDetection; import clickDetector.ClickDetection;
import clickDetector.ClickDisplayManagerParameters; import clickDetector.ClickDisplayManagerParameters;
import clickDetector.alarm.ClickAlarmParameters;
import clickDetector.dataSelector.ClickDataSelector;
import clickDetector.dialogs.ClickDisplayDialog; import clickDetector.dialogs.ClickDisplayDialog;
import PamView.GeneralProjector.ParameterType; import PamView.GeneralProjector.ParameterType;
import PamView.GeneralProjector.ParameterUnits; import PamView.GeneralProjector.ParameterUnits;
@ -52,6 +54,10 @@ public class ClickPlotInfo extends TDDataInfo {
allScaleInfo[3] = slantScaleInfo; allScaleInfo[3] = slantScaleInfo;
clickHidingDialog = new ClickHidingDialog(this); clickHidingDialog = new ClickHidingDialog(this);
} }
ClickDataSelector getDataSelector() {
return (ClickDataSelector) clickControl.getClickDataBlock().getDataSelector("ClickTDPlots", false);
}
@Override @Override
public Double getDataValue(PamDataUnit pamDataUnit) { public Double getDataValue(PamDataUnit pamDataUnit) {
@ -110,7 +116,8 @@ public class ClickPlotInfo extends TDDataInfo {
private synchronized boolean shouldPlot(ClickDetection click) { private synchronized boolean shouldPlot(ClickDetection click) {
if (click == null) return false; if (click == null) return false;
if (btDisplayParams.showEchoes == false && click.isEcho()) { boolean showEchoes = getDataSelector().getClickAlarmParameters().useEchoes;
if (showEchoes == false && click.isEcho()) {
return false; return false;
} }
@ -170,7 +177,7 @@ public class ClickPlotInfo extends TDDataInfo {
*/ */
@Override @Override
public boolean editOptions(Window frame) { public boolean editOptions(Window frame) {
BTDisplayParameters newParams = ClickDisplayDialog.showDialog(clickControl, frame, btDisplayParams); BTDisplayParameters newParams = ClickDisplayDialog.showDialog(clickControl, frame, btDisplayParams, getDataSelector().getClickAlarmParameters());
if (newParams != null) { if (newParams != null) {
btDisplayParams = newParams.clone(); btDisplayParams = newParams.clone();
updateSettings(); updateSettings();