Merge pull request #35 from PAMGuard/main

Last fixes just after release 2.02.06
This commit is contained in:
Douglas Gillespie 2022-11-20 21:04:48 +00:00 committed by GitHub
commit 358770b485
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 69 additions and 19 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.pamguard</groupId> <groupId>org.pamguard</groupId>
<artifactId>Pamguard</artifactId> <artifactId>Pamguard</artifactId>
<version>2.02.06</version> <version>2.02.06a</version>
<name>Pamguard Java12+</name> <name>Pamguard Java12+</name>
<description>Pamguard for Java 12+, using Maven to control dependcies</description> <description>Pamguard for Java 12+, using Maven to control dependcies</description>
<url>www.pamguard.org</url> <url>www.pamguard.org</url>

View File

@ -167,6 +167,8 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe
private SudListener sudListener; private SudListener sudListener;
private boolean fullyStopped;
public FileInputSystem(AcquisitionControl acquisitionControl) { public FileInputSystem(AcquisitionControl acquisitionControl) {
this.acquisitionControl = acquisitionControl; this.acquisitionControl = acquisitionControl;
PamSettingManager.getInstance().registerSettings(this); PamSettingManager.getInstance().registerSettings(this);
@ -739,6 +741,8 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe
dontStop = true; dontStop = true;
fullyStopped = false;
theThread.start(); theThread.start();
setStreamStatus(STREAM_RUNNING); setStreamStatus(STREAM_RUNNING);
@ -780,6 +784,9 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe
} }
public void systemHasStopped(boolean wasRunning) { public void systemHasStopped(boolean wasRunning) {
if (fullyStopped) {
return;
}
long stopTime = System.currentTimeMillis(); long stopTime = System.currentTimeMillis();
if (getCurrentFile() == null) { if (getCurrentFile() == null) {
return; return;
@ -788,6 +795,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe
double analSecs = (stopTime - fileStartTime) / 1000.; double analSecs = (stopTime - fileStartTime) / 1000.;
System.out.println(String.format("File %s, SR=%dHz, length=%3.1fs took %3.1fs = %3.1fx real time", System.out.println(String.format("File %s, SR=%dHz, length=%3.1fs took %3.1fs = %3.1fx real time",
getCurrentFile().getName(), (int)getSampleRate(), fileSecs, analSecs, fileSecs / analSecs)); getCurrentFile().getName(), (int)getSampleRate(), fileSecs, analSecs, fileSecs / analSecs));
fullyStopped = true;
} }
/** /**
@ -933,7 +941,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe
* PamDataUnits from them. Once a unit is created, tell this thread * PamDataUnits from them. Once a unit is created, tell this thread
* to wait until it has been used by the main thread. * to wait until it has been used by the main thread.
*/ */
System.out.println("File system start processing"); // System.out.println("File system start processing");
/* /*
* File should have been opened in the constructor so just read it * File should have been opened in the constructor so just read it
* in in chunks and pass to datablock * in in chunks and pass to datablock

View File

@ -150,7 +150,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings{
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
System.out.println("Restart later time action"); // System.out.println("Restart later time action");
newFileTimer.stop(); newFileTimer.stop();
PamController.getInstance().startLater(false); //don't save settings on restarts PamController.getInstance().startLater(false); //don't save settings on restarts
@ -655,7 +655,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings{
if (currentFile < allFiles.size()) { if (currentFile < allFiles.size()) {
// only restart if the file ended - not if it stopped // only restart if the file ended - not if it stopped
if (getStreamStatus() == STREAM_ENDED) { if (getStreamStatus() == STREAM_ENDED) {
System.out.println(String.format("Start new file timer (file %d/%d)",currentFile+1,allFiles.size())); // System.out.println(String.format("Start new file timer (file %d/%d)",currentFile+1,allFiles.size()));
newFileTimer.start(); newFileTimer.start();
} }
} }
@ -778,7 +778,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings{
@Override @Override
public boolean startSystem(AcquisitionControl daqControl) { public boolean startSystem(AcquisitionControl daqControl) {
System.out.println("Start system"); // System.out.println("Start system");
setFolderProgress(); setFolderProgress();
return super.startSystem(daqControl); return super.startSystem(daqControl);
} }

View File

@ -79,8 +79,9 @@ public class EnergySumProcess extends IshDetFnProcess {
EnergySumParams p = (EnergySumParams)ishDetControl.ishDetParams; EnergySumParams p = (EnergySumParams)ishDetControl.ishDetParams;
PamDataBlock inputDataBlock = getInputDataBlock(); //might be null PamDataBlock inputDataBlock = getInputDataBlock(); //might be null
if (inputDataBlock != null && inputDataBlock.getUnitsCount() > 0) { FFTDataUnit lastFFTUnit = ((FFTDataUnit)inputDataBlock.getLastUnit());
savedGramHeight = ((FFTDataUnit)inputDataBlock.getLastUnit()).getFftData().length(); if (lastFFTUnit != null) {
savedGramHeight = lastFFTUnit.getFftData().length();
int len = savedGramHeight; int len = savedGramHeight;
//Should be max(1,...) here, but FFT bin 0 has 0's in it. //Should be max(1,...) here, but FFT bin 0 has 0's in it.
loBin = Math.max(1, (int) Math.floor(len * p.f0 / (sampleRate/2))); loBin = Math.max(1, (int) Math.floor(len * p.f0 / (sampleRate/2)));

View File

@ -83,9 +83,14 @@ public class SgramCorrProcess extends IshDetFnProcess
protected void prepareMyParams() { protected void prepareMyParams() {
SgramCorrParams p = (SgramCorrParams)ishDetControl.ishDetParams; SgramCorrParams p = (SgramCorrParams)ishDetControl.ishDetParams;
PamDataBlock inputDataBlock = getInputDataBlock(); PamDataBlock inputDataBlock = getInputDataBlock();
/*
if (inputDataBlock != null && inputDataBlock.getUnitsCount() > 0) { * get the unit. first, then check it's null. Due to multithreading it's
savedGramHeight = ((FFTDataUnit)inputDataBlock.getLastUnit()).getFftData().length(); * possible that checking there are units and then asking for one,without
* synchronization will crash if the unit is deleted between those two calls.
*/
FFTDataUnit lastFFTUnit = ((FFTDataUnit)inputDataBlock.getLastUnit());
if (lastFFTUnit != null) {
savedGramHeight = lastFFTUnit.getFftData().length();
/* /*
* fft information is now stored in an FFTDataBLock, so no need to get * fft information is now stored in an FFTDataBLock, so no need to get
* back to the process above it. * back to the process above it.

View File

@ -63,7 +63,7 @@ public class MapParametersDialog extends PamDialog {
private JCheckBox headingUp = new JCheckBox("Ship heading always up"); private JCheckBox headingUp = new JCheckBox("Ship heading always up");
private JCheckBox showSurface = new JCheckBox("Show sea sueface"); private JCheckBox showSurface = new JCheckBox("Show sea surface");
private MapFileManager mapFileManager; private MapFileManager mapFileManager;
@ -261,7 +261,7 @@ public class MapParametersDialog extends PamDialog {
public HydrophonePanel() { public HydrophonePanel() {
super(); super();
setBorder(new TitledBorder("Hydropone Options")); setBorder(new TitledBorder("Hydrophone Options"));
setLayout(new GridBagLayout()); setLayout(new GridBagLayout());
GridBagConstraints c = new PamGridBagContraints(); GridBagConstraints c = new PamGridBagContraints();
c.gridx = 0; c.gridx = 0;
@ -272,7 +272,7 @@ public class MapParametersDialog extends PamDialog {
addComponent(this, colourByChannel, c); addComponent(this, colourByChannel, c);
c.gridy++; c.gridy++;
c.gridwidth = 1; c.gridwidth = 1;
addComponent(this, new JLabel("Symbox size ", JLabel.RIGHT), c); addComponent(this, new JLabel("Symbol size ", JLabel.RIGHT), c);
c.gridx++; c.gridx++;
symbolSize = new SpinnerNumberModel(Hydrophone.DefaultSymbolSize, 4, 30, 2); symbolSize = new SpinnerNumberModel(Hydrophone.DefaultSymbolSize, 4, 30, 2);
addComponent(this, symbolSizeSpinner = new JSpinner(symbolSize), c); addComponent(this, symbolSizeSpinner = new JSpinner(symbolSize), c);

View File

@ -1225,8 +1225,9 @@ public class PamController implements PamControllerInterface, PamSettings {
if (PamCalendar.isSoundFile() == false) { if (PamCalendar.isSoundFile() == false) {
PamCalendar.setSessionStartTime(PamCalendar.getTimeInMillis()); PamCalendar.setSessionStartTime(PamCalendar.getTimeInMillis());
} }
if (PamCalendar.isSoundFile() == false) {
System.out.printf("PAMGUARD Startup took %d milliseconds at time %s\n", startDelay, PamCalendar.formatDateTime(PamCalendar.getSessionStartTime())); System.out.printf("PAMGUARD Startup took %d milliseconds at time %s\n", startDelay, PamCalendar.formatDateTime(PamCalendar.getSessionStartTime()));
}
guiFrameManager.pamStarted(); guiFrameManager.pamStarted();
return true; return true;

View File

@ -31,7 +31,7 @@ public class PamguardVersionInfo {
* Version number, major version.minorversion.sub-release. * Version number, major version.minorversion.sub-release.
* Note: can't go higher than sub-release 'f' * Note: can't go higher than sub-release 'f'
*/ */
static public final String version = "2.02.06"; static public final String version = "2.02.06a";
/** /**
* Release date * Release date

View File

@ -63,6 +63,7 @@ public class SettingsFileDialog extends PamDialog {
pan.add(BorderLayout.CENTER, p); pan.add(BorderLayout.CENTER, p);
pan.add(BorderLayout.SOUTH, q); pan.add(BorderLayout.SOUTH, q);
setMoveToMouse(false);
setDialogComponent(pan); setDialogComponent(pan);
} }

View File

@ -37,6 +37,7 @@ import javax.swing.JPanel;
import javax.swing.JPopupMenu; import javax.swing.JPopupMenu;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.Timer; import javax.swing.Timer;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
@ -883,6 +884,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener,
setVisible(true); setVisible(true);
} }
private int getYOffset() { private int getYOffset() {
@ -1005,6 +1007,22 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener,
return null; return null;
} }
@Override
public void setVisible(boolean vis) {
if (vis) {
SwingUtilities.invokeLater(new Runnable() {
/**
* This seems to work and resize the text fields on high def displays.
*/
@Override
public void run() {
pack();
}
});
}
super.setVisible(vis);
}
void fillPanelContent() { void fillPanelContent() {
p.removeAll(); p.removeAll();
GridBagLayout layout = new GridBagLayout(); GridBagLayout layout = new GridBagLayout();

View File

@ -64,6 +64,10 @@ abstract public class PamDialog extends JDialog {
private boolean warnDefaultSetting = true; private boolean warnDefaultSetting = true;
private CancelObserver cancelObserver; private CancelObserver cancelObserver;
private boolean firstShowing = true; private boolean firstShowing = true;
/*
* Move to mouse position is parent is null
*/
private boolean moveToMouse = true;
public JPanel getButtonPanel() { public JPanel getButtonPanel() {
return buttonPanel; return buttonPanel;
@ -281,7 +285,7 @@ abstract public class PamDialog extends JDialog {
synchronized (this) { synchronized (this) {
PamColors.getInstance().notifyContianer(this.getContentPane()); PamColors.getInstance().notifyContianer(this.getContentPane());
} }
if (getOwner() == null) { if (getOwner() == null && isMoveToMouse()) {
moveToMouseLocation(); moveToMouseLocation();
} }
if (firstShowing) { if (firstShowing) {
@ -691,4 +695,18 @@ abstract public class PamDialog extends JDialog {
} }
} }
/**
* @return the moveToMouse
*/
public boolean isMoveToMouse() {
return moveToMouse;
}
/**
* @param moveToMouse the moveToMouse to set
*/
public void setMoveToMouse(boolean moveToMouse) {
this.moveToMouse = moveToMouse;
}
} }

View File

@ -6,8 +6,6 @@ import java.sql.Types;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;