Merge branch 'Tethys' of C:\Users\dg50\source\repos\PAMGuardTethys into

Tethys
This commit is contained in:
Douglas Gillespie 2023-12-14 12:27:14 +00:00
commit 3059e087ac
439 changed files with 18650 additions and 1102 deletions

View File

@ -17,10 +17,7 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="lib" path="C:/Users/dg50/Tethys/NilusXMLGenerator/target/nilus-1.5.jar"> <classpathentry combineaccessrules="false" kind="src" path="/nilusxmlgenerator"/>
<attributes> <classpathentry combineaccessrules="false" kind="src" path="/TethysJavaClient"/>
<attribute name="javadoc_location" value="jar:file:/C:/Users/dg50/Tethys/NilusXMLGenerator/target/nilus-1.5-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>PamGuard Main DG</name> <name>PamGuard Main Tethys</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>

View File

@ -5,6 +5,7 @@ import java.lang.reflect.Field;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
public class AISParameters implements Serializable, Cloneable, ManagedParameters { public class AISParameters implements Serializable, Cloneable, ManagedParameters {
@ -51,7 +52,7 @@ public class AISParameters implements Serializable, Cloneable, ManagedParameters
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try { try {
Field field = this.getClass().getDeclaredField("nmeaSource"); Field field = this.getClass().getDeclaredField("nmeaSource");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -5,6 +5,7 @@ import java.io.Serializable;
import NMEA.NMEABitArray; import NMEA.NMEABitArray;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamUtils.LatLong; import PamUtils.LatLong;
/** /**
@ -160,7 +161,7 @@ sensor.
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps; return ps;
} }

View File

@ -6,6 +6,7 @@ import java.util.Calendar;
import NMEA.NMEABitArray; import NMEA.NMEABitArray;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamUtils.PamCalendar; import PamUtils.PamCalendar;
public class AISStaticData extends AISReport implements Serializable, ManagedParameters{ public class AISStaticData extends AISReport implements Serializable, ManagedParameters{
@ -393,7 +394,7 @@ public class AISStaticData extends AISReport implements Serializable, ManagedPar
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps; return ps;
} }

View File

@ -283,6 +283,16 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet
return daqControllers; return daqControllers;
} }
@Override
public String getDataLocation() {
if (offlineFileServer == null) {
return null;
}
else {
return offlineFileServer.getDataLocation();
}
}
public AcquisitionProcess getDaqProcess() { public AcquisitionProcess getDaqProcess() {
return acquisitionProcess; return acquisitionProcess;
} }

View File

@ -151,6 +151,7 @@ public class AcquisitionDialog extends PamDialog {
acquisitionParameters = oldParams.clone(); acquisitionParameters = oldParams.clone();
acquisitionControl = daqControl; acquisitionControl = daqControl;
// singleInstance = null;
if (singleInstance == null || singleInstance.getOwner() != parentFrame) { if (singleInstance == null || singleInstance.getOwner() != parentFrame) {
singleInstance = new AcquisitionDialog(parentFrame); singleInstance = new AcquisitionDialog(parentFrame);

View File

@ -10,6 +10,7 @@ import Array.Preamplifier;
import PamController.PamController; import PamController.PamController;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
import PamguardMVC.PamConstants; import PamguardMVC.PamConstants;
@ -320,7 +321,7 @@ public class AcquisitionParameters implements Serializable, Cloneable, ManagedPa
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try { try {
Field field = this.getClass().getDeclaredField("channelList"); Field field = this.getClass().getDeclaredField("channelList");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -5,6 +5,7 @@ import java.lang.reflect.Field;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryHeader;
import binaryFileStorage.BinaryObjectData; import binaryFileStorage.BinaryObjectData;
@ -30,7 +31,7 @@ class DaqStatusModuleHeader extends ModuleHeader implements Serializable, Manage
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try { try {
Field field = this.getClass().getDeclaredField("daqName"); Field field = this.getClass().getDeclaredField("daqName");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/** /**
* Used by FileInputSystem * Used by FileInputSystem
@ -78,7 +79,7 @@ public class FileInputParameters implements Serializable, Cloneable, ManagedPara
return null; return null;
} }
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }
} }

View File

@ -318,6 +318,9 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D
} }
selection = folderInputParameters.getSelectedFiles(); selection = folderInputParameters.getSelectedFiles();
} }
if (selection == null) {
return 0;
}
if (selection.length > 0) { if (selection.length > 0) {
System.out.println("FolderInputSystem.makeSelFileList(): Searching for sound files in " + selection[0]); System.out.println("FolderInputSystem.makeSelFileList(): Searching for sound files in " + selection[0]);
} }

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import simulatedAcquisition.SimProcess; import simulatedAcquisition.SimProcess;
/** /**
@ -47,7 +48,7 @@ public class SoundCardParameters implements Serializable, Cloneable, ManagedPara
return null; return null;
} }
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }
} }

View File

@ -6,6 +6,7 @@ import java.util.TimeZone;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import soundtrap.STXMLFile; import soundtrap.STXMLFile;
public class StandardFileDateSettings implements Serializable, Cloneable, ManagedParameters { public class StandardFileDateSettings implements Serializable, Cloneable, ManagedParameters {
@ -150,7 +151,7 @@ public class StandardFileDateSettings implements Serializable, Cloneable, Manage
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps; return ps;
} }
} }

View File

@ -6,6 +6,7 @@ import Acquisition.AcquisitionControl;
import Acquisition.AcquisitionDialog; import Acquisition.AcquisitionDialog;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class PPSParameters implements Cloneable, Serializable, ManagedParameters { public class PPSParameters implements Cloneable, Serializable, ManagedParameters {
@ -36,7 +37,7 @@ public class PPSParameters implements Cloneable, Serializable, ManagedParameters
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -6,6 +6,7 @@ import java.lang.reflect.Field;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
import PamUtils.LatLong; import PamUtils.LatLong;
@ -95,7 +96,7 @@ public class AirgunParameters implements Serializable, Cloneable, ManagedParamet
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
try { try {
Field field = this.getClass().getDeclaredField("dimE"); Field field = this.getClass().getDeclaredField("dimE");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -44,6 +44,8 @@ public class ArrayDialog extends PamDialog implements ActionListener {
private EnvironmentPanel environmentPanel; private EnvironmentPanel environmentPanel;
private HydrophoneDiagram hydrophoneDiagram; private HydrophoneDiagram hydrophoneDiagram;
private InstrumentIdentityPanel instrumentIdentityPanel;
private JButton okButton, cancelButton; private JButton okButton, cancelButton;
@ -69,11 +71,14 @@ public class ArrayDialog extends PamDialog implements ActionListener {
eastPanel.add(channelPanel.getChannelPanel()); eastPanel.add(channelPanel.getChannelPanel());
environmentPanel = new EnvironmentPanel(this); environmentPanel = new EnvironmentPanel(this);
instrumentIdentityPanel = new InstrumentIdentityPanel();
// eastPanel.add(environmentPanel.getEnvironmentPanel());
hydrophoneDiagram = new HydrophoneDiagram(this); hydrophoneDiagram = new HydrophoneDiagram(this);
JPanel westPanel = new JPanel(new BorderLayout()); JPanel westPanel = new JPanel(new BorderLayout());
westPanel.add(BorderLayout.CENTER, hydrophoneDiagram.getPlotPanel()); westPanel.add(BorderLayout.CENTER, hydrophoneDiagram.getPlotPanel());
westPanel.add(BorderLayout.SOUTH, environmentPanel.getEnvironmentPanel()); westPanel.add(BorderLayout.SOUTH, environmentPanel.getEnvironmentPanel());
westPanel.add(BorderLayout.NORTH, instrumentIdentityPanel.getComponent());
splitPanel.add(westPanel); splitPanel.add(westPanel);
@ -144,6 +149,7 @@ public class ArrayDialog extends PamDialog implements ActionListener {
hydrophoneDialogPanel.setParams(selArray); hydrophoneDialogPanel.setParams(selArray);
channelPanel.setParams(); channelPanel.setParams();
hydrophoneDiagram.rePaint(); hydrophoneDiagram.rePaint();
instrumentIdentityPanel.setParams(selArray);
if (selArray != null) { if (selArray != null) {
environmentPanel.setNewSpeed(selArray.getSpeedOfSound()); environmentPanel.setNewSpeed(selArray.getSpeedOfSound());
} }
@ -171,6 +177,7 @@ public class ArrayDialog extends PamDialog implements ActionListener {
array.setSpeedOfSound(environmentPanel.getNewSpeed()); array.setSpeedOfSound(environmentPanel.getNewSpeed());
array.setSpeedOfSoundError(environmentPanel.getNewError()); array.setSpeedOfSoundError(environmentPanel.getNewError());
hydrophoneDialogPanel.getParams(); hydrophoneDialogPanel.getParams();
instrumentIdentityPanel.getParams(array);
if (checkDaqChannels(array) == false) { if (checkDaqChannels(array) == false) {
return false; return false;
@ -250,6 +257,7 @@ public class ArrayDialog extends PamDialog implements ActionListener {
environmentPanel.setNewSpeed(currentArray.getSpeedOfSound()); environmentPanel.setNewSpeed(currentArray.getSpeedOfSound());
environmentPanel.setNewError(currentArray.getSpeedOfSoundError()); environmentPanel.setNewError(currentArray.getSpeedOfSoundError());
} }
instrumentIdentityPanel.setParams(currentArray);
} }
void newChannelSelection() { void newChannelSelection() {

View File

@ -28,6 +28,7 @@ import java.util.Arrays;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
import pamMaths.PamVector; import pamMaths.PamVector;
import PamView.PamSymbol; import PamView.PamSymbol;
@ -158,7 +159,7 @@ public class Hydrophone implements Serializable, Cloneable, ManagedParameters {
return sensitivity; return sensitivity;
} }
protected void setSensitivity(double sensitivity) { public void setSensitivity(double sensitivity) {
this.sensitivity = sensitivity; this.sensitivity = sensitivity;
} }
@ -333,7 +334,7 @@ public class Hydrophone implements Serializable, Cloneable, ManagedParameters {
/** /**
* @return Returns the coordinate. * @return Returns the coordinate.
*/ */
protected double[] getCoordinates() { public double[] getCoordinates() {
return Arrays.copyOf(coordinate,3); return Arrays.copyOf(coordinate,3);
} }
@ -364,7 +365,7 @@ public class Hydrophone implements Serializable, Cloneable, ManagedParameters {
/** /**
* @param preampGain The preampGain to set. * @param preampGain The preampGain to set.
*/ */
protected void setPreampGain(double preampGain) { public void setPreampGain(double preampGain) {
this.preampGain = preampGain; this.preampGain = preampGain;
} }
@ -478,7 +479,7 @@ public class Hydrophone implements Serializable, Cloneable, ManagedParameters {
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet pps = PamParameterSet.autoGenerate(this); PamParameterSet pps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
Field f; Field f;
try { try {
f = this.getClass().getDeclaredField("coordinate"); f = this.getClass().getDeclaredField("coordinate");

View File

@ -7,6 +7,7 @@ import Array.streamerOrigin.StreamerDataIterator;
import GPS.GpsData; import GPS.GpsData;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
import PamUtils.LatLong; import PamUtils.LatLong;
import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataBlock;
@ -225,7 +226,7 @@ abstract public class HydrophoneLocator implements Serializable, Cloneable, Mana
*/ */
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try { try {
Field field = this.getClass().getDeclaredField("pamArray"); Field field = this.getClass().getDeclaredField("pamArray");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -0,0 +1,72 @@
package Array;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import PamView.dialog.PamGridBagContraints;
import PamView.panel.WestAlignedPanel;
/**
* Instrument identity panel, contrians additional fields required by Tethys.
* @author dg50
*
*/
public class InstrumentIdentityPanel {
private JPanel mainPanel;
private JTextField instrumentId;
private JTextField instrumentType;
public InstrumentIdentityPanel() {
mainPanel = new WestAlignedPanel();
mainPanel.setBorder(new TitledBorder("Instrument information"));
mainPanel.setLayout(new GridBagLayout());
GridBagConstraints c = new PamGridBagContraints();
mainPanel.add(new JLabel("Instrument Type ", JLabel.RIGHT), c);
c.gridx++;
mainPanel.add(instrumentType = new JTextField(20), c);
c.gridx = 0;
c.gridy++;
mainPanel.add(new JLabel("Instrument Id ", JLabel.RIGHT), c);
c.gridx++;
mainPanel.add(instrumentId = new JTextField(20), c);
instrumentType.setToolTipText("Instrument type, e.g. Towed array, HARP, EAR, Popup, DMON, Rock Hopper, etc.");
instrumentId.setToolTipText("Instrument identifier, e.g. serial number");
}
public JComponent getComponent() {
return mainPanel;
}
public void setParams(PamArray currentArray) {
if (currentArray == null) {
currentArray = ArrayManager.getArrayManager().getCurrentArray();
}
if (currentArray == null) {
return;
}
instrumentType.setText(currentArray.getInstrumentType());
instrumentId.setText(currentArray.getInstrumentId());
}
public void getParams(PamArray currentArray) {
if (currentArray == null) {
currentArray = ArrayManager.getArrayManager().getCurrentArray();
}
if (currentArray == null) {
return;
}
currentArray.setInstrumentType(instrumentType.getText());
currentArray.setInstrumentId(instrumentId.getText());
}
}

View File

@ -16,5 +16,10 @@ abstract public class MovingHydrophoneLocator extends SimpleHydrophoneLocator {
super(pamArray, streamer); super(pamArray, streamer);
} }
@Override
public boolean isChangeable() {
return true;
}
} }

View File

@ -35,6 +35,7 @@ import Array.streamerOrigin.StreamerDataIterator;
import GPS.GpsData; import GPS.GpsData;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
import PamUtils.LatLong; import PamUtils.LatLong;
import PamUtils.PamArrayUtils; import PamUtils.PamArrayUtils;
@ -90,6 +91,33 @@ public class PamArray implements Serializable, Cloneable, ManagedParameters {
private String arrayName; private String arrayName;
private String arrayFile; private String arrayFile;
/**
* Type, used for Tethys and other meta data control
*/
private String instrumentType;
/**
* Array Id. Can be anything. Compulsory for Tethys.
*/
private String instrumentId;
public String getInstrumentType() {
return instrumentType;
}
public void setInstrumentType(String instrumentType) {
this.instrumentType = instrumentType;
}
public String getInstrumentId() {
return instrumentId;
}
public void setInstrumentId(String instrumentId) {
this.instrumentId = instrumentId;
}
// private int originInterpolation = ORIGIN_USE_LATEST; // private int originInterpolation = ORIGIN_USE_LATEST;
private int originInterpolation = ORIGIN_USE_PRECEEDING; private int originInterpolation = ORIGIN_USE_PRECEEDING;
@ -1574,7 +1602,7 @@ public class PamArray implements Serializable, Cloneable, ManagedParameters {
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try { try {
Field field = this.getClass().getDeclaredField("streamers"); Field field = this.getClass().getDeclaredField("streamers");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -25,6 +25,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/** /**
* *
@ -79,7 +80,7 @@ public class Preamplifier implements Serializable, Cloneable, ManagedParameters
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -17,6 +17,7 @@ import PamController.PamController;
import PamController.masterReference.MasterReferencePoint; import PamController.masterReference.MasterReferencePoint;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
import PamUtils.LatLong; import PamUtils.LatLong;
import PamUtils.PamCalendar; import PamUtils.PamCalendar;
@ -767,7 +768,7 @@ public class Streamer implements Serializable, Cloneable, ManagedParameters {
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try { try {
Field field = this.getClass().getDeclaredField("coordinate"); Field field = this.getClass().getDeclaredField("coordinate");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -259,6 +259,7 @@ public class StreamerDialog extends PamDialog {
// } // }
singleInstance.currentArray = currentArray; singleInstance.currentArray = currentArray;
singleInstance.defaultStreamer = streamer;//.clone(); singleInstance.defaultStreamer = streamer;//.clone();
// singleInstance.st
singleInstance.setParams(); singleInstance.setParams();
singleInstance.setVisible(true); singleInstance.setVisible(true);
return singleInstance.defaultStreamer; return singleInstance.defaultStreamer;
@ -549,6 +550,17 @@ public class StreamerDialog extends PamDialog {
pack(); pack();
} }
} }
try {
OriginSettings os = defaultStreamer.getOriginSettings(currentOriginMethod.getClass());
if (os != null) {
currentOriginMethod.setOriginSettings(os);
}
}
catch (Exception e) {
// will throw if it tries to set the wrong type of settings.
}
enableControls(); enableControls();
} }

View File

@ -3,6 +3,7 @@ package Array.streamerOrigin;
import PamController.SettingsObject; import PamController.SettingsObject;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/** /**
* Class to hold settings for the different origin methods. * Class to hold settings for the different origin methods.
@ -47,7 +48,7 @@ public abstract class OriginSettings implements SettingsObject, Cloneable, Manag
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -5,6 +5,7 @@ import java.util.Arrays;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import mcc.MccJniInterface; import mcc.MccJniInterface;
import mcc.mccjna.MCCConstants; import mcc.mccjna.MCCConstants;
@ -67,7 +68,7 @@ public class ArrayAccelParams implements Serializable, Cloneable, ManagedParamet
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -5,6 +5,7 @@ import java.lang.reflect.Field;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
import PamView.GroupedSourceParameters; import PamView.GroupedSourceParameters;
import PamguardMVC.PamConstants; import PamguardMVC.PamConstants;
@ -44,7 +45,7 @@ public class AzigramParameters implements Serializable, ManagedParameters, Clone
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try { try {
Field field = this.getClass().getDeclaredField("name"); Field field = this.getClass().getDeclaredField("name");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -7,6 +7,7 @@ import org.w3c.dom.Element;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/** /**
* FilterPArameters for use when the filter is on it's own (within a FilterController) * FilterPArameters for use when the filter is on it's own (within a FilterController)
@ -39,7 +40,7 @@ public class FilterParameters_2 implements Serializable, Cloneable, ManagedParam
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -30,6 +30,7 @@ import org.w3c.dom.Element;
import PamController.PamControlledUnit; import PamController.PamControlledUnit;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamUtils.FrequencyFormat; import PamUtils.FrequencyFormat;
/** /**
@ -358,7 +359,7 @@ public class FilterParams implements Serializable, Cloneable, ManagedParameters
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -5,6 +5,7 @@ import java.lang.reflect.Field;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
public class GPSParameters implements Serializable, Cloneable, ManagedParameters { public class GPSParameters implements Serializable, Cloneable, ManagedParameters {
@ -175,7 +176,7 @@ public class GPSParameters implements Serializable, Cloneable, ManagedParameters
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try { try {
Field field = this.getClass().getDeclaredField("nmeaSource"); Field field = this.getClass().getDeclaredField("nmeaSource");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -1,5 +1,6 @@
package GPS; package GPS;
import PamUtils.PamCalendar;
import PamguardMVC.PamDataUnit; import PamguardMVC.PamDataUnit;
public class GpsDataUnit extends PamDataUnit { public class GpsDataUnit extends PamDataUnit {
@ -52,12 +53,18 @@ public class GpsDataUnit extends PamDataUnit {
*/ */
@Override @Override
public String getSummaryString() { public String getSummaryString() {
// TODO Auto-generated method stub // String str = super.getSummaryString();
String str = super.getSummaryString(); String str = String.format("<html>%s<br>UID:%d, Database: %d<br>%s<br>",
"GPS Data", getUID(), getDatabaseIndex(), PamCalendar.formatDBDateTime(getTimeMilliseconds(), true));
if (gpsData != null) { if (gpsData != null) {
str += gpsData.summaryString(); str += gpsData.summaryString();
} }
return str; return str;
} }
@Override
public double[] getFrequency() {
return null;
}
} }

View File

@ -17,6 +17,7 @@ import java.lang.reflect.Field;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamView.GroupedSourceParameters; import PamView.GroupedSourceParameters;
public class IshDetParams implements Serializable, Cloneable, ManagedParameters { public class IshDetParams implements Serializable, Cloneable, ManagedParameters {
@ -96,7 +97,7 @@ public class IshDetParams implements Serializable, Cloneable, ManagedParameters
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try { try {
Field field = this.getClass().getDeclaredField("inputDataSource"); Field field = this.getClass().getDeclaredField("inputDataSource");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/** /**
* Ishamel display parameters for the Spectrogram plug in. * Ishamel display parameters for the Spectrogram plug in.
@ -42,7 +43,7 @@ public class IshDisplayParams implements Serializable, Cloneable, ManagedParamet
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps; return ps;
} }

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class KernelSmoothingParameters implements Serializable, Cloneable, ManagedParameters { public class KernelSmoothingParameters implements Serializable, Cloneable, ManagedParameters {
@ -25,7 +26,7 @@ public class KernelSmoothingParameters implements Serializable, Cloneable, Manag
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import fftFilter.FFTFilterParams; import fftFilter.FFTFilterParams;
/** /**
@ -157,7 +158,7 @@ public class DelayMeasurementParams implements Serializable, Cloneable, ManagedP
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class MCMCParams2 implements Serializable, Cloneable, ManagedParameters { public class MCMCParams2 implements Serializable, Cloneable, ManagedParameters {
@ -126,7 +127,7 @@ public class MCMCParams2 implements Serializable, Cloneable, ManagedParameters
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class MCMCParams implements Serializable, Cloneable, ManagedParameters { public class MCMCParams implements Serializable, Cloneable, ManagedParameters {
@ -64,7 +65,7 @@ public class MCMCParams implements Serializable, Cloneable, ManagedParameters {
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/** /**
@ -69,7 +70,7 @@ public class HyperbolicParams implements Serializable, Cloneable, ManagedParamet
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import Spectrogram.WindowFunction; import Spectrogram.WindowFunction;
/** /**
@ -104,7 +105,7 @@ public class RawOrFFTParams implements Serializable, Cloneable, RawOrFFTParamsIn
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -7,6 +7,7 @@ import java.util.ListIterator;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/** /**
* PArameters for MapDetectionsManager which * PArameters for MapDetectionsManager which
@ -65,7 +66,7 @@ public class MapDetectionsParameters implements Serializable, Cloneable, Managed
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps; return ps;
} }

View File

@ -27,6 +27,7 @@ import java.lang.reflect.Field;
import Array.Hydrophone; import Array.Hydrophone;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
public class MapParameters implements Serializable, Cloneable, ManagedParameters { public class MapParameters implements Serializable, Cloneable, ManagedParameters {
@ -301,7 +302,7 @@ public class MapParameters implements Serializable, Cloneable, ManagedParameters
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps; return ps;
} }

View File

@ -20,9 +20,15 @@
*/ */
package Map; package Map;
import java.awt.Point;
import java.awt.event.MouseMotionAdapter; import java.awt.event.MouseMotionAdapter;
import java.awt.geom.AffineTransform; import java.awt.geom.AffineTransform;
import java.util.ListIterator;
import GPS.GPSControl;
import GPS.GPSDataBlock;
import GPS.GpsDataUnit;
import PamController.PamController;
import PamUtils.Coordinate3d; import PamUtils.Coordinate3d;
import PamUtils.LatLong; import PamUtils.LatLong;
import PamUtils.PamCoordinate; import PamUtils.PamCoordinate;
@ -385,6 +391,45 @@ public class MapRectProjector extends MapProjector {
return xTrans; return xTrans;
} }
@Override
public String getHoverText(Point mousePoint, int ploNumberMatch) {
String text = super.getHoverText(mousePoint, ploNumberMatch);
if (text == null) {
return findGpsTrackText(mousePoint, ploNumberMatch);
}
else {
return text;
}
}
private String findGpsTrackText(Point mousePoint, int ploNumberMatch) {
GPSControl gpsControl = GPSControl.getGpsControl();
if (gpsControl == null) {
return null;
}
LatLong currentPos = getDataPosition(new Coordinate3d(mousePoint.x, mousePoint.y));
GPSDataBlock gpsDataBlock = gpsControl.getGpsDataBlock();
double dist = Double.MAX_VALUE;
GpsDataUnit closest = null;
ListIterator<GpsDataUnit> it = gpsDataBlock.getListIterator(0);
while (it.hasNext()) {
GpsDataUnit gpsUnit = it.next();
double r = gpsUnit.getGpsData().distanceToMetres(currentPos);
if (r < dist) {
dist = r;
closest = gpsUnit;
}
}
if (closest == null) {
return null;
}
double rPix = dist*this.pixelsPerMetre;
if (rPix > 20) {
return null;
}
return closest.getSummaryString();
}
} }

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class GridbaseParameters implements Cloneable, Serializable, ManagedParameters { public class GridbaseParameters implements Cloneable, Serializable, ManagedParameters {
@ -25,7 +26,7 @@ public class GridbaseParameters implements Cloneable, Serializable, ManagedParam
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps; return ps;
} }

View File

@ -24,6 +24,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import serialComms.jserialcomm.PJSerialComm; import serialComms.jserialcomm.PJSerialComm;
public class NMEAParameters implements Serializable, Cloneable, ManagedParameters { public class NMEAParameters implements Serializable, Cloneable, ManagedParameters {
@ -149,7 +150,7 @@ public class NMEAParameters implements Serializable, Cloneable, ManagedParameter
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -33,6 +33,13 @@ public interface OfflineDataStore {
*/ */
public String getDataSourceName(); public String getDataSourceName();
/**
* Get the data location. This may be a specific file, or might be a folder
* if data are in many files, a URI, etc.
* @return store locations
*/
public String getDataLocation();
/** /**
* Load data for a given datablock between two time limits. * Load data for a given datablock between two time limits.
* @param dataBlock datablock owner of the data * @param dataBlock datablock owner of the data

View File

@ -23,6 +23,7 @@ package PamController;
import java.awt.Component; import java.awt.Component;
import java.awt.Frame; import java.awt.Frame;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JMenu; import javax.swing.JMenu;
@ -39,7 +40,9 @@ import org.w3c.dom.Element;
import PamController.status.ModuleStatus; import PamController.status.ModuleStatus;
import PamController.status.ModuleStatusManager; import PamController.status.ModuleStatusManager;
import PamController.status.ProcessCheck; import PamController.status.ProcessCheck;
import PamModel.PamModel;
import PamModel.PamModuleInfo; import PamModel.PamModuleInfo;
import PamModel.PamPluginInterface;
import PamView.ClipboardCopier; import PamView.ClipboardCopier;
import PamView.PamGui; import PamView.PamGui;
import PamView.PamSidePanel; import PamView.PamSidePanel;
@ -880,6 +883,23 @@ public abstract class PamControlledUnit implements SettingsNameProvider {
public int getInstanceIndex() { public int getInstanceIndex() {
return instanceIndex; return instanceIndex;
} }
/**
* Get detail if this is a plugin.
* @return plugin detail, or null if it's not a plugin.
*/
public PamPluginInterface getPlugin() {
List<PamPluginInterface> pluginList = ((PamModel) PamController.getInstance().getModelInterface()).getPluginList();
if (pluginList == null) {
return null;
}
for (PamPluginInterface plugin : pluginList) {
if (plugin.getClassName().equals(this.getClass().getName())) {
return plugin;
}
}
return null;
}
/** /**
* The PamConfiguration holds the master list of modules which form part of a * The PamConfiguration holds the master list of modules which form part of a

View File

@ -36,6 +36,7 @@ import org.apache.commons.io.input.ClassLoaderObjectInputStream;
import PamModel.PamModel; import PamModel.PamModel;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamView.dialog.warn.WarnOnce; import PamView.dialog.warn.WarnOnce;
@ -398,7 +399,7 @@ public class PamControlledUnitSettings implements Serializable, ManagedParameter
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -57,6 +57,7 @@ import fftManager.FFTDataUnit;
import generalDatabase.DBControlUnit; import generalDatabase.DBControlUnit;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.stage.Stage; import javafx.stage.Stage;
import metadata.MetaDataContol;
import Array.ArrayManager; import Array.ArrayManager;
import PamController.command.MulticastController; import PamController.command.MulticastController;
import PamController.command.NetworkController; import PamController.command.NetworkController;
@ -446,6 +447,7 @@ public class PamController implements PamControllerInterface, PamSettings {
System.out.println(""); System.out.println("");
System.out.println("Note - ignore the following SLF4J warn/error messages, they are not applicable to this application"); System.out.println("Note - ignore the following SLF4J warn/error messages, they are not applicable to this application");
ArrayManager.getArrayManager(); // create the array manager so that it get's it's settings ArrayManager.getArrayManager(); // create the array manager so that it get's it's settings
MetaDataContol.getMetaDataControl();
/** /**
* Check for archived files and unpack automatically. * Check for archived files and unpack automatically.
@ -2426,7 +2428,7 @@ public class PamController implements PamControllerInterface, PamSettings {
if (dbc == null) { if (dbc == null) {
return null; return null;
} }
return dbc.getDatabaseName(); return dbc.getLongDatabaseName();
} }
return null; return null;
} }

View File

@ -0,0 +1,20 @@
package PamController;
/**
* Interface to define modules which can be considered as sensors of some sort.
* e.g. depth and orientation modules and the SoundTrap clickdetecotr
* @author dg50
*
*/
public interface PamSensor {
public String getUnitName();
public String getUnitType();
public String getSensorDescription();
public String getSensorId();
}

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/** /**
* Very simple class used in an ArrayList of used modules that * Very simple class used in an ArrayList of used modules that
@ -53,7 +54,7 @@ public class UsedModuleInfo implements Serializable, ManagedParameters {
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -29,6 +29,7 @@ import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import com.sun.javafx.runtime.VersionInfo; import com.sun.javafx.runtime.VersionInfo;
@ -42,12 +43,14 @@ import PamController.PamguardVersionInfo;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterData; import PamModel.parametermanager.PamParameterData;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamUtils.PamCalendar; import PamUtils.PamCalendar;
import PamUtils.XMLUtils; import PamUtils.XMLUtils;
import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit; import PamguardMVC.PamDataUnit;
import PamguardMVC.PamProcess; import PamguardMVC.PamProcess;
import binaryFileStorage.BinaryStore; import binaryFileStorage.BinaryStore;
import tethys.TethysControl;
/** /**
* Class for writing XML configuration output to a file. * Class for writing XML configuration output to a file.
@ -62,6 +65,8 @@ public class PamguardXMLWriter implements PamSettings {
private static final Set<Class<?>> WRAPPER_TYPES = getWrapperTypes(); private static final Set<Class<?>> WRAPPER_TYPES = getWrapperTypes();
private XMLWriterSettings writerSettings = new XMLWriterSettings(); private XMLWriterSettings writerSettings = new XMLWriterSettings();
private boolean excludeDisplaySettings;
// private String xmlNameSpace;
private static PamguardXMLWriter singleInstance; private static PamguardXMLWriter singleInstance;
@ -83,6 +88,19 @@ public class PamguardXMLWriter implements PamSettings {
} }
return singleInstance; return singleInstance;
} }
/**
* Recursively walk the tree and add a namespace to every
* single element.
* @param doc
* @param nameSpace
* @return
*/
public boolean addNameSpaceToElements(Document doc, Element el, String nameSpace) {
// el.setAttributeNS(nameSpace, nameSpace, nameSpace);
NamedNodeMap attributes = el.getAttributes();
return true;
}
/** /**
* Make a document with the options specified in writerSettings. * Make a document with the options specified in writerSettings.
@ -437,8 +455,7 @@ public class PamguardXMLWriter implements PamSettings {
* @param pamSettingsUnit * @param pamSettingsUnit
* @return xml element * @return xml element
*/ */
private Element writeUnitSettings(Document doc, Element parent, PamSettings pamSettingsUnit) { public Element writeUnitSettings(Document doc, Element parent, PamSettings pamSettingsUnit) {
int[] settingInds = findSettings(null, pamSettingsUnit.getUnitName()); int[] settingInds = findSettings(null, pamSettingsUnit.getUnitName());
PamSettings[] settingsObjects = null; PamSettings[] settingsObjects = null;
if (settingInds != null) { if (settingInds != null) {
@ -462,7 +479,7 @@ public class PamguardXMLWriter implements PamSettings {
* can be temporary settings objects when writing temporary settings from dialogs. * can be temporary settings objects when writing temporary settings from dialogs.
* @return new XML element. * @return new XML element.
*/ */
private Element writeUnitSettings(Document doc, Element parent, PamSettings pamSettingsUnit, PamSettings[] toWrite) { public Element writeUnitSettings(Document doc, Element parent, PamSettings pamSettingsUnit, PamSettings[] toWrite) {
Element moduleData = doc.createElement("MODULE"); Element moduleData = doc.createElement("MODULE");
moduleData.setAttribute("Java.class", pamSettingsUnit.getClass().getName()); moduleData.setAttribute("Java.class", pamSettingsUnit.getClass().getName());
moduleData.setAttribute("UnitType", pamSettingsUnit.getUnitType()); moduleData.setAttribute("UnitType", pamSettingsUnit.getUnitType());
@ -483,6 +500,9 @@ public class PamguardXMLWriter implements PamSettings {
Element settingEl = doc.createElement("CONFIGURATION"); Element settingEl = doc.createElement("CONFIGURATION");
moduleData.appendChild(settingEl); moduleData.appendChild(settingEl);
for (int i = 0; i < toWrite.length; i++) { for (int i = 0; i < toWrite.length; i++) {
if (wantObject(toWrite[i]) == false) {
continue;
}
Element setEl = writeSettings(doc, toWrite[i], new ArrayList<Object>()); Element setEl = writeSettings(doc, toWrite[i], new ArrayList<Object>());
if (setEl != null) { if (setEl != null) {
settingEl.appendChild(setEl); settingEl.appendChild(setEl);
@ -493,6 +513,32 @@ public class PamguardXMLWriter implements PamSettings {
return moduleData; return moduleData;
} }
/**
* USed by the Tethys writer to avoid writing display settings.
* @param pamSettings
* @return
*/
private boolean wantObject(PamSettings pamSettings) {
if (excludeDisplaySettings == false) {
return true;
}
Object obj = pamSettings.getSettingsReference();
if (obj == null) {
return false;
}
if (obj instanceof ManagedParameters) {
ManagedParameters managedParams = (ManagedParameters) obj;
PamParameterSet paramSet = managedParams.getParameterSet();
if (paramSet == null) {
return false;
}
if (paramSet.getParameterSetType() == ParameterSetType.DISPLAY && excludeDisplaySettings) {
return false;
}
}
return true;
}
/** /**
* Write settings for a settings object, using the standard retreived object * Write settings for a settings object, using the standard retreived object
* from the settings. * from the settings.
@ -504,6 +550,14 @@ public class PamguardXMLWriter implements PamSettings {
private Element writeSettings(Document doc, PamSettings pamSettings, ArrayList<Object> objectHierarchy) { private Element writeSettings(Document doc, PamSettings pamSettings, ArrayList<Object> objectHierarchy) {
return writeSettings(doc, pamSettings, pamSettings.getSettingsReference(), objectHierarchy); return writeSettings(doc, pamSettings, pamSettings.getSettingsReference(), objectHierarchy);
} }
public Document writeOneObject(Object data) {
Document doc = XMLUtils.createBlankDoc();
Element el = doc.createElement("Settings");
Element newel = writeObjectData(doc, el, data, new ArrayList<Object>());
doc.appendChild(newel);
return doc;
}
/** /**
* Write settings using an object of choice instead of the standard one from PamSettings. * Write settings using an object of choice instead of the standard one from PamSettings.
@ -515,6 +569,7 @@ public class PamguardXMLWriter implements PamSettings {
* @return * @return
*/ */
private Element writeSettings(Document doc, PamSettings pamSettings, Object data, ArrayList<Object> objectHierarchy) { private Element writeSettings(Document doc, PamSettings pamSettings, Object data, ArrayList<Object> objectHierarchy) {
Element el = doc.createElement("SETTINGS"); Element el = doc.createElement("SETTINGS");
el.setAttribute("Type", pamSettings.getUnitType()); el.setAttribute("Type", pamSettings.getUnitType());
el.setAttribute("Name", pamSettings.getUnitName()); el.setAttribute("Name", pamSettings.getUnitName());
@ -526,10 +581,13 @@ public class PamguardXMLWriter implements PamSettings {
return el; return el;
} }
private Element writeObjectData(Document doc, Element el, Object data, ArrayList<Object> objectHierarchy) { public Element writeObjectData(Document doc, Element el, Object data, ArrayList<Object> objectHierarchy) {
if (data == null) { if (data == null) {
return null; return null;
} }
if (objectHierarchy == null) {
objectHierarchy = new ArrayList<>();
}
if (objectHierarchy.contains(data)) { if (objectHierarchy.contains(data)) {
// just write the reference, but nothing else or we'll end up in an infinite loop of objects. // just write the reference, but nothing else or we'll end up in an infinite loop of objects.
Element e = doc.createElement("Object"); Element e = doc.createElement("Object");
@ -551,8 +609,10 @@ public class PamguardXMLWriter implements PamSettings {
if (parameterSet == null) { if (parameterSet == null) {
return null; return null;
} }
objectHierarchy.add(data); if (objectHierarchy != null) {
objectHierarchy.add(data);
}
for (PamParameterData pamParam:parameterSet.getParameterCollection()) { for (PamParameterData pamParam:parameterSet.getParameterCollection()) {
try { try {
Object paramData = pamParam.getData(); Object paramData = pamParam.getData();
@ -825,7 +885,16 @@ public class PamguardXMLWriter implements PamSettings {
*/ */
private int[] findSettings(String type, String name) { private int[] findSettings(String type, String name) {
if (settingsSets == null) { if (settingsSets == null) {
return null; makeSettingsList();
if (settingsSets == null) {
return null;
}
}
if (usedSettingsSets == null) {
usedSettingsSets = new boolean[settingsSets.size()];
}
else if (usedSettingsSets.length < settingsSets.size()) {
usedSettingsSets = Arrays.copyOf(usedSettingsSets, settingsSets.size());
} }
int[] found = new int[settingsSets.size()]; int[] found = new int[settingsSets.size()];
int nFound = 0; int nFound = 0;
@ -845,7 +914,7 @@ public class PamguardXMLWriter implements PamSettings {
return Arrays.copyOf(found, nFound); return Arrays.copyOf(found, nFound);
} }
private ArrayList<PamSettings> makeSettingsList() { public ArrayList<PamSettings> makeSettingsList() {
PamSettingManager settingsManager = PamSettingManager.getInstance(); PamSettingManager settingsManager = PamSettingManager.getInstance();
settingsSets = settingsManager.getOwners(); settingsSets = settingsManager.getOwners();
if (settingsSets == null) { if (settingsSets == null) {
@ -877,6 +946,14 @@ public class PamguardXMLWriter implements PamSettings {
return doc; return doc;
} }
/**
* Is this element a writable type ? Basically, this means
* that it's a primitive of some sort. Otherwise it's
* probably an object and may even be a list in which case
* it will need treating differently.
* @param clazz
* @return
*/
public static boolean isWritableType(Class<?> clazz) public static boolean isWritableType(Class<?> clazz)
{ {
if (clazz.isEnum()) return true; if (clazz.isEnum()) return true;
@ -967,5 +1044,23 @@ public class PamguardXMLWriter implements PamSettings {
return true; return true;
} }
/**
* @return the excludeDisplaySettings
*/
public boolean isExcludeDisplaySettings() {
return excludeDisplaySettings;
}
/**
* @param excludeDisplaySettings the excludeDisplaySettings to set
*/
public void setExcludeDisplaySettings(boolean excludeDisplaySettings) {
this.excludeDisplaySettings = excludeDisplaySettings;
}
// public void setStaticNameSpace(String xmlNameSpace) {
// this.xmlNameSpace = xmlNameSpace;
// }
} }

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class XMLWriterSettings implements Serializable, Cloneable, ManagedParameters { public class XMLWriterSettings implements Serializable, Cloneable, ManagedParameters {
@ -34,7 +35,7 @@ public class XMLWriterSettings implements Serializable, Cloneable, ManagedParame
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps; return ps;
} }

View File

@ -5,6 +5,7 @@ import java.io.Serializable;
import PamController.soundMedium.GlobalMedium.SoundMedium; import PamController.soundMedium.GlobalMedium.SoundMedium;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/** /**
* Stores parameters for the current medium. * Stores parameters for the current medium.
@ -41,7 +42,7 @@ public class GlobalMediumParams implements Serializable, Cloneable, ManagedParam
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps; return ps;
} }

View File

@ -51,6 +51,8 @@ import rockBlock.RockBlockControl;
import tethys.TethysControl; import tethys.TethysControl;
import turbineops.TurbineOperationControl; import turbineops.TurbineOperationControl;
import GPS.GpsDataUnit; import GPS.GpsDataUnit;
import Map.MapController;
import Map.gridbaselayer.GridbaseControl;
import NMEA.NMEADataUnit; import NMEA.NMEADataUnit;
import PamController.PamControlledUnitSettings; import PamController.PamControlledUnitSettings;
import PamController.PamController; import PamController.PamController;
@ -64,6 +66,7 @@ import PamguardMVC.PamDataBlock;
import analogarraysensor.ArraySensorControl; import analogarraysensor.ArraySensorControl;
import backupmanager.BackupManager; import backupmanager.BackupManager;
import beamformer.continuous.BeamFormerControl; import beamformer.continuous.BeamFormerControl;
import beamformer.localiser.BeamFormLocaliserControl;
import bearinglocaliser.BearingLocaliserControl; import bearinglocaliser.BearingLocaliserControl;
import binaryFileStorage.SecondaryBinaryStore; import binaryFileStorage.SecondaryBinaryStore;
import cepstrum.CepstrumControl; import cepstrum.CepstrumControl;
@ -458,17 +461,17 @@ final public class PamModel implements PamSettings {
mi.setMaxNumber(1); mi.setMaxNumber(1);
mi = PamModuleInfo.registerControlledUnit(MetaDataContol.class.getName(), MetaDataContol.unitType); // mi = PamModuleInfo.registerControlledUnit(MetaDataContol.class.getName(), MetaDataContol.unitType);
mi.setToolTipText("Deployment Meta Data"); // mi.setToolTipText("Project Meta Data");
mi.setModulesMenuGroup(utilitiesGroup); // mi.setModulesMenuGroup(utilitiesGroup);
mi.setMaxNumber(1); // mi.setMaxNumber(1);
if (isViewer) { if (isViewer) {
mi = PamModuleInfo.registerControlledUnit(TethysControl.class.getName(), TethysControl.defaultName); mi = PamModuleInfo.registerControlledUnit(TethysControl.class.getName(), TethysControl.defaultName);
mi.setToolTipText("Interface to Tethys Database"); mi.setToolTipText("Interface to Tethys Database");
mi.setModulesMenuGroup(utilitiesGroup); mi.setModulesMenuGroup(utilitiesGroup);
mi.setMaxNumber(1); mi.setMaxNumber(1);
} }
/* /*
* ************* End Utilities Group ******************* * ************* End Utilities Group *******************
@ -1076,7 +1079,7 @@ final public class PamModel implements PamSettings {
// clear the current list // clear the current list
pluginList.clear(); pluginList.clear();
daqList.clear(); daqList.clear();
/* /*
* If developing a new PAMPlugin in eclipse, the easiest way to do it is to make a new * If developing a new PAMPlugin in eclipse, the easiest way to do it is to make a new
* Eclipse project for your plugin code. Within that project, copy this PamModel class * Eclipse project for your plugin code. Within that project, copy this PamModel class
@ -1091,6 +1094,8 @@ final public class PamModel implements PamSettings {
* When you export the code for your plugin to a jar file, remember to NOT inlcude the copy of * When you export the code for your plugin to a jar file, remember to NOT inlcude the copy of
* PamModel ! * PamModel !
*/ */
// pluginList.add(new MorlaisWP1aPlugin());
// Load up whatever default classloader was used to create this class. Must use the same classloader // 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 // for all plugins, or else we will not be able to create proper dependencies between them or be able
@ -1158,11 +1163,30 @@ final public class PamModel implements PamSettings {
// to add that URL to the default classloader path. // to add that URL to the default classloader path.
URL newURL = jarList.get(i).toURI().toURL(); 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 // 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 // as before it doesn't load the parameters
classLoader.addURL(newURL); 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. // Save the name of the class to the global pluginBeingLoaded variable, and load the class.
this.setPluginBeingLoaded(className); this.setPluginBeingLoaded(className);
// Class c = cl.loadClass(className); // Class c = cl.loadClass(className);
@ -1243,8 +1267,9 @@ final public class PamModel implements PamSettings {
"for help.<p>" + "for help.<p>" +
"This plug-in will not be available for loading"; "This plug-in will not be available for loading";
String help = null; String help = null;
int ans = WarnOnce.showWarning(PamController.getInstance().getGuiFrameManager().getFrame(0), title, msg, WarnOnce.WARNING_MESSAGE, help, e1); int ans = WarnOnce.showWarning(PamController.getMainFrame(), title, msg, WarnOnce.WARNING_MESSAGE, help, e1);
System.err.println("Exception while loading " + className); System.err.println("Exception while loading " + className);
System.err.println(e1.getMessage());
continue; continue;
} }
} }
@ -1257,7 +1282,7 @@ final public class PamModel implements PamSettings {
"for help.<p>" + "for help.<p>" +
"This plug-in will not be available for loading"; "This plug-in will not be available for loading";
String help = null; String help = null;
int ans = WarnOnce.showWarning(PamController.getInstance().getGuiFrameManager().getFrame(0), title, msg, WarnOnce.WARNING_MESSAGE, help, ex); int ans = WarnOnce.showWarning(PamController.getMainFrame(), title, msg, WarnOnce.WARNING_MESSAGE, help, ex);
System.err.println("Exception while loading " + jarList.get(i).getName()); System.err.println("Exception while loading " + jarList.get(i).getName());
continue; continue;
} }
@ -1282,7 +1307,7 @@ final public class PamModel implements PamSettings {
// instantiate the plugin control class using the custom class loader // instantiate the plugin control class using the custom class loader
try { try {
// File classFile = new File(pf.getJarFile()); File classFile = new File(pf.getJarFile());
//URLClassLoader cl = new URLClassLoader(new URL[]{classFile.toURI().toURL()}); //URLClassLoader cl = new URLClassLoader(new URL[]{classFile.toURI().toURL()});
// mi = PamModuleInfo.registerControlledUnit(pf.getClassName(), pf.getDescription(),cl); // mi = PamModuleInfo.registerControlledUnit(pf.getClassName(), pf.getDescription(),cl);
mi = PamModuleInfo.registerControlledUnit(pf.getClassName(), pf.getDescription(),classLoader); mi = PamModuleInfo.registerControlledUnit(pf.getClassName(), pf.getDescription(),classLoader);
@ -1348,7 +1373,7 @@ final public class PamModel implements PamSettings {
"for help.<p>" + "for help.<p>" +
"This plug-in will not be available for loading"; "This plug-in will not be available for loading";
String help = null; String help = null;
int ans = WarnOnce.showWarning(PamController.getInstance().getGuiFrameManager().getFrame(0), title, msg, WarnOnce.WARNING_MESSAGE, help, e1); int ans = WarnOnce.showWarning(PamController.getMainFrame(), title, msg, WarnOnce.WARNING_MESSAGE, help, e1);
System.err.println("Exception while loading " + pf.getDefaultName()); System.err.println("Exception while loading " + pf.getDefaultName());
pluginList.remove(pf); pluginList.remove(pf);
continue; continue;

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class PamModelSettings implements Cloneable, Serializable, ManagedParameters { public class PamModelSettings implements Cloneable, Serializable, ManagedParameters {
@ -74,7 +75,7 @@ public class PamModelSettings implements Cloneable, Serializable, ManagedParamet
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -29,6 +29,9 @@ public class PamParameterSet {
private static boolean printDebug = false; private static boolean printDebug = false;
public enum ParameterSetType {DETECTOR, DISPLAY};
private ParameterSetType parameterSetType;
/** /**
* Standard modifiers to exclude. This is important for many classes which will tend to * Standard modifiers to exclude. This is important for many classes which will tend to
* do crazy things such as incorporate ALL of their final fields, e.g. when a Color * do crazy things such as incorporate ALL of their final fields, e.g. when a Color
@ -55,8 +58,10 @@ public class PamParameterSet {
* in the STANDARD_MODIFIER_EXCLUSIONS list (FINAL or STATIC). * in the STANDARD_MODIFIER_EXCLUSIONS list (FINAL or STATIC).
* @return Created parameter set. * @return Created parameter set.
*/ */
public static PamParameterSet autoGenerate(Object parentObject) { public static PamParameterSet autoGenerate(Object parentObject, ParameterSetType parameterSetType) {
return autoGenerate(parentObject, STANDARD_MODIFIER_EXCLUSIONS); PamParameterSet paramSet = autoGenerate(parentObject, STANDARD_MODIFIER_EXCLUSIONS);
paramSet.setParameterSetType(parameterSetType);
return paramSet;
} }
/** /**
@ -287,4 +292,18 @@ public class PamParameterSet {
return parameterDatas.remove(paramName); return parameterDatas.remove(paramName);
} }
/**
* @return the parameterSetType
*/
public ParameterSetType getParameterSetType() {
return parameterSetType;
}
/**
* @param parameterSetType the parameterSetType to set
*/
public void setParameterSetType(ParameterSetType parameterSetType) {
this.parameterSetType = parameterSetType;
}
} }

View File

@ -26,6 +26,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/** /**
* Class definition for a x,y coordinate number type. * Class definition for a x,y coordinate number type.
@ -168,7 +169,7 @@ public class Coordinate3d implements Serializable , Cloneable, PamCoordinate, Ma
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -15,6 +15,7 @@ import java.text.NumberFormat;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamguardMVC.PamConstants; import PamguardMVC.PamConstants;
import net.sf.geographiclib.Geodesic; import net.sf.geographiclib.Geodesic;
import net.sf.geographiclib.PolygonArea; import net.sf.geographiclib.PolygonArea;
@ -833,7 +834,7 @@ public class LatLong implements Serializable, Cloneable, Transferable, PamCoordi
*/ */
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try { try {
Field field = this.getClass().getDeclaredField("height"); Field field = this.getClass().getDeclaredField("height");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -47,10 +47,7 @@ public class PamCalendar {
public static TimeZone defaultTimeZone = TimeZone.getTimeZone("UTC"); public static TimeZone defaultTimeZone = TimeZone.getTimeZone("UTC");
/* private static TimeZone localTimeZone = defaultTimeZone;// TimeZone.getDefault();
* Not used: all now handled in PamCalendar.
*/
// private static TimeZone localTimeZone = defaultTimeZone;// TimeZone.getDefault();
public static final long millisPerDay = 1000L*24L*3600L; public static final long millisPerDay = 1000L*24L*3600L;
@ -63,7 +60,7 @@ public class PamCalendar {
private static boolean soundFile; private static boolean soundFile;
/** /**
* time from the start of the file to the current moment. * time from the start of the file to the currentmoment.
* This is updated every time data re read from the file, so is * This is updated every time data re read from the file, so is
* accurate to about 1/10 second. * accurate to about 1/10 second.
* For accurate timing within detectors, always try to use sample number * For accurate timing within detectors, always try to use sample number
@ -180,44 +177,8 @@ public class PamCalendar {
public static TimeZone getDisplayTimeZone(boolean useLocal) { public static TimeZone getDisplayTimeZone(boolean useLocal) {
// return TimeZone.getTimeZone("UTC"); // return TimeZone.getTimeZone("UTC");
return useLocal ? CalendarControl.getInstance().getChosenTimeZone() : defaultTimeZone; // return useLocal ? CalendarControl.getInstance().getChosenTimeZone() : defaultTimeZone;
// return useLocal ? localTimeZone : defaultTimeZone; return useLocal ? localTimeZone : defaultTimeZone;
}
/**
* Get the display time zone offset in milliseconds.
* @param useLocal
* @return
*/
public static long getDisplayTimeZoneOffest(boolean useLocal) {
TimeZone tz = getDisplayTimeZone(useLocal);
return tz.getOffset(getTimeInMillis());
}
/**
* Get a short string describing the time zone. This should be less than
* 10 characters. So if the full name of the TZ is long, then write it
* in the format "UTC+..."
* @param useLocal
* @return
*/
public static String getShortDisplayTimeZoneString(boolean useLocal) {
TimeZone tz = getDisplayTimeZone(useLocal);
String str = tz.getDisplayName();
str = CalendarControl.getInstance().getTZCode(true);
if (str.length() <= 10) {
return str;
}
// otherwise make up a string.
long offset = getDisplayTimeZoneOffest(useLocal) / 1000;
boolean isInt = offset % 3600 == 0;
if (isInt) {
str = String.format("UTC%+d", offset/3600);
}
else {
str = String.format("UTC%+3.1f", (double) offset/3600.);
}
return str;
} }
public static String formatDateTime(Date date) { public static String formatDateTime(Date date) {
@ -430,13 +391,8 @@ public class PamCalendar {
public static String formatDBStyleTime(long timeInMillis, boolean showMillis, boolean useLocal) { public static String formatDBStyleTime(long timeInMillis, boolean showMillis, boolean useLocal) {
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
TimeZone tz = getDisplayTimeZone(useLocal);
// if (tz != null) {
// long offs = tz.getOffset(timeInMillis);
// timeInMillis += tz.getOffset(timeInMillis);
// }
c.setTimeInMillis(timeInMillis); c.setTimeInMillis(timeInMillis);
c.setTimeZone(tz); c.setTimeZone(getDisplayTimeZone(useLocal));
DateFormat df; DateFormat df;
if (showMillis) { if (showMillis) {
df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
@ -444,7 +400,7 @@ public class PamCalendar {
else { else {
df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
} }
df.setTimeZone(tz); df.setTimeZone(getDisplayTimeZone(useLocal));
Date d = c.getTime(); Date d = c.getTime();
// return String.format("%tY-%<tm-%<td %<tH:%<tM:%<tS", d); // return String.format("%tY-%<tm-%<td %<tH:%<tM:%<tS", d);
@ -776,7 +732,6 @@ public class PamCalendar {
public static long msFromDateString(String dateString) { public static long msFromDateString(String dateString) {
return msFromDateString(dateString, false); return msFromDateString(dateString, false);
} }
/** /**
* Read a date string and turn it into a millisecond time. * Read a date string and turn it into a millisecond time.
* @param dateString * @param dateString

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class GlobalTimeParameters implements Serializable, Cloneable, ManagedParameters { public class GlobalTimeParameters implements Serializable, Cloneable, ManagedParameters {
@ -91,7 +92,7 @@ public class GlobalTimeParameters implements Serializable, Cloneable, ManagedPar
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -5,6 +5,7 @@ import java.util.TimeZone;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class TimeDisplayParameters implements Serializable, Cloneable, ManagedParameters { public class TimeDisplayParameters implements Serializable, Cloneable, ManagedParameters {
@ -34,7 +35,7 @@ public class TimeDisplayParameters implements Serializable, Cloneable, ManagedPa
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps; return ps;
} }

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class NMEATimeParameters implements Serializable, Cloneable, ManagedParameters { public class NMEATimeParameters implements Serializable, Cloneable, ManagedParameters {
@ -26,7 +27,7 @@ public class NMEATimeParameters implements Serializable, Cloneable, ManagedParam
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class NTPTimeParameters implements Serializable, Cloneable, ManagedParameters { public class NTPTimeParameters implements Serializable, Cloneable, ManagedParameters {
@ -32,7 +33,7 @@ public class NTPTimeParameters implements Serializable, Cloneable, ManagedParame
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -5,6 +5,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/** /**
* A series of functions for creating arrays of colours * A series of functions for creating arrays of colours
@ -410,7 +411,7 @@ public class ColourArray implements Cloneable, Serializable, ManagedParameters {
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps; return ps;
} }

View File

@ -265,6 +265,11 @@ public abstract class GeneralProjector<T extends PamCoordinate> {
JComponent toolTipComponent; JComponent toolTipComponent;
/**
* Gets an adapter that can provide tooltips automatically based on plotted data units.
* @param component
* @return
*/
public MouseHoverAdapter getMouseHoverAdapter(JComponent component) { public MouseHoverAdapter getMouseHoverAdapter(JComponent component) {
ToolTipManager tt = ToolTipManager.sharedInstance(); ToolTipManager tt = ToolTipManager.sharedInstance();
tt.registerComponent(component); tt.registerComponent(component);
@ -384,7 +389,9 @@ public abstract class GeneralProjector<T extends PamCoordinate> {
} }
String hintText = dataBlock.getHoverText(this, hoveredDataUnit, hoverData.get(unitIndex).getAmbiguity()); String hintText = dataBlock.getHoverText(this, hoveredDataUnit, hoverData.get(unitIndex).getAmbiguity());
if (hintText == null) return null; if (hintText == null) {
return null;
}
// System.out.println(hintText); // System.out.println(hintText);
return hintText; return hintText;
} }

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamUtils.PamUtils; import PamUtils.PamUtils;
import PamView.dialog.GroupedSourcePanel; import PamView.dialog.GroupedSourcePanel;
@ -210,7 +211,7 @@ public class GroupedSourceParameters implements Serializable, Cloneable, Managed
*/ */
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -7,6 +7,7 @@ import java.util.ArrayList;
import PamController.PamControlledUnit; import PamController.PamControlledUnit;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
/** /**
@ -55,7 +56,7 @@ public class GuiFrameSettings implements Serializable, Cloneable, ManagedParamet
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
try { try {
Field field = this.getClass().getDeclaredField("unitFrameInfo"); Field field = this.getClass().getDeclaredField("unitFrameInfo");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {
@ -89,7 +90,7 @@ public class GuiFrameSettings implements Serializable, Cloneable, ManagedParamet
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
try { try {
Field field = this.getClass().getDeclaredField("guiFrame"); Field field = this.getClass().getDeclaredField("guiFrame");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -61,6 +61,7 @@ import javax.swing.JMenuBar;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JRootPane;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.Timer; import javax.swing.Timer;
@ -73,6 +74,7 @@ import javax.swing.event.MenuListener;
import Acquisition.DaqSystemInterface; import Acquisition.DaqSystemInterface;
import annotation.tasks.AnnotationManager; import annotation.tasks.AnnotationManager;
import metadata.MetaDataContol;
import performanceTests.PerformanceDialog; import performanceTests.PerformanceDialog;
import tipOfTheDay.TipOfTheDayManager; import tipOfTheDay.TipOfTheDayManager;
import Array.ArrayManager; import Array.ArrayManager;
@ -761,6 +763,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
//for changing "hydrophones" to "microphone" and vice versa if medium changes. //for changing "hydrophones" to "microphone" and vice versa if medium changes.
menu.addMenuListener(new SettingsMenuListener()); menu.addMenuListener(new SettingsMenuListener());
menu.add(MetaDataContol.getMetaDataControl().createMenu(frame));
menu.addSeparator(); menu.addSeparator();
@ -1666,10 +1669,10 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
protected void getGuiParameters() { protected void getGuiParameters() {
guiParameters.extendedState = frame.getExtendedState(); guiParameters.extendedState = frame.getExtendedState();
guiParameters.state = frame.getState(); guiParameters.state = frame.getState();
if (guiParameters.state != Frame.MAXIMIZED_BOTH) { // if (guiParameters.state != Frame.MAXIMIZED_BOTH) {
guiParameters.size = frame.getSize(); guiParameters.size = frame.getSize();
guiParameters.bounds = frame.getBounds(); guiParameters.bounds = frame.getBounds();
} // }
} }
/** /**
@ -1984,6 +1987,30 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
public PamTabbedPane getTabbedPane() { public PamTabbedPane getTabbedPane() {
return this.mainTab; return this.mainTab;
} }
/**
* find a parent window for a JComponent. This can be useful in
* finding windows to open child dialogs when the object holding
* the component may not have a direct reference back to it's dialog.
* @param component any Swing component
* @return parent Window (or frame) if it can be found
*/
public static Window findComponentWindow(JComponent component) {
if (component == null) {
return null;
}
JRootPane root = component.getRootPane();
if (root == null) {
return null;
}
Container rootP = root.getParent();
if (rootP instanceof Window) {
return (Window) rootP;
}
else {
return null;
}
}
} }

View File

@ -38,6 +38,7 @@ import javax.swing.JPanel;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamView.PamColors.PamColor; import PamView.PamColors.PamColor;
import PamView.symbol.SymbolData; import PamView.symbol.SymbolData;
@ -808,7 +809,7 @@ public class PamSymbol extends PamSymbolBase implements Serializable, Icon, Clon
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps; return ps;
} }

View File

@ -48,6 +48,7 @@ public class WarnOnce implements PamSettings {
int ans = showWarning(parent, "Warning Messages", "Show all PAMGuard warning messages", WarnOnce.OK_CANCEL_OPTION); int ans = showWarning(parent, "Warning Messages", "Show all PAMGuard warning messages", WarnOnce.OK_CANCEL_OPTION);
if (ans == WarnOnce.CANCEL_OPTION) return; if (ans == WarnOnce.CANCEL_OPTION) return;
singleInstance.warnOnceList.clearList(); singleInstance.warnOnceList.clearList();
singleInstance.showThisSess.clear();
} }
@Override @Override

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class OverlayDataInfo implements Serializable, Cloneable, ManagedParameters { public class OverlayDataInfo implements Serializable, Cloneable, ManagedParameters {
@ -31,7 +32,7 @@ public class OverlayDataInfo implements Serializable, Cloneable, ManagedParamete
*/ */
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps; return ps;
} }

View File

@ -6,6 +6,7 @@ import java.util.Hashtable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataBlock;
@ -73,7 +74,7 @@ public class MarkDataSelectorParams implements Serializable, Cloneable, ManagedP
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
try { try {
Field field = this.getClass().getDeclaredField("overlayChoices"); Field field = this.getClass().getDeclaredField("overlayChoices");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -3,7 +3,11 @@ package PamView.symbol;
import java.io.Serializable; import java.io.Serializable;
import java.util.Hashtable; import java.util.Hashtable;
public class ManagedSymbolData implements Cloneable, Serializable { import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class ManagedSymbolData implements Cloneable, Serializable, ManagedParameters {
public static final long serialVersionUID = 1L; public static final long serialVersionUID = 1L;
@ -34,5 +38,10 @@ public class ManagedSymbolData implements Cloneable, Serializable {
return symbolOptions; return symbolOptions;
} }
@Override
public PamParameterSet getParameterSet() {
return PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
}
} }

View File

@ -0,0 +1,160 @@
package PamView.wizard;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JPanel;
import PamView.dialog.PamDialog;
import tethys.swing.export.ExportStreamInfoPanel;
import tethys.swing.export.ExportWizardCard;
abstract public class PamWizard extends PamDialog {
private static final long serialVersionUID = 1L;
private JPanel cardPanel;
private CardLayout cardLayout;
private JPanel mainPanel;
private JButton prevButton;
private ArrayList<PamWizardCard> wizardCards = new ArrayList();
public PamWizard(Window parentFrame, String title) {
super(parentFrame, title, false);
cardLayout = new CardLayout();
mainPanel = new JPanel(new BorderLayout());
cardPanel = new JPanel(cardLayout);
mainPanel.add(BorderLayout.CENTER, cardPanel);
setDialogComponent(mainPanel);
getOkButton().setText("Finish");
prevButton = new JButton("Previous");
getButtonPanel().add(prevButton, 0);
prevButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
previousButton();
}
});
setResizable(true);
}
public void addCard(PamWizardCard wizPanel) {
cardPanel.add(wizPanel, wizPanel.getTitle());
wizardCards.add(wizPanel);
}
/**
* Get the main panel. This is the main dialog panel and uses a borderlayout
* with the cards in the CENTER of the panel. Additional information panels
* (generally fixed and not changing with the dialog) can be added NORTH, SOUTH, WEST and EAST.
* @return main Panel.
*/
public JPanel getMainPanel() {
return mainPanel;
}
/**
* Called when 'previous' button is clicked.
*/
protected void previousButton() {
cardLayout.previous(cardPanel);
enableControls();
}
public void enableControls() {
int iCard = getCardIndex();
prevButton.setEnabled(iCard > 0);
boolean isLast = iCard == wizardCards.size()-1;
// getOkButton().setEnabled(!isLast);
getOkButton().setText(isLast ? "Finish" : "Next");
}
private boolean checkCurrentCard() {
int iCard = getCardIndex();
if (iCard < 0) {
return true;
}
return getCardParams(wizardCards.get(iCard));
}
abstract public void setCardParams(PamWizardCard wizardCard);
abstract public boolean getCardParams(PamWizardCard wizardCard);
public int getCardIndex() {
for (int i = 0; i < cardPanel.getComponentCount(); i++) {
Component component = cardPanel.getComponent(i);
if (component.isVisible()) {
return i;
}
}
return -1;
}
public JButton getPreviousButton() {
return prevButton;
}
public void setParams() {
for (PamWizardCard wizCard : wizardCards) {
setCardParams(wizCard);
}
enableControls();
}
@Override
public boolean getParams() {
/**
* This is the OK button, so we need to NOT return OK, which would close the
* dialog until we're on the last card.
*/
if (checkCurrentCard() == false) {
return false;
}
int iCard = getCardIndex();
if (iCard < wizardCards.size()-1) {
cardLayout.next(cardPanel);
enableControls();
return false;
}
return true;
}
@Override
public void restoreDefaultSettings() {
// TODO Auto-generated method stub
}
/**
* Move to the first card in the stack
*/
public void moveFirst() {
cardLayout.first(cardPanel);
}
/**
* Move to the last card in the stack
*/
public void moveLast() {
cardLayout.last(cardPanel);
}
}

View File

@ -0,0 +1,45 @@
package PamView.wizard;
import java.io.Serializable;
import javax.swing.JPanel;
/**
* Base class for PAMGuard wizard cards.
* @author dg50
*
* @param <T> class type for parameters to set and get.
*/
abstract public class PamWizardCard<T extends Object> extends JPanel {
private static final long serialVersionUID = 1L;
private String title;
private PamWizard pamWizard;
/**
* @param title
*/
public PamWizardCard(PamWizard pamWizard, String title) {
this.pamWizard = pamWizard;
this.title = title;
}
public abstract boolean getParams(T cardParams);
public abstract void setParams(T cardParams);
public String getTitle() {
return title;
}
/**
* @return the pamWizard
*/
public PamWizard getPamWizard() {
return pamWizard;
}
}

View File

@ -0,0 +1,29 @@
package PamguardMVC;
/**
* @author dg50
* Levels of automation for the various datas in PAMGuard.
* Should be used within DataAutomationInfo to perhaps combine with other info in the future.
*
*/
public enum DataAutomation {
AUTOMATIC, MANUAL, MANUALANDAUTOMATIC;
@Override
public String toString() {
switch (this) {
case AUTOMATIC:
return "Automatic";
case MANUAL:
return "Manual";
case MANUALANDAUTOMATIC:
return "Manual and automatic";
default:
break;
}
return null;
}
}

View File

@ -0,0 +1,44 @@
package PamguardMVC;
/**
* Returned by datablocks, though default is null, to give information on how
* automatic the process was.
* @author dg50
*
*/
public class DataAutomationInfo {
private DataAutomation automation;
/**
* @param automation
*/
public DataAutomationInfo(DataAutomation automation) {
this.setAutomation(automation);
}
/**
* @return the automation
*/
public DataAutomation getAutomation() {
return automation;
}
/**
* @param automation the automation to set
*/
public void setAutomation(DataAutomation automation) {
this.automation = automation;
}
@Override
public String toString() {
if (automation == null) {
return "Unknown data automation";
}
return automation.toString();
}
}

View File

@ -50,8 +50,10 @@ import org.w3c.dom.Element;
import Acquisition.AcquisitionControl; import Acquisition.AcquisitionControl;
import Acquisition.AcquisitionProcess; import Acquisition.AcquisitionProcess;
import pamScrollSystem.ViewLoadObserver; import pamScrollSystem.ViewLoadObserver;
import tethys.TethysControl;
import tethys.pamdata.AutoTethysProvider; import tethys.pamdata.AutoTethysProvider;
import tethys.pamdata.TethysDataProvider; import tethys.pamdata.TethysDataProvider;
import tethys.species.DataBlockSpeciesManager;
import dataGram.DatagramProvider; import dataGram.DatagramProvider;
import dataMap.BespokeDataMapGraphic; import dataMap.BespokeDataMapGraphic;
import dataMap.OfflineDataMap; import dataMap.OfflineDataMap;
@ -74,8 +76,10 @@ import PamguardMVC.background.BackgroundDataBlock;
import PamguardMVC.background.BackgroundManager; import PamguardMVC.background.BackgroundManager;
import PamguardMVC.dataOffline.OfflineDataLoadInfo; import PamguardMVC.dataOffline.OfflineDataLoadInfo;
import PamguardMVC.dataOffline.OfflineDataLoading; import PamguardMVC.dataOffline.OfflineDataLoading;
import PamguardMVC.dataSelector.DataSelectParams;
import PamguardMVC.dataSelector.DataSelector; import PamguardMVC.dataSelector.DataSelector;
import PamguardMVC.dataSelector.DataSelectorCreator; import PamguardMVC.dataSelector.DataSelectorCreator;
import PamguardMVC.dataSelector.DataSelectorSettings;
import PamguardMVC.dataSelector.NullDataSelectorCreator; import PamguardMVC.dataSelector.NullDataSelectorCreator;
import PamguardMVC.datamenus.DataMenuParent; import PamguardMVC.datamenus.DataMenuParent;
import PamguardMVC.nanotime.NanoTimeCalculator; import PamguardMVC.nanotime.NanoTimeCalculator;
@ -2838,7 +2842,7 @@ public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable {
* @return temporary copy of the data * @return temporary copy of the data
*/ */
public ArrayList<Tunit> getDataCopy(long t1, long t2, boolean assumeOrder, DataSelector dataSelector) { public ArrayList<Tunit> getDataCopy(long t1, long t2, boolean assumeOrder, DataSelector dataSelector) {
if (dataSelector == null) { if (dataSelector == null || dataSelector.getParams().getCombinationFlag() == DataSelectParams.DATA_SELECT_DISABLE) {
return getDataCopy(t1, t2, assumeOrder); return getDataCopy(t1, t2, assumeOrder);
} }
else { else {
@ -2868,8 +2872,6 @@ public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable {
private Vector<OfflineDataMap> offlineDataMaps = null; private Vector<OfflineDataMap> offlineDataMaps = null;
private SQLLogging logging; private SQLLogging logging;
private TethysDataProvider tethysDataProvider;
private JSONObjectDataSource jsonDataSource; private JSONObjectDataSource jsonDataSource;
@ -3085,22 +3087,30 @@ public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable {
/** /**
* Gets a data provider for Tethys. These will probably need * Gets a data provider for Tethys. These will probably need
* to be bespoke, but for now will autogenerate based on the SALLogging information. * to be bespoke, but for now will autogenerate based on the SQLLogging information.
* @return the tethysDataProvider * @return the tethysDataProvider
*/ */
public TethysDataProvider getTethysDataProvider() { public TethysDataProvider getTethysDataProvider(TethysControl tethysControl) {
if (tethysDataProvider == null && PamDetection.class.isAssignableFrom(unitClass) && getLogging() != null) { return null;
tethysDataProvider = new AutoTethysProvider(this);
}
return tethysDataProvider;
} }
/** /**
* Set a data provider for Tethys. * Get the level of automation employed by the generation of these data.
* @param tethysDataProvider the tethysDataProvider to set * Should ideally be completed for everything providing data to Tethys.
* @return level of automation for this data block.
*/ */
public void setTethysDataProvider(TethysDataProvider tethysDataProvider) { public DataAutomationInfo getDataAutomationInfo() {
this.tethysDataProvider = tethysDataProvider; return null;
}
/**
* Get information about species types that may occur within this data
* block. Primarily for conversion into Tethys compatible data, but may
* prove to have other uses.
* @return Types of species information available within this datablock.
*/
public DataBlockSpeciesManager<Tunit> getDatablockSpeciesManager() {
return null;
} }
final public boolean getCanLog() { final public boolean getCanLog() {

View File

@ -974,8 +974,13 @@ abstract public class PamDataUnit<T extends PamDataUnit, U extends PamDataUnit>
// add frequency and amplitude information // add frequency and amplitude information
str += "Frequency: " + FrequencyFormat.formatFrequencyRange(this.getFrequency(), true) + "<br>"; double[] frequency = this.getFrequency();
str += String.format("Amplitude: %3.1fdB<br>", getAmplitudeDB()); if (frequency != null) {
str += "Frequency: " + FrequencyFormat.formatFrequencyRange(this.getFrequency(), true) + "<br>";
}
if (getAmplitudeDB() != 0) {
str += String.format("Amplitude: %3.1fdB<br>", getAmplitudeDB());
}
if (getSignalSPL() != null) { if (getSignalSPL() != null) {
str += String.format("SPL: %3.1fdBre1uPa<br>",linAmplitudeToDB(getSignalSPL())); str += String.format("SPL: %3.1fdBre1uPa<br>",linAmplitudeToDB(getSignalSPL()));
} }

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class RawDataDisplayOptions implements Serializable, Cloneable, ManagedParameters { public class RawDataDisplayOptions implements Serializable, Cloneable, ManagedParameters {
@ -13,7 +14,7 @@ public class RawDataDisplayOptions implements Serializable, Cloneable, ManagedPa
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
return ps; return ps;
} }

View File

@ -61,7 +61,7 @@ public class RawDataUnavailableException extends Exception {
return String.format("Samples %d length %d requested from %s have not yet arrived", return String.format("Samples %d length %d requested from %s have not yet arrived",
startSample, duration, rawDataBlock.getDataName()); startSample, duration, rawDataBlock.getDataName());
case INVALID_CHANNEL_LIST: case INVALID_CHANNEL_LIST:
return String.format("Samples %d length %d requested from %s do not contain the reqeusted channels %s", return String.format("Samples %d length %d requested from %s do not contain the reqeusted channels",
startSample, duration, rawDataBlock.getDataName()); startSample, duration, rawDataBlock.getDataName());
case NEGATIVE_DURATION: case NEGATIVE_DURATION:
return String.format("Negative data duration request for %d samples" , duration); return String.format("Negative data duration request for %d samples" , duration);

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import gpl.GPLParameters; import gpl.GPLParameters;
/** /**
@ -44,7 +45,7 @@ public class PamBlockParams implements Cloneable, Serializable, ManagedParameter
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/** /**
* Data select parameters. * Data select parameters.
@ -53,7 +54,7 @@ abstract public class DataSelectParams implements Serializable, ManagedParameter
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -9,7 +9,10 @@ import javax.swing.ImageIcon;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
import org.w3c.dom.Document;
import PamController.PamController; import PamController.PamController;
import PamController.settings.output.xml.PamguardXMLWriter;
import PamView.dialog.PamDialogPanel; import PamView.dialog.PamDialogPanel;
import PamView.dialog.SettingsButton; import PamView.dialog.SettingsButton;
import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataBlock;
@ -39,7 +42,7 @@ public abstract class DataSelector {
private String selectorTitle; private String selectorTitle;
private boolean allowScores; private boolean allowScores;
/** /**
* Create a data selector for a DataBlock. If allowScores is * Create a data selector for a DataBlock. If allowScores is
* true, then the selector MAY (but may not) offer a more complicated * true, then the selector MAY (but may not) offer a more complicated
@ -104,18 +107,8 @@ public abstract class DataSelector {
if (parentFrame == null) { if (parentFrame == null) {
parentFrame = PamController.getMainFrame(); parentFrame = PamController.getMainFrame();
} }
Window localWin = parentFrame;
DataSelectorChangeListener localChangeListener = changeListener;
JMenuItem menuItem = new JMenuItem("Data selection ..."); JMenuItem menuItem = new JMenuItem("Data selection ...");
menuItem.addActionListener(new ActionListener() { menuItem.addActionListener(new ShowSettingsButton(parentFrame, changeListener));
@Override
public void actionPerformed(ActionEvent e) {
boolean ok = showSelectDialog(localWin);
if (ok && changeListener != null) {
changeListener.selectorChange(DataSelector.this);
}
}
});
return menuItem; return menuItem;
} }
@ -129,6 +122,24 @@ public abstract class DataSelector {
return ok; return ok;
} }
/**
* Get descriptive text about the data selector which can be
* added to dialogs and other information panels.
* @return descriptive text. Default is a xml dump of params.
*/
public String getDescription() {
if (getParams() == null) {
return null;
}
PamguardXMLWriter xmlWriter = PamguardXMLWriter.getXMLWriter();
Document doc = xmlWriter.writeOneObject(getParams());
if (doc != null) {
String str = xmlWriter.getAsString(doc, true);
return str;
}
return null;
}
/** /**
* Score a PAMDataUnit. this is used in preference * Score a PAMDataUnit. this is used in preference
* to a boolean select function so that the user can add different * to a boolean select function so that the user can add different
@ -228,25 +239,40 @@ public abstract class DataSelector {
* @param parentWindow * @param parentWindow
*/ */
public JButton getDialogButton(Window parentWindow) { public JButton getDialogButton(Window parentWindow) {
return getDialogButton(parentWindow, null);
}
/**
* Create a settings type button that can be inserted into a
* larger dialog.
* @param parentWindow
*/
public JButton getDialogButton(Window parentWindow, DataSelectorChangeListener changeListener) {
JButton button = new SettingsButton(); JButton button = new SettingsButton();
button.addActionListener(new ShowSettingsButton(parentWindow)); button.addActionListener(new ShowSettingsButton(parentWindow, changeListener));
button.setToolTipText("Data selection options for " + getSelectorTitle()); button.setToolTipText("Data selection options for " + getSelectorTitle());
return button; return button;
} }
private class ShowSettingsButton implements ActionListener { private class ShowSettingsButton implements ActionListener {
private Window parentWindow; private Window parentWindow;
private DataSelectorChangeListener changeListener;
/** /**
* @param parentWindow * @param parentWindow
* @param changeListener
*/ */
public ShowSettingsButton(Window parentWindow) { public ShowSettingsButton(Window parentWindow, DataSelectorChangeListener changeListener) {
super(); super();
this.parentWindow = parentWindow; this.parentWindow = parentWindow;
this.changeListener = changeListener;
} }
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showSelectDialog(parentWindow); boolean ok = showSelectDialog(parentWindow);
if (ok && changeListener != null) {
changeListener.selectorChange(DataSelector.this);
}
} }
} }

View File

@ -7,6 +7,7 @@ import java.util.Hashtable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class DataSelectorSettings implements Serializable, ManagedParameters { public class DataSelectorSettings implements Serializable, ManagedParameters {
@ -42,7 +43,7 @@ public class DataSelectorSettings implements Serializable, ManagedParameters {
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try { try {
Field field = this.getClass().getDeclaredField("selectorParams"); Field field = this.getClass().getDeclaredField("selectorParams");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -7,6 +7,7 @@ import java.util.Hashtable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class DataKeeperSettings implements Serializable, Cloneable, ManagedParameters { public class DataKeeperSettings implements Serializable, Cloneable, ManagedParameters {
@ -51,7 +52,7 @@ public class DataKeeperSettings implements Serializable, Cloneable, ManagedParam
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try { try {
Field field = this.getClass().getDeclaredField("keepTimeData"); Field field = this.getClass().getDeclaredField("keepTimeData");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -6,6 +6,7 @@ import Localiser.DelayMeasurementParams;
import Localiser.controls.RawOrFFTParams; import Localiser.controls.RawOrFFTParams;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/** /**
* General parameters for detection TOAD measurement. Is split * General parameters for detection TOAD measurement. Is split
@ -67,7 +68,7 @@ public class GenericTOADSourceParams implements Cloneable, Serializable, Managed
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -218,7 +218,7 @@ public class RWEBinaryDataSource extends BinaryDataSource {
binaryObjectData.getDataUnitBaseData().setSampleDuration(duration); binaryObjectData.getDataUnitBaseData().setSampleDuration(duration);
// rweDataUnit = new RWEDataUnit(aSound.timeMilliseconds, channelMap, // rweDataUnit = new RWEDataUnit(aSound.timeMilliseconds, channelMap,
// startSample, duration, aSound); // startSample, duration, aSound);
rweDataUnit = new RWEDataUnit(binaryObjectData.getDataUnitBaseData(), aSound); rweDataUnit = new RWEDataUnit(rweProcess, binaryObjectData.getDataUnitBaseData(), aSound);
rweDataUnit.setSequenceBitmap(sequenceMap); rweDataUnit.setSequenceBitmap(sequenceMap);
double f[] = new double[2]; double f[] = new double[2];
f[0] = aSound.minFreq * rweDataBlock.getSampleRate()/rweDataBlock.getFftLength(); f[0] = aSound.minFreq * rweDataBlock.getSampleRate()/rweDataBlock.getFftLength();

View File

@ -2,19 +2,29 @@ package RightWhaleEdgeDetector;
import PamView.GroupedDataSource; import PamView.GroupedDataSource;
import PamView.GroupedSourceParameters; import PamView.GroupedSourceParameters;
import PamguardMVC.DataAutomation;
import PamguardMVC.DataAutomationInfo;
import PamguardMVC.PamProcess; import PamguardMVC.PamProcess;
import PamguardMVC.dataOffline.OfflineDataLoadInfo; import PamguardMVC.dataOffline.OfflineDataLoadInfo;
import PamguardMVC.dataSelector.DataSelectorCreator; import PamguardMVC.dataSelector.DataSelectorCreator;
import RightWhaleEdgeDetector.datasel.RWDataSelCreator; import RightWhaleEdgeDetector.datasel.RWDataSelCreator;
import RightWhaleEdgeDetector.species.RWSpeciesManager;
import RightWhaleEdgeDetector.species.RWTethysDataProvider;
import pamScrollSystem.ViewLoadObserver; import pamScrollSystem.ViewLoadObserver;
import tethys.TethysControl;
import tethys.pamdata.TethysDataProvider;
import tethys.species.DataBlockSpeciesManager;
import whistlesAndMoans.AbstractWhistleDataBlock; import whistlesAndMoans.AbstractWhistleDataBlock;
public class RWEDataBlock extends AbstractWhistleDataBlock implements GroupedDataSource { public class RWEDataBlock extends AbstractWhistleDataBlock<RWEDataUnit> implements GroupedDataSource {
private double[] rwFreqRange = {50., 250.}; private double[] rwFreqRange = {50., 250.};
private RWEControl rweControl; private RWEControl rweControl;
private RWEProcess rweProcess; private RWEProcess rweProcess;
private RWDataSelCreator dataSelCreator; private RWDataSelCreator dataSelCreator;
private RWSpeciesManager rwSpeciesManager;
private RWTethysDataProvider rwTethysDataProvider;
public RWEDataBlock(RWEControl rweControl, String dataName, public RWEDataBlock(RWEControl rweControl, String dataName,
RWEProcess rweProcess, int channelMap) { RWEProcess rweProcess, int channelMap) {
@ -53,4 +63,25 @@ public class RWEDataBlock extends AbstractWhistleDataBlock implements GroupedDat
return dataSelCreator; return dataSelCreator;
} }
@Override
public DataBlockSpeciesManager<RWEDataUnit> getDatablockSpeciesManager() {
if (rwSpeciesManager == null) {
rwSpeciesManager = new RWSpeciesManager(this);
}
return rwSpeciesManager;
}
@Override
public TethysDataProvider getTethysDataProvider(TethysControl tethysControl) {
if (rwTethysDataProvider == null) {
rwTethysDataProvider = new RWTethysDataProvider(tethysControl, rweProcess.getRweDataBlock());
}
return rwTethysDataProvider;
}
@Override
public DataAutomationInfo getDataAutomationInfo() {
return new DataAutomationInfo(DataAutomation.AUTOMATIC);
}
} }

View File

@ -6,26 +6,31 @@ import whistlesAndMoans.AbstractWhistleDataUnit;
public class RWEDataUnit extends AbstractWhistleDataUnit { public class RWEDataUnit extends AbstractWhistleDataUnit {
public RWESound rweSound; public RWESound rweSound;
private RWEProcess rweProcess;
public RWEDataUnit(long timeMilliseconds, int channelBitmap, public RWEDataUnit(RWEProcess rweProcess, long timeMilliseconds, int channelBitmap,
long startSample, long duration, RWESound rweSound) { long startSample, long duration, RWESound rweSound) {
super(timeMilliseconds, channelBitmap, startSample, duration); super(timeMilliseconds, channelBitmap, startSample, duration);
this.rweSound = rweSound; this.rweSound = rweSound;
this.rweProcess = rweProcess;
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
public RWEDataUnit(DataUnitBaseData basicData, RWESound rweSound) { public RWEDataUnit(RWEProcess rweProcess, DataUnitBaseData basicData, RWESound rweSound) {
super(basicData); super(basicData);
this.rweSound = rweSound; this.rweSound = rweSound;
this.rweProcess = rweProcess;
} }
double[] freqsHz;
@Override @Override
public double[] getFreqsHz() { public double[] getFreqsHz() {
if (freqsHz == null) { double[] f = new double[rweSound.sliceCount];
freqsHz = new double[rweSound.sliceCount]; RWEDataBlock rweDataBlock = rweProcess.getRweDataBlock();
double binToHz = rweDataBlock.getSampleRate() / rweDataBlock.getFftLength();
for (int i = 0; i < f.length; i++) {
f[i] = (double) rweSound.peakFreq[i] * binToHz;
} }
return null; return f;
} }
@Override @Override
@ -35,8 +40,16 @@ public class RWEDataUnit extends AbstractWhistleDataUnit {
@Override @Override
public double[] getTimesInSeconds() { public double[] getTimesInSeconds() {
// TODO Auto-generated method stub if (rweSound == null) {
return null; return null;
}
double[] t = new double[rweSound.sliceCount];
RWEDataBlock rweDataBlock = rweProcess.getRweDataBlock();
double binToT = rweDataBlock.getFftHop() / rweDataBlock.getSampleRate();
for (int i = 0; i < t.length; i++) {
t[i] = (double) rweSound.sliceList[i] * binToT;
}
return t;
} }
@Override @Override

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
public class RWEParameters implements Serializable, Cloneable, ManagedParameters { public class RWEParameters implements Serializable, Cloneable, ManagedParameters {
@ -41,7 +42,7 @@ public class RWEParameters implements Serializable, Cloneable, ManagedParameters
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps; return ps;
} }

View File

@ -42,6 +42,10 @@ public class RWEProcess extends PamProcess {
private FFTDataBlock sourceDataBlock; private FFTDataBlock sourceDataBlock;
private RWEDataBlock rweDataBlock; private RWEDataBlock rweDataBlock;
public RWEDataBlock getRweDataBlock() {
return rweDataBlock;
}
private Hashtable<Integer, BearingLocaliser> bearingLocalisers; private Hashtable<Integer, BearingLocaliser> bearingLocalisers;
private StandardSymbolManager symbolManager; private StandardSymbolManager symbolManager;
/** /**
@ -212,7 +216,7 @@ public class RWEProcess extends PamProcess {
// System.out.println(String.format("Detected sound type %d on channel %d", // System.out.println(String.format("Detected sound type %d on channel %d",
// soundType, this.iChannel)); // soundType, this.iChannel));
duration = sourceDataBlock.getFftHop() * aSound.duration; duration = sourceDataBlock.getFftHop() * aSound.duration;
rweDataUnit = new RWEDataUnit(aSound.timeMilliseconds, rweDataUnit = new RWEDataUnit(RWEProcess.this, aSound.timeMilliseconds,
1<<iChannel, fftDataUnit.getStartSample()-duration, duration, aSound); 1<<iChannel, fftDataUnit.getStartSample()-duration, duration, aSound);
rweDataUnit.sortOutputMaps(sourceDataBlock.getChannelMap(), sourceDataBlock.getSequenceMapObject(), 1<<iChannel); rweDataUnit.sortOutputMaps(sourceDataBlock.getChannelMap(), sourceDataBlock.getSequenceMapObject(), 1<<iChannel);
f[0] = aSound.minFreq * getSampleRate()/sourceDataBlock.getFftLength(); f[0] = aSound.minFreq * getSampleRate()/sourceDataBlock.getFftLength();

View File

@ -0,0 +1,28 @@
package RightWhaleEdgeDetector.species;
import PamguardMVC.PamDataBlock;
import RightWhaleEdgeDetector.RWEDataUnit;
import tethys.species.DataBlockSpeciesManager;
import tethys.species.DataBlockSpeciesCodes;
import tethys.species.SpeciesMapItem;
public class RWSpeciesManager extends DataBlockSpeciesManager<RWEDataUnit> {
private RWSpeciesTypes rwSpeciesTypes = new RWSpeciesTypes();
public RWSpeciesManager(PamDataBlock<RWEDataUnit> dataBlock) {
super(dataBlock);
setDefaultDefaultSpecies(new SpeciesMapItem(RWSpeciesTypes.eubalaena, RWSpeciesTypes.onlyType, RWSpeciesTypes.defaultName));
}
@Override
public DataBlockSpeciesCodes getSpeciesCodes() {
return null;
}
@Override
public String getSpeciesCode(RWEDataUnit dataUnit) {
return RWSpeciesTypes.defaultName;
}
}

View File

@ -0,0 +1,17 @@
package RightWhaleEdgeDetector.species;
import tethys.species.DataBlockSpeciesCodes;
public class RWSpeciesTypes extends DataBlockSpeciesCodes {
public static final String onlyType = "Up call";
public static final int eubalaena = 180536;
public static final String defaultName = "Right Whale";
public RWSpeciesTypes() {
super(eubalaena, defaultName, onlyType);
}
}

View File

@ -0,0 +1,37 @@
package RightWhaleEdgeDetector.species;
import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit;
import RightWhaleEdgeDetector.RWEDataUnit;
import nilus.Detection;
import nilus.Detection.Parameters;
import tethys.TethysControl;
import tethys.output.StreamExportParams;
import tethys.output.TethysExportParams;
import tethys.pamdata.AutoTethysProvider;
public class RWTethysDataProvider extends AutoTethysProvider {
public RWTethysDataProvider(TethysControl tethysControl, PamDataBlock pamDataBlock) {
super(tethysControl, pamDataBlock);
}
@Override
public Detection createDetection(PamDataUnit dataUnit, TethysExportParams tethysExportParams,
StreamExportParams streamExportParams) {
Detection detection = super.createDetection(dataUnit, tethysExportParams, streamExportParams);
if (detection == null) {
return null;
}
RWEDataUnit rweDataUnit = (RWEDataUnit) dataUnit;
Parameters parameters = detection.getParameters();
parameters.setScore((double) rweDataUnit.rweSound.soundType);
double snr = 20.*Math.log10(rweDataUnit.rweSound.signal/rweDataUnit.rweSound.noise);
parameters.setSNRDB(snr);
return detection;
}
}

View File

@ -16,6 +16,7 @@ import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterData; import PamModel.parametermanager.PamParameterData;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamUtils.PamUtils; import PamUtils.PamUtils;
import PamguardMVC.PamRawDataBlock; import PamguardMVC.PamRawDataBlock;
import SoundRecorder.trigger.RecorderTrigger; import SoundRecorder.trigger.RecorderTrigger;
@ -443,7 +444,7 @@ public class RecorderSettings implements Serializable, Cloneable, ManagedParamet
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try { try {
Field field = this.getClass().getDeclaredField("channelBitmap"); Field field = this.getClass().getDeclaredField("channelBitmap");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -6,6 +6,7 @@ import java.lang.reflect.Field;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/** /**
* Information for triggered recordings to tell each recorder how long * Information for triggered recordings to tell each recorder how long
@ -271,7 +272,7 @@ public class RecorderTriggerData implements Serializable, Cloneable, ManagedPara
*/ */
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try { try {
Field field = this.getClass().getDeclaredField("lastTriggerStart"); Field field = this.getClass().getDeclaredField("lastTriggerStart");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

View File

@ -1642,6 +1642,9 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett
return; return;
} }
long t1 = dataUnit.getTimeMilliseconds()-viewerScroller.getValueMillis(); long t1 = dataUnit.getTimeMilliseconds()-viewerScroller.getValueMillis();
if (timeAxis == null) {
return;
}
int x1 = (int) Math.floor(timeAxis.getPosition(t1/1000)); int x1 = (int) Math.floor(timeAxis.getPosition(t1/1000));
int x2 = x1; int x2 = x1;
if (dataUnit.getDurationInMilliseconds() != null) { if (dataUnit.getDurationInMilliseconds() != null) {

View File

@ -136,7 +136,9 @@ public class UserInputLogger extends SQLLogging {
if (dataUnit != null && dataUnit.getDatabaseIndex() != databaseIndex) { if (dataUnit != null && dataUnit.getDatabaseIndex() != databaseIndex) {
dataUnit.setDatabaseIndex(databaseIndex); dataUnit.setDatabaseIndex(databaseIndex);
dataUnit.setUserString(dataUnit.getUserString() + " " + txt); dataUnit.setUserString(dataUnit.getUserString() + " " + txt);
getPamDataBlock().updatePamData(dataUnit, timeMilliseconds); // don't call this next line, it causes the unit to get relogged.
// getPamDataBlock().updatePamData(dataUnit, timeMilliseconds);
dataUnit.clearUpdateCount();
} }
else { else {
dataUnit = new UserInputDataUnit(timeMilliseconds, txt); dataUnit = new UserInputDataUnit(timeMilliseconds, txt);

View File

@ -6,6 +6,7 @@ import java.lang.reflect.Field;
import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PrivatePamParameterData;
public class AlarmParameters implements Serializable, Cloneable, ManagedParameters { public class AlarmParameters implements Serializable, Cloneable, ManagedParameters {
@ -103,7 +104,7 @@ public class AlarmParameters implements Serializable, Cloneable, ManagedParamete
@Override @Override
public PamParameterSet getParameterSet() { public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this); PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY);
try { try {
Field field = this.getClass().getDeclaredField("hadHold"); Field field = this.getClass().getDeclaredField("hadHold");
ps.put(new PrivatePamParameterData(this, field) { ps.put(new PrivatePamParameterData(this, field) {

Some files were not shown because too many files have changed in this diff Show More