Fix clip generator dialog

Issue fix #177
This commit is contained in:
Douglas Gillespie 2024-10-28 10:58:23 +00:00
parent 6c7389c3fc
commit 95d08dd34b
3 changed files with 23 additions and 4 deletions

View File

@ -17,12 +17,14 @@ import javax.swing.JRadioButton;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import PamController.PamController;
import PamDetection.RawDataUnit; import PamDetection.RawDataUnit;
import PamUtils.SelectFolder; import PamUtils.SelectFolder;
import PamView.dialog.PamDialog; import PamView.dialog.PamDialog;
import PamView.dialog.PamGridBagContraints; import PamView.dialog.PamGridBagContraints;
import PamView.dialog.SourcePanel; import PamView.dialog.SourcePanel;
import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataBlock;
import PamguardMVC.PamRawDataBlock;
public class ClipDialog extends PamDialog { public class ClipDialog extends PamDialog {
@ -71,7 +73,19 @@ public class ClipDialog extends PamDialog {
} }
private void setParams() { private void setParams() {
sourcePanel.setSource(clipSettings.dataSourceName);
boolean found = sourcePanel.setSource(clipSettings.dataSourceName);
if (!found) {
PamRawDataBlock rawDataBlock = (PamRawDataBlock) PamController.getInstance().getDataBlockByLongName(clipControl.clipSettings.dataSourceName);
if (rawDataBlock == null) {
// have changed dialog to use long data name. More robust. Old configs will get null
// from that, so use this instead.
rawDataBlock = PamController.getInstance().getRawDataBlock(clipControl.clipSettings.dataSourceName);
}
if (rawDataBlock != null) {
sourcePanel.setSource(rawDataBlock);
}
}
storagePanel.setParams(); storagePanel.setParams();
clipPanel.setParams(); clipPanel.setParams();
enableControls(); enableControls();
@ -79,7 +93,7 @@ public class ClipDialog extends PamDialog {
@Override @Override
public boolean getParams() { public boolean getParams() {
clipSettings.dataSourceName = sourcePanel.getSource().getDataName(); clipSettings.dataSourceName = sourcePanel.getSource().getLongDataName();
if (clipSettings.dataSourceName == null) { if (clipSettings.dataSourceName == null) {
return showWarning("No data source"); return showWarning("No data source");
} }

View File

@ -394,7 +394,12 @@ public class ClipProcess extends SpectrogramMarkProcess {
*/ */
public synchronized void subscribeDataBlocks() { public synchronized void subscribeDataBlocks() {
unSubscribeDataBlocks(); unSubscribeDataBlocks();
rawDataBlock = PamController.getInstance().getRawDataBlock(clipControl.clipSettings.dataSourceName); rawDataBlock = (PamRawDataBlock) PamController.getInstance().getDataBlockByLongName(clipControl.clipSettings.dataSourceName);
if (rawDataBlock == null) {
// have changed dialog to use long data name. More robust. Old configs will get null
// from that, so use this instead.
rawDataBlock = PamController.getInstance().getRawDataBlock(clipControl.clipSettings.dataSourceName);
}
setParentDataBlock(rawDataBlock, true); setParentDataBlock(rawDataBlock, true);
int nBlocks = clipControl.clipSettings.getNumClipGenerators(); int nBlocks = clipControl.clipSettings.getNumClipGenerators();

View File

@ -49,7 +49,7 @@ public abstract class DLTaskThread extends Thread {
// System.out.println("ORCASPOT THREAD while: " + "The queue size is " + queue.size()); // System.out.println("ORCASPOT THREAD while: " + "The queue size is " + queue.size());
try { try {
if (queue.size()>0) { if (queue.size()>0) {
System.out.println("DL TASK THREAD: " + "The queue size is " + queue.size()); // System.out.println("DL TASK THREAD: " + "The queue size is " + queue.size());
ArrayList<? extends PamDataUnit> groupedRawData = queue.remove(0); ArrayList<? extends PamDataUnit> groupedRawData = queue.remove(0);
ArrayList<StandardPrediction> modelResult = dlModelWorker.runModel(groupedRawData, ArrayList<StandardPrediction> modelResult = dlModelWorker.runModel(groupedRawData,