mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-25 16:42:27 +00:00
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
commit
8bad89ecfa
@ -1,7 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
|
21
buildconfigurations/Build PAMGuard DG.launch
Normal file
21
buildconfigurations/Build PAMGuard DG.launch
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
|
||||
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
|
||||
<stringAttribute key="M2_GOALS" value="package shade:shade"/>
|
||||
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
|
||||
<booleanAttribute key="M2_OFFLINE" value="false"/>
|
||||
<stringAttribute key="M2_PROFILES" value=""/>
|
||||
<listAttribute key="M2_PROPERTIES"/>
|
||||
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
|
||||
<booleanAttribute key="M2_SKIP_TESTS" value="true"/>
|
||||
<intAttribute key="M2_THREADS" value="1"/>
|
||||
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
|
||||
<stringAttribute key="M2_USER_SETTINGS" value=""/>
|
||||
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-13/"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-mx6000m -Djava.library.path=lib64"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/PamGuard Main DG}"/>
|
||||
</launchConfiguration>
|
@ -4,7 +4,7 @@
|
||||
<groupId>org.pamguard</groupId>
|
||||
<artifactId>Pamguard</artifactId>
|
||||
<name>Pamguard Java12+</name>
|
||||
<version>2.02.03</version>
|
||||
<version>2.02.04a</version>
|
||||
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
|
||||
<url>www.pamguard.org</url>
|
||||
<organization>
|
||||
|
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.pamguard</groupId>
|
||||
<artifactId>Pamguard</artifactId>
|
||||
<version>2.02.03</version>
|
||||
<version>2.02.04a</version>
|
||||
<name>Pamguard Java12+</name>
|
||||
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
|
||||
<url>www.pamguard.org</url>
|
||||
|
@ -27,6 +27,7 @@ import Acquisition.layoutFX.AcquisitionPaneFX;
|
||||
import Acquisition.layoutFX.DAQSettingsPane;
|
||||
import Acquisition.layoutFX.FolderInputPane;
|
||||
import javafx.application.Platform;
|
||||
import pamguard.GlobalArguments;
|
||||
import Acquisition.pamAudio.PamAudioSystem;
|
||||
import PamController.PamControlledUnitSettings;
|
||||
import PamController.PamController;
|
||||
@ -77,6 +78,8 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings{
|
||||
protected long eta = -1;
|
||||
|
||||
private FolderInputParameters folderInputParameters;
|
||||
|
||||
public static final String GlobalWavFolderArg = "wavfilefolder";
|
||||
|
||||
|
||||
/**
|
||||
@ -110,12 +113,30 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings{
|
||||
if (folderInputParameters == null)
|
||||
setFolderInputParameters(new FolderInputParameters(getSystemType()));
|
||||
// PamSettingManager.getInstance().registerSettings(this); //calling super already registers this in the FileInputSystem constructor
|
||||
checkComandLine();
|
||||
makeSelFileList();
|
||||
newFileTimer = new Timer(1000, new RestartTimer());
|
||||
newFileTimer.setRepeats(false);
|
||||
// timer = new Timer(1000, new TimerAction());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if acquisition source folder was set in the command line.
|
||||
*/
|
||||
private void checkComandLine() {
|
||||
String globalFolder = GlobalArguments.getParam(GlobalWavFolderArg);
|
||||
if (globalFolder == null) {
|
||||
return;
|
||||
}
|
||||
// see if it at least exists, though will we want to do this for Network folders ?
|
||||
File aFile = new File(globalFolder);
|
||||
if (aFile.exists() == false) {
|
||||
System.err.println("Command line folder does not exist: " + globalFolder);
|
||||
}
|
||||
String[] selList = {globalFolder};
|
||||
folderInputParameters.setSelectedFiles(selList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restarts after a file has ended when processing multiple files.
|
||||
* 27 Jan 2011 - this now reschedules in the AWT thread
|
||||
|
@ -249,6 +249,18 @@ public class StandardFileDate implements FileDate, PamSettings {
|
||||
String name = file.getName();
|
||||
name = removeWildChars(name, forcedDateFormat);
|
||||
String redFormat = forcedDateFormat.replace("#", "");
|
||||
// see if it's only all milliseconds, i.e. format is only 'S's and > 12 of them
|
||||
if (allSSSS(redFormat)) {
|
||||
// try pulling a number from the name.
|
||||
try {
|
||||
long millis = Long.valueOf(name);
|
||||
return millis;
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
SimpleDateFormat sdf = null;
|
||||
try {
|
||||
sdf = new SimpleDateFormat(redFormat);
|
||||
@ -271,6 +283,15 @@ public class StandardFileDate implements FileDate, PamSettings {
|
||||
return d.getTime();
|
||||
}
|
||||
|
||||
private boolean allSSSS(String redFormat) {
|
||||
for(int i = 0; i < redFormat.length(); i++) {
|
||||
if (redFormat.charAt(i) != 'S') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private String removeWildChars(String name, String forcedDateFormat) {
|
||||
// # is the wild field i s#
|
||||
if (name == null || forcedDateFormat == null) {
|
||||
|
@ -380,6 +380,10 @@ abstract public class IshLocProcess extends PamProcess implements SpectrogramMar
|
||||
} else {
|
||||
newTime = oldTime*2;
|
||||
}
|
||||
/*
|
||||
* Above causes same error as in Rocca and needs fixing
|
||||
*/
|
||||
newTime = Math.min(newTime, 600000); // don't let this exceed 10 minutes.
|
||||
// System.out.println("Adjusting raw data natural lifetime from " + oldTime + " ms to " + newTime + " ms");
|
||||
daqBlock.setNaturalLifetimeMillis(newTime); // increase the lifetime to try and prevent this from happening again
|
||||
return;
|
||||
|
@ -31,12 +31,12 @@ public class PamguardVersionInfo {
|
||||
* Version number, major version.minorversion.sub-release.
|
||||
* Note: can't go higher than sub-release 'f'
|
||||
*/
|
||||
static public final String version = "2.02.03";
|
||||
static public final String version = "2.02.04a";
|
||||
|
||||
/**
|
||||
* Release date
|
||||
*/
|
||||
static public final String date = "8 February 2022";
|
||||
static public final String date = "23 June 2022";
|
||||
|
||||
// /**
|
||||
// * Release type - Beta or Core
|
||||
|
@ -20,12 +20,22 @@ public class PamDependency {
|
||||
|
||||
private String dataBlockName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param requiredDataType Class of Data unit
|
||||
* @param defaultProvider Class name of default provider.
|
||||
* @param dataBlockName Specific data block name
|
||||
*/
|
||||
public PamDependency(Class requiredDataType, String defaultProvider, String dataBlockName) {
|
||||
this.requiredDataType = requiredDataType;
|
||||
this.defaultProvider = defaultProvider;
|
||||
this.dataBlockName = dataBlockName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param requiredDataType Class of Data unit
|
||||
* @param defaultProvider Class name of default provider.
|
||||
*/
|
||||
public PamDependency(Class requiredDataType, String defaultProvider) {
|
||||
this.requiredDataType = requiredDataType;
|
||||
this.defaultProvider = defaultProvider;
|
||||
@ -41,12 +51,10 @@ public class PamDependency {
|
||||
/**
|
||||
* @return Returns the requiredDataType.
|
||||
*/
|
||||
// public DataType getRequiredDataType() {
|
||||
// return requiredDataType;
|
||||
// }
|
||||
public Class getRequiredDataType() {
|
||||
return requiredDataType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the dataBlockName.
|
||||
*/
|
||||
|
@ -451,7 +451,7 @@ final public class PamModel implements PamModelInterface, PamSettings {
|
||||
mi = PamModuleInfo.registerControlledUnit(EffortControl.class.getName(), EffortControl.unitType);
|
||||
mi.setToolTipText("Record observer monitoring effort");
|
||||
mi.setModulesMenuGroup(utilitiesGroup);
|
||||
mi.setHidden(SMRUEnable.isEnable() == false);
|
||||
// mi.setHidden(SMRUEnable.isEnable() == false);
|
||||
mi.setToolTipText("Enables an observer to enter their name and infomation about which displays are being monitored");
|
||||
mi.setMaxNumber(1);
|
||||
|
||||
|
@ -67,6 +67,8 @@ public interface PamPluginInterface extends CommonPluginInterface {
|
||||
* A short description of the plug in module. This text is used in various informational
|
||||
* windows displayed to the user. The value returned here is typically the same as the text returned
|
||||
* from the {@link #getDefaultName() getDefaultName()} method (e.g. <em>Click Detector</em> or <em>FFT (Spectrogram) Engine</em>).
|
||||
* <br>This is the text used in the main 'Add Modules' menus and is used as the
|
||||
* second argument to PamModuleInfo.registerControlledUnit
|
||||
* <p>
|
||||
* This field cannot be null.
|
||||
* @return String describing the plugin. Cannot be null.
|
||||
|
@ -344,7 +344,7 @@ public class ColourArray implements Cloneable, Serializable, ManagedParameters {
|
||||
* @return a contrasting colour.
|
||||
*/
|
||||
private Color createContrastingColour() {
|
||||
Color[] tryCols = {Color.white, Color.red, Color.blue, Color.green, Color.black};
|
||||
Color[] tryCols = {Color.white, Color.red, Color.CYAN, Color.blue, Color.green, Color.black};
|
||||
if (colours == null) {
|
||||
return tryCols[0];
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package PamView.dialog;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.Window;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
@ -8,9 +11,9 @@ import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
public class GenericSwingDialog extends PamDialog {
|
||||
|
||||
|
||||
private boolean allOk;
|
||||
|
||||
|
||||
private PamDialogPanel[] dialogPanels;
|
||||
|
||||
private GenericSwingDialog(Window parentFrame, String title, PamDialogPanel ...dialogPanels) {
|
||||
@ -25,15 +28,48 @@ public class GenericSwingDialog extends PamDialog {
|
||||
}
|
||||
mainPanel.add(comp);
|
||||
}
|
||||
|
||||
|
||||
setDialogComponent(mainPanel);
|
||||
}
|
||||
|
||||
public static boolean showDialog(Window parentFrame, String title, PamDialogPanel ...dialogPanels) {
|
||||
|
||||
public static boolean showDialog(Window parentFrame, String title, PamDialogPanel ...dialogPanels) {
|
||||
return showDialog(parentFrame, title, null, dialogPanels);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show dialog at a specific location on the screen.
|
||||
* @param parentFrame
|
||||
* @param title
|
||||
* @param screenPoint
|
||||
* @param dialogPanels
|
||||
* @return
|
||||
*/
|
||||
public static boolean showDialog(Window parentFrame, String title, Point screenPoint, PamDialogPanel ...dialogPanels) {
|
||||
GenericSwingDialog swingDialog = new GenericSwingDialog(parentFrame, title, dialogPanels);
|
||||
swingDialog.setParams();
|
||||
swingDialog.pack();
|
||||
if (screenPoint != null) {
|
||||
try {
|
||||
// check we're not going too far off the screen.
|
||||
Dimension sz = swingDialog.getPreferredSize();
|
||||
Dimension screen = null;
|
||||
if (parentFrame != null) {
|
||||
screen = parentFrame.getSize();
|
||||
}
|
||||
else {
|
||||
screen = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
}
|
||||
screenPoint.y = Math.min(screenPoint.y, screen.height-sz.height-10);
|
||||
screenPoint.y = Math.max(screenPoint.y, 0);
|
||||
screenPoint.x = Math.min(screenPoint.x, screen.width-sz.width-10);
|
||||
screenPoint.x = Math.max(screenPoint.x, 0);
|
||||
|
||||
swingDialog.setLocation(screenPoint);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// shouldn't happen, but if it does, it doesn't matter much
|
||||
}
|
||||
}
|
||||
swingDialog.setVisible(true);
|
||||
return swingDialog.allOk;
|
||||
}
|
||||
|
@ -3,10 +3,14 @@ package PamView.dialog;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dialog;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.MouseInfo;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
@ -225,6 +229,9 @@ abstract public class PamDialog extends JDialog {
|
||||
synchronized (this) {
|
||||
PamColors.getInstance().notifyContianer(this.getContentPane());
|
||||
}
|
||||
if (getOwner() == null) {
|
||||
moveToMouseLocation();
|
||||
}
|
||||
}
|
||||
try{
|
||||
super.setVisible(visible);
|
||||
@ -235,6 +242,42 @@ abstract public class PamDialog extends JDialog {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* put the dialog near the mouse location.
|
||||
*/
|
||||
public void moveToMouseLocation() {
|
||||
Point mouse = MouseInfo.getPointerInfo().getLocation();
|
||||
moveToLocation(mouse);
|
||||
}
|
||||
|
||||
public void moveToLocation(Point point) {
|
||||
if (point == null) {
|
||||
return;
|
||||
}
|
||||
// check we're not going too far off the screen.
|
||||
Dimension sz = getPreferredSize();
|
||||
Dimension screen = null;
|
||||
int w, h;
|
||||
if (getOwner() != null) {
|
||||
Window owner = getOwner();
|
||||
Rectangle bounds = owner.getBounds();
|
||||
w = bounds.x+bounds.width;
|
||||
h = bounds.y+bounds.height;
|
||||
screen = getOwner().getSize();
|
||||
}
|
||||
else {
|
||||
screen = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
w = screen.width;
|
||||
h = screen.height;
|
||||
}
|
||||
point.y = Math.min(point.y, h-sz.height-10);
|
||||
point.y = Math.max(point.y, 0);
|
||||
point.x = Math.min(point.x, w-sz.width-10);
|
||||
point.x = Math.max(point.x, 0);
|
||||
|
||||
setLocation(point);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reschedule closing of the window to happen
|
||||
* on the AWT thread using SwingUtilities.invokeLater(...)
|
||||
|
@ -48,6 +48,9 @@ public class OverlayCheckboxMenuSelect implements ActionListener {
|
||||
return;
|
||||
}
|
||||
DataSelectDialog dataSelectDialog = new DataSelectDialog(javaFrame, dataBlock, dataSelector, symbolChooser);
|
||||
if (javaFrame == null) {
|
||||
dataSelectDialog.moveToMouseLocation();
|
||||
}
|
||||
boolean ok = dataSelectDialog.showDialog();
|
||||
if (ok) {
|
||||
menuItem.setSelected(true);
|
||||
|
@ -42,7 +42,6 @@ public abstract class OverlayDataManager<TOverlayInfoType extends OverlayDataInf
|
||||
private ParameterType[] parameterTypes;
|
||||
|
||||
private ParameterUnits[] parameterUnits;
|
||||
|
||||
|
||||
/**
|
||||
* @param generalProjector
|
||||
|
@ -87,7 +87,8 @@ public class ExtMouseAdapter {
|
||||
}
|
||||
|
||||
final public boolean mouseWheelMoved(MouseWheelEvent e) {
|
||||
return mouseWheelMoved(fxScroll(e));
|
||||
// return mouseWheelMoved(fxScroll(e));
|
||||
return false;
|
||||
}
|
||||
|
||||
// private MouseEvent swingMouse(javafx.scene.input.MouseEvent e) {
|
||||
|
@ -76,6 +76,9 @@ public class MarkOverlayDraw extends PanelOverlayDraw {
|
||||
hoverData.setTransformShape(t);
|
||||
generalProjector.addHoverData(t, pamDataUnit);
|
||||
}
|
||||
if (drawnShape == null) {
|
||||
return null;
|
||||
}
|
||||
return drawnShape.getBounds();
|
||||
}
|
||||
|
||||
@ -143,52 +146,60 @@ public class MarkOverlayDraw extends PanelOverlayDraw {
|
||||
* To allow for things like the rotated map which no longer show rectangles as
|
||||
* rectangles, we now need to draw rectangles are irregular polygons too !
|
||||
*/
|
||||
int[] x = new int[4];
|
||||
int[] y = new int[4];
|
||||
PamCoordinate m0 = mark.getCoordinate(0);
|
||||
PamCoordinate m1 = mark.getCoordinate(1);
|
||||
Point p;
|
||||
p = generalProjector.getCoord3d(m0.getCoordinate(0), m0.getCoordinate(1), 0).getXYPoint();
|
||||
x[0] = p.x;
|
||||
y[0] = p.y;
|
||||
p = generalProjector.getCoord3d(m0.getCoordinate(0), m1.getCoordinate(1), 0).getXYPoint();
|
||||
x[1] = p.x;
|
||||
y[1] = p.y;
|
||||
p = generalProjector.getCoord3d(m1.getCoordinate(0), m1.getCoordinate(1), 0).getXYPoint();
|
||||
x[2] = p.x;
|
||||
y[2] = p.y;
|
||||
p = generalProjector.getCoord3d(m1.getCoordinate(0), m0.getCoordinate(1), 0).getXYPoint();
|
||||
x[3] = p.x;
|
||||
y[3] = p.y;
|
||||
Polygon pgon = new Polygon(x, y, 4);
|
||||
Color fillCol = getFillCol();
|
||||
if (fillCol != null) {
|
||||
g2d.setColor(getFillCol());
|
||||
g2d.fillPolygon(pgon);
|
||||
try {
|
||||
int[] x = new int[4];
|
||||
int[] y = new int[4];
|
||||
PamCoordinate m0 = mark.getCoordinate(0);
|
||||
PamCoordinate m1 = mark.getCoordinate(1);
|
||||
if (m0 == null || m1 == null) {
|
||||
return null;
|
||||
}
|
||||
Point p;
|
||||
p = generalProjector.getCoord3d(m0.getCoordinate(0), m0.getCoordinate(1), 0).getXYPoint();
|
||||
x[0] = p.x;
|
||||
y[0] = p.y;
|
||||
p = generalProjector.getCoord3d(m0.getCoordinate(0), m1.getCoordinate(1), 0).getXYPoint();
|
||||
x[1] = p.x;
|
||||
y[1] = p.y;
|
||||
p = generalProjector.getCoord3d(m1.getCoordinate(0), m1.getCoordinate(1), 0).getXYPoint();
|
||||
x[2] = p.x;
|
||||
y[2] = p.y;
|
||||
p = generalProjector.getCoord3d(m1.getCoordinate(0), m0.getCoordinate(1), 0).getXYPoint();
|
||||
x[3] = p.x;
|
||||
y[3] = p.y;
|
||||
Polygon pgon = new Polygon(x, y, 4);
|
||||
Color fillCol = getFillCol();
|
||||
if (fillCol != null) {
|
||||
g2d.setColor(getFillCol());
|
||||
g2d.fillPolygon(pgon);
|
||||
}
|
||||
return pgon;
|
||||
}
|
||||
return pgon;
|
||||
|
||||
//
|
||||
// Point p0 = generalProjector.getCoord3d(m0).getXYPoint();
|
||||
// Point p1 = generalProjector.getCoord3d(m1).getXYPoint();
|
||||
// g2d.setColor(getLineCol());
|
||||
// g2d.setStroke(getLineStroke());
|
||||
// g2d.drawLine(p0.x, p0.y, p1.x, p0.y);
|
||||
// g2d.drawLine(p1.x, p0.y, p1.x, p1.y);
|
||||
// g2d.drawLine(p1.x, p1.y, p0.x, p1.y);
|
||||
// g2d.drawLine(p0.x, p1.y, p0.x, p0.y);
|
||||
// int x = Math.min(p0.x, p1.x);
|
||||
// int y = Math.min(p0.y, p1.y);
|
||||
// int w = Math.abs(p0.x - p1.x);
|
||||
// int h = Math.abs(p0.y - p1.y);
|
||||
//
|
||||
// Color fillCol = getFillCol();
|
||||
// if (fillCol != null) {
|
||||
// g2d.setColor(getFillCol());
|
||||
// g2d.fillRect(x, y, w, h);
|
||||
// }
|
||||
// Rectangle r = new Rectangle(x, y, w, h);
|
||||
// return r;
|
||||
catch (NullPointerException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
//
|
||||
// Point p0 = generalProjector.getCoord3d(m0).getXYPoint();
|
||||
// Point p1 = generalProjector.getCoord3d(m1).getXYPoint();
|
||||
// g2d.setColor(getLineCol());
|
||||
// g2d.setStroke(getLineStroke());
|
||||
// g2d.drawLine(p0.x, p0.y, p1.x, p0.y);
|
||||
// g2d.drawLine(p1.x, p0.y, p1.x, p1.y);
|
||||
// g2d.drawLine(p1.x, p1.y, p0.x, p1.y);
|
||||
// g2d.drawLine(p0.x, p1.y, p0.x, p0.y);
|
||||
// int x = Math.min(p0.x, p1.x);
|
||||
// int y = Math.min(p0.y, p1.y);
|
||||
// int w = Math.abs(p0.x - p1.x);
|
||||
// int h = Math.abs(p0.y - p1.y);
|
||||
//
|
||||
// Color fillCol = getFillCol();
|
||||
// if (fillCol != null) {
|
||||
// g2d.setColor(getFillCol());
|
||||
// g2d.fillRect(x, y, w, h);
|
||||
// }
|
||||
// Rectangle r = new Rectangle(x, y, w, h);
|
||||
// return r;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -223,7 +234,7 @@ public class MarkOverlayDraw extends PanelOverlayDraw {
|
||||
public Stroke getLineStroke() {
|
||||
return plainStroke ;
|
||||
}
|
||||
|
||||
|
||||
public Stroke getFinalLineStroke() {
|
||||
return dashed;
|
||||
}
|
||||
|
@ -232,6 +232,9 @@ public class OverlayMark {
|
||||
}
|
||||
PamCoordinate c0 = projector.getCoord3d(coordinates.get(0));
|
||||
PamCoordinate c1 = projector.getCoord3d(coordinates.get(1));
|
||||
if (c0 == null || c1 == null) {
|
||||
return null;
|
||||
}
|
||||
double x = Math.min(c0.getCoordinate(0), c1.getCoordinate(0));
|
||||
double y = Math.min(c0.getCoordinate(1), c1.getCoordinate(1));
|
||||
double w = Math.abs(c0.getCoordinate(0) - c1.getCoordinate(0));
|
||||
|
@ -610,8 +610,6 @@ abstract public class OverlayMarker extends ExtMouseAdapter implements MarkManag
|
||||
}
|
||||
}
|
||||
|
||||
// Debug.out.printf("OverlayMarker: _ 2 In getSelectedMarkedDataUnits with %d available units\n", selectedData.size());
|
||||
|
||||
|
||||
return selectedData;
|
||||
}
|
||||
|
@ -32,12 +32,13 @@ public class SuperDetSymbolWrapper extends SymbolModifier {
|
||||
|
||||
@Override
|
||||
public SymbolData getSymbolData(GeneralProjector projector, PamDataUnit dataUnit) {
|
||||
PamDataUnit superDet = dataUnit.getSuperDetection(superDetDataBlock);
|
||||
PamDataUnit superDet = dataUnit.getSuperDetection(superDetDataBlock, true);
|
||||
if (superDet == null) {
|
||||
return null;
|
||||
}
|
||||
return superDetModifier.getSymbolData(getSymbolChooser().getProjector(), superDet);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getToolTipText() {
|
||||
|
@ -3705,6 +3705,28 @@ public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable {
|
||||
return blockDataSelector;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to save programmer from having to call into the creator
|
||||
* all the time.
|
||||
*
|
||||
* @param selectorName
|
||||
* @param allowScores
|
||||
* @param selectorType Type of selector, generally a ModuleType name, e.g. Map,
|
||||
* so that options can be tailored to specific needs
|
||||
* @param includeAnnotations include options from any annotators of this data stream
|
||||
* @param includeSuperDetections include any possible super detection data selectors.
|
||||
* @return null or a DataSelector
|
||||
*/
|
||||
public DataSelector getDataSelector(String selectorName, boolean allowScores, String selectorType,
|
||||
boolean includeAnnotations, boolean includeSuperDetections) {
|
||||
DataSelector blockDataSelector = null;
|
||||
DataSelectorCreator dsc = getDataSelectCreator();
|
||||
if (dsc != null) {
|
||||
blockDataSelector = dsc.getDataSelector(selectorName, allowScores, selectorType, includeAnnotations, includeSuperDetections);
|
||||
}
|
||||
return blockDataSelector;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get any information from the data block about cross referencing in database
|
||||
* tables.
|
||||
|
@ -943,23 +943,27 @@ abstract public class PamDataUnit<T extends PamDataUnit, U extends PamDataUnit>
|
||||
}
|
||||
}
|
||||
|
||||
int nAttotations = getNumDataAnnotations();
|
||||
for (int i = 0; i < nAttotations; i++) {
|
||||
DataAnnotation an = getDataAnnotation(i);
|
||||
DataAnnotationType ant = an.getDataAnnotationType();
|
||||
String anName = ant.getAnnotationName();
|
||||
String anString = an.toString();
|
||||
if (anString == null) {
|
||||
continue;
|
||||
}
|
||||
if (anString.contains("<html>")) {
|
||||
anString = anString.replace("<html>", "");
|
||||
}
|
||||
if (anString.contains("</html>")) {
|
||||
anString = anString.replace("</html>", "");
|
||||
}
|
||||
str += anName + ": " + anString + "<br>";
|
||||
String annotString = getAnnotationsSummaryString();
|
||||
if (annotString != null) {
|
||||
str += annotString;
|
||||
}
|
||||
// int nAttotations = getNumDataAnnotations();
|
||||
// for (int i = 0; i < nAttotations; i++) {
|
||||
// DataAnnotation an = getDataAnnotation(i);
|
||||
// DataAnnotationType ant = an.getDataAnnotationType();
|
||||
// String anName = ant.getAnnotationName();
|
||||
// String anString = an.toString();
|
||||
// if (anString == null) {
|
||||
// continue;
|
||||
// }
|
||||
// if (anString.contains("<html>")) {
|
||||
// anString = anString.replace("<html>", "");
|
||||
// }
|
||||
// if (anString.contains("</html>")) {
|
||||
// anString = anString.replace("</html>", "");
|
||||
// }
|
||||
// str += anName + ": " + anString + "<br>";
|
||||
// }
|
||||
|
||||
|
||||
// add frequency and amplitude information
|
||||
@ -999,6 +1003,36 @@ abstract public class PamDataUnit<T extends PamDataUnit, U extends PamDataUnit>
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get string information for the annotations. Kept separate so
|
||||
* it can be called in overridden version of getSummaryString()
|
||||
* @return
|
||||
*/
|
||||
public String getAnnotationsSummaryString() {
|
||||
int nAnnotations = getNumDataAnnotations();
|
||||
if (nAnnotations == 0) {
|
||||
return null;
|
||||
}
|
||||
String str = "";
|
||||
for (int i = 0; i < nAnnotations; i++) {
|
||||
DataAnnotation an = getDataAnnotation(i);
|
||||
DataAnnotationType ant = an.getDataAnnotationType();
|
||||
String anName = ant.getAnnotationName();
|
||||
String anString = an.toString();
|
||||
if (anString == null) {
|
||||
continue;
|
||||
}
|
||||
if (anString.contains("<html>")) {
|
||||
anString = anString.replace("<html>", "");
|
||||
}
|
||||
if (anString.contains("</html>")) {
|
||||
anString = anString.replace("</html>", "");
|
||||
}
|
||||
str += anName + ": " + anString + "<br>";
|
||||
}
|
||||
return str.length() > 0 ? str : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Some functions to do with data annotations
|
||||
*/
|
||||
@ -1258,6 +1292,32 @@ abstract public class PamDataUnit<T extends PamDataUnit, U extends PamDataUnit>
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* find a super detection form the parent data block of the super detection.
|
||||
* @param superDataBlock data block of super detection
|
||||
* @param allowSuperSuper Allow iteration through mutilple super detection layers
|
||||
* @return data unit from that block, or null.
|
||||
*/
|
||||
public SuperDetection getSuperDetection(PamDataBlock superDataBlock, boolean allowSuperSuper) {
|
||||
synchronized (superDetectionSyncronisation) {
|
||||
if (superDetections == null) return null;
|
||||
SuperDetection superDet;
|
||||
for (int i = 0; i < superDetections.size(); i++) {
|
||||
superDet = superDetections.get(i);
|
||||
if (superDet.getParentDataBlock() == superDataBlock) {
|
||||
return superDet;
|
||||
}
|
||||
if (allowSuperSuper) {
|
||||
SuperDetection supersuper = superDet.getSuperDetection(superDataBlock, allowSuperSuper);
|
||||
if (supersuper != null) {
|
||||
return supersuper;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public SuperDetection getSuperDetection(int ind) {
|
||||
synchronized (superDetectionSyncronisation) {
|
||||
if (superDetections == null || superDetections.size()<=ind) return null;
|
||||
|
@ -100,10 +100,26 @@ public class RawDataTransforms {
|
||||
private int shortestFFTLength;
|
||||
|
||||
|
||||
private Object synchObject;
|
||||
|
||||
public RawDataTransforms(@SuppressWarnings("rawtypes") PamDataUnit rawDataHolder) {
|
||||
/**
|
||||
* Create a RawDataTransforms with a specified synchronisation object. This is mostly the data unit,
|
||||
* but in some circumstances may need to be a different object to avoid thread lock.
|
||||
* @param rawDataHolder
|
||||
* @param synchObject
|
||||
*/
|
||||
public RawDataTransforms(@SuppressWarnings("rawtypes") PamDataUnit rawDataHolder, Object synchObject) {
|
||||
this.rawData=(RawDataHolder) rawDataHolder;
|
||||
this.dataUnit = rawDataHolder;
|
||||
this.synchObject = synchObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create raw data transforms using the rawDatAholder for synchronisation.
|
||||
* @param rawDataHolder
|
||||
*/
|
||||
public RawDataTransforms(@SuppressWarnings("rawtypes") PamDataUnit rawDataHolder) {
|
||||
this(rawDataHolder, rawDataHolder);
|
||||
}
|
||||
|
||||
|
||||
@ -118,7 +134,7 @@ public class RawDataTransforms {
|
||||
return powerSpectra;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the shortest FFT length for the number of samples.
|
||||
* The is the
|
||||
@ -143,12 +159,24 @@ public class RawDataTransforms {
|
||||
* @param fftLength
|
||||
* @return Power spectrum
|
||||
*/
|
||||
public synchronized double[] getPowerSpectrum(int channel, int minBin, int maxBin, int fftLength) {
|
||||
if (minBin==0 && maxBin>=this.getWaveData(0).length-1) {
|
||||
return getPowerSpectrum(channel, fftLength);
|
||||
}
|
||||
if (fftLength == 0) {
|
||||
fftLength = getCurrentSpectrumLength();
|
||||
public double[] getPowerSpectrum(int channel, int minBin, int maxBin, int fftLength) {
|
||||
synchronized (synchObject) {
|
||||
if (minBin==0 && maxBin>=this.getWaveData(0).length-1) {
|
||||
return getPowerSpectrum(channel, fftLength);
|
||||
}
|
||||
if (fftLength == 0) {
|
||||
fftLength = getCurrentSpectrumLength();
|
||||
}
|
||||
|
||||
double[] waveformTrim = new double[maxBin-minBin];
|
||||
|
||||
//System.out.println("minBin: " + minBin + " maxBin: " + maxBin + " raw waveform: " + this.getWaveData(channel).length);
|
||||
|
||||
System.arraycopy(this.getWaveData(channel), minBin, waveformTrim, 0, Math.min(this.getWaveData(channel).length-minBin-1, waveformTrim.length));
|
||||
|
||||
ComplexArray cData = getComplexSpectrumHann(waveformTrim, fftLength);
|
||||
|
||||
return cData.magsq();
|
||||
}
|
||||
|
||||
double[] waveformTrim = new double[maxBin-minBin];
|
||||
@ -300,8 +328,8 @@ public class RawDataTransforms {
|
||||
public ClipSpectrogram getSpectrogram(int fftSize, int fftHop) {
|
||||
return getSpectrogram( fftSize, fftHop, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get a spectrogram image of the wave clip. The clip is null until called. It is recalculated if the
|
||||
* FFT length and/or hop size are different.
|
||||
@ -437,15 +465,18 @@ public class RawDataTransforms {
|
||||
* @param iChan channel number
|
||||
* @return envelope of the filtered data.
|
||||
*/
|
||||
public synchronized double[] getFilteredAnalyticWaveform(FFTFilterParams fftFilterParams, int iChan) {
|
||||
if (analyticWaveform == null) {
|
||||
analyticWaveform = new double[getNChan()][];
|
||||
|
||||
public double[] getFilteredAnalyticWaveform(FFTFilterParams fftFilterParams, int iChan) {
|
||||
synchronized (synchObject) {
|
||||
if (analyticWaveform == null) {
|
||||
analyticWaveform = new double[getNChan()][];
|
||||
}
|
||||
// if (analyticWaveform[iChan] == null) {
|
||||
analyticWaveform[iChan] = hilbert.
|
||||
getHilbert(getFilteredWaveData(fftFilterParams, iChan));
|
||||
// }
|
||||
return analyticWaveform[iChan];
|
||||
}
|
||||
// if (analyticWaveform[iChan] == null) {
|
||||
analyticWaveform[iChan] = hilbert.
|
||||
getHilbert(getFilteredWaveData(fftFilterParams, iChan));
|
||||
// }
|
||||
return analyticWaveform[iChan];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -478,9 +509,12 @@ public class RawDataTransforms {
|
||||
* @param channelIndex channel index
|
||||
* @return filtered waveform data
|
||||
*/
|
||||
public synchronized double[] getFilteredWaveData(FFTFilterParams filterParams, int channelIndex) {
|
||||
filteredWaveData = getFilteredWaveData(filterParams);
|
||||
return filteredWaveData[channelIndex];
|
||||
|
||||
public double[] getFilteredWaveData(FFTFilterParams filterParams, int channelIndex) {
|
||||
synchronized (synchObject) {
|
||||
filteredWaveData = getFilteredWaveData(filterParams);
|
||||
return filteredWaveData[channelIndex];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -489,12 +523,15 @@ public class RawDataTransforms {
|
||||
* @param filterParams filter parameters
|
||||
* @return array of filtered data
|
||||
*/
|
||||
public synchronized double[][] getFilteredWaveData(FFTFilterParams filterParams) {
|
||||
//System.out.println("Make filterred wave data!: " + (filterParams != oldFFTFilterParams));
|
||||
if (filteredWaveData == null || filterParams != oldFFTFilterParams) {
|
||||
filteredWaveData = makeFilteredWaveData(filterParams);
|
||||
|
||||
public double[][] getFilteredWaveData(FFTFilterParams filterParams) {
|
||||
synchronized (synchObject) {
|
||||
//System.out.println("Make filterred wave data!: " + (filterParams != oldFFTFilterParams));
|
||||
if (filteredWaveData == null || filterParams != oldFFTFilterParams) {
|
||||
filteredWaveData = makeFilteredWaveData(filterParams);
|
||||
}
|
||||
return filteredWaveData;
|
||||
}
|
||||
return filteredWaveData;
|
||||
}
|
||||
|
||||
private double[][] makeFilteredWaveData(FFTFilterParams filterParams) {
|
||||
@ -574,7 +611,7 @@ public class RawDataTransforms {
|
||||
public double[] getWaveData(int channel) {
|
||||
return this.rawData.getWaveData()[channel];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the wave data for the given channel in int16 format.
|
||||
* @param channel channel index
|
||||
|
@ -62,19 +62,38 @@ public abstract class DataSelectorCreator implements PamSettings {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a data selector of a given name.
|
||||
* Get a data selector of a given name including all possible options for super detections and annotations.
|
||||
* @param selectorName
|
||||
* @param allowScores
|
||||
* @return
|
||||
* @return data selector for given name.
|
||||
*/
|
||||
public synchronized DataSelector getDataSelector(String selectorName, boolean allowScores, String selectorType) {
|
||||
return getDataSelector(selectorName, allowScores, selectorType, true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Get a data selector of a given name with optional inclusion of options for annotations and super detections
|
||||
* @param selectorName data selector name
|
||||
* @param allowScores allow scores
|
||||
* @param selectorType
|
||||
* @param includeAnnotations include options from any annotators of this data stream
|
||||
* @param includeSuperDetections include any possible super detection data selectors.
|
||||
* @return data selector for given name with appropriate options.
|
||||
*/
|
||||
public synchronized DataSelector getDataSelector(String selectorName, boolean allowScores, String selectorType,
|
||||
boolean includeAnnotations, boolean includeSuperDetections) {
|
||||
DataSelector ds = findDataSelector(selectorName);
|
||||
if (ds == null) {
|
||||
ds = createDataSelector(selectorName, allowScores, selectorType);
|
||||
|
||||
ds = addAnnotationOptions(ds, selectorName, allowScores, selectorType);
|
||||
if (includeAnnotations) {
|
||||
ds = addAnnotationOptions(ds, selectorName, allowScores, selectorType);
|
||||
}
|
||||
|
||||
ds = addSuperDetectionOptions(ds, selectorName, allowScores, selectorType);
|
||||
if (includeSuperDetections) {
|
||||
ds = addSuperDetectionOptions(ds, selectorName, allowScores, selectorType);
|
||||
}
|
||||
|
||||
// and get it's params from the centralised list.
|
||||
DataSelectParams params = dataSelectorSettings.getParams(selectorName);
|
||||
|
@ -471,6 +471,7 @@ public class SuperDetDataBlock<Tunit extends SuperDetection, TSubDet extends Pam
|
||||
PamDataUnit subDet = subDetectionFinder.findDataUnit(sdInfo);
|
||||
sdInfo.setSubDetection(subDet);
|
||||
if (subDet != null) {
|
||||
aData.addSubDetection(subDet);
|
||||
subDet.addSuperDetection(aData);
|
||||
}
|
||||
}
|
||||
|
@ -146,6 +146,17 @@ public abstract class AnnotationChoiceHandler extends AnnotationHandler {
|
||||
* @param annotationType
|
||||
*/
|
||||
public boolean updateAnnotation(PamDataUnit pamDataUnit, DataAnnotationType annotationType) {
|
||||
/*
|
||||
* need to check this is actually the right data unit, which matches the datablock of
|
||||
* this annotatoin handler. Gets very confused when dealing with superdetections
|
||||
*/
|
||||
if (pamDataUnit.getParentDataBlock() != this.getPamDataBlock()) {
|
||||
pamDataUnit = pamDataUnit.getSuperDetection(getPamDataBlock(), true);
|
||||
if (pamDataUnit == null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
DataAnnotation existingAnnotation = pamDataUnit.findDataAnnotation(annotationType.getAnnotationClass(), annotationType.getAnnotationName());
|
||||
boolean changed = false;
|
||||
if (annotationType.canAutoAnnotate()) {
|
||||
|
@ -10,6 +10,7 @@ import java.awt.event.WindowEvent;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import PamUtils.PamCalendar;
|
||||
import annotation.AnnotationDialogPanel;
|
||||
import PamView.DBTextArea;
|
||||
import PamView.dialog.PamDialogPanel;
|
||||
@ -51,13 +52,21 @@ public class StringDialogPanel implements AnnotationDialogPanel {
|
||||
note = note.trim();
|
||||
}
|
||||
if (note != null && note.length() > 0) {
|
||||
StringAnnotation an = (StringAnnotation) pamDataUnit.findDataAnnotation(StringAnnotation.class,
|
||||
stringAnnotationType.getAnnotationName());
|
||||
if (an == null) {
|
||||
StringAnnotation an;
|
||||
/*
|
||||
* always add a new annotation rather than editing the old one since
|
||||
* the old one will get removed to handle annotation types which really
|
||||
* do need to make a new one each time.
|
||||
*/
|
||||
|
||||
// = (StringAnnotation) pamDataUnit.findDataAnnotation(StringAnnotation.class,
|
||||
// stringAnnotationType.getAnnotationName());
|
||||
// if (an == null) {
|
||||
an = new StringAnnotation(stringAnnotationType);
|
||||
pamDataUnit.addDataAnnotation(an);
|
||||
}
|
||||
// }
|
||||
an.setString(textArea.getText());
|
||||
pamDataUnit.setLastUpdateTime(PamCalendar.getTimeInMillis());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1572,6 +1572,9 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
||||
}
|
||||
private double clickAngleToY(ClickDetection click) {
|
||||
AbstractLocalisation loc = click.getLocalisation();
|
||||
// if (click.getUID() == 110006089) {
|
||||
// System.out.println("Click 110006089 angle " + click.getAngle());
|
||||
// }
|
||||
if (loc == null) return 0;
|
||||
double angle = 0;
|
||||
GpsData oll;
|
||||
@ -3657,15 +3660,15 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
||||
/**
|
||||
* Scroll the display to a specific event.
|
||||
* @param event event to scroll to
|
||||
* @param beforeTime seconds before the event to scroll to.
|
||||
*/
|
||||
public void gotoEvent(OfflineEventDataUnit event) {
|
||||
long evStart = event.getTimeMilliseconds();
|
||||
public void gotoEvent(OfflineEventDataUnit event, int beforeTime) {
|
||||
long evStart = event.getTimeMilliseconds() - beforeTime*1000;
|
||||
if (evStart < hScrollBar.getMinimumMillis() || evStart > hScrollBar.getMaximumMillis()) {
|
||||
long range = hScrollBar.getMaximumMillis() - hScrollBar.getMinimumMillis();
|
||||
hScrollBar.setRangeMillis(evStart, evStart + range, true);
|
||||
}
|
||||
hScrollBar.setValueMillis(evStart);
|
||||
|
||||
}
|
||||
|
||||
int playbackStatus = PlaybackProgressMonitor.PLAY_END;
|
||||
|
@ -210,8 +210,8 @@ public class ClickBinaryDataSource extends BinaryDataSource {
|
||||
// long uid = binaryObjectData.getDataUnitBaseData().getUID();
|
||||
// System.out.printf("Loading click with UID %d at %s\n", uid,
|
||||
// PamCalendar.formatDateTime(binaryObjectData.getTimeMilliseconds()));
|
||||
// if (uid == lastUID) {
|
||||
// System.out.println("Click repeat UID: " + lastUID);
|
||||
// if (uid == 110006089) {
|
||||
// System.out.println("Click UID: " + 110006089);
|
||||
// }
|
||||
// else {
|
||||
// lastUID = binaryObjectData.getDataUnitBaseData().getUID();
|
||||
|
@ -1015,9 +1015,10 @@ public class ClickControl extends PamControlledUnit implements PamSettings {
|
||||
/**
|
||||
* Scrolls the display to a specific event.
|
||||
* @param event event to scroll to
|
||||
* @param beforeTime
|
||||
*/
|
||||
public void gotoEvent(OfflineEventDataUnit event) {
|
||||
tabPanelControl.clickDisplayManager.gotoEvent(event);
|
||||
public void gotoEvent(OfflineEventDataUnit event, int beforeTime) {
|
||||
tabPanelControl.clickDisplayManager.gotoEvent(event, beforeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1328,6 +1328,8 @@ public class ClickDetection extends PamDataUnit<PamDataUnit, PamDataUnit> implem
|
||||
|
||||
/**
|
||||
* Returns the angle in degrees for compatibilty with older version of click detector
|
||||
* This is really bad to use for anything apart from two element arrays and it would be
|
||||
* sensible to remove the function entirely.
|
||||
* @return angle of the click detection in degrees
|
||||
*/
|
||||
public double getAngle() {
|
||||
|
@ -463,11 +463,12 @@ public class ClickDisplayManager implements PamSettings {
|
||||
/**
|
||||
* Scroll the time displays to a specific event.
|
||||
* @param event
|
||||
* @param beforeTime
|
||||
*/
|
||||
public void gotoEvent(OfflineEventDataUnit event) {
|
||||
public void gotoEvent(OfflineEventDataUnit event, int beforeTime) {
|
||||
for (int i = 0; i < windowList.size(); i++) {
|
||||
if (windowList.get(i).getClass() == ClickBTDisplay.class) {
|
||||
((ClickBTDisplay)windowList.get(i)).gotoEvent(event);
|
||||
((ClickBTDisplay)windowList.get(i)).gotoEvent(event, beforeTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -175,9 +175,19 @@ public class EventListDialog extends PamDialog {
|
||||
JPopupMenu menu = new JPopupMenu();
|
||||
JMenuItem menuItem;
|
||||
int evNo = event.getDatabaseIndex();
|
||||
menuItem = new JMenuItem(String.format("Goto event %d ...", evNo));
|
||||
menuItem.addActionListener(new GotoEvent(event));
|
||||
menu.add(menuItem);
|
||||
int[] beforeTimes = {0, 10, 60};
|
||||
for (int i = 0; i < beforeTimes.length; i++) {
|
||||
String title;
|
||||
if (beforeTimes[i] == 0) {
|
||||
title = String.format("Goto event %d ...", evNo);
|
||||
}
|
||||
else {
|
||||
title = String.format("Goto %ds before event %d ...", beforeTimes[i], evNo);
|
||||
}
|
||||
menuItem = new JMenuItem(title);
|
||||
menuItem.addActionListener(new GotoEvent(event, beforeTimes[i]));
|
||||
menu.add(menuItem);
|
||||
}
|
||||
menuItem = new JMenuItem(String.format("Edit event %d ...", evNo));
|
||||
menuItem.addActionListener(new EditEvent(event));
|
||||
menu.add(menuItem);
|
||||
@ -219,14 +229,16 @@ public class EventListDialog extends PamDialog {
|
||||
private class GotoEvent implements ActionListener {
|
||||
|
||||
private OfflineEventDataUnit event;
|
||||
private int beforeTime;
|
||||
|
||||
public GotoEvent(OfflineEventDataUnit event) {
|
||||
public GotoEvent(OfflineEventDataUnit event, int beforeTime) {
|
||||
this.event = event;
|
||||
this.beforeTime = beforeTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
clickControl.gotoEvent(event);
|
||||
clickControl.gotoEvent(event, beforeTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package clickTrainDetector.layout.dataselector;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComponent;
|
||||
@ -15,6 +16,7 @@ import PamView.dialog.PamDialog;
|
||||
import PamView.dialog.PamDialogPanel;
|
||||
import PamView.dialog.PamGridBagContraints;
|
||||
import PamguardMVC.dataSelector.DataSelectParams;
|
||||
import clickTrainDetector.classification.CTClassifier;
|
||||
import clickTrainDetector.classification.CTClassifierManager;
|
||||
import clickTrainDetector.dataselector.CTDataSelector;
|
||||
import clickTrainDetector.dataselector.CTSelectParams;
|
||||
@ -286,10 +288,12 @@ public class CTDataSelectPanel implements PamDialogPanel {
|
||||
}
|
||||
|
||||
// System.out.println("No. count: " + count);
|
||||
currentParams.classifier = new int[count];
|
||||
currentParams.classifier = new int[count];
|
||||
ArrayList<CTClassifier> classifiers = ctDataSelector.getClickControl().getClassifierManager().getCurrentClassifiers();
|
||||
int used = 0;
|
||||
for (int i=0; i<classifierCheckBoxes.length; i++) {
|
||||
if (classifierCheckBoxes[i].isSelected()) {
|
||||
currentParams.classifier[i] = ctDataSelector.getClickControl().getClassifierManager().getCurrentClassifiers().get(i).getSpeciesID();
|
||||
currentParams.classifier[used++] = classifiers.get(i).getSpeciesID();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@ import java.util.ArrayList;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import pamScrollSystem.AbstractScrollManager;
|
||||
|
||||
import generalDatabase.DBControlUnit;
|
||||
import binaryFileStorage.BinaryStore;
|
||||
import dataMap.layoutFX.DataMapGUIFX;
|
||||
@ -240,6 +239,32 @@ public class DataMapControl extends PamControlledUnit implements PamSettings {
|
||||
public ArrayList<PamDataBlock> getMappedDataBlocks() {
|
||||
return mappedDataBlocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a single data map. Useful when bringing in data
|
||||
* from 'non standard' sources. Check overall time limits and
|
||||
* redraw, but no total map creation.
|
||||
* @param singleDataMap
|
||||
*/
|
||||
public void updateSingleDataMap(OfflineDataMap<?> singleDataMap) {
|
||||
long newLastTime = singleDataMap.getLastDataTime();
|
||||
long newFirstTime = singleDataMap.getFirstDataTime();
|
||||
if (mappedDataBlocks == null) {
|
||||
return;
|
||||
}
|
||||
for (PamDataBlock aBlock : mappedDataBlocks) {
|
||||
int nMaps = aBlock.getNumOfflineDataMaps();
|
||||
for (int iMap = 0; iMap < nMaps; iMap++) {
|
||||
OfflineDataMap aMap = aBlock.getOfflineDataMap(iMap);
|
||||
newFirstTime = Math.min(newFirstTime, aMap.getFirstDataTime());
|
||||
newLastTime = Math.max(newLastTime, aMap.getLastDataTime());
|
||||
}
|
||||
}
|
||||
firstTime = newFirstTime;
|
||||
lastTime = newLastTime;
|
||||
dataMapPanel.repaintAll();
|
||||
dataMapPanel.getSummaryPanel().newDataSources();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the firstTime for any data in any data block
|
||||
|
@ -167,5 +167,12 @@ public class DataMapPanel extends PamBorderPanel implements PamTabPanel {
|
||||
}
|
||||
summaryPanel.newDataSources();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the summaryPanel
|
||||
*/
|
||||
public SummaryPanel getSummaryPanel() {
|
||||
return summaryPanel;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,7 +24,8 @@ import detectiongrouplocaliser.dialogs.DisplayOptionsHandler;
|
||||
import userDisplay.UserDisplayControl;
|
||||
|
||||
/**
|
||||
* Class for grouping any type of data together.
|
||||
* Class for grouping any type of data together. Not really a localiser, but
|
||||
* does include some localisation options.<br>
|
||||
* Will attempt to offer a variety of localisation options and will store data for each group
|
||||
* in a pair of database tables.
|
||||
* @author dg50
|
||||
|
@ -56,23 +56,23 @@ import warnings.PamWarning;
|
||||
public class DetectionGroupTable extends UserDisplayComponentAdapter implements DetectionGroupObserver {
|
||||
|
||||
private JPanel mainPanel;
|
||||
|
||||
|
||||
private DetectionGroupProcess detectionGroupProcess;
|
||||
|
||||
|
||||
private DetectionGroupDataBlock detectionGroupDataBlock;
|
||||
|
||||
|
||||
private DetectionGroupControl detectionGroupControl;
|
||||
|
||||
|
||||
private JTable table;
|
||||
|
||||
private TableModel tableModel;
|
||||
|
||||
private JScrollPane scrollPane;
|
||||
|
||||
|
||||
private JPanel controlPanel;
|
||||
|
||||
|
||||
private JRadioButton showAll, showCurrent;
|
||||
|
||||
|
||||
private JButton checkIntegrity;
|
||||
|
||||
private boolean isViewer;
|
||||
@ -80,7 +80,7 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
private DisplayOptionsHandler displayOptionsHandler;
|
||||
|
||||
private SwingTableColumnWidths widthManager;
|
||||
|
||||
|
||||
public DetectionGroupTable(DetectionGroupProcess detectionGroupProcess) {
|
||||
super();
|
||||
this.detectionGroupProcess = detectionGroupProcess;
|
||||
@ -95,7 +95,7 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
mainPanel.add(BorderLayout.CENTER, scrollPane);
|
||||
detectionGroupControl.addGroupObserver(this);
|
||||
table.addMouseListener(new TableMouseHandler());
|
||||
|
||||
|
||||
if (isViewer) {
|
||||
displayOptionsHandler = detectionGroupControl.getDisplayOptionsHandler();
|
||||
controlPanel = new JPanel(new BorderLayout());
|
||||
@ -134,9 +134,9 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// sortColumnWidths();
|
||||
|
||||
|
||||
// sortColumnWidths();
|
||||
}
|
||||
|
||||
|
||||
@ -144,7 +144,7 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
public Component getComponent() {
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see userDisplay.UserDisplayComponentAdapter#openComponent()
|
||||
*/
|
||||
@ -195,7 +195,7 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
showPopupMenu(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -205,7 +205,7 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
|
||||
public void editSelectedEvent(MouseEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -234,26 +234,39 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
menuItem = annotationHandler.createAnnotationEditMenu(dgdu);
|
||||
menuItem.setIcon(menuIcon);
|
||||
pMenu.add(menuItem);
|
||||
|
||||
menuItem = new JMenuItem("Scroll to Group UID " + dgdu.getUID() + " at " + PamCalendar.formatDBDateTime(dgdu.getTimeMilliseconds()));
|
||||
menuItem.setIcon(menuIcon);
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
scrollToEvent(dgdu.getTimeMilliseconds());
|
||||
|
||||
int[] beforeTimesSecs = {0, 10, 60};
|
||||
pMenu.addSeparator();
|
||||
for (int i = 0; i < beforeTimesSecs.length; i++) {
|
||||
int before = beforeTimesSecs[i];
|
||||
String title;
|
||||
if (before == 0) {
|
||||
title = "Scroll to Group UID " + dgdu.getUID() + " at " + PamCalendar.formatDBDateTime(dgdu.getTimeMilliseconds());
|
||||
}
|
||||
});
|
||||
pMenu.add(menuItem);
|
||||
else {
|
||||
title = String.format("Scroll to %ds before Group UID %d", before, dgdu.getUID());
|
||||
}
|
||||
menuItem = new JMenuItem(title);
|
||||
// menuItem.setIcon(menuIcon);
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
scrollToEvent(dgdu.getTimeMilliseconds()-before*1000);
|
||||
}
|
||||
});
|
||||
pMenu.add(menuItem);
|
||||
}
|
||||
|
||||
pMenu.show(e.getComponent(), e.getX(), e.getY());
|
||||
}
|
||||
|
||||
protected void scrollToEvent(long timeMilliseconds) {
|
||||
// start a it earlier.
|
||||
timeMilliseconds -= 5000;
|
||||
// now WTF - how do I tell every scroller to go to this point in time ?
|
||||
// now WTF - how do I tell every scroller to go to this point in time ?
|
||||
AbstractScrollManager scrollManager = AbstractScrollManager.getScrollManager();
|
||||
scrollManager.startDataAt(detectionGroupDataBlock, timeMilliseconds);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -300,9 +313,9 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
TableColumn tableCol = table.getColumnModel().getColumn(i);
|
||||
tableCol.setPreferredWidth(tableModel.getRelativeWidth(i)*50);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private int getViewOption() {
|
||||
if (!isViewer) {
|
||||
return DisplayOptionsHandler.SHOW_ALL;
|
||||
@ -348,7 +361,7 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
// System.out.println("getRowCount()");
|
||||
// System.out.println("getRowCount()");
|
||||
if (getViewOption() == DisplayOptionsHandler.SHOW_ALL) {
|
||||
firstRowToShow = 0;
|
||||
return numRowsToShow = detectionGroupDataBlock.getUnitsCount();
|
||||
@ -396,9 +409,9 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
return null;
|
||||
}
|
||||
case 2:
|
||||
// if (iRow == 0) {
|
||||
// System.out.println("getValueAt(0,0)");
|
||||
// }
|
||||
// if (iRow == 0) {
|
||||
// System.out.println("getValueAt(0,0)");
|
||||
// }
|
||||
return dgdu.getUID();
|
||||
case 3:
|
||||
return PamCalendar.formatDateTime(dgdu.getTimeMilliseconds());
|
||||
@ -416,16 +429,16 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
if (annotation != null) {
|
||||
return annotation.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Class<?> getColumnClass(int col) {
|
||||
if (col == 0) {
|
||||
@ -433,7 +446,7 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
}
|
||||
return super.getColumnClass(col);
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.swing.table.AbstractTableModel#fireTableStructureChanged()
|
||||
*/
|
||||
@ -486,7 +499,7 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
widthManager = new SwingTableColumnWidths(uniqueName, table);
|
||||
super.setUniqueName(uniqueName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
@ -18,14 +19,18 @@ import PamController.PamController;
|
||||
import PamController.PamSettingManager;
|
||||
import PamController.PamSettings;
|
||||
import PamUtils.PamCalendar;
|
||||
import PamView.PamSidePanel;
|
||||
import PamguardMVC.PamDataBlock;
|
||||
import PamguardMVC.PamProcess;
|
||||
import PamguardMVC.debug.Debug;
|
||||
import effortmonitor.swing.EffortDataMapGraph;
|
||||
import effortmonitor.swing.EffortDialog;
|
||||
import effortmonitor.swing.EffortDisplayProvider;
|
||||
import effortmonitor.swing.EffortSidePanel;
|
||||
import pamScrollSystem.AbstractPamScroller;
|
||||
import pamScrollSystem.AbstractScrollManager;
|
||||
import pamScrollSystem.PamScroller;
|
||||
import pamScrollSystem.PamScrollerData;
|
||||
import userDisplay.UserDisplayControl;
|
||||
|
||||
public class EffortControl extends PamControlledUnit implements PamSettings{
|
||||
@ -42,6 +47,10 @@ public class EffortControl extends PamControlledUnit implements PamSettings{
|
||||
|
||||
private EffortDataMapGraph dataMapGraph;
|
||||
|
||||
private HashMap<AbstractPamScroller, PamScrollerData> lastOuterStarts = new HashMap<>();
|
||||
|
||||
private EffortSidePanel effortSidePanel;
|
||||
|
||||
public EffortControl(String unitName) {
|
||||
super("unitType", unitName);
|
||||
EffortProcess effortProc = new EffortProcess();
|
||||
@ -50,12 +59,22 @@ public class EffortControl extends PamControlledUnit implements PamSettings{
|
||||
effortProc.addOutputDataBlock(effortDataBlock);
|
||||
effortDataBlock.SetLogging(new EffortLogging(this, effortDataBlock));
|
||||
dataMapGraph = new EffortDataMapGraph(this);
|
||||
|
||||
// PamScroller
|
||||
|
||||
UserDisplayControl.addUserDisplayProvider(new EffortDisplayProvider(this));
|
||||
|
||||
PamSettingManager.getInstance().registerSettings(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PamSidePanel getSidePanel() {
|
||||
if (effortSidePanel == null) {
|
||||
effortSidePanel = new EffortSidePanel(this);
|
||||
}
|
||||
return effortSidePanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyModelChanged(int changeType) {
|
||||
super.notifyModelChanged(changeType);
|
||||
@ -65,6 +84,10 @@ public class EffortControl extends PamControlledUnit implements PamSettings{
|
||||
break;
|
||||
case PamController.NEW_SCROLL_TIME:
|
||||
updateScrollerInfo();
|
||||
break;
|
||||
case PamController.DATA_LOAD_COMPLETE:
|
||||
updateScrollerInfo();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,7 +125,25 @@ public class EffortControl extends PamControlledUnit implements PamSettings{
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
boolean newOuter = isNewOuter(scroller);
|
||||
if (effortParams.outserScrollOnly) {
|
||||
if (newOuter) {
|
||||
logOuterScroll(scroller);
|
||||
}
|
||||
}
|
||||
else {
|
||||
logInnerScroll(scroller);
|
||||
}
|
||||
}
|
||||
|
||||
private void logOuterScroll(AbstractPamScroller scroller) {
|
||||
EffortDataUnit effortData = new EffortDataUnit(scroller, effortParams.getObserver(), effortParams.getObjective());
|
||||
effortData.setOuterLimits();
|
||||
effortDataBlock.addPamData(effortData);
|
||||
}
|
||||
|
||||
private void logInnerScroll(AbstractPamScroller scroller) {
|
||||
// checkObserverName();
|
||||
|
||||
EffortDataUnit effortData = effortDataBlock.findActiveUnit(scroller);
|
||||
@ -129,6 +170,38 @@ public class EffortControl extends PamControlledUnit implements PamSettings{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Has the outer scroll moved.
|
||||
* @param scroller
|
||||
* @return true if the outer has moved.
|
||||
*/
|
||||
private boolean isNewOuter(AbstractPamScroller scroller) {
|
||||
PamScrollerData lastData = lastOuterStarts.get(scroller);
|
||||
PamScrollerData nowVal = scroller.getScrollerData();
|
||||
if (nowVal == null) {
|
||||
return false; // shouldn't happen !
|
||||
}
|
||||
boolean changed = isChanged(lastData, nowVal);
|
||||
if (changed) {
|
||||
lastOuterStarts.put(scroller, nowVal.clone());
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
private boolean isChanged(PamScrollerData lastData, PamScrollerData nowVal) {
|
||||
if (lastData == null || nowVal == null) {
|
||||
return true;
|
||||
}
|
||||
if (lastData.getMinimumMillis() != nowVal.getMinimumMillis()) {
|
||||
return true;
|
||||
}
|
||||
if (lastData.getMaximumMillis() != nowVal.getMaximumMillis()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick and dirty to get observer name.
|
||||
*/
|
||||
@ -203,9 +276,11 @@ public class EffortControl extends PamControlledUnit implements PamSettings{
|
||||
existingUnit.setObserver(newParams.getObserver());
|
||||
existingUnit.setObjective(newParams.getObjective());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if (effortSidePanel != null) {
|
||||
effortSidePanel.updateSettings();
|
||||
}
|
||||
return newParams!=null;
|
||||
}
|
||||
|
||||
public void goToTime(AbstractPamScroller scroller, long timeInMilliseconds) {
|
||||
@ -235,6 +310,9 @@ public class EffortControl extends PamControlledUnit implements PamSettings{
|
||||
@Override
|
||||
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) {
|
||||
effortParams = ((EffortParams) pamControlledUnitSettings.getSettings());
|
||||
if (effortSidePanel != null) {
|
||||
effortSidePanel.updateSettings();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@ public class EffortDataUnit extends PamDataUnit {
|
||||
getBasicData().setEndTime(scroller.getValueMillis()+scroller.getVisibleAmount());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor to use when reloading from database.
|
||||
* @param databaseIndex
|
||||
@ -210,4 +211,13 @@ public class EffortDataUnit extends PamDataUnit {
|
||||
return runMode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the limits as the outer limits of the scroller.
|
||||
*/
|
||||
public void setOuterLimits() {
|
||||
setTimeMilliseconds(scroller.getMinimumMillis());
|
||||
getBasicData().setEndTime(scroller.getMaximumMillis());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,11 @@ public class EffortParams implements Cloneable, Serializable, ManagedParameters
|
||||
|
||||
public transient boolean isSet;
|
||||
|
||||
/**
|
||||
* Only log outer scroll events when paging forwards, not every little movement.
|
||||
*/
|
||||
public boolean outserScrollOnly = false;
|
||||
|
||||
private static final int MAX_OBSERVERS = 10;
|
||||
private static final int MAX_OBJECTIVES = 10;
|
||||
|
||||
|
@ -8,9 +8,11 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import PamView.DBTextArea;
|
||||
@ -29,6 +31,7 @@ public class EffortDialog extends PamDialog {
|
||||
private JComboBox<String> observer;
|
||||
private JComboBox<String> oldObjectives;
|
||||
private DBTextArea objective;
|
||||
private JRadioButton outerOnly, allActions;
|
||||
|
||||
private EffortDialog(Window parentFrame, EffortControl effortControl) {
|
||||
super(parentFrame, effortControl.getUnitName(), false);
|
||||
@ -40,6 +43,18 @@ public class EffortDialog extends PamDialog {
|
||||
mainPanel.add(new JLabel("Observer name or initials"), c);
|
||||
c.gridx++;
|
||||
mainPanel.add(observer = new JComboBox<String>(), c);
|
||||
outerOnly = new JRadioButton("Log uter scroll only");
|
||||
allActions = new JRadioButton("Log all scroll actions");
|
||||
ButtonGroup bg = new ButtonGroup();
|
||||
bg.add(allActions);
|
||||
bg.add(outerOnly);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
c.gridwidth = 1;
|
||||
mainPanel.add(allActions, c);
|
||||
c.gridx+=c.gridwidth;
|
||||
mainPanel.add(outerOnly, c);
|
||||
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
c.gridwidth = 2;
|
||||
@ -80,6 +95,8 @@ public class EffortDialog extends PamDialog {
|
||||
for (String obs : oldObs) {
|
||||
observer.addItem(obs);
|
||||
}
|
||||
allActions.setSelected(effortParams.outserScrollOnly == false);
|
||||
outerOnly.setSelected(effortParams.outserScrollOnly);
|
||||
oldObjectives.removeAllItems();
|
||||
oldObjectives.addItem("");
|
||||
for (String obj : effortParams.getRecentObjectives()) {
|
||||
@ -100,6 +117,7 @@ public class EffortDialog extends PamDialog {
|
||||
if (obs == null || obs.length() == 0) {
|
||||
return showWarning("You must give your name or initials to contine");
|
||||
}
|
||||
effortParams.outserScrollOnly = outerOnly.isSelected();
|
||||
effortParams.setObserver(obs);
|
||||
effortParams.setObjective(objective.getText());
|
||||
return true;
|
||||
|
99
src/effortmonitor/swing/EffortSidePanel.java
Normal file
99
src/effortmonitor/swing/EffortSidePanel.java
Normal file
@ -0,0 +1,99 @@
|
||||
package effortmonitor.swing;
|
||||
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import PamView.PamSidePanel;
|
||||
import PamView.component.PamSettingsIconButton;
|
||||
import PamView.dialog.PamCheckBox;
|
||||
import PamView.dialog.PamGridBagContraints;
|
||||
import PamView.dialog.PamLabel;
|
||||
import PamView.dialog.PamTextField;
|
||||
import PamView.panel.PamPanel;
|
||||
import effortmonitor.EffortControl;
|
||||
import effortmonitor.EffortObserver;
|
||||
import effortmonitor.EffortParams;
|
||||
|
||||
public class EffortSidePanel implements PamSidePanel, EffortObserver {
|
||||
|
||||
private PamPanel mainPanel;
|
||||
|
||||
private PamTextField person;
|
||||
|
||||
private PamCheckBox logging;
|
||||
|
||||
private PamSettingsIconButton settingsButton;
|
||||
|
||||
private EffortControl effortControl;
|
||||
|
||||
public EffortSidePanel(EffortControl effortControl) {
|
||||
this.effortControl = effortControl;
|
||||
|
||||
mainPanel = new PamPanel(new GridBagLayout());
|
||||
mainPanel.setBorder(new TitledBorder(effortControl.getUnitName()));
|
||||
GridBagConstraints c = new PamGridBagContraints();
|
||||
mainPanel.add(new PamLabel("Person ", JLabel.RIGHT), c);
|
||||
c.gridx++;
|
||||
mainPanel.add(person = new PamTextField(6), c);
|
||||
person.setEditable(false);
|
||||
c.gridx = 0;
|
||||
c.gridy++;
|
||||
c.gridwidth = 1;
|
||||
mainPanel.add(logging = new PamCheckBox("Log effort"), c);
|
||||
c.gridx += c.gridwidth;
|
||||
mainPanel.add(settingsButton = new PamSettingsIconButton(), c);
|
||||
settingsButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
settings();
|
||||
}
|
||||
});
|
||||
effortControl.addObserver(this);
|
||||
logging.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
loggingButton();
|
||||
}
|
||||
});
|
||||
|
||||
updateSettings();
|
||||
}
|
||||
|
||||
protected void loggingButton() {
|
||||
effortControl.setOnEffort(logging.isSelected());
|
||||
}
|
||||
|
||||
protected void settings() {
|
||||
effortControl.showSettingsDialog(effortControl.getGuiFrame(), null);
|
||||
}
|
||||
|
||||
public void updateSettings() {
|
||||
EffortParams params = effortControl.getEffortParams();
|
||||
person.setText(params.getObserver());
|
||||
logging.setSelected(params.isSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getPanel() {
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rename(String newName) {
|
||||
mainPanel.setBorder(new TitledBorder(newName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void statusChange() {
|
||||
updateSettings();
|
||||
}
|
||||
|
||||
}
|
@ -91,6 +91,8 @@ PamSettingsSource {
|
||||
private boolean fullTablesCheck = false;
|
||||
|
||||
static private String dbUnitType = "Pamguard Database";
|
||||
|
||||
static public final String GlobalDatabaseNameArg = "-databasefile";
|
||||
|
||||
private DBControl THIS;
|
||||
|
||||
|
@ -426,7 +426,11 @@ public class PamTableItem implements Cloneable {
|
||||
return (Double) value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a float value, being aware that some DBMS may have
|
||||
* decided to store as a Double anyway. Return Float.NaN for null data
|
||||
* @return float value or NaN
|
||||
*/
|
||||
public float getFloatValue() {
|
||||
if (value == null) {
|
||||
return Float.NaN;
|
||||
|
@ -120,6 +120,9 @@ public class DatabaseBackupStream extends FileBackupStream {
|
||||
|
||||
public FileLocation getSourceLocation() {
|
||||
File dbFile = getDatabaesFile();
|
||||
if (dbFile == null) {
|
||||
return null;
|
||||
}
|
||||
FileLocation sl = new FileLocation();
|
||||
sl.path = dbFile.getAbsolutePath();
|
||||
sl.canEditMask = false;
|
||||
|
@ -91,69 +91,15 @@ public class SqliteDialogPanel implements SystemDialogPanel {
|
||||
|
||||
String newDB = sqliteSystem.browseDatabases(parent);
|
||||
if (newDB != null) {
|
||||
|
||||
// see if this file exists in the list and if it does, remove it
|
||||
for (int i = 0; i < sqliteSystem.getRecentDatabases().size(); i++) {
|
||||
if (sqliteSystem.getRecentDatabases().get(i).toString().equalsIgnoreCase(newDB)) {
|
||||
sqliteSystem.getRecentDatabases().remove(i);
|
||||
}
|
||||
}
|
||||
// then insert the file at the top of the list.
|
||||
File newFile = new File(newDB);
|
||||
// if the file doesn't exit, consider creating it.
|
||||
if (newFile.exists() == false) {
|
||||
newFile = createNewDatabase(newDB);
|
||||
if (newFile == null) {
|
||||
System.out.println("Unable to create "+newFile);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sqliteSystem.getRecentDatabases().add(0, newFile);
|
||||
sqliteSystem.setDatabaseName(newDB);
|
||||
|
||||
setParams();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public File createNewDatabase(String newDB) {
|
||||
|
||||
File newFile = new File(newDB);
|
||||
newFile = PamFileFilter.checkFileEnd(newFile, ".sqlite3", true);
|
||||
|
||||
int ans = JOptionPane.showConfirmDialog(parent, "Create blank database " + newFile.getAbsolutePath() + " ?", "Sqlite", JOptionPane.OK_CANCEL_OPTION);
|
||||
if (ans == JOptionPane.CANCEL_OPTION) {
|
||||
return null;
|
||||
}
|
||||
Connection connection = null;
|
||||
|
||||
try {
|
||||
// create a database connection;
|
||||
// Sqlite will automatically create file if it does not exist;
|
||||
connection = DriverManager.getConnection("jdbc:sqlite:" + newFile);
|
||||
|
||||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if(connection != null)
|
||||
connection.close();
|
||||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
// connection close failed.
|
||||
System.err.println(e);
|
||||
}
|
||||
}
|
||||
return newFile;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package generalDatabase.sqlite;
|
||||
import generalDatabase.pamCursor.NonScrollablePamCursor;
|
||||
import generalDatabase.pamCursor.PamCursor;
|
||||
import javafx.stage.FileChooser;
|
||||
import pamguard.GlobalArguments;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Desktop;
|
||||
@ -10,10 +11,12 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import org.sqlite.SQLiteConfig;
|
||||
|
||||
@ -82,6 +85,53 @@ public class SqliteSystem extends DBSystem implements PamSettings {
|
||||
if (sqliteParameters.getRecentDatabases() == null) {
|
||||
sqliteParameters.setRecentDatabases(new ArrayList<File>());
|
||||
}
|
||||
checkCommandLineOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if the database name was included as a command line option,
|
||||
* in which case, put it at the top of the list. this is better than just using
|
||||
* it,since it then gets stored within it's own settings.
|
||||
*/
|
||||
private void checkCommandLineOption() {
|
||||
// TODO Auto-generated method stub
|
||||
/*
|
||||
* If a database name was passed as a global argument, then use the passed name instead of
|
||||
* the name in the list of recent databases.
|
||||
*/
|
||||
String commandName = GlobalArguments.getParam(DBControl.GlobalDatabaseNameArg);
|
||||
if (commandName == null) {
|
||||
return;
|
||||
}
|
||||
setDatabaseName(commandName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the database name, check it exists, check it's end
|
||||
* and add to top of list of databases.
|
||||
* @param databaseName
|
||||
*/
|
||||
public void setDatabaseName(String databaseName) {
|
||||
// see if this file exists in the list and if it does, remove it
|
||||
for (int i = 0; i < getRecentDatabases().size(); i++) {
|
||||
if (getRecentDatabases().get(i).toString().equalsIgnoreCase(databaseName)) {
|
||||
getRecentDatabases().remove(i);
|
||||
}
|
||||
}
|
||||
// then insert the file at the top of the list.
|
||||
File newFile = new File(databaseName);
|
||||
// if the file doesn't exit, consider creating it.
|
||||
if (newFile.exists() == false) {
|
||||
newFile = createNewDatabase(databaseName, null, true);
|
||||
if (newFile == null) {
|
||||
System.out.println("Unable to create "+newFile);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getRecentDatabases().add(0, newFile);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -111,6 +161,52 @@ public class SqliteSystem extends DBSystem implements PamSettings {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new empty database file.
|
||||
* @param newDB full path for database file (can be missing .sqlit3 if you like - this will get checked and added).
|
||||
* @param parent window (for confirm dialog, can be null)
|
||||
* @param askFirst show a confirm dialog before creating the database file.
|
||||
* @return a path to the file, whether created or no.
|
||||
*/
|
||||
public File createNewDatabase(String newDB, Component parent, boolean askFirst) {
|
||||
|
||||
File newFile = new File(newDB);
|
||||
newFile = PamFileFilter.checkFileEnd(newFile, ".sqlite3", true);
|
||||
|
||||
if (askFirst) {
|
||||
int ans = JOptionPane.showConfirmDialog(parent, "Create blank database " + newFile.getAbsolutePath() + " ?", "Sqlite", JOptionPane.OK_CANCEL_OPTION);
|
||||
if (ans == JOptionPane.CANCEL_OPTION) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Connection connection = null;
|
||||
|
||||
try {
|
||||
// create a database connection;
|
||||
// Sqlite will automatically create file if it does not exist;
|
||||
connection = DriverManager.getConnection("jdbc:sqlite:" + newFile);
|
||||
|
||||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if(connection != null)
|
||||
connection.close();
|
||||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
// connection close failed.
|
||||
System.err.println(e);
|
||||
}
|
||||
}
|
||||
return newFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCreate() {
|
||||
@ -208,6 +304,15 @@ public class SqliteSystem extends DBSystem implements PamSettings {
|
||||
|
||||
@Override
|
||||
public String getDatabaseName() {
|
||||
/*
|
||||
* If a database name was passed as a global argument, then use the passed name instead of
|
||||
* the name in the list of recent databases.
|
||||
*/
|
||||
String commandName = GlobalArguments.getParam(DBControl.GlobalDatabaseNameArg);
|
||||
if (commandName != null) {
|
||||
return commandName;
|
||||
}
|
||||
|
||||
if (getRecentDatabases() == null) return null;
|
||||
if (getRecentDatabases().size() < 1) return null;
|
||||
return getRecentDatabases().get(0).getAbsolutePath();
|
||||
@ -271,7 +376,7 @@ public class SqliteSystem extends DBSystem implements PamSettings {
|
||||
|
||||
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) {
|
||||
Object settings = pamControlledUnitSettings.getSettings();
|
||||
if (settings instanceof ArrayList) {
|
||||
if (settings instanceof ArrayList) { // deal with old format which just stored a list.
|
||||
sqliteParameters.getRecentDatabases().clear();
|
||||
sqliteParameters.getRecentDatabases().addAll((ArrayList) settings);
|
||||
}
|
||||
|
@ -193,6 +193,7 @@ public class Group3DProcess extends PamProcess implements DetectionGroupMonitor
|
||||
// will have to make a data unit for each group now...
|
||||
Group3DDataUnit[] group3dDataUnits = new Group3DDataUnit[nGroups];
|
||||
|
||||
// System.out.println("Enter newGRoupedDataSet with groups: " + detectionGroupedSet.getNumGroups());
|
||||
// if (detectionGroupedSet.hasUID(14045004731L)) {
|
||||
// Debug.out.println(" found it");
|
||||
// }
|
||||
@ -209,6 +210,7 @@ public class Group3DProcess extends PamProcess implements DetectionGroupMonitor
|
||||
// localiserAlgorithm3D.process(detectionGroupedSet.getGroup(i));
|
||||
abstractLocalisation = localiserAlgorithm3D.runModel(group3dDataUnits[i], null, false);
|
||||
if (abstractLocalisation == null) {
|
||||
System.out.println("Group 3D process null localisation from " + localiserAlgorithm3D.getName());
|
||||
continue;
|
||||
}
|
||||
// log all outputs ..
|
||||
|
@ -160,9 +160,15 @@ public class DetectionGrouper {
|
||||
if (motherGroup.getTotalChannelMap() == 0) {
|
||||
return;
|
||||
}
|
||||
// if (maybeCloseMotherGroup(0, sampleNumber - (long) (sampleRate / 2))) {
|
||||
// motherGroup.
|
||||
// int lastGroup = motherGroup.getLastChannelGroup();
|
||||
long buffer = (long) this.maxInterGroupSample;
|
||||
// if (shouldCloseMotherGroup(lastGroup, sampleNumber, buffer)) {
|
||||
if (sampleNumber > motherGroup.getVeryLastSample() + buffer + sampleRate) {
|
||||
closeMotherGroup();
|
||||
// if (maybeCloseMotherGroup(motherGroup.getLastChannelGroup(), sampleNumber - (long) (sampleRate / 2))) {
|
||||
// System.out.println("Mother group closed on timer");
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized boolean maybeCloseMotherGroup(int iChanGroup, long currentSample) {
|
||||
|
@ -24,6 +24,8 @@ public class FirstGrouping {
|
||||
private long veryLastSample;
|
||||
|
||||
private int[] groupCount;
|
||||
|
||||
private int lastChannelGroup;
|
||||
|
||||
public FirstGrouping(int nChannelGroups, int channelGroup, PamDataUnit pamDataUnit) {
|
||||
this.nChannelGroups = nChannelGroups;
|
||||
@ -44,6 +46,7 @@ public class FirstGrouping {
|
||||
lastSamples[channelGroup] += pamDataUnit.getSampleDuration();
|
||||
}
|
||||
veryLastSample = Math.max(veryLastSample, lastSamples[channelGroup]);
|
||||
lastChannelGroup = channelGroup;
|
||||
}
|
||||
|
||||
// /**
|
||||
@ -92,4 +95,11 @@ public class FirstGrouping {
|
||||
return dataUnits;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lastChannelGroup
|
||||
*/
|
||||
public int getLastChannelGroup() {
|
||||
return lastChannelGroup;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import generalDatabase.DBControlUnit;
|
||||
import generalDatabase.PamConnection;
|
||||
import generalDatabase.SQLLogging;
|
||||
import generalDatabase.SQLTypes;
|
||||
import generalDatabase.SuperDetLogging;
|
||||
import generalDatabase.clauses.FixedClause;
|
||||
import generalDatabase.clauses.FromClause;
|
||||
import generalDatabase.clauses.PAMSelectClause;
|
||||
@ -354,6 +355,7 @@ public abstract class OfflineTask<T extends PamDataUnit> {
|
||||
}
|
||||
aBlock.clearAll();
|
||||
|
||||
|
||||
|
||||
SQLLogging logging = aBlock.getLogging();
|
||||
if (logging == null) {
|
||||
@ -382,7 +384,15 @@ public abstract class OfflineTask<T extends PamDataUnit> {
|
||||
System.out.println("Unknown data selection option in OfflineTask.deleteOldData: " + taskGroupParams.dataChoice);
|
||||
return;
|
||||
}
|
||||
logging.deleteData(clause);
|
||||
while (logging != null) {
|
||||
logging.deleteData(clause);
|
||||
if (logging instanceof SuperDetLogging) {
|
||||
logging = ((SuperDetLogging) logging).getSubLogging();
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class PamScrollerData implements Serializable, Cloneable {
|
||||
|
||||
|
||||
@Override
|
||||
protected PamScrollerData clone() {
|
||||
public PamScrollerData clone() {
|
||||
try {
|
||||
return (PamScrollerData) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
|
@ -23,6 +23,7 @@ package pamguard;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import Acquisition.FolderInputSystem;
|
||||
import PamController.PamController;
|
||||
import PamController.PamGUIManager;
|
||||
import PamController.PamSettingManager;
|
||||
@ -41,6 +42,8 @@ import PamView.dialog.warn.WarnOnce;
|
||||
import PamguardMVC.debug.Debug;
|
||||
import binaryFileStorage.BinaryStore;
|
||||
import dataPlotsFX.JamieDev;
|
||||
import generalDatabase.DBControl;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -216,11 +219,15 @@ public class Pamguard {
|
||||
}
|
||||
else if (anArg.equalsIgnoreCase(BinaryStore.GlobalFolderArg)) {
|
||||
// output folder for binary files.
|
||||
GlobalArguments.setParam(anArg, args[iArg++]);
|
||||
GlobalArguments.setParam(BinaryStore.GlobalFolderArg, args[iArg++]);
|
||||
}
|
||||
else if (anArg.equalsIgnoreCase("-databasefile")) {
|
||||
else if (anArg.equalsIgnoreCase(DBControl.GlobalDatabaseNameArg)) {
|
||||
// database file name
|
||||
GlobalArguments.setParam(anArg, args[iArg++]);
|
||||
GlobalArguments.setParam(DBControl.GlobalDatabaseNameArg, args[iArg++]);
|
||||
}
|
||||
else if (anArg.equalsIgnoreCase(FolderInputSystem.GlobalWavFolderArg)) {
|
||||
// source folder for wav files (or other supported sound files)
|
||||
GlobalArguments.setParam(FolderInputSystem.GlobalWavFolderArg, args[iArg++]);
|
||||
}
|
||||
else if (anArg.equalsIgnoreCase("-help")) {
|
||||
System.out.println("--PamGuard Help");
|
||||
|
@ -69,6 +69,11 @@ public class RoccaControl extends PamControlledUnit implements PamSettings {
|
||||
*/
|
||||
public static final String unitType = "Rocca";
|
||||
|
||||
/*
|
||||
* Max max data keep time to avoid memory overflows. Currently at 15 minutes.
|
||||
*/
|
||||
private static final int MAXMAXDATAKEEPTIME = 900000;
|
||||
|
||||
/**
|
||||
* reference to the ClickControl module when it is loaded in Viewer mode
|
||||
*/
|
||||
@ -193,6 +198,17 @@ public class RoccaControl extends PamControlledUnit implements PamSettings {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* A bit of a fudge to deal with some old code which kept doubling the
|
||||
* keep time of the raw data, which eventually led to raw data using too
|
||||
* much memory and bringing down PG. I don't fully understand that code so
|
||||
* have left as much of it as possible, but put this in as an absolute
|
||||
* maximum which cannot be exceeded.
|
||||
* @return max in milliseconds as int, which is what's used in PAMDataBlock.
|
||||
*/
|
||||
public int getMaxDataKeepTime() {
|
||||
return MAXMAXDATAKEEPTIME;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param eventList
|
||||
@ -242,18 +258,21 @@ public class RoccaControl extends PamControlledUnit implements PamSettings {
|
||||
(rcdb.getContour().get(RoccaContourStats.ParamIndx.SNR) > 35. ||
|
||||
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) < 0.005 ||
|
||||
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) > 0.6 )) {
|
||||
rcdb.setNaturalLifetimeMillis(0);
|
||||
return;
|
||||
}
|
||||
if (roccaParameters.roccaClassifierModelFilename.getName().equals("HIClick.model") &&
|
||||
(rcdb.getContour().get(RoccaContourStats.ParamIndx.SNR) > 40. ||
|
||||
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) < 0.01 ||
|
||||
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) > 0.6 )) {
|
||||
rcdb.setNaturalLifetimeMillis(0);
|
||||
return;
|
||||
}
|
||||
if (roccaParameters.roccaClassifierModelFilename.getName().equals("NWAtlClick.model") &&
|
||||
(rcdb.getContour().get(RoccaContourStats.ParamIndx.SNR) > 35. ||
|
||||
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) < 0.005 ||
|
||||
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) > 0.6 )) {
|
||||
rcdb.setNaturalLifetimeMillis(0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -363,6 +363,9 @@ public class RoccaProcess extends PamProcess {
|
||||
|
||||
// 2017/12/4 set the natural lifetime to Integer.Max, so that we definitely keep all of the data
|
||||
// units during this code block. Set the lifetime back to 0 at the end of the block
|
||||
/*
|
||||
* DG June '22 made sure this is the case when the function returns early !
|
||||
*/
|
||||
rcdb.setNaturalLifetimeMillis(Integer.MAX_VALUE);
|
||||
rcdb.calculateStatistics();
|
||||
|
||||
@ -385,6 +388,7 @@ public class RoccaProcess extends PamProcess {
|
||||
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) > 1.5 ||
|
||||
rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQABSSLOPEMEAN) < 2000. ||
|
||||
rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQABSSLOPEMEAN) > 28000. )) {
|
||||
rcdb.setNaturalLifetimeMillis(0);
|
||||
return;
|
||||
}
|
||||
if (roccaControl.roccaParameters.roccaClassifierModelFilename.getName().equals("HIWhist.model") &&
|
||||
@ -398,6 +402,7 @@ public class RoccaProcess extends PamProcess {
|
||||
rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQABSSLOPEMEAN) > 60000. ||
|
||||
rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQRANGE) < 800. ||
|
||||
rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQRANGE) > 14000. )) {
|
||||
rcdb.setNaturalLifetimeMillis(0);
|
||||
return;
|
||||
}
|
||||
if (roccaControl.roccaParameters.roccaClassifierModelFilename.getName().equals("NWAtlWhist.model") &&
|
||||
@ -407,6 +412,7 @@ public class RoccaProcess extends PamProcess {
|
||||
rcdb.getContour().get(RoccaContourStats.ParamIndx.DURATION) > 2.5 ||
|
||||
rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQABSSLOPEMEAN) < 9100. ||
|
||||
rcdb.getContour().get(RoccaContourStats.ParamIndx.FREQABSSLOPEMEAN) > 82000. )) {
|
||||
rcdb.setNaturalLifetimeMillis(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -736,13 +742,15 @@ public class RoccaProcess extends PamProcess {
|
||||
PamUtils.makeChannelMap(lowestChanList));
|
||||
int firstIndx = prdb.getUnitIndex(firstRDU);
|
||||
if (firstIndx==-1) {
|
||||
System.out.println("RoccaProcess: Cannot determine firstIndx, raw data lifetime = " + prdb.getNaturalLifetimeMillis() + " ms");
|
||||
int newTime;
|
||||
if (prdb.getNaturalLifetimeMillis() > Integer.MAX_VALUE/2) {
|
||||
newTime = Integer.MAX_VALUE;
|
||||
} else {
|
||||
newTime = prdb.getNaturalLifetimeMillis()*2;
|
||||
}
|
||||
// stop it getting silly.
|
||||
newTime = Math.min(newTime, roccaControl.getMaxDataKeepTime());
|
||||
System.out.println("RoccaProcess: Cannot determine firstIndx, raw data lifetime = " + prdb.getNaturalLifetimeMillis() + " ms");
|
||||
prdb.setNaturalLifetimeMillis(newTime); // increase the lifetime to try and prevent this from happening again
|
||||
return null;
|
||||
}
|
||||
@ -769,13 +777,14 @@ public class RoccaProcess extends PamProcess {
|
||||
PamUtils.makeChannelMap(highestChanList));
|
||||
int lastIndx = prdb.getUnitIndex(lastRDU);
|
||||
if (lastIndx==-1) {
|
||||
System.out.println("RoccaProcess: Cannot determine lastIndx, raw data lifetime = " + prdb.getNaturalLifetimeMillis() + " ms");
|
||||
int newTime;
|
||||
if (prdb.getNaturalLifetimeMillis() > Integer.MAX_VALUE/2) {
|
||||
newTime = Integer.MAX_VALUE;
|
||||
} else {
|
||||
newTime = prdb.getNaturalLifetimeMillis()*2;
|
||||
}
|
||||
newTime = Math.min(newTime, roccaControl.getMaxDataKeepTime());
|
||||
System.out.println("RoccaProcess: Cannot determine lastIndx, raw data lifetime = " + prdb.getNaturalLifetimeMillis() + " ms");
|
||||
prdb.setNaturalLifetimeMillis(newTime); // increase the lifetime to try and prevent this from happening again
|
||||
return null;
|
||||
}
|
||||
|
@ -114,7 +114,13 @@ public class RoccaSidePanel extends PamObserverAdapter implements PamSidePanel
|
||||
this.rsdb = new RoccaSightingDataBlock
|
||||
(roccaControl.roccaProcess,
|
||||
roccaControl.roccaParameters.getChannelMap());
|
||||
rsdb.setNaturalLifetimeMillis(Integer.MAX_VALUE);
|
||||
|
||||
/*
|
||||
* this one probably OK to never delete ? Nope lots of stuff goes in
|
||||
* here, so it seems it will eventually bring the system down.
|
||||
*/
|
||||
rsdb.setNaturalLifetimeMillis(roccaControl.getMaxDataKeepTime());
|
||||
|
||||
rdl = new RoccaDetectionLogger(this, rsdb);
|
||||
rsdb.SetLogging(rdl);
|
||||
rsdb.setMixedDirection(PamDataBlock.MIX_INTODATABASE);
|
||||
|
@ -171,6 +171,8 @@ public class RoccaWhistleSelect extends PamProcess implements SpectrogramMarkObs
|
||||
roccaControl.roccaSidePanel.sidePanel.addASighting(false);
|
||||
// if the user hit cancel, just exit
|
||||
if (dummy == RoccaSightingDataUnit.NONE) {
|
||||
selectedWhistle.setNaturalLifetimeMillis(0);
|
||||
selectedWhistleRaw.setNaturalLifetimeMillis(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -198,6 +200,14 @@ public class RoccaWhistleSelect extends PamProcess implements SpectrogramMarkObs
|
||||
selectedWhistleRaw,
|
||||
display,
|
||||
channel);
|
||||
|
||||
/**
|
||||
* DG June '22.
|
||||
* I hope IT's K to set these back here. It's possible it's also
|
||||
* done elsewhere.
|
||||
*/
|
||||
selectedWhistle.setNaturalLifetimeMillis(0);
|
||||
selectedWhistleRaw.setNaturalLifetimeMillis(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -304,7 +304,7 @@ public class SimProcess extends DaqSystem implements PamSettings {
|
||||
/* simulate the noise, need to divide fs by 2 to only generate for 0 to Nyquist to get correct values out.
|
||||
* that match the results of the noise band monitor modules.
|
||||
*/
|
||||
double dbNse = simParameters.backgroundNoise + 10*Math.log10(getSampleRate()/2);
|
||||
double dbNse = simParameters.backgroundNoise + 10*Math.log10(getSampleRate()/2.);
|
||||
nse = daqControl.getDaqProcess().dbMicropascalToSignal(i, dbNse);
|
||||
generateNoise(channelData, nse);
|
||||
// generateNoiseQuickly(channelData, nse, i);
|
||||
|
@ -27,6 +27,9 @@ public class SimSignals {
|
||||
simSignalList.add(new ClickSound("Click", 3000, 3000, 2e-3, WINDOWTYPE.DECAY));
|
||||
simSignalList.add(new ClickSound("Chirp", 3000, 6000, 0.1, WINDOWTYPE.TAPER10));
|
||||
simSignalList.add(new ClickSound("Chirp", 3000, 8000, 0.5, WINDOWTYPE.TAPER10));
|
||||
simSignalList.add(new ClickSound("Dolphin Click", 60000, 60000, 20.e-6, WINDOWTYPE.DECAY));
|
||||
simSignalList.add(new ClickSound("Fin 20Hz", 20, 20, 0.5, WINDOWTYPE.HANN));
|
||||
simSignalList.add(new ClickSound("Fin 40Hz", 40, 40, 0.5, WINDOWTYPE.HANN));
|
||||
// simSignalList.add(new LinearChirp(simProcess.getSampleRate(), 3000, 6000, 0.1));
|
||||
// simSignalList.add(new LinearChirp(simProcess.getSampleRate(), 3000, 8000, .5));
|
||||
simSignalList.add(new RandomWhistles());
|
||||
|
@ -67,7 +67,8 @@ public class SingleLineWarningDisplay implements WarningDisplay {
|
||||
lastWarning.setToolTipText(null);
|
||||
}
|
||||
else {
|
||||
String str = String.format("Warning: %s-%s ", w.getWarningSource(), w.getWarningMessage());
|
||||
String str = w.getWarnignLevel() > 0 ? "Warning: " : "";
|
||||
str += String.format("%s-%s ", w.getWarningSource(), w.getWarningMessage());
|
||||
lastWarning.setText(str);
|
||||
lastWarning.setWarningLevel(w.getWarnignLevel());
|
||||
lastWarning.setToolTipText(w.getWarningTip());
|
||||
|
Loading…
Reference in New Issue
Block a user