mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-26 00:52:29 +00:00
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
commit
702863fed2
30
.gitignore
vendored
30
.gitignore
vendored
@ -41,33 +41,3 @@ settings.xml
|
||||
.classpath
|
||||
.classpath
|
||||
.classpath
|
||||
.metadata/.lock
|
||||
.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.location
|
||||
.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version
|
||||
.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index
|
||||
.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version
|
||||
.metadata/.plugins/org.eclipse.core.resources/.root/1.tree
|
||||
.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources
|
||||
.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs
|
||||
.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs
|
||||
.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.m2e.discovery.prefs
|
||||
.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs
|
||||
.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs
|
||||
.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs
|
||||
.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi
|
||||
.metadata/.plugins/org.eclipse.egit.core/.org.eclipse.egit.core.cmp/.settings/org.eclipse.core.resources.prefs
|
||||
.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache
|
||||
.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache
|
||||
.metadata/.plugins/org.eclipse.jdt.core/javaLikeNames.txt
|
||||
.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache
|
||||
.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat
|
||||
.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml
|
||||
.metadata/.plugins/org.eclipse.jdt.ui/OpenTypeHistory.xml
|
||||
.metadata/.plugins/org.eclipse.jdt.ui/QualifiedTypeNameHistory.xml
|
||||
.metadata/.plugins/org.eclipse.m2e.core/workspaceState.ser
|
||||
.metadata/.plugins/org.eclipse.m2e.logback/logback.2.1.100.20230106-1511.xml
|
||||
.metadata/.plugins/org.eclipse.oomph.setup/workspace.setup
|
||||
.metadata/.plugins/org.eclipse.tips.ide/dialog_settings.xml
|
||||
.metadata/.plugins/org.eclipse.ui.intro/introstate
|
||||
.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml
|
||||
.metadata/version.ini
|
||||
|
@ -104,9 +104,13 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D
|
||||
boolean ans = super.prepareInputFile();
|
||||
if (ans == false && ++currentFile < allFiles.size()) {
|
||||
System.out.println("Failed to open sound file. Try again with file " + allFiles.get(currentFile).getName());
|
||||
|
||||
/*
|
||||
* jumping striaght to the next file messes it up if it thinks the files
|
||||
* are continuous, so we HAVE to stop and restart.
|
||||
*/
|
||||
// return prepareInputFile();
|
||||
PamController.getInstance().pamStop();
|
||||
PamController.getInstance().startLater();
|
||||
PamController.getInstance().startLater(false);
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
@ -648,7 +652,17 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D
|
||||
}
|
||||
setFolderProgress();
|
||||
// sayEta();
|
||||
ans = prepareInputFile();
|
||||
/*
|
||||
* I think that here, we just need a check of the file. the prepareInputFile in
|
||||
* this class will (on failure) move straight to the next file and also issue a
|
||||
* stop/start, which is not good if it's trying a continuous file, where this is
|
||||
* being called, if false is returned it should manage moving onto the next file by
|
||||
* itself if we use the super.prep ....
|
||||
*/
|
||||
ans = super.prepareInputFile();
|
||||
if (ans == false) {
|
||||
return false;
|
||||
}
|
||||
currentFileStart = System.currentTimeMillis();
|
||||
// if (ans && audioFormat.getSampleRate() != currentSampleRate && currentFile > 0) {
|
||||
// acquisitionControl.getDaqProcess().setSampleRate(currentSampleRate = audioFormat.getSampleRate(), true);
|
||||
|
@ -22,7 +22,7 @@ public class SUDFileType extends SoundFileType {
|
||||
if (isShown) {
|
||||
return;
|
||||
}
|
||||
WarnOnce.showWarning("SoundTrap SUD Files", sudInfoText, WarnOnce.OK_OPTION);
|
||||
// WarnOnce.showWarning("SoundTrap SUD Files", sudInfoText, WarnOnce.OK_OPTION);
|
||||
isShown = true;
|
||||
}
|
||||
|
||||
|
@ -48,9 +48,9 @@ public class SudAudioFile extends WavAudioFile {
|
||||
}
|
||||
// don't do anything and it will try the built in Audiosystem
|
||||
catch (UnsupportedAudioFileException e) {
|
||||
System.err.println("Could not open sud file: not a supported file " + soundFile.getName());
|
||||
|
||||
e.printStackTrace();
|
||||
System.err.println("UnsupportedAudioFileException: Could not open sud file: not a supported file " + soundFile.getName());
|
||||
System.err.println(e.getMessage());
|
||||
// e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
System.err.println("Could not open sud file: IO Exception: " + soundFile.getName());
|
||||
|
||||
|
@ -46,7 +46,8 @@ public class SudAudioFileReader {
|
||||
try {
|
||||
sudAudioInputStream = SudAudioInputStream.openInputStream(file, sudParams, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = String.format("Corrupt sud file %s: %s", file.getName(), e.getMessage());
|
||||
throw new UnsupportedAudioFileException(msg);
|
||||
}
|
||||
return sudAudioInputStream;
|
||||
}
|
||||
|
@ -245,6 +245,31 @@ public class GPSControl extends PamControlledUnit implements PamSettings, Positi
|
||||
public GpsDataUnit getShipPosition(long timeMilliseconds) {
|
||||
return getGpsDataBlock().getClosestUnitMillis(timeMilliseconds);
|
||||
}
|
||||
/**
|
||||
* Do we want this string ? It will be either RMC or GGA and may want wildcarding
|
||||
* @param stringId
|
||||
* @return
|
||||
*/
|
||||
public boolean wantString(String stringId) {
|
||||
if (stringId == null || stringId.length() < 6) {
|
||||
return false;
|
||||
}
|
||||
if (gpsControl.gpsParameters.allowWildcard) {
|
||||
String lastBit = stringId.substring(3, 6);
|
||||
switch (gpsControl.gpsParameters.mainString) {
|
||||
case GPSParameters.READ_RMC:
|
||||
return lastBit.equals("RMC");
|
||||
case GPSParameters.READ_GGA:
|
||||
return lastBit.equals("GGA");
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
String wantedString = gpsControl.getWantedString();
|
||||
return stringId.equals(wantedString);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the string we're wanting.
|
||||
|
@ -59,6 +59,8 @@ public class GPSParameters implements Serializable, Cloneable, ManagedParameters
|
||||
public String rmcInitials = "GP";
|
||||
public String ggaInitials = "GP";
|
||||
|
||||
public boolean allowWildcard = true;
|
||||
|
||||
/**
|
||||
* Attempt to read true heading information
|
||||
*/
|
||||
|
@ -149,9 +149,9 @@ public class GPSParametersDialog extends PamDialog {
|
||||
}
|
||||
}
|
||||
public static GPSParameters showDialog(Frame parentFrame, GPSParameters gpsParameters) {
|
||||
if (parentFrame != lastFrame || gpsParametersDialog == null) {
|
||||
// if (parentFrame != lastFrame || gpsParametersDialog == null) {
|
||||
gpsParametersDialog = new GPSParametersDialog(parentFrame);
|
||||
}
|
||||
// }
|
||||
gpsParametersDialog.gpsParameters = gpsParameters.clone();
|
||||
gpsParametersDialog.setParams();
|
||||
gpsParametersDialog.setVisible(true);
|
||||
@ -335,6 +335,7 @@ public class GPSParametersDialog extends PamDialog {
|
||||
JRadioButton ggaString;
|
||||
JTextField rmcInitials;
|
||||
JTextField ggaInitials;
|
||||
JCheckBox allowWildcard;
|
||||
public MainStringPanel() {
|
||||
super();
|
||||
setBorder(new TitledBorder("Main Nav' data string"));
|
||||
@ -345,8 +346,16 @@ public class GPSParametersDialog extends PamDialog {
|
||||
|
||||
ButtonGroup buttonGroup = new ButtonGroup();
|
||||
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
c.gridwidth = 5;
|
||||
this.add(allowWildcard = new JCheckBox("Allow any string initials"), c);
|
||||
allowWildcard.setToolTipText("Use RMC or GGA data from any source independent of the string initials (e.g. GP, GN, etc.)");
|
||||
c.gridy ++;
|
||||
c.gridwidth = 1;
|
||||
c.gridx=0;
|
||||
addComponent(this, new JLabel("RMC String"), c);
|
||||
c.gridx++;
|
||||
c.gridx ++;
|
||||
addComponent(this, rmcString = new JRadioButton(""), c);
|
||||
c.gridx++;
|
||||
addComponent(this, rmcInitials = new JTextField(2), c);
|
||||
@ -355,6 +364,7 @@ public class GPSParametersDialog extends PamDialog {
|
||||
|
||||
c.gridx = 0;
|
||||
c.gridy ++;
|
||||
c.gridwidth = 1;
|
||||
addComponent(this, new JLabel("GGA String"), c);
|
||||
c.gridx++;
|
||||
addComponent(this, ggaString = new JRadioButton(""), c);
|
||||
@ -363,6 +373,7 @@ public class GPSParametersDialog extends PamDialog {
|
||||
c.gridx++;
|
||||
addComponent(this, new JLabel(" GGA"), c);
|
||||
|
||||
allowWildcard.addActionListener(this);
|
||||
rmcString.addActionListener(this);
|
||||
ggaString.addActionListener(this);
|
||||
buttonGroup.add(rmcString);
|
||||
@ -374,10 +385,12 @@ public class GPSParametersDialog extends PamDialog {
|
||||
ggaString.setSelected(gpsParameters.mainString == GPSParameters.READ_GGA);
|
||||
rmcInitials.setText(gpsParameters.rmcInitials);
|
||||
ggaInitials.setText(gpsParameters.ggaInitials);
|
||||
allowWildcard.setSelected(gpsParameters.allowWildcard);
|
||||
enableControls();
|
||||
}
|
||||
|
||||
public boolean getParams() {
|
||||
gpsParameters.allowWildcard = allowWildcard.isSelected();
|
||||
if (ggaString.isSelected()) {
|
||||
gpsParameters.mainString = GPSParameters.READ_GGA;
|
||||
}
|
||||
@ -385,12 +398,12 @@ public class GPSParametersDialog extends PamDialog {
|
||||
gpsParameters.mainString = GPSParameters.READ_RMC;
|
||||
}
|
||||
gpsParameters.rmcInitials = rmcInitials.getText();
|
||||
if (gpsParameters.rmcInitials.length() != 2) {
|
||||
return false;
|
||||
if (gpsParameters.rmcInitials.length() != 2 && !gpsParameters.allowWildcard) {
|
||||
return showWarning("Expecting a two character identifier for RMC strings");
|
||||
}
|
||||
gpsParameters.ggaInitials = ggaInitials.getText();
|
||||
if (gpsParameters.ggaInitials.length() != 2) {
|
||||
return false;
|
||||
if (gpsParameters.ggaInitials.length() != 2 && !gpsParameters.allowWildcard) {
|
||||
return showWarning("Expecting a two character identifier for GGA strings");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -400,8 +413,9 @@ public class GPSParametersDialog extends PamDialog {
|
||||
}
|
||||
|
||||
private void enableControls() {
|
||||
rmcInitials.setEnabled(rmcString.isSelected());
|
||||
ggaInitials.setEnabled(ggaString.isSelected());
|
||||
boolean wild = allowWildcard.isSelected();
|
||||
rmcInitials.setEnabled(rmcString.isSelected() & !wild);
|
||||
ggaInitials.setEnabled(ggaString.isSelected() & !wild);
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class ProcessNmeaData extends PamProcess {
|
||||
|
||||
private GpsLogger gpsLogger;
|
||||
|
||||
private String wantedString = "$GPRMC";
|
||||
// private String wantedString = "$GPRMC";
|
||||
|
||||
private GpsDataUnit previousUnit = null;
|
||||
|
||||
@ -161,7 +161,7 @@ public class ProcessNmeaData extends PamProcess {
|
||||
@Override
|
||||
public void noteNewSettings() {
|
||||
findNMEADataBlock();
|
||||
setWantedString();
|
||||
// setWantedString();
|
||||
double minRate = Math.max(.2, 1./gpsController.gpsParameters.readInterval);
|
||||
processCheck.getOutputCounter().setMinRate(minRate);
|
||||
}
|
||||
@ -179,7 +179,8 @@ public class ProcessNmeaData extends PamProcess {
|
||||
StringBuffer nmeaString = nmeaData.getCharData();
|
||||
String stringId = NMEADataBlock.getSubString(nmeaString, 0);
|
||||
|
||||
if (stringId.equalsIgnoreCase(wantedString)) {
|
||||
// if (stringId.equalsIgnoreCase(wantedString)) {
|
||||
if (gpsController.wantString(stringId)) {
|
||||
gpsData = new GpsData(nmeaString, gpsController.gpsParameters.mainString); // GpsData constructor which
|
||||
// unpacks the string.
|
||||
if (gpsData.isDataOk()) {
|
||||
@ -316,13 +317,13 @@ public class ProcessNmeaData extends PamProcess {
|
||||
super.clearOldData();
|
||||
}
|
||||
|
||||
public String getWantedString() {
|
||||
return wantedString;
|
||||
}
|
||||
|
||||
public void setWantedString() {
|
||||
wantedString = gpsController.getWantedString();
|
||||
}
|
||||
// public String getWantedString() {
|
||||
// return wantedString;
|
||||
// }
|
||||
//
|
||||
// public void setWantedString() {
|
||||
// wantedString = gpsController.getWantedString();
|
||||
// }
|
||||
|
||||
public GPSControl getGpsController() {
|
||||
return gpsController;
|
||||
|
@ -221,9 +221,8 @@ public class UpdateClockDialog extends JDialog implements ActionListener, PamObs
|
||||
// NMEADataBlock nmeaDataBlock = (NMEADataBlock) o;
|
||||
NMEADataUnit nmeaDataUnit = (NMEADataUnit) arg;
|
||||
StringBuffer nmeaData = nmeaDataUnit.getCharData();
|
||||
String wantedString = gpsControl.getWantedString();
|
||||
String stringId = NMEADataBlock.getSubString(nmeaData, 0);
|
||||
if (wantedString.equals(stringId) == false) {
|
||||
if (gpsControl.wantString(stringId) == false) {
|
||||
return;
|
||||
}
|
||||
if (gpsControl.gpsParameters.mainString == GPSParameters.READ_GGA) {
|
||||
@ -232,6 +231,8 @@ public class UpdateClockDialog extends JDialog implements ActionListener, PamObs
|
||||
newRMCData(nmeaData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateData(PamObservable observable, PamDataUnit pamDataUnit) {
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -810,6 +810,9 @@ public class TMGroupLocInfo implements GroupLocInfo {
|
||||
for (int i = 0; i < nSubDetections; i++) {
|
||||
|
||||
localisation = getParentDetection().getSubDetection(i).getLocalisation();
|
||||
if (localisation == null) {
|
||||
continue;
|
||||
}
|
||||
angles = localisation.getAngles();
|
||||
angleErrors = localisation.getAngleErrors();
|
||||
|
||||
@ -879,6 +882,10 @@ public class TMGroupLocInfo implements GroupLocInfo {
|
||||
totalVectors += nVectors;
|
||||
}
|
||||
|
||||
if (totalVectors == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
//now create the separate arrays for different ambiguities.
|
||||
/**
|
||||
*
|
||||
|
@ -11,8 +11,10 @@ import java.util.Vector;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import PamController.PamController;
|
||||
import PamUtils.LatLong;
|
||||
import PamUtils.PamFileChooser;
|
||||
import PamView.dialog.warn.WarnOnce;
|
||||
|
||||
public class GebcoMapFile implements MapFileManager {
|
||||
|
||||
@ -109,10 +111,19 @@ public class GebcoMapFile implements MapFileManager {
|
||||
int pointCount;
|
||||
int depth;
|
||||
MapContour mapContour;
|
||||
boolean error = false;
|
||||
try {
|
||||
int iLine = 0;
|
||||
while((line = reader.readLine())!=null){
|
||||
iLine++;
|
||||
line = line.trim();
|
||||
spaceIndex = line.indexOf(' ');
|
||||
if (spaceIndex < 0) {
|
||||
String msg = String.format("Error in map file at line %d \"%s\"", iLine, line);
|
||||
WarnOnce.showNamedWarning("Gebco Map File Warning", PamController.getMainFrame(), gebcoFile.getName(), msg, WarnOnce.WARNING_MESSAGE);
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
num1 = line.substring(0,spaceIndex).trim();
|
||||
num2 = line.substring(spaceIndex).trim();
|
||||
depth = Integer.valueOf(num1);
|
||||
@ -143,11 +154,22 @@ public class GebcoMapFile implements MapFileManager {
|
||||
}
|
||||
catch (NumberFormatException nex) {
|
||||
nex.printStackTrace();
|
||||
return false;
|
||||
error = true;
|
||||
}
|
||||
catch (IndexOutOfBoundsException iex) {
|
||||
iex.printStackTrace();
|
||||
error = true;
|
||||
}
|
||||
if (reader != null) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Collections.sort(mapContours);
|
||||
Collections.sort(availableContours);
|
||||
return true;
|
||||
return !error;
|
||||
}
|
||||
|
||||
|
||||
|
@ -520,9 +520,15 @@ public class PamSettingManager {
|
||||
if (initializationComplete == false) {
|
||||
// if PAMGAURD hasn't finished loading, then don't save the settings
|
||||
// or the file will get wrecked (bug tracker 2269579)
|
||||
String msg = "There was an error loading settings from this configuration, so the configuration"
|
||||
+ " may be incomplete. <p>Do you want to save anyway ? <p>"
|
||||
+ " If you have added new modules, the answer is probably \"Yes\"";
|
||||
int ans = WarnOnce.showWarning("Confuguration file warning", msg, WarnOnce.YES_NO_OPTION);
|
||||
if (ans == WarnOnce.CANCEL_OPTION) {
|
||||
System.out.println("Settings have not yet loaded. Don't save file");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
saveGlobalSettings();
|
||||
// saveSettingToDatabase();
|
||||
|
@ -31,12 +31,12 @@ public class PamguardVersionInfo {
|
||||
* Version number, major version.minorversion.sub-release.
|
||||
* Note: can't go higher than sub-release 'f'
|
||||
*/
|
||||
static public final String version = "2.02.07f";
|
||||
static public final String version = "2.02.08a";
|
||||
|
||||
/**
|
||||
* Release date
|
||||
*/
|
||||
static public final String date = "4 April 2023";
|
||||
static public final String date = "30 May 2023";
|
||||
|
||||
// /**
|
||||
// * Release type - Beta or Core
|
||||
|
@ -1,5 +1,6 @@
|
||||
package PamController.settings;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -14,6 +15,7 @@ import PamController.PamController;
|
||||
import PamController.PamSettingManager;
|
||||
import PamController.PamSettings;
|
||||
import PamController.PamSettingsGroup;
|
||||
import PamModel.PamModel;
|
||||
import PamModel.PamModuleInfo;
|
||||
import PamModel.SMRUEnable;
|
||||
import PamView.dialog.PamFileBrowser;
|
||||
@ -226,7 +228,13 @@ public class SettingsImport {
|
||||
ownerClass = Class.forName(aSet.getOwnerClassName());
|
||||
} catch (ClassNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
// e.printStackTrace();
|
||||
// this is happening since the ownerclassname is not set correctly in psfx files
|
||||
// so we have to deserialise the data to find the class.
|
||||
// ownerClass = getClassFromData(aSet.getSerialisedByteArray());
|
||||
// ownerClass = PamModuleInfo.findModuleClass(aSet.getUnitType());
|
||||
}
|
||||
if (ownerClass == null) {
|
||||
continue;
|
||||
}
|
||||
if (PamControlledUnit.class.isAssignableFrom(ownerClass)) {
|
||||
@ -264,6 +272,17 @@ public class SettingsImport {
|
||||
return groupedSettings;
|
||||
}
|
||||
|
||||
private Class getClassFromData(byte[] data) {
|
||||
try {
|
||||
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data));
|
||||
Object obj = ois.readObject();
|
||||
return obj.getClass();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private SettingsImportGroup findGroup(ArrayList<SettingsImportGroup> groupedSettings, String unitName) {
|
||||
for (SettingsImportGroup iG:groupedSettings) {
|
||||
if (iG.getMainSettings().getUnitName().equals(unitName)) {
|
||||
|
@ -45,14 +45,10 @@ import fftManager.FFTDataUnit;
|
||||
import fftManager.PamFFTControl;
|
||||
import group3dlocaliser.Group3DLocaliserControl;
|
||||
import meygenturbine.MeygenTurbine;
|
||||
import networkTransfer.receive.BuoyStatusDataUnit;
|
||||
import networkTransfer.receive.NetworkReceiver;
|
||||
import printscreen.PrintScreenControl;
|
||||
import rockBlock.RockBlockControl;
|
||||
import turbineops.TurbineOperationControl;
|
||||
import GPS.GpsDataUnit;
|
||||
import Map.MapController;
|
||||
import Map.gridbaselayer.GridbaseControl;
|
||||
import NMEA.NMEADataUnit;
|
||||
import PamController.PamControlledUnitSettings;
|
||||
import PamController.PamController;
|
||||
@ -66,7 +62,6 @@ import PamguardMVC.PamDataBlock;
|
||||
import analogarraysensor.ArraySensorControl;
|
||||
import backupmanager.BackupManager;
|
||||
import beamformer.continuous.BeamFormerControl;
|
||||
import beamformer.localiser.BeamFormLocaliserControl;
|
||||
import bearinglocaliser.BearingLocaliserControl;
|
||||
import binaryFileStorage.SecondaryBinaryStore;
|
||||
import cepstrum.CepstrumControl;
|
||||
@ -1083,7 +1078,6 @@ final public class PamModel implements PamModelInterface, PamSettings {
|
||||
* PamModel !
|
||||
*/
|
||||
|
||||
|
||||
// Load up whatever default classloader was used to create this class. Must use the same classloader
|
||||
// for all plugins, or else we will not be able to create proper dependencies between them or be able
|
||||
// to save properties in the psf file. Found this problem because ipiDemo requires the
|
||||
@ -1150,30 +1144,11 @@ final public class PamModel implements PamModelInterface, PamSettings {
|
||||
// to add that URL to the default classloader path.
|
||||
URL newURL = jarList.get(i).toURI().toURL();
|
||||
|
||||
// original method
|
||||
// Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
|
||||
// method.setAccessible(true);
|
||||
// method.invoke(cl, newURL);
|
||||
|
||||
// first fix attempt - create a brand new URLClassLoader. As expected, we get a ClassCastException when trying
|
||||
// to load the parameters so we can't save params using this method
|
||||
// URL[] newURLArray = new URL[1];
|
||||
// newURLArray[0] = newURL;
|
||||
// cl = new URLClassLoader(newURLArray);
|
||||
|
||||
// second attempt - custom class loader with the system app loader specified as the parent. Loads controlled unit, but
|
||||
// as before it doesn't load the parameters
|
||||
classLoader.addURL(newURL);
|
||||
|
||||
// third attempt
|
||||
// Class<?> genericClass = cl.getClass();
|
||||
// Method method = genericClass.getSuperclass().getDeclaredMethod("addURL", new Class[] {URL.class});
|
||||
// method.setAccessible(true);
|
||||
// method.invoke(cl, new Object[] {newURL});
|
||||
|
||||
|
||||
|
||||
|
||||
// Save the name of the class to the global pluginBeingLoaded variable, and load the class.
|
||||
this.setPluginBeingLoaded(className);
|
||||
// Class c = cl.loadClass(className);
|
||||
@ -1254,9 +1229,8 @@ final public class PamModel implements PamModelInterface, PamSettings {
|
||||
"for help.<p>" +
|
||||
"This plug-in will not be available for loading";
|
||||
String help = null;
|
||||
int ans = WarnOnce.showWarning(PamController.getMainFrame(), title, msg, WarnOnce.WARNING_MESSAGE, help, e1);
|
||||
int ans = WarnOnce.showWarning(PamController.getInstance().getGuiFrameManager().getFrame(0), title, msg, WarnOnce.WARNING_MESSAGE, help, e1);
|
||||
System.err.println("Exception while loading " + className);
|
||||
System.err.println(e1.getMessage());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -1269,7 +1243,7 @@ final public class PamModel implements PamModelInterface, PamSettings {
|
||||
"for help.<p>" +
|
||||
"This plug-in will not be available for loading";
|
||||
String help = null;
|
||||
int ans = WarnOnce.showWarning(PamController.getMainFrame(), title, msg, WarnOnce.WARNING_MESSAGE, help, ex);
|
||||
int ans = WarnOnce.showWarning(PamController.getInstance().getGuiFrameManager().getFrame(0), title, msg, WarnOnce.WARNING_MESSAGE, help, ex);
|
||||
System.err.println("Exception while loading " + jarList.get(i).getName());
|
||||
continue;
|
||||
}
|
||||
@ -1294,7 +1268,7 @@ final public class PamModel implements PamModelInterface, PamSettings {
|
||||
|
||||
// instantiate the plugin control class using the custom class loader
|
||||
try {
|
||||
File classFile = new File(pf.getJarFile());
|
||||
// File classFile = new File(pf.getJarFile());
|
||||
//URLClassLoader cl = new URLClassLoader(new URL[]{classFile.toURI().toURL()});
|
||||
// mi = PamModuleInfo.registerControlledUnit(pf.getClassName(), pf.getDescription(),cl);
|
||||
mi = PamModuleInfo.registerControlledUnit(pf.getClassName(), pf.getDescription(),classLoader);
|
||||
@ -1360,7 +1334,7 @@ final public class PamModel implements PamModelInterface, PamSettings {
|
||||
"for help.<p>" +
|
||||
"This plug-in will not be available for loading";
|
||||
String help = null;
|
||||
int ans = WarnOnce.showWarning(PamController.getMainFrame(), title, msg, WarnOnce.WARNING_MESSAGE, help, e1);
|
||||
int ans = WarnOnce.showWarning(PamController.getInstance().getGuiFrameManager().getFrame(0), title, msg, WarnOnce.WARNING_MESSAGE, help, e1);
|
||||
System.err.println("Exception while loading " + pf.getDefaultName());
|
||||
pluginList.remove(pf);
|
||||
continue;
|
||||
|
@ -283,6 +283,7 @@ public class PamModuleInfo implements PamDependent{
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static JMenu getModulesMenu(Frame parentFrame) {
|
||||
|
||||
ArrayList<ModulesMenuGroup> moduleGroupsList = new ArrayList<ModulesMenuGroup>();
|
||||
|
@ -24,6 +24,7 @@ import javafx.scene.control.Alert.AlertType;
|
||||
public class WarnOnce implements PamSettings {
|
||||
|
||||
public static final int OK_CANCEL_OPTION = JOptionPane.OK_CANCEL_OPTION;
|
||||
public static final int YES_NO_OPTION = JOptionPane.YES_NO_OPTION;
|
||||
public static final int WARNING_MESSAGE = JOptionPane.DEFAULT_OPTION;
|
||||
public static final int OK_OPTION = JOptionPane.OK_OPTION;
|
||||
public static final int CANCEL_OPTION = JOptionPane.CANCEL_OPTION;
|
||||
|
@ -92,12 +92,17 @@ public class WarnOnceDialog extends PamDialog {
|
||||
}
|
||||
|
||||
// if the message type is OK_OPTION, hide the cancel button
|
||||
if (messageType == WarnOnce.OK_OPTION) {
|
||||
if (messageType == WarnOnce.YES_NO_OPTION) {
|
||||
getOkButton().setText("Yes");
|
||||
getCancelButton().setText("No");
|
||||
}
|
||||
else if (messageType == WarnOnce.OK_OPTION) {
|
||||
getCancelButton().setVisible(false);
|
||||
} else {
|
||||
getCancelButton().setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
// change the button text to custom text, if needed
|
||||
if (okButtonText!=null) {
|
||||
getOkButton().setText(okButtonText);
|
||||
|
@ -844,6 +844,30 @@ public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable {
|
||||
return unitsInInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do data exist which cover the given time range ?
|
||||
* @param startMillis
|
||||
* @param endMillis
|
||||
* @return true if data exist covering that time range.
|
||||
*/
|
||||
public boolean hasDataRange(long startMillis, long endMillis) {
|
||||
PamDataUnit first = null, last = null;
|
||||
synchronized (synchronizationLock) {
|
||||
first = getFirstUnit();
|
||||
last = getLastUnit();
|
||||
}
|
||||
if (first == null || last == null) {
|
||||
return false;
|
||||
}
|
||||
if (first.getTimeMilliseconds() > startMillis) {
|
||||
return false;
|
||||
}
|
||||
if (last.getEndTimeInMilliseconds() < endMillis) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// recursive search for the correct unit
|
||||
// private Tunit searchFirstUnitAfter(int i1, int i2, long timems) {
|
||||
// /*
|
||||
@ -1014,6 +1038,9 @@ public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable {
|
||||
* @return true if we need to reload offline data.
|
||||
*/
|
||||
public boolean needViewerDataLoad(OfflineDataLoadInfo offlineDataLoadInfo) {
|
||||
if (pamDataUnits.size() == 0) {
|
||||
return true;
|
||||
}
|
||||
if (offlineDataLoadInfo.getStartMillis() == currentViewDataStart
|
||||
&& offlineDataLoadInfo.getEndMillis() == currentViewDataEnd) {
|
||||
return false;
|
||||
|
@ -527,7 +527,10 @@ public class OfflineDataLoading<T extends PamDataUnit> {
|
||||
public void notifyOfflineObservers(T pamDataUnit) {
|
||||
if (requestingObservers != null) {
|
||||
for (int i = 0; i < requestingObservers.size(); i++) {
|
||||
requestingObservers.get(i).addData(pamDataBlock, pamDataUnit);
|
||||
PamObserver obs = requestingObservers.get(i);
|
||||
if (obs != null) {
|
||||
obs.addData(pamDataBlock, pamDataUnit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class AnalogArraySensorDataUnit extends PamDataUnit implements Array.sens
|
||||
}
|
||||
|
||||
private Double getFieldVal(int iVal) {
|
||||
if (sensorData == null || sensorData.length <= iVal) {
|
||||
if (sensorData == null || sensorData.length <= iVal || iVal < 0) {
|
||||
return null;
|
||||
}
|
||||
AnalogSensorData sensDat = sensorData[iVal];
|
||||
|
@ -225,7 +225,8 @@ public class AnalogDiagnosticsDisplay extends UserDisplayComponentAdapter implem
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (allItemData[rowIndex] != null) {
|
||||
ItemAllData data = allItemData[rowIndex];
|
||||
if (data != null) {
|
||||
return allItemData[rowIndex].getIntValue();
|
||||
}
|
||||
break;
|
||||
|
@ -4,6 +4,7 @@ import java.util.ListIterator;
|
||||
|
||||
import PamguardMVC.PamDataBlock;
|
||||
import PamguardMVC.PamDataUnit;
|
||||
import PamguardMVC.dataOffline.OfflineDataLoadInfo;
|
||||
import bearinglocaliser.BearingLocaliserControl;
|
||||
import bearinglocaliser.BearingProcess;
|
||||
import dataMap.OfflineDataMapPoint;
|
||||
@ -28,6 +29,9 @@ public class BLOfflineTask extends OfflineTask {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (bearingLocaliserControl == null) {
|
||||
return null;
|
||||
}
|
||||
return bearingLocaliserControl.getUnitName();
|
||||
}
|
||||
|
||||
@ -67,15 +71,21 @@ public class BLOfflineTask extends OfflineTask {
|
||||
if (rawOrFFTBlock == null) {
|
||||
return;
|
||||
}
|
||||
ListIterator it = rawOrFFTBlock.getListIterator(dataUnit.getTimeMilliseconds(), rawOrFFTBlock.getChannelMap(),
|
||||
PamDataBlock.MATCH_BEFORE, PamDataBlock.POSITION_BEFORE);
|
||||
if (it == null || it.hasNext() == false) {
|
||||
long dataStart = dataUnit.getTimeMilliseconds();
|
||||
long dataEnd = dataUnit.getEndTimeInMilliseconds();
|
||||
if (dataEnd-dataStart <= 0) {
|
||||
dataEnd = dataStart + 1000;
|
||||
}
|
||||
rawOrFFTBlock.loadViewerData(dataStart, dataEnd, null);
|
||||
boolean haveData = rawOrFFTBlock.hasDataRange(dataStart, dataEnd);
|
||||
if (haveData == false) {
|
||||
// ListIterator it = rawOrFFTBlock.getListIterator(dataUnit.getTimeMilliseconds(), rawOrFFTBlock.getChannelMap(),
|
||||
// PamDataBlock.MATCH_BEFORE, PamDataBlock.POSITION_BEFORE);
|
||||
// if (it == null || it.hasNext() == false) {
|
||||
// if (dataEnd-dataStart <= 0) {
|
||||
// dataEnd = dataStart + 1000;
|
||||
// }
|
||||
OfflineDataLoadInfo offlineLoadInfo = new OfflineDataLoadInfo(dataStart, dataEnd);
|
||||
offlineLoadInfo.setLoadKeepLayers(2);
|
||||
rawOrFFTBlock.getOfflineData(offlineLoadInfo);
|
||||
// System.out.printf("Loaded some FFT data I hope\n");
|
||||
// rawOrFFTBlock.loadViewerData(dataStart, dataEnd, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -391,6 +391,9 @@ public class ScrollingDataPanel extends PamBorderPanel {
|
||||
public void scrollToData(PamDataBlock dataBlock) {
|
||||
long startTime = dataBlock.getCurrentViewDataStart();
|
||||
int val = (int) ((startTime - getScreenStartMillis())/1000 - getScreenSeconds()/5) ;
|
||||
val += hScrollBar.getValue();
|
||||
// System.out.printf("Scroll bar %d to %d set %d\n", hScrollBar.getMinimum(),
|
||||
// hScrollBar.getMaximum(), val);
|
||||
hScrollBar.setValue(val);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import PamController.PamController;
|
||||
import PamController.SettingsNameProvider;
|
||||
import PamDetection.RawDataUnit;
|
||||
import PamUtils.PamUtils;
|
||||
@ -143,6 +144,11 @@ public class FFTDataOrganiser {
|
||||
if (rawOrFFTData == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// if (PamController.getInstance().getRunMode() == PamController.RUN_PAMVIEW) {
|
||||
// checkOfflineDataLoad(rawOrFFTData, pamDataUnit.getTimeMilliseconds(), pamDataUnit.getEndTimeInMilliseconds());
|
||||
// }
|
||||
|
||||
switch (inputType) {
|
||||
case FFTData:
|
||||
return createFromFFTData(pamDataUnit, sampleRate, channelMap);
|
||||
@ -157,6 +163,52 @@ public class FFTDataOrganiser {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when running offline to try to ensure required raw or fft data are in memory.
|
||||
* @param sourceData
|
||||
* @param timeMilliseconds
|
||||
* @param endTimeInMilliseconds
|
||||
*/
|
||||
private boolean checkOfflineDataLoad(PamDataBlock sourceData, long startMilliseconds, long endMilliseconds) {
|
||||
if (sourceData == null) {
|
||||
return false;
|
||||
}
|
||||
boolean needData = needOfflineDataLoad(sourceData, startMilliseconds, endMilliseconds);
|
||||
if (needData) {
|
||||
sourceData.loadViewerData(startMilliseconds, endMilliseconds, null);
|
||||
}
|
||||
return needOfflineDataLoad(sourceData, startMilliseconds, endMilliseconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to see if we still need to load offline data.
|
||||
* @param sourceData
|
||||
* @param startMilliseconds
|
||||
* @param endMilliseconds
|
||||
* @return
|
||||
*/
|
||||
private boolean needOfflineDataLoad(PamDataBlock sourceData, long startMilliseconds, long endMilliseconds) {
|
||||
if (sourceData == null) {
|
||||
return false;
|
||||
}
|
||||
synchronized (sourceData.getSynchLock()) {
|
||||
PamDataUnit first = sourceData.getFirstUnit();
|
||||
PamDataUnit last = sourceData.getLastUnit();
|
||||
if (first == null || last == null) {
|
||||
return true;
|
||||
}
|
||||
if (first.getTimeMilliseconds() > startMilliseconds) {
|
||||
return true;
|
||||
}
|
||||
if (last.getEndTimeInMilliseconds() < endMilliseconds) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get FFT data units matching in time from the source
|
||||
* @param pamDataUnit data unit we need FFT data for (can be anything, just needs it's times)
|
||||
|
@ -3,6 +3,8 @@ package fileOfflineData;
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* Make a list of files with the given file filter.
|
||||
@ -30,6 +32,21 @@ public class OfflineFileList {
|
||||
return files.size();
|
||||
}
|
||||
|
||||
public void sortByFileName() {
|
||||
if (files == null || files.size() == 0) {
|
||||
return;
|
||||
}
|
||||
Collections.sort(files, new Comparator<File>() {
|
||||
|
||||
@Override
|
||||
public int compare(File file1, File file2) {
|
||||
String n1 = file1.getName();
|
||||
String n2 = file2.getName();
|
||||
return n1.compareTo(n2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addFiles(File current) {
|
||||
if (current.exists() == false) {
|
||||
return;
|
||||
|
@ -173,6 +173,9 @@ public class GroupLocSettingPaneFX extends SettingsPane<Group3DParams>{
|
||||
algoOptsButton.setDisable(true);
|
||||
return;
|
||||
}
|
||||
// also enable / disable the more options button ...
|
||||
algoOptsButton.setDisable(localiserAlgorithm.hasParams() == false);
|
||||
|
||||
/**
|
||||
* Need to immediately tell the algorithm which input we're using so that it can
|
||||
* show the correct settings...
|
||||
@ -209,9 +212,6 @@ public class GroupLocSettingPaneFX extends SettingsPane<Group3DParams>{
|
||||
}
|
||||
algorithmSourcePane = newPane;
|
||||
|
||||
// also enable / disable the more options button ...
|
||||
algoOptsButton.setDisable(localiserAlgorithm.hasParams() == false);
|
||||
|
||||
|
||||
repackDialog();
|
||||
}
|
||||
|
@ -36,7 +36,10 @@ From the Detection Menu, select <strong><em>GPS>GPS Options</em></strong>
|
||||
<p>
|
||||
On very rare occasions, if the GPS data have been multiplexed through some other instruments, the first
|
||||
two characters of the string identifier are changed. If this is the case, it may also be necessary to set these
|
||||
so that the GPS module can identify the appropriate data.
|
||||
so that the GPS module can identify the appropriate data. As an alternative, select the "Allow and string initials" option
|
||||
which will use any valid RMC or GGA string. Note however, that with a complex NMEA system there may be more than one GPS and
|
||||
it is better to select only strings from the most accurate</p>
|
||||
|
||||
|
||||
<h3>Read Options</h3>
|
||||
<p>Three options for reading and storing GPS data are available.</p>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 14 KiB |
@ -140,7 +140,7 @@ public class BBED549 {
|
||||
public static double hexToEngineering(int range, int data) {
|
||||
/**
|
||||
* convert integer data to engineering units.
|
||||
* @param range range on device, asumed the same for all channels.
|
||||
* @param range range on device, assumed the same for all channels.
|
||||
* @param data data array
|
||||
* @return
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user