mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-25 08:32:32 +00:00
Merge branch 'main' of https://github.com/macster110/PAMGuard
This commit is contained in:
commit
d3d998ca87
@ -6,7 +6,7 @@
|
|||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Amazon Coretto 21">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="module" value="true"/>
|
<attribute name="module" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
encoding//src/rawDeepLearningClassifer/segmenter/SegmenterProcess.java=UTF-8
|
encoding//src/rawDeepLearningClassifer/segmenter/SegmenterProcess.java=UTF-8
|
||||||
encoding//src/test=UTF-8
|
|
||||||
encoding//src/test/resources=UTF-8
|
encoding//src/test/resources=UTF-8
|
||||||
encoding/<project>=UTF-8
|
encoding/<project>=UTF-8
|
||||||
encoding/src=UTF-8
|
encoding/src=UTF-8
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=18
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
org.eclipse.jdt.core.compiler.compliance=21
|
org.eclipse.jdt.core.compiler.compliance=18
|
||||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
@ -13,4 +13,4 @@ org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
|||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||||
org.eclipse.jdt.core.compiler.release=enabled
|
org.eclipse.jdt.core.compiler.release=enabled
|
||||||
org.eclipse.jdt.core.compiler.source=21
|
org.eclipse.jdt.core.compiler.source=18
|
||||||
|
43
pom.xml
43
pom.xml
@ -302,11 +302,7 @@
|
|||||||
<version>0.0.57</version>
|
<version>0.0.57</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--jpam project - Deep learning java library
|
<!--jpam project - Deep learning java library -->
|
||||||
DG has commented this out since there are problems with access to the maven repo
|
|
||||||
on JDJM's Github. For now a jar file is included in the build and we'll go back to
|
|
||||||
Maven when we can ... DG 15 Jan 2022.
|
|
||||||
Repo for jpam code- this used for deep learning [15:17] Jamie MacAulay-->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.macster110</groupId>
|
<groupId>io.github.macster110</groupId>
|
||||||
<artifactId>jdl4pam</artifactId>
|
<artifactId>jdl4pam</artifactId>
|
||||||
@ -372,7 +368,7 @@
|
|||||||
<version>${javafx.version}</version>
|
<version>${javafx.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Decorates JavaFX components-->
|
<!-- Decorates JavaFX components with error icons if inputs are incorrect-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.synedra</groupId>
|
<groupId>net.synedra</groupId>
|
||||||
<artifactId>validatorfx</artifactId>
|
<artifactId>validatorfx</artifactId>
|
||||||
@ -466,6 +462,13 @@
|
|||||||
<version>12.3.1</version>
|
<version>12.3.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Icon symbol pack for swing icons . -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.kordamp.ikonli</groupId>
|
||||||
|
<artifactId>ikonli-swing</artifactId>
|
||||||
|
<version>12.3.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Ikonli MaterialDesign2 (Latest) font pack https://kordamp.org/ikonli/cheat-sheet-materialdesign2.html -->
|
<!-- Ikonli MaterialDesign2 (Latest) font pack https://kordamp.org/ikonli/cheat-sheet-materialdesign2.html -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.kordamp.ikonli</groupId>
|
<groupId>org.kordamp.ikonli</groupId>
|
||||||
@ -480,30 +483,28 @@
|
|||||||
<version>12.3.1</version>
|
<version>12.3.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/net.sf.geographiclib/GeographicLib-Java -->
|
<!-- https://mvnrepository.com/artifact/net.sf.geographiclib/GeographicLib-Java
|
||||||
|
Used in the video range module-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.sf.geographiclib</groupId>
|
<groupId>net.sf.geographiclib</groupId>
|
||||||
<artifactId>GeographicLib-Java</artifactId>
|
<artifactId>GeographicLib-Java</artifactId>
|
||||||
<version>1.50</version>
|
<version>1.50</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.jogamp.gluegen/gluegen -->
|
<!-- https://mvnrepository.com/artifact/org.jogamp.gluegen/gluegen
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jogamp.gluegen</groupId>
|
<groupId>org.jogamp.gluegen</groupId>
|
||||||
<artifactId>gluegen-rt-main</artifactId>
|
<artifactId>gluegen-rt-main</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.3.2</version>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/java3d/j3dutils -->
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/java3d/j3dcore -->
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.healthmarketscience.jackcess/jackcess -->
|
<!-- https://mvnrepository.com/artifact/com.healthmarketscience.jackcess/jackcess
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.healthmarketscience.jackcess</groupId>
|
<groupId>com.healthmarketscience.jackcess</groupId>
|
||||||
<artifactId>jackcess</artifactId>
|
<artifactId>jackcess</artifactId>
|
||||||
<version>3.0.1</version>
|
<version>3.0.1</version>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -512,12 +513,12 @@
|
|||||||
<version>2.10.1</version>
|
<version>2.10.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.jogamp.jogl/jogl-all-main -->
|
<!-- https://mvnrepository.com/artifact/org.jogamp.jogl/jogl-all-main
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jogamp.jogl</groupId>
|
<groupId>org.jogamp.jogl</groupId>
|
||||||
<artifactId>jogl-all-main</artifactId>
|
<artifactId>jogl-all-main</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.3.2</version>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
|
|
||||||
<!-- NOT SURE IF WE NEED THE JAXB LIBRARIES HERE - NO ERRORS WHEN REMOVED
|
<!-- NOT SURE IF WE NEED THE JAXB LIBRARIES HERE - NO ERRORS WHEN REMOVED
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -654,7 +655,8 @@
|
|||||||
<version>42.2.24</version>
|
<version>42.2.24</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.renjin/renjin-script-engine -->
|
<!-- https://mvnrepository.com/artifact/org.renjin/renjin-script-engine
|
||||||
|
Used to export data to R structures-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.renjin</groupId>
|
<groupId>org.renjin</groupId>
|
||||||
<artifactId>renjin-script-engine</artifactId>
|
<artifactId>renjin-script-engine</artifactId>
|
||||||
@ -669,8 +671,7 @@
|
|||||||
<version>1.8.0-beta4</version>
|
<version>1.8.0-beta4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-nop
|
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-nop
|
||||||
this one is only needed to get rid of an annoying warning that shows up during startup -->
|
this one is only needed to get rid of an annoying warning that shows up during startup -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -906,7 +907,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/it.sauronsoftware/jave -->
|
<!-- https://mvnrepository.com/artifact/it.sauronsoftware/jave -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>it.sauronsoftware</groupId>
|
<groupId>it.sauronsoftware</groupId>
|
||||||
<artifactId>jave</artifactId>
|
<artifactId>jave</artifactId>
|
||||||
|
@ -45,7 +45,6 @@ import whistlesAndMoans.AbstractWhistleDataUnit;
|
|||||||
import fftManager.FFTDataUnit;
|
import fftManager.FFTDataUnit;
|
||||||
import fftManager.PamFFTControl;
|
import fftManager.PamFFTControl;
|
||||||
import group3dlocaliser.Group3DLocaliserControl;
|
import group3dlocaliser.Group3DLocaliserControl;
|
||||||
import metadata.MetaDataContol;
|
|
||||||
import meygenturbine.MeygenTurbine;
|
import meygenturbine.MeygenTurbine;
|
||||||
import printscreen.PrintScreenControl;
|
import printscreen.PrintScreenControl;
|
||||||
import rockBlock.RockBlockControl;
|
import rockBlock.RockBlockControl;
|
||||||
@ -472,6 +471,7 @@ final public class PamModel implements PamSettings {
|
|||||||
mi.setToolTipText("Interface to Tethys Database");
|
mi.setToolTipText("Interface to Tethys Database");
|
||||||
mi.setModulesMenuGroup(utilitiesGroup);
|
mi.setModulesMenuGroup(utilitiesGroup);
|
||||||
mi.setMaxNumber(1);
|
mi.setMaxNumber(1);
|
||||||
|
//mi.addGUICompatabilityFlag(PamGUIManager.FX); //has FX enabled GUI.
|
||||||
mi.setHidden(SMRUEnable.isEnable() == false);
|
mi.setHidden(SMRUEnable.isEnable() == false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +74,11 @@ import javax.swing.event.MenuListener;
|
|||||||
|
|
||||||
import Acquisition.DaqSystemInterface;
|
import Acquisition.DaqSystemInterface;
|
||||||
import annotation.tasks.AnnotationManager;
|
import annotation.tasks.AnnotationManager;
|
||||||
|
import export.layoutFX.ExportOptions;
|
||||||
import metadata.MetaDataContol;
|
import metadata.MetaDataContol;
|
||||||
|
import pamViewFX.fxNodes.pamDialogFX.PamDialogFX2AWT;
|
||||||
import performanceTests.PerformanceDialog;
|
import performanceTests.PerformanceDialog;
|
||||||
|
import rawDeepLearningClassifier.RawDLParams;
|
||||||
import tipOfTheDay.TipOfTheDayManager;
|
import tipOfTheDay.TipOfTheDayManager;
|
||||||
import Array.ArrayManager;
|
import Array.ArrayManager;
|
||||||
//import Logging.LogDataObserver;
|
//import Logging.LogDataObserver;
|
||||||
@ -86,6 +89,7 @@ import PamController.PamControllerInterface;
|
|||||||
import PamController.PamSettingManager;
|
import PamController.PamSettingManager;
|
||||||
import PamController.PamSettings;
|
import PamController.PamSettings;
|
||||||
import PamController.PamguardVersionInfo;
|
import PamController.PamguardVersionInfo;
|
||||||
|
import PamController.SettingsPane;
|
||||||
import PamController.settings.SettingsImport;
|
import PamController.settings.SettingsImport;
|
||||||
import PamModel.CommonPluginInterface;
|
import PamModel.CommonPluginInterface;
|
||||||
import PamModel.PamModel;
|
import PamModel.PamModel;
|
||||||
@ -668,6 +672,13 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
|
|||||||
startMenuEnabler.addMenuItem(menuItem);
|
startMenuEnabler.addMenuItem(menuItem);
|
||||||
fileMenu.add(menuItem);
|
fileMenu.add(menuItem);
|
||||||
|
|
||||||
|
//export items
|
||||||
|
menuItem = new JMenuItem("Export Data ...");
|
||||||
|
menuItem.addActionListener(new ExportOptionsListener(getGuiFrame()));
|
||||||
|
startMenuEnabler.addMenuItem(menuItem);
|
||||||
|
fileMenu.add(menuItem);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < pamControllerInterface.getNumControlledUnits(); i++) {
|
for (int i = 0; i < pamControllerInterface.getNumControlledUnits(); i++) {
|
||||||
|
|
||||||
menuItem = pamControllerInterface.getControlledUnit(i).createFileMenu(frame);
|
menuItem = pamControllerInterface.getControlledUnit(i).createFileMenu(frame);
|
||||||
@ -975,6 +986,20 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ExportOptionsListener implements ActionListener {
|
||||||
|
private JFrame parentFrame;
|
||||||
|
|
||||||
|
public ExportOptionsListener(JFrame parentFrame) {
|
||||||
|
super();
|
||||||
|
this.parentFrame = parentFrame;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
//show the export options dialog.
|
||||||
|
ExportOptions.getInstance().showDialog(parentFrame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class MenuGeneralXMLExport implements ActionListener {
|
class MenuGeneralXMLExport implements ActionListener {
|
||||||
private JFrame parentFrame;
|
private JFrame parentFrame;
|
||||||
public MenuGeneralXMLExport(JFrame parentFrame) {
|
public MenuGeneralXMLExport(JFrame parentFrame) {
|
||||||
|
@ -274,10 +274,7 @@ public class DataMapPaneFX extends PamBorderPane implements UserDisplayNodeFX {
|
|||||||
* @param timeEnd - the end of loaded data in millis.
|
* @param timeEnd - the end of loaded data in millis.
|
||||||
*/
|
*/
|
||||||
public void selectedDataTime(Long timeStart, Long timeEnd) {
|
public void selectedDataTime(Long timeStart, Long timeEnd) {
|
||||||
System.out.println("SELECTED DATA TIME: " + timeStart + " " + timeEnd);
|
|
||||||
summaryPane.setSelectedDataTime(timeStart, timeEnd);
|
summaryPane.setSelectedDataTime(timeStart, timeEnd);
|
||||||
dateAxis.setUpperBound(timeEnd);
|
|
||||||
dateAxis.setLowerBound(timeStart);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ public class DataStreamPaneFX extends PamBorderPane {
|
|||||||
|
|
||||||
long time2 = System.currentTimeMillis();
|
long time2 = System.currentTimeMillis();
|
||||||
|
|
||||||
System.out.println("Paint Canvas: " + this + " " + System.currentTimeMillis() + " " + (time2-time1));
|
//System.out.println("Paint Canvas: " + this + " " + System.currentTimeMillis() + " " + (time2-time1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,12 +9,15 @@ import PamUtils.PamCalendar;
|
|||||||
import binaryFileStorage.BinaryStore;
|
import binaryFileStorage.BinaryStore;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.ComboBox;
|
import javafx.scene.control.ComboBox;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.Slider;
|
import javafx.scene.control.Slider;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
|
import javafx.util.StringConverter;
|
||||||
import pamViewFX.PamGuiManagerFX;
|
import pamViewFX.PamGuiManagerFX;
|
||||||
import pamViewFX.fxNodes.PamBorderPane;
|
import pamViewFX.fxNodes.PamBorderPane;
|
||||||
import pamViewFX.fxNodes.PamGridPane;
|
import pamViewFX.fxNodes.PamGridPane;
|
||||||
@ -22,6 +25,7 @@ import pamViewFX.fxNodes.PamHBox;
|
|||||||
import pamViewFX.fxNodes.PamVBox;
|
import pamViewFX.fxNodes.PamVBox;
|
||||||
import pamViewFX.fxNodes.pamDialogFX.PamDialogFX;
|
import pamViewFX.fxNodes.pamDialogFX.PamDialogFX;
|
||||||
import pamViewFX.fxNodes.sliders.PamSlider;
|
import pamViewFX.fxNodes.sliders.PamSlider;
|
||||||
|
import pamViewFX.fxNodes.utilityPanes.PamToggleSwitch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows uses to change the horizontal and vertical scales on the data map.
|
* Allows uses to change the horizontal and vertical scales on the data map.
|
||||||
@ -59,14 +63,17 @@ public class ScalePaneFX extends PamBorderPane {
|
|||||||
/**
|
/**
|
||||||
* Check box for log vertical scale.
|
* Check box for log vertical scale.
|
||||||
*/
|
*/
|
||||||
private CheckBox logScaleBox;
|
private PamToggleSwitch logScaleBox;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The chosen time values.
|
* The chosen time values.
|
||||||
*/
|
*/
|
||||||
private double[] timeScaleChoices = DataMapParameters.hScaleChoices;
|
private double[] timeScaleChoices = DataMapParameters.hScaleChoices;
|
||||||
|
|
||||||
private Pane datagramPane;
|
/**
|
||||||
|
* Combo box holding options to channge the datargam bin size
|
||||||
|
*/
|
||||||
|
private ComboBox<String> datagramBox;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds a list of times for the datagram bin size.
|
* Holds a list of times for the datagram bin size.
|
||||||
@ -76,7 +83,14 @@ public class ScalePaneFX extends PamBorderPane {
|
|||||||
/**
|
/**
|
||||||
* Holds everything.
|
* Holds everything.
|
||||||
*/
|
*/
|
||||||
private PamVBox holder;
|
private PamVBox holder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grid pane with settings for the data scales
|
||||||
|
*/
|
||||||
|
private PamGridPane scaleSettingsPane;
|
||||||
|
|
||||||
|
private Label dataGramLabel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -84,9 +98,16 @@ public class ScalePaneFX extends PamBorderPane {
|
|||||||
this.dataMapControl = dataMapControl;
|
this.dataMapControl = dataMapControl;
|
||||||
this.dataMapPane = dataMapPane;
|
this.dataMapPane = dataMapPane;
|
||||||
|
|
||||||
|
// //create the holder pane.
|
||||||
|
// PamVBox vBoxHolder=new PamVBox();
|
||||||
|
// vBoxHolder.setSpacing(5);
|
||||||
|
// Label title=new Label("Scales");
|
||||||
|
// PamGuiManagerFX.titleFont2style(title);
|
||||||
|
// vBoxHolder.getChildren().addAll(title, controlPane);
|
||||||
|
|
||||||
holder=new PamVBox();
|
holder=new PamVBox();
|
||||||
holder.setSpacing(20);
|
holder.setSpacing(20);
|
||||||
holder.getChildren().add(createScalePane());
|
holder.getChildren().add(scaleSettingsPane = createScalePane());
|
||||||
|
|
||||||
this.setCenter(holder);
|
this.setCenter(holder);
|
||||||
|
|
||||||
@ -103,31 +124,28 @@ public class ScalePaneFX extends PamBorderPane {
|
|||||||
public void checkDataGramPane(){
|
public void checkDataGramPane(){
|
||||||
if (BinaryStore.findBinaryStoreControl()!=null){
|
if (BinaryStore.findBinaryStoreControl()!=null){
|
||||||
DatagramManager dataGramManager=BinaryStore.findBinaryStoreControl().getDatagramManager();
|
DatagramManager dataGramManager=BinaryStore.findBinaryStoreControl().getDatagramManager();
|
||||||
if (dataGramManager!=null && datagramPane==null) {
|
if (dataGramManager!=null && datagramBox==null) {
|
||||||
datagramPane=createDatagramPane(dataGramManager);
|
datagramBox=createDatagramPane(dataGramManager);
|
||||||
holder.getChildren().add(datagramPane);
|
scaleSettingsPane.add(dataGramLabel= new Label("Datagram bin size"), 0, 2);
|
||||||
|
scaleSettingsPane.add(dataGramComboBox, 1, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
holder.getChildren().remove(datagramPane);
|
scaleSettingsPane.getChildren().remove(dataGramLabel);
|
||||||
datagramPane=null;
|
scaleSettingsPane.getChildren().remove(dataGramComboBox);
|
||||||
|
|
||||||
|
datagramBox=null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the pane to reset the datagram pane bin size.
|
* Create the a datagram combo box to change the size of the datagram
|
||||||
* @param dataGramManager - the datagram manager for the current biinary store.
|
* @param dataGramManager - the datagram manager for the current biinary store.
|
||||||
* @return
|
* @return a combo box with datagram bin sizes.
|
||||||
*/
|
*/
|
||||||
private Pane createDatagramPane(DatagramManager dataGramManager){
|
private ComboBox<String> createDatagramPane(DatagramManager dataGramManager){
|
||||||
|
|
||||||
|
|
||||||
PamGridPane dataGramOptions=new PamGridPane();
|
|
||||||
dataGramOptions.setHgap(5);
|
|
||||||
dataGramOptions.setVgap(5);
|
|
||||||
|
|
||||||
dataGramOptions.add(new Label("Datagram Bin Size"),0,0);
|
|
||||||
dataGramComboBox=new ComboBox<String>(createDurationList(dataGramManager));
|
dataGramComboBox=new ComboBox<String>(createDurationList(dataGramManager));
|
||||||
|
|
||||||
dataGramComboBox.getSelectionModel().select(durationToString(dataGramManager.getDatagramSettings().datagramSeconds*1000L));
|
dataGramComboBox.getSelectionModel().select(durationToString(dataGramManager.getDatagramSettings().datagramSeconds*1000L));
|
||||||
@ -147,19 +165,7 @@ public class ScalePaneFX extends PamBorderPane {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dataGramOptions.add(dataGramComboBox,1,0);
|
return dataGramComboBox;
|
||||||
|
|
||||||
//create the holder pane.
|
|
||||||
PamVBox vBoxHolder=new PamVBox();
|
|
||||||
vBoxHolder.setSpacing(5);
|
|
||||||
Label title=new Label("Datagram");
|
|
||||||
// title.setFont(PamGuiManagerFX.titleFontSize2);
|
|
||||||
PamGuiManagerFX.titleFont2style(title);
|
|
||||||
|
|
||||||
vBoxHolder.getChildren().addAll(title, dataGramOptions);
|
|
||||||
|
|
||||||
|
|
||||||
return vBoxHolder;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,19 +190,24 @@ public class ScalePaneFX extends PamBorderPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Node createScalePane() {
|
private PamGridPane createScalePane() {
|
||||||
|
|
||||||
PamGridPane controlPane=new PamGridPane();
|
PamGridPane controlPane=new PamGridPane();
|
||||||
controlPane.setHgap(5);
|
controlPane.setHgap(5);
|
||||||
controlPane.setVgap(5);
|
controlPane.setVgap(5);
|
||||||
|
|
||||||
//create time scale controls
|
//create time scale controls
|
||||||
controlPane.add(new Label("Time"),0,1);
|
controlPane.add(new Label("Time window"),0,1);
|
||||||
|
|
||||||
//create time slider
|
//create time slider
|
||||||
timeSlider=new Slider(0, timeScaleChoices.length-1, 1);
|
timeSlider=new Slider(0, timeScaleChoices.length-1, 1);
|
||||||
timeSlider.setShowTickLabels(true);
|
timeSlider.setShowTickLabels(true);
|
||||||
timeSlider.setShowTickMarks(true);
|
timeSlider.setShowTickMarks(true);
|
||||||
|
timeSlider.setMajorTickUnit(1);
|
||||||
|
|
||||||
|
timeSlider.setLabelFormatter(new ScaleStringConverter());
|
||||||
|
|
||||||
|
// PamGridPane.setHalignment(timeSlider, Pos.BOTTOM_CENTER);
|
||||||
|
|
||||||
controlPane.add(timeSlider,1,1);
|
controlPane.add(timeSlider,1,1);
|
||||||
//add listener to time slider to change datamap.
|
//add listener to time slider to change datamap.
|
||||||
@ -205,10 +216,11 @@ public class ScalePaneFX extends PamBorderPane {
|
|||||||
dataMapPane.scaleChanged();
|
dataMapPane.scaleChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
controlPane.add(timeScaleLabel=new Label(""),2,1);
|
controlPane.add(timeScaleLabel=new Label(""),3,1);
|
||||||
|
|
||||||
//create vertical scale controls
|
//create vertical scale controls
|
||||||
controlPane.add(new Label("Data Counts"),0,0);
|
controlPane.add(new Label("Data counts"),0,0);
|
||||||
|
|
||||||
|
|
||||||
scaleBox=new ComboBox<String> ();
|
scaleBox=new ComboBox<String> ();
|
||||||
scaleBox.getItems().add("No Scaling");
|
scaleBox.getItems().add("No Scaling");
|
||||||
@ -217,28 +229,37 @@ public class ScalePaneFX extends PamBorderPane {
|
|||||||
scaleBox.getItems().add("per Hour");
|
scaleBox.getItems().add("per Hour");
|
||||||
scaleBox.getItems().add("per Day");
|
scaleBox.getItems().add("per Day");
|
||||||
controlPane.add(scaleBox,1,0);
|
controlPane.add(scaleBox,1,0);
|
||||||
|
scaleBox.setPrefWidth(200);
|
||||||
|
|
||||||
scaleBox.valueProperty().addListener((ov, oldVal, newVal)->{
|
scaleBox.valueProperty().addListener((ov, oldVal, newVal)->{
|
||||||
dataMapPane.scaleChanged();
|
dataMapPane.scaleChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
logScaleBox=new CheckBox("Log Scale");
|
logScaleBox=new PamToggleSwitch("Log Scale");
|
||||||
logScaleBox.setOnAction((action)->{
|
logScaleBox.selectedProperty().addListener((obsVal, oldVal, newVal)->{
|
||||||
dataMapPane.scaleChanged();
|
dataMapPane.scaleChanged();
|
||||||
});;
|
});
|
||||||
controlPane.add(logScaleBox,2,0);
|
|
||||||
|
|
||||||
//create the holder pane.
|
|
||||||
PamVBox vBoxHolder=new PamVBox();
|
controlPane.add(logScaleBox,3,0);
|
||||||
vBoxHolder.setSpacing(5);
|
|
||||||
Label title=new Label("Scales");
|
|
||||||
PamGuiManagerFX.titleFont2style(title);
|
|
||||||
vBoxHolder.getChildren().addAll(title, controlPane);
|
|
||||||
|
|
||||||
|
|
||||||
|
return controlPane;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ScaleStringConverter extends StringConverter<Double> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(Double object) {
|
||||||
|
return String.valueOf(timeScaleChoices[object.intValue()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Double fromString(String string) {
|
||||||
|
return Double.valueOf(string);
|
||||||
|
}
|
||||||
|
|
||||||
return vBoxHolder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,22 +8,19 @@ import PamUtils.PamCalendar;
|
|||||||
import javafx.animation.KeyFrame;
|
import javafx.animation.KeyFrame;
|
||||||
import javafx.animation.Timeline;
|
import javafx.animation.Timeline;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.geometry.Side;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.ScrollBar;
|
import javafx.scene.control.ScrollBar;
|
||||||
import javafx.scene.control.ScrollPane.ScrollBarPolicy;
|
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.text.Text;
|
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
import PamguardMVC.PamDataBlock;
|
import PamguardMVC.PamDataBlock;
|
||||||
import dataMap.DataMapControl;
|
import dataMap.DataMapControl;
|
||||||
import pamViewFX.fxGlyphs.PamGlyphDude;
|
|
||||||
import pamViewFX.fxNodes.PamBorderPane;
|
import pamViewFX.fxNodes.PamBorderPane;
|
||||||
import pamViewFX.fxNodes.PamButton;
|
|
||||||
import pamViewFX.fxNodes.PamColorsFX;
|
import pamViewFX.fxNodes.PamColorsFX;
|
||||||
import pamViewFX.fxNodes.PamScrollPane;
|
import pamViewFX.fxNodes.PamScrollPane;
|
||||||
import pamViewFX.fxNodes.PamVBox;
|
import pamViewFX.fxNodes.PamVBox;
|
||||||
import pamViewFX.fxNodes.sashPane.SashPane;
|
import pamViewFX.fxNodes.pamAxis.PamDateAxis;
|
||||||
|
|
||||||
public class ScrollingDataPaneFX extends PamBorderPane {
|
public class ScrollingDataPaneFX extends PamBorderPane {
|
||||||
|
|
||||||
@ -99,8 +96,10 @@ public class ScrollingDataPaneFX extends PamBorderPane {
|
|||||||
|
|
||||||
private PamBorderPane holder;
|
private PamBorderPane holder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Axis which shows the current dates
|
||||||
|
*/
|
||||||
|
private PamDateAxis dateAxis;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the ScrollingDataPaneFX
|
* Constructor for the ScrollingDataPaneFX
|
||||||
@ -162,6 +161,18 @@ public class ScrollingDataPaneFX extends PamBorderPane {
|
|||||||
notifyScrollChange(300);
|
notifyScrollChange(300);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
dateAxis = new PamDateAxis();
|
||||||
|
dateAxis.setAutoRanging(false);
|
||||||
|
dateAxis.setLabel("Time");
|
||||||
|
dateAxis.setSide(Side.TOP);
|
||||||
|
dateAxis.setAnimated(false);
|
||||||
|
dateAxis.setMinHeight(50);
|
||||||
|
// dateAxis.prefWidthProperty().bind(scrollingDataPanel.widthProperty());
|
||||||
|
// dateAxis.setStyle("-fx-background-color: ORANGE;");
|
||||||
|
dateAxis.setForceZeroInRange(false);
|
||||||
|
holder.setTop(dateAxis);
|
||||||
|
|
||||||
return holder;
|
return holder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,6 +215,8 @@ public class ScrollingDataPaneFX extends PamBorderPane {
|
|||||||
notifyScrollChange();
|
notifyScrollChange();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
timeScrollBar.setPrefHeight(20);
|
||||||
|
|
||||||
holder.setCenter(timeScrollBar);
|
holder.setCenter(timeScrollBar);
|
||||||
holder.setBottom(timeLabelPane);
|
holder.setBottom(timeLabelPane);
|
||||||
|
|
||||||
@ -236,10 +249,13 @@ public class ScrollingDataPaneFX extends PamBorderPane {
|
|||||||
dataStreamPanels.get(i).scrollChanged();
|
dataStreamPanels.get(i).scrollChanged();
|
||||||
}
|
}
|
||||||
settingsStrip.scrollChanged();
|
settingsStrip.scrollChanged();
|
||||||
|
|
||||||
|
updateDateAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
Timeline timeline;
|
Timeline timeline;
|
||||||
long lastTime = 0;
|
long lastTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify all panels and the settings strip that the scroll bar moved - but have a timer to wait to not call too often.
|
* Notify all panels and the settings strip that the scroll bar moved - but have a timer to wait to not call too often.
|
||||||
*/
|
*/
|
||||||
@ -259,9 +275,19 @@ public class ScrollingDataPaneFX extends PamBorderPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lastTime=currentTime;
|
lastTime=currentTime;
|
||||||
|
|
||||||
|
updateDateAxis();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateDateAxis() {
|
||||||
|
calcStartEndMillis();
|
||||||
|
dateAxis.setUpperBound(screenEndMillis);
|
||||||
|
dateAxis.setLowerBound(screenStartMillis);
|
||||||
|
double[] ticks = dateAxis.recalculateTicks();
|
||||||
|
System.out.println("Ticks: " + (ticks[3]/1000/3600) + "hours");
|
||||||
|
dateAxis.setTickUnit(ticks[3]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the data graphs to go into the pane.
|
* Create the data graphs to go into the pane.
|
||||||
@ -282,7 +308,7 @@ public class ScrollingDataPaneFX extends PamBorderPane {
|
|||||||
for (int i = 0; i < dataBlocks.size(); i++) {
|
for (int i = 0; i < dataBlocks.size(); i++) {
|
||||||
aStreamPanel = new DataStreamPaneFX(dataMapControl, this, dataBlocks.get(i));
|
aStreamPanel = new DataStreamPaneFX(dataMapControl, this, dataBlocks.get(i));
|
||||||
dataStreamPanels.add(aStreamPanel);
|
dataStreamPanels.add(aStreamPanel);
|
||||||
dataStreamPanels.get(i).setPrefHeight(DATASTREAMPANE_HEIGHT);
|
dataStreamPanels.get(i).setMinHeight(DATASTREAMPANE_HEIGHT);
|
||||||
//now add to a split pane.
|
//now add to a split pane.
|
||||||
//SplitPane.setResizableWithParent(aStreamPanel, true);
|
//SplitPane.setResizableWithParent(aStreamPanel, true);
|
||||||
dataPanePanes.getChildren().add(aStreamPanel);
|
dataPanePanes.getChildren().add(aStreamPanel);
|
||||||
|
@ -637,6 +637,14 @@ public class ModuleConnectionNode extends StandardConnectionNode implements PAMC
|
|||||||
removeConnectionPlug(getConnectionPlugs().get(i),false);
|
removeConnectionPlug(getConnectionPlugs().get(i),false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Tooltip tooltip = ModuleToolTipFactory.getToolTip(pamControlledUnit);
|
||||||
|
|
||||||
|
if (tooltip!=null) {
|
||||||
|
Tooltip. install(this, tooltip);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pamControlledUnit.getPamModuleInfo()!=null) {
|
if (pamControlledUnit.getPamModuleInfo()!=null) {
|
||||||
|
@ -36,7 +36,7 @@ public class ModuleIconFactory {
|
|||||||
public enum ModuleIcon {
|
public enum ModuleIcon {
|
||||||
DATAMAP, NMEA, GPS, MAP, SOUND_AQ, SOUND_OUTPUT, FFT, FILTER, CLICK, CLICK_TRAIN, RECORDER, WHISTLE_MOAN,
|
DATAMAP, NMEA, GPS, MAP, SOUND_AQ, SOUND_OUTPUT, FFT, FILTER, CLICK, CLICK_TRAIN, RECORDER, WHISTLE_MOAN,
|
||||||
NOISE_BAND, NOISE_FILT, DATABASE, BINARY, TIME_DISPLAY, DETECTION_DISPLAY, ARRAY, DEEP_LEARNING, MATCHED_CLICK_CLASSIFIER,
|
NOISE_BAND, NOISE_FILT, DATABASE, BINARY, TIME_DISPLAY, DETECTION_DISPLAY, ARRAY, DEEP_LEARNING, MATCHED_CLICK_CLASSIFIER,
|
||||||
DECIMATOR, CPOD
|
DECIMATOR, CPOD, TETHYS
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,14 +130,14 @@ public class ModuleIconFactory {
|
|||||||
case CPOD:
|
case CPOD:
|
||||||
iconNode = new Label("CPOD"); //TEMP
|
iconNode = new Label("CPOD"); //TEMP
|
||||||
break;
|
break;
|
||||||
|
case TETHYS:
|
||||||
|
iconNode = PamGlyphDude.createModuleIcon("file-codemeta");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
long time2 = System.currentTimeMillis();
|
long time2 = System.currentTimeMillis();
|
||||||
|
|
||||||
//System.out.println("GET MODULE ICON: " + icon + " load time: " + (time2-time1));
|
|
||||||
|
|
||||||
return iconNode;
|
return iconNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -215,6 +215,7 @@ public class ModuleIconFactory {
|
|||||||
* @return the module icon enum
|
* @return the module icon enum
|
||||||
*/
|
*/
|
||||||
public ModuleIcon getModuleIcon(String className) {
|
public ModuleIcon getModuleIcon(String className) {
|
||||||
|
System.out.println("Get module icon: " + className);
|
||||||
ModuleIcon icon = null;
|
ModuleIcon icon = null;
|
||||||
switch (className) {
|
switch (className) {
|
||||||
case "Acquisition.AcquisitionControl":
|
case "Acquisition.AcquisitionControl":
|
||||||
@ -268,6 +269,9 @@ public class ModuleIconFactory {
|
|||||||
case "cpod.CPODControl2":
|
case "cpod.CPODControl2":
|
||||||
icon=ModuleIcon.CPOD;
|
icon=ModuleIcon.CPOD;
|
||||||
break;
|
break;
|
||||||
|
case "MetaDataControl":
|
||||||
|
icon = ModuleIcon.TETHYS;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
16
src/dataModelFX/connectionNodes/ModuleToolTipFactory.java
Normal file
16
src/dataModelFX/connectionNodes/ModuleToolTipFactory.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package dataModelFX.connectionNodes;
|
||||||
|
|
||||||
|
import PamController.PamControlledUnit;
|
||||||
|
import javafx.scene.control.Tooltip;
|
||||||
|
|
||||||
|
public class ModuleToolTipFactory {
|
||||||
|
|
||||||
|
public static Tooltip getToolTip(PamControlledUnit pamControlledUnit) {
|
||||||
|
|
||||||
|
if (pamControlledUnit.getPamModuleInfo()==null) return null;
|
||||||
|
|
||||||
|
return new Tooltip(pamControlledUnit.getPamModuleInfo().getToolTipText());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -13,6 +13,7 @@ import dataPlots.TDParameters;
|
|||||||
import dataPlotsFX.data.TDDataInfoFX;
|
import dataPlotsFX.data.TDDataInfoFX;
|
||||||
import dataPlotsFX.layout.TDDisplayFX;
|
import dataPlotsFX.layout.TDDisplayFX;
|
||||||
import dataPlotsFX.layout.TDGraphFX;
|
import dataPlotsFX.layout.TDGraphFX;
|
||||||
|
import detectiongrouplocaliser.DetectionGroupSummary;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main class for the TDDisplay.
|
* The main class for the TDDisplay.
|
||||||
@ -222,5 +223,13 @@ public abstract class TDControl implements PamSettings {
|
|||||||
this.uniqueDisplayName = uniqueName;
|
this.uniqueDisplayName = uniqueName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A new detection group has been selected.
|
||||||
|
* @param detectionGroup - the detection group that has been selected
|
||||||
|
*/
|
||||||
|
public void newSelectedDetectionGroup(DetectionGroupSummary detectionGroup, TDGraphFX tdGraph) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,8 @@ import dataPlotsFX.data.TDDataInfoFX;
|
|||||||
import dataPlotsFX.data.TDDataProviderFX;
|
import dataPlotsFX.data.TDDataProviderFX;
|
||||||
import dataPlotsFX.data.TDDataProviderRegisterFX;
|
import dataPlotsFX.data.TDDataProviderRegisterFX;
|
||||||
import dataPlotsFX.layout.TDDisplayFX;
|
import dataPlotsFX.layout.TDDisplayFX;
|
||||||
|
import dataPlotsFX.layout.TDGraphFX;
|
||||||
|
import detectiongrouplocaliser.DetectionGroupSummary;
|
||||||
import PamController.PamController;
|
import PamController.PamController;
|
||||||
import PamguardMVC.PamDataBlock;
|
import PamguardMVC.PamDataBlock;
|
||||||
import PamguardMVC.PamDataUnit;
|
import PamguardMVC.PamDataUnit;
|
||||||
@ -394,4 +396,10 @@ public class TDControlFX extends TDControl implements UserDisplayNodeFX {
|
|||||||
public void setFrameHolder(PamInternalPane internalFrame) {
|
public void setFrameHolder(PamInternalPane internalFrame) {
|
||||||
this.internalFrame=internalFrame;
|
this.internalFrame=internalFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void newSelectedDetectionGroup(DetectionGroupSummary detectionGroup, TDGraphFX tdGraph) {
|
||||||
|
System.out.println("New selected detection group: " + detectionGroup);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,12 @@ import userDisplayFX.UserDisplayControlFX;
|
|||||||
import userDisplayFX.UserDisplayNodeFX;
|
import userDisplayFX.UserDisplayNodeFX;
|
||||||
import PamController.PamController;
|
import PamController.PamController;
|
||||||
import PamController.PamControllerInterface;
|
import PamController.PamControllerInterface;
|
||||||
|
import PamguardMVC.PamDataBlock;
|
||||||
|
import PamguardMVC.PamDataUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The controller for the TD display. This is only used in the FX Gui where displays
|
* The controller for the TD display. This is only used in the FX GUI where displays
|
||||||
* tend to have equality with modules.
|
* tend to have equal parity with modules.
|
||||||
*
|
*
|
||||||
* @author Jamie Macaulay
|
* @author Jamie Macaulay
|
||||||
*
|
*
|
||||||
@ -30,6 +32,8 @@ public class TDDisplayController extends UserDisplayControlFX {
|
|||||||
*/
|
*/
|
||||||
private TDControlFX tdControlFX;
|
private TDControlFX tdControlFX;
|
||||||
|
|
||||||
|
private PamDataBlock selectedDataUnits;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public TDDisplayController(String unitName) {
|
public TDDisplayController(String unitName) {
|
||||||
@ -37,13 +41,18 @@ public class TDDisplayController extends UserDisplayControlFX {
|
|||||||
//set the compatible data units.
|
//set the compatible data units.
|
||||||
//indicate that this display can accept multiple parent data blocks at the same time.
|
//indicate that this display can accept multiple parent data blocks at the same time.
|
||||||
this.setMultiParent(true);
|
this.setMultiParent(true);
|
||||||
//set which PamDataUnits the display can show and therefore which datablocks it can accept as parents.
|
|
||||||
|
//set which PamDataUnits the display can show and therefore which data blocks it can accept as parents.
|
||||||
setCompatibleDataUnits();
|
setCompatibleDataUnits();
|
||||||
|
|
||||||
|
selectedDataUnits = new PamDataBlock(PamDataUnit.class, "Selected Data Units", getUserDisplayProcess() , Integer.MAX_VALUE); //TODO
|
||||||
|
|
||||||
|
getUserDisplayProcess().addOutputDataBlock(selectedDataUnits);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set compatible data units in the process for this display. This allows the data model to determine if connections can
|
* Set compatible data units in the process for this display. This allows the
|
||||||
* be made to the display.
|
* data model to determine if connections can be made to the display.
|
||||||
*/
|
*/
|
||||||
private void setCompatibleDataUnits(){
|
private void setCompatibleDataUnits(){
|
||||||
super.removeCompatibleDataUnits();
|
super.removeCompatibleDataUnits();
|
||||||
@ -61,7 +70,6 @@ public class TDDisplayController extends UserDisplayControlFX {
|
|||||||
* @param dataBlocks - the parent datablocks to set.
|
* @param dataBlocks - the parent datablocks to set.
|
||||||
*/
|
*/
|
||||||
protected void setParentDataBlocks(ArrayList<TDDataInfoFX> dataBlocks){
|
protected void setParentDataBlocks(ArrayList<TDDataInfoFX> dataBlocks){
|
||||||
// System.out.println("Set parent datablocks: " + dataBlocks.size());
|
|
||||||
allowProcessNotify=false;
|
allowProcessNotify=false;
|
||||||
|
|
||||||
while (getUserDisplayProcess().getNumMuiltiplexDataBlocks()>0){
|
while (getUserDisplayProcess().getNumMuiltiplexDataBlocks()>0){
|
||||||
@ -80,6 +88,7 @@ public class TDDisplayController extends UserDisplayControlFX {
|
|||||||
|
|
||||||
//disables notifications.
|
//disables notifications.
|
||||||
boolean allowProcessNotify=true;
|
boolean allowProcessNotify=true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notifyModelChanged(int type){
|
public void notifyModelChanged(int type){
|
||||||
// System.out.println("---------------------------------" );
|
// System.out.println("---------------------------------" );
|
||||||
|
19
src/dataPlotsFX/overlaymark/DetectionGroupListener.java
Normal file
19
src/dataPlotsFX/overlaymark/DetectionGroupListener.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package dataPlotsFX.overlaymark;
|
||||||
|
|
||||||
|
import detectiongrouplocaliser.DetectionGroupSummary;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listener for detection group.
|
||||||
|
*
|
||||||
|
* @author Jamie Macaulay
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface DetectionGroupListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A new detection group has been selected.
|
||||||
|
* @param detectionGroup - the detection group.
|
||||||
|
*/
|
||||||
|
public void newSelectedGroup(DetectionGroupSummary detectionGroup);
|
||||||
|
|
||||||
|
}
|
@ -42,73 +42,6 @@ public class OverlayMarkerManager extends ExtMouseAdapter {
|
|||||||
markerAdapters.add(new DragMarkerAdapter(tdGraphFX));
|
markerAdapters.add(new DragMarkerAdapter(tdGraphFX));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// public void subscribePanel(TDPlotPanel fxPlot) {
|
|
||||||
//
|
|
||||||
// fxPlot.setOnMouseClicked(new MouseClicked());
|
|
||||||
// fxPlot.setOnMousePressed(new MousePressed());
|
|
||||||
// fxPlot.setOnMouseReleased(new MouseReleased());
|
|
||||||
// fxPlot.setOnMouseMoved(new MouseMoved());
|
|
||||||
// fxPlot.setOnMouseDragged(new MouseDragged());
|
|
||||||
// fxPlot.setOnMouseEntered(new MouseEntered());
|
|
||||||
// fxPlot.setOnMouseExited(new MouseExited());
|
|
||||||
//
|
|
||||||
// for (TDOverlayMarker tdOverlayMarker: overlayMarkers){
|
|
||||||
// tdOverlayMarker.subscribePanel(fxPlot);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class MouseClicked implements EventHandler<MouseEvent> {
|
|
||||||
// @Override
|
|
||||||
// public void handle(MouseEvent event) {
|
|
||||||
//// System.out.println("Mouse Clicked: " + event.toString());
|
|
||||||
// overlayMarkers.get(currentMarker).mouseClicked(event);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class MousePressed implements EventHandler<MouseEvent> {
|
|
||||||
// @Override
|
|
||||||
// public void handle(MouseEvent event) {
|
|
||||||
//// System.out.println("Mouse Pressed: " + event.toString());
|
|
||||||
// overlayMarkers.get(currentMarker).mousePressed(event);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// class MouseReleased implements EventHandler<MouseEvent> {
|
|
||||||
// @Override
|
|
||||||
// public void handle(MouseEvent event) {
|
|
||||||
//// System.out.println("Mouse Released: " + event.toString());
|
|
||||||
// overlayMarkers.get(currentMarker).mouseReleased(event);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// class MouseMoved implements EventHandler<MouseEvent> {
|
|
||||||
// @Override
|
|
||||||
// public void handle(MouseEvent event) {
|
|
||||||
// overlayMarkers.get(currentMarker).mouseMoved(event);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// class MouseDragged implements EventHandler<MouseEvent> {
|
|
||||||
// @Override
|
|
||||||
// public void handle(MouseEvent event) {
|
|
||||||
// overlayMarkers.get(currentMarker).mouseDragged(event);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class MouseEntered implements EventHandler<MouseEvent> {
|
|
||||||
// @Override
|
|
||||||
// public void handle(MouseEvent event) {
|
|
||||||
//// System.out.println("Mouse Entered: " + event.toString());
|
|
||||||
// overlayMarkers.get(currentMarker).mouseEntered(event);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class MouseExited implements EventHandler<MouseEvent> {
|
|
||||||
// @Override
|
|
||||||
// public void handle(MouseEvent event) {
|
|
||||||
//// System.out.println("Mouse Exited: " + event.toString());
|
|
||||||
// overlayMarkers.get(currentMarker).mouseExited(event);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
public ArrayList<TDOverlayAdapter> getOverlayMarkers() {
|
public ArrayList<TDOverlayAdapter> getOverlayMarkers() {
|
||||||
return markerAdapters;
|
return markerAdapters;
|
||||||
|
@ -2,9 +2,15 @@ package dataPlotsFX.overlaymark;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.swing.JPopupMenu;
|
||||||
|
|
||||||
|
import PamView.GeneralProjector.ParameterType;
|
||||||
|
import PamView.paneloverlay.overlaymark.MarkDataSelector;
|
||||||
import PamView.paneloverlay.overlaymark.MarkRelationships;
|
import PamView.paneloverlay.overlaymark.MarkRelationships;
|
||||||
import PamView.paneloverlay.overlaymark.OverlayMark;
|
import PamView.paneloverlay.overlaymark.OverlayMark;
|
||||||
|
import PamView.paneloverlay.overlaymark.OverlayMarkObserver;
|
||||||
import PamView.paneloverlay.overlaymark.OverlayMarkProviders;
|
import PamView.paneloverlay.overlaymark.OverlayMarkProviders;
|
||||||
|
import PamView.paneloverlay.overlaymark.OverlayMarker;
|
||||||
import dataPlotsFX.layout.TDGraphFX;
|
import dataPlotsFX.layout.TDGraphFX;
|
||||||
import dataPlotsFX.layout.TDGraphFX.TDPlotPane;
|
import dataPlotsFX.layout.TDGraphFX.TDPlotPane;
|
||||||
import detectiongrouplocaliser.DetectionGroupSummary;
|
import detectiongrouplocaliser.DetectionGroupSummary;
|
||||||
@ -30,7 +36,7 @@ public class TDMarkerAdapter extends TDOverlayAdapter {
|
|||||||
/**
|
/**
|
||||||
* The overlay marker with hooks into other modules which subscribe to the display.
|
* The overlay marker with hooks into other modules which subscribe to the display.
|
||||||
*/
|
*/
|
||||||
private StandardOverlayMarker pamMarker;
|
private TDMarkerFX pamMarker;
|
||||||
|
|
||||||
public TDMarkerAdapter(TDGraphFX tdGraphFX){
|
public TDMarkerAdapter(TDGraphFX tdGraphFX){
|
||||||
|
|
||||||
@ -51,16 +57,20 @@ public class TDMarkerAdapter extends TDOverlayAdapter {
|
|||||||
MarkRelationships.getInstance().subscribeObservers(pamMarker);
|
MarkRelationships.getInstance().subscribeObservers(pamMarker);
|
||||||
}
|
}
|
||||||
pamMarker.setProjector(tdGraphFX.getGraphProjector());
|
pamMarker.setProjector(tdGraphFX.getGraphProjector());
|
||||||
|
|
||||||
|
pamMarker.addDetectionGroupListener((detectionGroup)->{
|
||||||
|
tdGraphFX.getTDDisplay().getTDControl().newSelectedDetectionGroup(detectionGroup, tdGraphFX);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the selected detections
|
* Get the selected detections
|
||||||
* @return class containing selected detections
|
* @return class containing selected detections
|
||||||
*/
|
*/
|
||||||
public DetectionGroupSummary getSelectedDetectionGroup(){
|
public DetectionGroupSummary getSelectedDetectionGroup(){
|
||||||
//get the currently selected data units.
|
//get the currently selected data units.
|
||||||
|
|
||||||
//System.out.println("Get selected detection group: " + pamMarker.getCurrentDetectionGroup());
|
|
||||||
return pamMarker.getCurrentDetectionGroup();
|
return pamMarker.getCurrentDetectionGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package dataPlotsFX.overlaymark;
|
package dataPlotsFX.overlaymark;
|
||||||
|
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.JPopupMenu;
|
import javax.swing.JPopupMenu;
|
||||||
@ -36,17 +37,20 @@ public class TDMarkerFX extends StandardOverlayMarker {
|
|||||||
* The current detection group.
|
* The current detection group.
|
||||||
*/
|
*/
|
||||||
private DetectionGroupSummary currentDetectionGroup;
|
private DetectionGroupSummary currentDetectionGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The detection groups.
|
||||||
|
*/
|
||||||
|
public ArrayList<DetectionGroupListener> detectionGroupListeners = new ArrayList<DetectionGroupListener>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The maximum distance a click can be from a data unit to be selected.
|
* The maximum distance a click can be from a data unit to be selected.
|
||||||
*/
|
*/
|
||||||
private static double maxMarkDistance=15;
|
private static double maxMarkDistance=15;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public TDMarkerFX(TDGraphFX tdGraphFX) {
|
public TDMarkerFX(TDGraphFX tdGraphFX) {
|
||||||
super(tdGraphFX);
|
super(tdGraphFX);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -57,6 +61,23 @@ public class TDMarkerFX extends StandardOverlayMarker {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the detection group listener.
|
||||||
|
* @param detectionGroupListener - the detection group listener
|
||||||
|
*/
|
||||||
|
public void addDetectionGroupListener(DetectionGroupListener detectionGroupListener) {
|
||||||
|
detectionGroupListeners.add(detectionGroupListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify all listeners that there is a new detection group.
|
||||||
|
* @param detectionGroup - the detection groups.
|
||||||
|
*/
|
||||||
|
private void notifyNewDetectionGroup(DetectionGroupSummary detectionGroup) {
|
||||||
|
for (DetectionGroupListener aDetectionGroupListener : detectionGroupListeners) {
|
||||||
|
aDetectionGroupListener.newSelectedGroup(detectionGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override to allow a highlighting of selected data units.
|
* Override to allow a highlighting of selected data units.
|
||||||
@ -110,7 +131,7 @@ public class TDMarkerFX extends StandardOverlayMarker {
|
|||||||
|
|
||||||
currentDetectionGroup = new DetectionGroupSummary(e, this, this.getCurrentMark(),
|
currentDetectionGroup = new DetectionGroupSummary(e, this, this.getCurrentMark(),
|
||||||
getSelectedMarkedDataUnits(this.getCurrentMark(), null) );
|
getSelectedMarkedDataUnits(this.getCurrentMark(), null) );
|
||||||
|
notifyNewDetectionGroup(currentDetectionGroup);
|
||||||
// Debug.out.println("TDMarkerFX: Marked data units: " + currentDetectionGroup.getNumDataUnits());
|
// Debug.out.println("TDMarkerFX: Marked data units: " + currentDetectionGroup.getNumDataUnits());
|
||||||
|
|
||||||
this.setNowMarking(false);
|
this.setNowMarking(false);
|
||||||
@ -160,6 +181,7 @@ public class TDMarkerFX extends StandardOverlayMarker {
|
|||||||
//System.out.println("PamMarkerFX: Found a data unit @ distance: " + foundDataUnit.distance + " "
|
//System.out.println("PamMarkerFX: Found a data unit @ distance: " + foundDataUnit.distance + " "
|
||||||
// + PamCalendar.formatDateTime(foundDataUnit.dataUnit.getTimeMilliseconds()));
|
// + PamCalendar.formatDateTime(foundDataUnit.dataUnit.getTimeMilliseconds()));
|
||||||
currentDetectionGroup = new DetectionGroupSummary(e, this, this.getCurrentMark(), foundDataUnit.dataUnit);
|
currentDetectionGroup = new DetectionGroupSummary(e, this, this.getCurrentMark(), foundDataUnit.dataUnit);
|
||||||
|
notifyNewDetectionGroup(currentDetectionGroup);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -168,6 +190,7 @@ public class TDMarkerFX extends StandardOverlayMarker {
|
|||||||
//only do this if the primary mouse button. Otherwise we might be right clicking on a markout out area in which
|
//only do this if the primary mouse button. Otherwise we might be right clicking on a markout out area in which
|
||||||
//all saved markes will be removed and the pop up menu will show nothing. So the user can only use the primary button to select data units.
|
//all saved markes will be removed and the pop up menu will show nothing. So the user can only use the primary button to select data units.
|
||||||
currentDetectionGroup =null;
|
currentDetectionGroup =null;
|
||||||
|
notifyNewDetectionGroup(currentDetectionGroup);
|
||||||
}
|
}
|
||||||
foundDataUnit=null;
|
foundDataUnit=null;
|
||||||
return false;
|
return false;
|
||||||
|
@ -9,7 +9,7 @@ import javafx.scene.canvas.GraphicsContext;
|
|||||||
import javafx.scene.control.Tooltip;
|
import javafx.scene.control.Tooltip;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An overlay adapter essentially allows user mouse and touch interactions with the display.
|
* An overlay adapter allows user mouse and touch interactions with the display.
|
||||||
*
|
*
|
||||||
* @author Jamie Macaulay
|
* @author Jamie Macaulay
|
||||||
*
|
*
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
package export.MLExport;
|
package export.MLExport;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse.File;
|
|
||||||
|
|
||||||
import PamguardMVC.PamDataUnit;
|
import PamguardMVC.PamDataUnit;
|
||||||
import export.PamExportManager;
|
import export.PamDataUnitExporter;
|
||||||
import us.hebi.matlab.mat.format.Mat5;
|
import us.hebi.matlab.mat.format.Mat5;
|
||||||
import us.hebi.matlab.mat.types.Struct;
|
import us.hebi.matlab.mat.types.Struct;
|
||||||
|
|
||||||
@ -16,7 +15,7 @@ import us.hebi.matlab.mat.types.Struct;
|
|||||||
* @author Jamie Macaulay
|
* @author Jamie Macaulay
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class MLDetectionsManager implements PamExportManager {
|
public class MLDetectionsManager implements PamDataUnitExporter {
|
||||||
|
|
||||||
public static final String extension = "mat";
|
public static final String extension = "mat";
|
||||||
|
|
||||||
@ -35,7 +34,15 @@ public class MLDetectionsManager implements PamExportManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCompatibleUnits(Class dataUnitType) {
|
public boolean hasCompatibleUnits(Class dataUnitType) {
|
||||||
// TODO Auto-generated method stub
|
for (int i=0; i<mlDataUnitsExport.size(); i++){
|
||||||
|
//check whether the same. ;
|
||||||
|
//System.out.println(" dataUnits.get(j).getClass(): " + dataUnits.get(j).getClass());
|
||||||
|
//System.out.println(" mlDataUnitsExport.get(i).getUnitClass(): " + mlDataUnitsExport.get(i).getUnitClass());
|
||||||
|
if (mlDataUnitsExport.get(i).getUnitClass().isAssignableFrom(dataUnitType)) {
|
||||||
|
//System.out.println("FOUND THE DATA UNIT!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,15 +59,7 @@ public class MLDetectionsManager implements PamExportManager {
|
|||||||
public boolean hasCompatibleUnits(List<PamDataUnit> dataUnits) {
|
public boolean hasCompatibleUnits(List<PamDataUnit> dataUnits) {
|
||||||
//first need to figure out how many data units there are.
|
//first need to figure out how many data units there are.
|
||||||
for (int j=0; j<dataUnits.size(); j++){
|
for (int j=0; j<dataUnits.size(); j++){
|
||||||
for (int i=0; i<mlDataUnitsExport.size(); i++){
|
if (hasCompatibleUnits(dataUnits.get(j).getClass())) return true;
|
||||||
//check whether the same. ;
|
|
||||||
//System.out.println(" dataUnits.get(j).getClass(): " + dataUnits.get(j).getClass());
|
|
||||||
//System.out.println(" mlDataUnitsExport.get(i).getUnitClass(): " + mlDataUnitsExport.get(i).getUnitClass());
|
|
||||||
if (mlDataUnitsExport.get(i).getUnitClass().isAssignableFrom(dataUnits.get(j).getClass())) {
|
|
||||||
//System.out.println("FOUND THE DATA UNIT!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -115,16 +114,12 @@ public class MLDetectionsManager implements PamExportManager {
|
|||||||
n++;
|
n++;
|
||||||
alreadyStruct[j] = true;
|
alreadyStruct[j] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n>=1) {
|
if (n>=1) {
|
||||||
list.set(mlDataUnitsExport.get(i).getName(),mlStructure);
|
list.set(mlDataUnitsExport.get(i).getName(),mlStructure);
|
||||||
list.set(mlDataUnitsExport.get(i).getName()+"_sR", Mat5.newScalar(sampleRate));
|
list.set(mlDataUnitsExport.get(i).getName()+"_sR", Mat5.newScalar(sampleRate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//now ready to save.
|
//now ready to save.
|
||||||
@ -137,6 +132,11 @@ public class MLDetectionsManager implements PamExportManager {
|
|||||||
return extension;
|
return extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIconString() {
|
||||||
|
return "file-matlab";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package export;
|
package export;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse.File;
|
|
||||||
|
|
||||||
import PamguardMVC.PamDataUnit;
|
import PamguardMVC.PamDataUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages the exporting of data units to a particular type of file e.g. CSV, MATLAB, R, WAV files
|
* Manages the exporting of data units to a particular type of file e.g. CSV, MATLAB, R, WAV files
|
||||||
*/
|
*/
|
||||||
public interface PamExportManager {
|
public interface PamDataUnitExporter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether a particular data unit class is compatible
|
* Check whether a particular data unit class is compatible
|
||||||
@ -31,6 +31,13 @@ public interface PamExportManager {
|
|||||||
* Get the extension for the output file type
|
* Get the extension for the output file type
|
||||||
* @return the extension for the file type e.g. "mat"
|
* @return the extension for the file type e.g. "mat"
|
||||||
*/
|
*/
|
||||||
public String getFileExtension();
|
public String getFileExtension();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the ikonli icon string for the exporter.
|
||||||
|
* @return the ikon string.
|
||||||
|
*/
|
||||||
|
public String getIconString();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,26 +0,0 @@
|
|||||||
package export;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import export.MLExport.MLDetectionsManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exports data to external files.
|
|
||||||
*/
|
|
||||||
public class PamExporter {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of the avilable exporters.
|
|
||||||
*/
|
|
||||||
private ArrayList<PamExportManager> pamExporters;
|
|
||||||
|
|
||||||
|
|
||||||
public PamExporter() {
|
|
||||||
pamExporters = new ArrayList<PamExportManager>();
|
|
||||||
|
|
||||||
//add the MATLAB export
|
|
||||||
pamExporters.add(new MLDetectionsManager());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
69
src/export/PamExporterManager.java
Normal file
69
src/export/PamExporterManager.java
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
package export;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import PamguardMVC.PamDataBlock;
|
||||||
|
import PamguardMVC.PamDataUnit;
|
||||||
|
import export.MLExport.MLDetectionsManager;
|
||||||
|
import export.RExport.RExportManager;
|
||||||
|
import export.wavExport.WavFileExportManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports data to external files. Manages the file sizes and creates data buffers for
|
||||||
|
* offline processing.
|
||||||
|
*/
|
||||||
|
public class PamExporterManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of the avilable exporters.
|
||||||
|
*/
|
||||||
|
private ArrayList<PamDataUnitExporter> pamExporters;
|
||||||
|
|
||||||
|
|
||||||
|
public PamExporterManager() {
|
||||||
|
pamExporters = new ArrayList<PamDataUnitExporter>();
|
||||||
|
|
||||||
|
//add the MATLAB export
|
||||||
|
pamExporters.add(new MLDetectionsManager());
|
||||||
|
pamExporters.add(new RExportManager());
|
||||||
|
pamExporters.add(new WavFileExportManager());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a data unit to the export list.
|
||||||
|
*/
|
||||||
|
public void exportDataUnit(PamDataUnit<?, ?> dataUnit) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canExportDataBlock(PamDataBlock dataBlock) {
|
||||||
|
for (PamDataUnitExporter exporter:pamExporters) {
|
||||||
|
if (exporter.hasCompatibleUnits(dataBlock.getUnitClass())) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of data exporters. e.g. MAT files, CSV, Wav etc.
|
||||||
|
* @return the number of data exporters
|
||||||
|
*/
|
||||||
|
public int getNumExporters() {
|
||||||
|
return pamExporters.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a specific exporter.
|
||||||
|
* @param i - the index of the exporter.
|
||||||
|
* @return the exporter.
|
||||||
|
*/
|
||||||
|
public PamDataUnitExporter getExporter(int i) {
|
||||||
|
return pamExporters.get(i);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,11 +1,14 @@
|
|||||||
package export.RExport;
|
package export.RExport;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.renjin.sexp.ListVector;
|
import org.renjin.sexp.ListVector;
|
||||||
import org.renjin.sexp.PairList;
|
import org.renjin.sexp.PairList;
|
||||||
|
|
||||||
import PamguardMVC.PamDataUnit;
|
import PamguardMVC.PamDataUnit;
|
||||||
|
import export.PamDataUnitExporter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles exporting pam data units into an rdata.
|
* Handles exporting pam data units into an rdata.
|
||||||
@ -13,7 +16,7 @@ import PamguardMVC.PamDataUnit;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public class RExportManager {
|
public class RExportManager implements PamDataUnitExporter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -27,29 +30,34 @@ public class RExportManager {
|
|||||||
mlDataUnitsExport.add(new RClickExport());
|
mlDataUnitsExport.add(new RClickExport());
|
||||||
mlDataUnitsExport.add(new RWhistleExport());
|
mlDataUnitsExport.add(new RWhistleExport());
|
||||||
mlDataUnitsExport.add(new RRawExport()); //should be last in case raw data holders have specific exporters
|
mlDataUnitsExport.add(new RRawExport()); //should be last in case raw data holders have specific exporters
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether there are compatible data units to be exported.
|
* Check whether there are compatible data units to be exported.
|
||||||
* @param dataUnits - the data unit list
|
* @param dataUnits - the data unit list
|
||||||
* @return true if MATLAB export is possible for the current data units.
|
* @return true if r export is possible for the current data units.
|
||||||
*/
|
*/
|
||||||
public boolean hasCompatibleUnits(List<PamDataUnit> dataUnits) {
|
public boolean hasCompatibleUnits(List<PamDataUnit> dataUnits) {
|
||||||
for (int i=0; i<mlDataUnitsExport.size(); i++){
|
//first need to figure out how many data units there are.
|
||||||
//first need to figure out how many data units there are.
|
for (int j=0; j<dataUnits.size(); j++){
|
||||||
for (int j=0; j<dataUnits.size(); j++){
|
if (hasCompatibleUnits(dataUnits.get(j).getClass())) return true;
|
||||||
//check whether the same. ;
|
|
||||||
// System.out.println(" dataUnits.get(j).getClass(): " + dataUnits.get(j).getClass());
|
|
||||||
// System.out.println(" mlDataUnitsExport.get(i).getUnitClass(): " + mlDataUnitsExport.get(i).getUnitClass());
|
|
||||||
if (mlDataUnitsExport.get(i).getUnitClass().isAssignableFrom(dataUnits.get(j).getClass())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCompatibleUnits(Class dataUnitType) {
|
||||||
|
for (int i=0; i<mlDataUnitsExport.size(); i++){
|
||||||
|
//check whether the same. ;
|
||||||
|
//System.out.println(" dataUnits.get(j).getClass(): " + dataUnits.get(j).getClass());
|
||||||
|
//System.out.println(" mlDataUnitsExport.get(i).getUnitClass(): " + mlDataUnitsExport.get(i).getUnitClass());
|
||||||
|
if (mlDataUnitsExport.get(i).getUnitClass().isAssignableFrom(dataUnitType)) {
|
||||||
|
//System.out.println("FOUND THE DATA UNIT!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort a list of data units into lists of the same type of units. Convert to a list of structures.
|
* Sort a list of data units into lists of the same type of units. Convert to a list of structures.
|
||||||
@ -126,6 +134,24 @@ public class RExportManager {
|
|||||||
public ArrayList<String> dataUnitTypes;
|
public ArrayList<String> dataUnitTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean exportData(File fileName, List<PamDataUnit> dataUnits) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFileExtension() {
|
||||||
|
return ".RData";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIconString() {
|
||||||
|
return "file-r";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
113
src/export/layoutFX/ExportOptions.java
Normal file
113
src/export/layoutFX/ExportOptions.java
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
package export.layoutFX;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
|
||||||
|
import PamController.PamControlledUnitSettings;
|
||||||
|
import PamController.PamSettingManager;
|
||||||
|
import PamController.PamSettings;
|
||||||
|
import PamController.StorageParameters;
|
||||||
|
import export.PamExporterManager;
|
||||||
|
import export.swing.ExportProcessDialog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manages opening settings dialog and saving settings.
|
||||||
|
*
|
||||||
|
* @author Jamie Macaulay
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ExportOptions implements PamSettings {
|
||||||
|
|
||||||
|
private static ExportOptions singleInstance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameters for the exporter.
|
||||||
|
*/
|
||||||
|
private ExportParams storageParameters = new ExportParams();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Swing dialog for exporting data.
|
||||||
|
*/
|
||||||
|
private ExportProcessDialog exportProcessDialog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reference to the export manager. This handles exporting data units.
|
||||||
|
*/
|
||||||
|
private PamExporterManager exportManager = new PamExporterManager();
|
||||||
|
|
||||||
|
private ExportOptions() {
|
||||||
|
PamSettingManager.getInstance().registerSettings(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ExportOptions getInstance() {
|
||||||
|
if (singleInstance == null) {
|
||||||
|
singleInstance = new ExportOptions();
|
||||||
|
}
|
||||||
|
return singleInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the swing dialog.
|
||||||
|
* @param parentFrame - the parent frame.
|
||||||
|
* @return true if settings are OK on close
|
||||||
|
*/
|
||||||
|
public boolean showDialog(JFrame parentFrame) {
|
||||||
|
|
||||||
|
if (exportProcessDialog==null) {
|
||||||
|
exportProcessDialog= new ExportProcessDialog(exportManager);
|
||||||
|
}
|
||||||
|
this.exportProcessDialog.showOfflineDialog(parentFrame);
|
||||||
|
|
||||||
|
// ExportParams newParams = StorageOptionsDialog.showDialog(parentFrame, storageParameters);
|
||||||
|
// if (newParams != null) {
|
||||||
|
// storageParameters = newParams.clone();
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Serializable getSettingsReference() {
|
||||||
|
return storageParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getSettingsVersion() {
|
||||||
|
return StorageParameters.serialVersionUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUnitName() {
|
||||||
|
return "PAMGUARD Export Options";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUnitType() {
|
||||||
|
return "PAMGUARD Export Options";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean restoreSettings(
|
||||||
|
PamControlledUnitSettings pamControlledUnitSettings) {
|
||||||
|
storageParameters = ((ExportParams) pamControlledUnitSettings.getSettings()).clone();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setStorageParameters(ExportParams storageParameters) {
|
||||||
|
this.storageParameters = storageParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get storage parameters settings.
|
||||||
|
* @return the storage paramters settings
|
||||||
|
*/
|
||||||
|
public ExportParams getStorageParameters() {
|
||||||
|
return storageParameters;
|
||||||
|
}
|
||||||
|
}
|
32
src/export/layoutFX/ExportParams.java
Normal file
32
src/export/layoutFX/ExportParams.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package export.layoutFX;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameter for the exporter.
|
||||||
|
* @author Jamie Macaulay
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ExportParams implements Serializable, Cloneable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public int exportChoice;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExportParams clone() {
|
||||||
|
try {
|
||||||
|
ExportParams newP = (ExportParams) super.clone();
|
||||||
|
return newP;
|
||||||
|
} catch (CloneNotSupportedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
53
src/export/layoutFX/ExporterPane.java
Normal file
53
src/export/layoutFX/ExporterPane.java
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
package export.layoutFX;
|
||||||
|
|
||||||
|
import PamController.SettingsPane;
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import pamViewFX.fxNodes.PamBorderPane;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a pane to export data.
|
||||||
|
* @author Jamie Macaulay
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ExporterPane extends SettingsPane<ExportParams>{
|
||||||
|
|
||||||
|
PamBorderPane mainPane;
|
||||||
|
|
||||||
|
public ExporterPane(Object ownerWindow) {
|
||||||
|
super(ownerWindow);
|
||||||
|
mainPane = new PamBorderPane();
|
||||||
|
|
||||||
|
mainPane.setTop(new Label("Hello"));
|
||||||
|
mainPane.setCenter(new Label("Hello"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExportParams getParams(ExportParams currParams) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setParams(ExportParams input) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Export Settings";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Node getContentNode() {
|
||||||
|
return mainPane;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paneInitialized() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
177
src/export/swing/ExportProcessDialog.java
Normal file
177
src/export/swing/ExportProcessDialog.java
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
package export.swing;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Frame;
|
||||||
|
import java.awt.Window;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import javax.swing.ButtonGroup;
|
||||||
|
import javax.swing.Icon;
|
||||||
|
import javax.swing.JToggleButton;
|
||||||
|
|
||||||
|
import org.kordamp.ikonli.Ikon;
|
||||||
|
import org.kordamp.ikonli.fileicons.FileIcons;
|
||||||
|
import org.kordamp.ikonli.materialdesign2.MaterialDesignA;
|
||||||
|
import org.kordamp.ikonli.materialdesign2.MaterialDesignF;
|
||||||
|
import org.kordamp.ikonli.swing.FontIcon;
|
||||||
|
|
||||||
|
import PamController.PamController;
|
||||||
|
import PamView.panel.PamPanel;
|
||||||
|
import PamguardMVC.PamDataBlock;
|
||||||
|
import export.PamExporterManager;
|
||||||
|
import offlineProcessing.OLProcessDialog;
|
||||||
|
import offlineProcessing.OfflineTaskGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes exportying data.
|
||||||
|
* @author Jamie Macaulay
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ExportProcessDialog {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The offline task group
|
||||||
|
*/
|
||||||
|
private OfflineTaskGroup dlOfflineGroup;
|
||||||
|
|
||||||
|
private OLProcessDialog mtOfflineDialog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reference to the export manager.
|
||||||
|
*/
|
||||||
|
private PamExporterManager exportManager;
|
||||||
|
|
||||||
|
public ExportProcessDialog(PamExporterManager exportManager) {
|
||||||
|
//create the offline task group.
|
||||||
|
this.exportManager=exportManager;
|
||||||
|
dlOfflineGroup = new ExportTaskGroup("Export data");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void createExportGroup() {
|
||||||
|
|
||||||
|
//clear current tasks.
|
||||||
|
dlOfflineGroup.clearTasks();
|
||||||
|
|
||||||
|
//go through every data block we have and check if we can export the data units...
|
||||||
|
ArrayList<PamDataBlock> dataBlocks= PamController.getInstance().getDataBlocks();
|
||||||
|
|
||||||
|
for (int i=0; i<dataBlocks.size(); i++) {
|
||||||
|
if (exportManager.canExportDataBlock(dataBlocks.get(i))) {
|
||||||
|
dlOfflineGroup.addTask(new ExportTask(dataBlocks.get(i), exportManager));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
////---Swing stuff----/// should not be here but this is how PG works.
|
||||||
|
|
||||||
|
public void showOfflineDialog(Frame parentFrame) {
|
||||||
|
|
||||||
|
createExportGroup();
|
||||||
|
|
||||||
|
//if null open the dialog- also create a new offlineTask group if the datablock has changed.
|
||||||
|
if (mtOfflineDialog == null) {
|
||||||
|
mtOfflineDialog = new ExportOLDialog(parentFrame,
|
||||||
|
dlOfflineGroup, "Export Data");
|
||||||
|
//batchLocaliseDialog.setModalityType(Dialog.ModalityType.MODELESS);
|
||||||
|
}
|
||||||
|
mtOfflineDialog.enableControls();
|
||||||
|
mtOfflineDialog.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom dialog which shows some extra options/
|
||||||
|
* @author Jamie Macaulay
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class ExportOLDialog extends OLProcessDialog {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public ExportOLDialog(Window parentFrame, OfflineTaskGroup taskGroup, String title) {
|
||||||
|
super(parentFrame, taskGroup, title);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
|
||||||
|
BorderLayout layout = new BorderLayout();
|
||||||
|
PamPanel mainPanel = new PamPanel();
|
||||||
|
|
||||||
|
ButtonGroup buttonGroup = new ButtonGroup();
|
||||||
|
|
||||||
|
|
||||||
|
PamPanel buttonPanel = new PamPanel();
|
||||||
|
ActionListener listener = actionEvent -> {
|
||||||
|
System.out.println(actionEvent.getActionCommand() + " Selected");
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < exportManager.getNumExporters(); i++) {
|
||||||
|
JToggleButton b = new JToggleButton();
|
||||||
|
|
||||||
|
FontIcon icon = FontIcon.of(getIconFromString(exportManager.getExporter(i).getIconString()));
|
||||||
|
icon.setIconSize(25);
|
||||||
|
icon.setIconColor(Color.GRAY);
|
||||||
|
|
||||||
|
|
||||||
|
b.setIcon(icon);
|
||||||
|
|
||||||
|
b.addActionListener(listener);
|
||||||
|
buttonGroup.add(b);
|
||||||
|
buttonPanel.add(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
mainPanel.add(buttonPanel, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
//add the main panel at a diffderent index.
|
||||||
|
getMainPanel().add(buttonPanel, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Ikon getIconFromString(String iconString) {
|
||||||
|
|
||||||
|
Ikon icon = null;
|
||||||
|
/**
|
||||||
|
* This is nasty but we won't have many exporters and this is the only
|
||||||
|
* good way to get this to work in Swing.
|
||||||
|
*/
|
||||||
|
switch (iconString) {
|
||||||
|
case "file-matlab":
|
||||||
|
icon=FileIcons.MATLAB;
|
||||||
|
break;
|
||||||
|
case "file-r":
|
||||||
|
icon=FileIcons.R;
|
||||||
|
break;
|
||||||
|
case "mdi2f-file-music":
|
||||||
|
icon=MaterialDesignF.FILE_MUSIC;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return icon;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class ExportTaskGroup extends OfflineTaskGroup{
|
||||||
|
|
||||||
|
public ExportTaskGroup(String settingsName) {
|
||||||
|
super(null, settingsName);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUnitType() {
|
||||||
|
return "Export Data";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
48
src/export/swing/ExportTask.java
Normal file
48
src/export/swing/ExportTask.java
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
package export.swing;
|
||||||
|
|
||||||
|
import PamguardMVC.PamDataBlock;
|
||||||
|
import PamguardMVC.PamDataUnit;
|
||||||
|
import dataMap.OfflineDataMapPoint;
|
||||||
|
import export.PamExporterManager;
|
||||||
|
import offlineProcessing.OfflineTask;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Export data to a file type.
|
||||||
|
*
|
||||||
|
* @author Jamie Macaulay
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ExportTask extends OfflineTask<PamDataUnit<?,?>>{
|
||||||
|
|
||||||
|
PamExporterManager exporter;
|
||||||
|
|
||||||
|
public ExportTask(PamDataBlock<PamDataUnit<?, ?>> parentDataBlock, PamExporterManager exporter) {
|
||||||
|
super(parentDataBlock);
|
||||||
|
this.exporter = exporter;
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return this.getDataBlock().getDataName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean processDataUnit(PamDataUnit<?, ?> dataUnit) {
|
||||||
|
exporter.exportDataUnit(dataUnit);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void newDataLoad(long startTime, long endTime, OfflineDataMapPoint mapPoint) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadedDataComplete() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -22,6 +22,7 @@ import PamguardMVC.PamRawDataBlock;
|
|||||||
import PamguardMVC.dataOffline.OfflineDataLoading;
|
import PamguardMVC.dataOffline.OfflineDataLoading;
|
||||||
import dataMap.OfflineDataMapPoint;
|
import dataMap.OfflineDataMapPoint;
|
||||||
import detectiongrouplocaliser.DetectionGroupSummary;
|
import detectiongrouplocaliser.DetectionGroupSummary;
|
||||||
|
import export.PamDataUnitExporter;
|
||||||
import wavFiles.Wav16AudioFormat;
|
import wavFiles.Wav16AudioFormat;
|
||||||
import wavFiles.WavFileWriter;
|
import wavFiles.WavFileWriter;
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ import wavFiles.WavFileWriter;
|
|||||||
* @author Jamie Macaulay
|
* @author Jamie Macaulay
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class WavFileExportManager {
|
public class WavFileExportManager implements PamDataUnitExporter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Successful writing of .wav file.
|
* Successful writing of .wav file.
|
||||||
@ -420,6 +421,38 @@ public class WavFileExportManager {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCompatibleUnits(Class dataUnitType) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean exportData(File fileName,
|
||||||
|
List<PamDataUnit> dataUnits) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFileExtension() {
|
||||||
|
return "wav";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIconString() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return "mdi2f-file-music";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// hello(){
|
// hello(){
|
||||||
|
@ -7,11 +7,13 @@ import java.io.Serializable;
|
|||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
|
|
||||||
|
import Array.ArrayManager;
|
||||||
import PamController.PamControlledUnit;
|
import PamController.PamControlledUnit;
|
||||||
import PamController.PamControlledUnitSettings;
|
import PamController.PamControlledUnitSettings;
|
||||||
import PamController.PamController;
|
import PamController.PamController;
|
||||||
import PamController.PamSettingManager;
|
import PamController.PamSettingManager;
|
||||||
import PamController.PamSettings;
|
import PamController.PamSettings;
|
||||||
|
import PamModel.PamModuleInfo;
|
||||||
import metadata.swing.MetaDataDialog;
|
import metadata.swing.MetaDataDialog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,12 +46,25 @@ public class MetaDataContol extends PamControlledUnit implements PamSettings {
|
|||||||
public static MetaDataContol getMetaDataControl() {
|
public static MetaDataContol getMetaDataControl() {
|
||||||
if (singleInstance == null) {
|
if (singleInstance == null) {
|
||||||
singleInstance = new MetaDataContol(unitType);
|
singleInstance = new MetaDataContol(unitType);
|
||||||
|
singleInstance.addModuleInfo(); //needed for FX
|
||||||
// add this line to add it to the main modules list. Then it will get menu's, etc.
|
// add this line to add it to the main modules list. Then it will get menu's, etc.
|
||||||
PamController.getInstance().addControlledUnit(singleInstance);
|
PamController.getInstance().addControlledUnit(singleInstance);
|
||||||
}
|
}
|
||||||
return singleInstance;
|
return singleInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add module info to the array manager. Need to do this to add icon which is used in data model.
|
||||||
|
*/
|
||||||
|
private void addModuleInfo(){
|
||||||
|
//need to add module info due to fact array manager is a special case
|
||||||
|
PamModuleInfo arrayModuleInfo=new PamModuleInfo("MetaDataControl", "Meta Data MANAGER", MetaDataContol.class);
|
||||||
|
arrayModuleInfo.setCoreModule(true);
|
||||||
|
arrayModuleInfo.setToolTipText("Meta data manager");
|
||||||
|
this.setPamModuleInfo(arrayModuleInfo);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get PAMGuard Metadata. This contains a nilus Deployment object wrapped up
|
* Get PAMGuard Metadata. This contains a nilus Deployment object wrapped up
|
||||||
* so that it can be serialised into other PAMGuard settings.
|
* so that it can be serialised into other PAMGuard settings.
|
||||||
|
@ -93,13 +93,18 @@ public class OLProcessDialog extends PamDialog {
|
|||||||
|
|
||||||
TaskStatus currentStatus = TaskStatus.IDLE;
|
TaskStatus currentStatus = TaskStatus.IDLE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reference to the main panel
|
||||||
|
*/
|
||||||
|
private JPanel mainPanel;
|
||||||
|
|
||||||
|
|
||||||
public OLProcessDialog(Window parentFrame, OfflineTaskGroup taskGroup, String title) {
|
public OLProcessDialog(Window parentFrame, OfflineTaskGroup taskGroup, String title) {
|
||||||
super(parentFrame, title, false);
|
super(parentFrame, title, false);
|
||||||
this.taskGroup = taskGroup;
|
this.taskGroup = taskGroup;
|
||||||
taskGroup.setTaskMonitor(new OLMonitor());
|
taskGroup.setTaskMonitor(new OLMonitor());
|
||||||
|
|
||||||
JPanel mainPanel = new JPanel();
|
mainPanel = new JPanel();
|
||||||
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
|
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
|
||||||
|
|
||||||
JPanel dataSelectPanel = new PamAlignmentPanel(BorderLayout.WEST);
|
JPanel dataSelectPanel = new PamAlignmentPanel(BorderLayout.WEST);
|
||||||
@ -207,6 +212,14 @@ public class OLProcessDialog extends PamDialog {
|
|||||||
setResizable(true);
|
setResizable(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the main panel. This can be used to add additional controls if needed.
|
||||||
|
* @return the main panel.
|
||||||
|
*/
|
||||||
|
public JPanel getMainPanel() {
|
||||||
|
return mainPanel;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the delete old data check box
|
* Get the delete old data check box
|
||||||
|
@ -66,6 +66,7 @@ public class OfflineTaskGroup implements PamSettings {
|
|||||||
private DataTimeLimits dataTimeLimits;
|
private DataTimeLimits dataTimeLimits;
|
||||||
|
|
||||||
private volatile TaskStatus completionStatus = TaskStatus.IDLE;
|
private volatile TaskStatus completionStatus = TaskStatus.IDLE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PamControlledunit required in constructor since some bookkeeping will
|
* PamControlledunit required in constructor since some bookkeeping will
|
||||||
* be going on in the background which will need the unit type and name.
|
* be going on in the background which will need the unit type and name.
|
||||||
@ -76,7 +77,7 @@ public class OfflineTaskGroup implements PamSettings {
|
|||||||
public OfflineTaskGroup(PamControlledUnit pamControlledUnit, String settingsName) {
|
public OfflineTaskGroup(PamControlledUnit pamControlledUnit, String settingsName) {
|
||||||
super();
|
super();
|
||||||
this.pamControlledUnit = pamControlledUnit;
|
this.pamControlledUnit = pamControlledUnit;
|
||||||
pamControlledUnit.addOfflineTaskGroup(this);
|
if (pamControlledUnit!=null) pamControlledUnit.addOfflineTaskGroup(this);
|
||||||
this.settingsName = settingsName;
|
this.settingsName = settingsName;
|
||||||
PamSettingManager.getInstance().registerSettings(this);
|
PamSettingManager.getInstance().registerSettings(this);
|
||||||
}
|
}
|
||||||
@ -965,4 +966,14 @@ public class OfflineTaskGroup implements PamSettings {
|
|||||||
public OfflineSuperDetFilter getSuperDetectionFilter() {
|
public OfflineSuperDetFilter getSuperDetectionFilter() {
|
||||||
return superDetectionFilter;
|
return superDetectionFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear all task from the task group. This also clears affected and required datablocks.
|
||||||
|
*/
|
||||||
|
public void clearTasks() {
|
||||||
|
requiredDataBlocks.clear();
|
||||||
|
affectedDataBlocks.clear();
|
||||||
|
offlineTasks.clear();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ public class PamDateAxis extends ValueAxis<Long> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private double[] recalculateTicks()
|
public double[] recalculateTicks()
|
||||||
{
|
{
|
||||||
final Side side = getSide();
|
final Side side = getSide();
|
||||||
final boolean vertical = Side.LEFT.equals(side) || Side.RIGHT.equals(side);
|
final boolean vertical = Side.LEFT.equals(side) || Side.RIGHT.equals(side);
|
||||||
|
@ -5,8 +5,17 @@ import java.net.MalformedURLException;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.jamdev.jdl4pam.transforms.DLTransformsFactory;
|
||||||
|
import org.jamdev.jdl4pam.transforms.DLTransfromParams;
|
||||||
|
import org.jamdev.jdl4pam.transforms.SimpleTransformParams;
|
||||||
|
import org.jamdev.jdl4pam.transforms.DLTransform.DLTransformType;
|
||||||
|
|
||||||
|
import rawDeepLearningClassifier.dlClassification.DLClassName;
|
||||||
import rawDeepLearningClassifier.dlClassification.animalSpot.StandardModelParams;
|
import rawDeepLearningClassifier.dlClassification.animalSpot.StandardModelParams;
|
||||||
|
import rawDeepLearningClassifier.dlClassification.genericModel.GenericModelParams;
|
||||||
|
import rawDeepLearningClassifier.layoutFX.exampleSounds.ExampleSoundFactory.ExampleSoundType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -57,7 +66,31 @@ public class HumpbackWhaleAtlantic implements DLModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setParams(Serializable dlModelSettings) {
|
public void setParams(Serializable dlModelSettings) {
|
||||||
// TODO Auto-generated method stub
|
GenericModelParams genericModelParams = (GenericModelParams) dlModelSettings;
|
||||||
|
|
||||||
|
//decimation value
|
||||||
|
float sr = 2000;
|
||||||
|
|
||||||
|
//create the transforms.
|
||||||
|
ArrayList<DLTransfromParams> dlTransformParamsArr = new ArrayList<DLTransfromParams>();
|
||||||
|
|
||||||
|
dlTransformParamsArr.add(new SimpleTransformParams(DLTransformType.DECIMATE_SCIPY, sr));
|
||||||
|
|
||||||
|
genericModelParams.dlTransfromParams = dlTransformParamsArr;
|
||||||
|
|
||||||
|
genericModelParams.defaultSegmentLen = 3.8775*1000;
|
||||||
|
genericModelParams.binaryClassification = new boolean[] {true};
|
||||||
|
genericModelParams.classNames= new DLClassName[] {new DLClassName("Humpback whale", (short) 1)};
|
||||||
|
genericModelParams.numClasses = 1;
|
||||||
|
|
||||||
|
|
||||||
|
genericModelParams.defaultShape= new Long[] {-1L,-1L,-1L,1L};
|
||||||
|
genericModelParams.shape= new Long[] {-1L,-1L,-1L,1L};
|
||||||
|
|
||||||
|
//create the transforms.
|
||||||
|
genericModelParams.dlTransfroms = DLTransformsFactory.makeDLTransforms((ArrayList<DLTransfromParams>)genericModelParams.dlTransfromParams);
|
||||||
|
|
||||||
|
genericModelParams.setExampleSound(ExampleSoundType.HUMPBACK_WHALE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ public class HumpbackWhaleGoogle implements DLModel {
|
|||||||
@Override
|
@Override
|
||||||
public URI getModelURI() {
|
public URI getModelURI() {
|
||||||
try {
|
try {
|
||||||
return new URL("https://github.com/PAMGuard/deeplearningmodels/raw/master/humpback_whale_1/humpback_whale_1.zip").toURI();
|
return new URI("https://github.com/PAMGuard/deeplearningmodels/raw/master/humpback_whale_1/humpback_whale_1.zip");
|
||||||
} catch (MalformedURLException | URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -52,8 +52,8 @@ public class HumpbackWhaleGoogle implements DLModel {
|
|||||||
@Override
|
@Override
|
||||||
public URI getCitationLink() {
|
public URI getCitationLink() {
|
||||||
try {
|
try {
|
||||||
return new URL("https://doi.org/10.3389/fmars.2021.607321").toURI();
|
return new URI("https://doi.org/10.3389/fmars.2021.607321");
|
||||||
} catch (MalformedURLException | URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
@ -70,7 +70,7 @@ public class HumpbackWhaleGoogle implements DLModel {
|
|||||||
//create the transforms.
|
//create the transforms.
|
||||||
ArrayList<DLTransfromParams> dlTransformParamsArr = new ArrayList<DLTransfromParams>();
|
ArrayList<DLTransfromParams> dlTransformParamsArr = new ArrayList<DLTransfromParams>();
|
||||||
|
|
||||||
dlTransformParamsArr.add(new SimpleTransformParams(DLTransformType.DECIMATE, sr));
|
dlTransformParamsArr.add(new SimpleTransformParams(DLTransformType.DECIMATE_SCIPY, sr));
|
||||||
|
|
||||||
genericModelParams.dlTransfromParams = dlTransformParamsArr;
|
genericModelParams.dlTransfromParams = dlTransformParamsArr;
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ public class RightWhaleModel1 implements DLModel {
|
|||||||
@Override
|
@Override
|
||||||
public URI getModelURI() {
|
public URI getModelURI() {
|
||||||
try {
|
try {
|
||||||
return new URL("https://github.com/PAMGuard/deeplearningmodels/raw/master/right_whale_1/model_lenet_dropout_input_conv_all.zip").toURI();
|
return new URI("https://github.com/PAMGuard/deeplearningmodels/raw/master/right_whale_1/model_lenet_dropout_input_conv_all.zip");
|
||||||
} catch (MalformedURLException | URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class GenericModelWorker extends DLModelWorker<GenericPrediction> {
|
|||||||
waveStack[i] = transformedDataStack[i][0];
|
waveStack[i] = transformedDataStack[i][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
//System.out.println("RUN GENERIC MODEL WAVE: " + transformedDataStack.length + " " + transformedDataStack[0].length);
|
//System.out.println("RUN GENERIC MODEL WAVE: " + waveStack.length + " " + waveStack[0].length + " " + waveStack[0][0]);
|
||||||
results = getModel().runModel(waveStack);
|
results = getModel().runModel(waveStack);
|
||||||
}
|
}
|
||||||
//System.out.println("GENERIC MODEL RESULTS: " + results== null ? null : results.length);
|
//System.out.println("GENERIC MODEL RESULTS: " + results== null ? null : results.length);
|
||||||
|
@ -3,6 +3,10 @@ package test.rawDeepLearningClassifier;
|
|||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@ -14,6 +18,7 @@ import org.jamdev.jdl4pam.utils.DLUtils;
|
|||||||
import org.jamdev.jpamutils.wavFiles.AudioData;
|
import org.jamdev.jpamutils.wavFiles.AudioData;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import rawDeepLearningClassifier.defaultModels.HumpbackWhaleAtlantic;
|
||||||
import rawDeepLearningClassifier.defaultModels.RightWhaleModel1;
|
import rawDeepLearningClassifier.defaultModels.RightWhaleModel1;
|
||||||
import rawDeepLearningClassifier.dlClassification.genericModel.GenericModelParams;
|
import rawDeepLearningClassifier.dlClassification.genericModel.GenericModelParams;
|
||||||
import rawDeepLearningClassifier.dlClassification.genericModel.GenericModelWorker;
|
import rawDeepLearningClassifier.dlClassification.genericModel.GenericModelWorker;
|
||||||
@ -29,10 +34,14 @@ import rawDeepLearningClassifier.segmenter.SegmenterProcess.GroupedRawData;
|
|||||||
public class GenericDLClassifierTest {
|
public class GenericDLClassifierTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run a test on the Generic DL Classifier. This tests the worker can open and run a model
|
* Run a test on the Generic DL Classifier. This tests the worker can open and
|
||||||
|
* run a model
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void rightWhaleDLWorker() {
|
public void rightWhaleDLWorker() {
|
||||||
|
|
||||||
|
System.out.println("*****Generic DL: Right whale test*****");
|
||||||
|
|
||||||
//relative paths to the resource folders.
|
//relative paths to the resource folders.
|
||||||
String relModelPath = "./src/test/resources/rawDeepLearningClassifier/Generic/right_whale/model_lenet_dropout_input_conv_all/saved_model.pb";
|
String relModelPath = "./src/test/resources/rawDeepLearningClassifier/Generic/right_whale/model_lenet_dropout_input_conv_all/saved_model.pb";
|
||||||
String relWavPath = "./src/test/resources/rawDeepLearningClassifier/Generic/right_whale/right_whale_example.wav";
|
String relWavPath = "./src/test/resources/rawDeepLearningClassifier/Generic/right_whale/right_whale_example.wav";
|
||||||
@ -63,18 +72,18 @@ public class GenericDLClassifierTest {
|
|||||||
|
|
||||||
GroupedRawData groupedRawData = new GroupedRawData(0, 1, 0, duration, (int) duration);
|
GroupedRawData groupedRawData = new GroupedRawData(0, 1, 0, duration, (int) duration);
|
||||||
groupedRawData.copyRawData(soundData.getScaledSampleAmplitudes(), 0, soundData.getScaledSampleAmplitudes().length, 0);
|
groupedRawData.copyRawData(soundData.getScaledSampleAmplitudes(), 0, soundData.getScaledSampleAmplitudes().length, 0);
|
||||||
|
|
||||||
ArrayList<GroupedRawData> groupedData = new ArrayList<GroupedRawData>();
|
ArrayList<GroupedRawData> groupedData = new ArrayList<GroupedRawData>();
|
||||||
|
|
||||||
|
|
||||||
groupedData.add(groupedRawData);
|
groupedData.add(groupedRawData);
|
||||||
|
|
||||||
ArrayList<GenericPrediction> gwenericPrediciton = genericModelWorker.runModel(groupedData, soundData.sampleRate, 0);
|
ArrayList<GenericPrediction> gwenericPrediciton = genericModelWorker.runModel(groupedData, soundData.sampleRate, 0);
|
||||||
|
|
||||||
float[] output = gwenericPrediciton.get(0).getPrediction();
|
float[] output = gwenericPrediciton.get(0).getPrediction();
|
||||||
|
|
||||||
System.out.println("Right whale network output: " + output[0] + " " + output[1]);
|
System.out.println("Right whale network output: " + output[0] + " " + output[1]);
|
||||||
|
|
||||||
//test the predicitons are true.
|
//test the predicitons are true.
|
||||||
assertTrue( output[0]<0.01 ); //noise
|
assertTrue( output[0]<0.01 ); //noise
|
||||||
assertTrue( output[1]>0.98 ); //right whale
|
assertTrue( output[1]>0.98 ); //right whale
|
||||||
@ -87,18 +96,98 @@ public class GenericDLClassifierTest {
|
|||||||
assertEquals(false, true);
|
assertEquals(false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the ketos classifier and tests are working properly. This tests loading the ketos model and also using
|
* Test the ketos classifier and tests are working properly. This tests loading
|
||||||
* functions in KetosWorker.
|
* the ketos model and also using functions in KetosWorker.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void humpbackWhaleTest() {
|
public void humpbackWhaleTest() {
|
||||||
|
|
||||||
|
System.out.println("*****Generic DL: Humpback whale test*****");
|
||||||
|
|
||||||
|
//relative paths to the resource folders.
|
||||||
|
String relModelPath = "./src/test/resources/rawDeepLearningClassifier/Generic/humpback_whale_atlantic/FlatHBNA/saved_model.pb";
|
||||||
|
String relWavPath = "./src/test/resources/rawDeepLearningClassifier/Generic/humpback_whale_atlantic/SAMOSAS_EL1_humpback.wav";
|
||||||
|
String resultsPath = "./src/test/resources/rawDeepLearningClassifier/Generic/humpback_whale_atlantic/SAMOSAS_EL1_humpback_annotations.txt";
|
||||||
|
|
||||||
|
Path path = Paths.get(relModelPath);
|
||||||
|
|
||||||
|
GenericModelWorker genericModelWorker = new GenericModelWorker();
|
||||||
|
|
||||||
|
GenericModelParams genericModelParams = new GenericModelParams();
|
||||||
|
|
||||||
|
genericModelParams.modelPath = path.toAbsolutePath().normalize().toString();
|
||||||
|
|
||||||
|
path = Paths.get(relWavPath);
|
||||||
|
String wavFilePath = path.toAbsolutePath().normalize().toString();
|
||||||
|
|
||||||
|
HumpbackWhaleAtlantic humpbackModel = new HumpbackWhaleAtlantic();
|
||||||
|
humpbackModel.setParams(genericModelParams);
|
||||||
|
|
||||||
|
System.out.println(genericModelParams);
|
||||||
|
|
||||||
|
//prep the model
|
||||||
|
genericModelWorker.prepModel(genericModelParams, null);
|
||||||
|
|
||||||
|
try {
|
||||||
|
//load audio
|
||||||
|
AudioData soundData = DLUtils.loadWavFile(wavFilePath);
|
||||||
|
|
||||||
|
|
||||||
|
//load true predictions file.
|
||||||
|
File file = new File(resultsPath);
|
||||||
|
FileReader fr = new FileReader(file);
|
||||||
|
BufferedReader br = new BufferedReader(fr);
|
||||||
|
String line;
|
||||||
|
int ind=0;
|
||||||
|
|
||||||
|
while((line = br.readLine()) != null){
|
||||||
|
if (ind>0) {
|
||||||
|
|
||||||
|
//read the data from the text file
|
||||||
|
String[] data = line.split("\t");
|
||||||
|
int chunkID = Integer.valueOf(data[0]);
|
||||||
|
|
||||||
|
double startTimeS = Double.valueOf(data[1]);
|
||||||
|
double endTimeS = Double.valueOf(data[2]);
|
||||||
|
double prediction = Double.valueOf(data[5]);
|
||||||
|
|
||||||
|
int startChunk = (int) (soundData.sampleRate*startTimeS); //humpback whale call
|
||||||
|
int chunkSize = (int) Math.ceil((endTimeS-startTimeS)*soundData.sampleRate);
|
||||||
|
|
||||||
|
chunkSize=7755;
|
||||||
|
|
||||||
|
GroupedRawData groupedRawData = new GroupedRawData(0, 1, 0, chunkSize, chunkSize);
|
||||||
|
groupedRawData.copyRawData(soundData.getScaledSampleAmplitudes(), startChunk, chunkSize, 0);
|
||||||
|
|
||||||
|
|
||||||
|
ArrayList<GroupedRawData> groupedData = new ArrayList<GroupedRawData>();
|
||||||
|
|
||||||
|
groupedData.add(groupedRawData);
|
||||||
|
|
||||||
|
ArrayList<GenericPrediction> genericPrediction = genericModelWorker.runModel(groupedData, soundData.sampleRate, 0);
|
||||||
|
|
||||||
|
float[] output = genericPrediction.get(0).getPrediction();
|
||||||
|
|
||||||
|
System.out.println(String.format("Chunk %d %d Predicted output: %.2f true output: %.2f passed: %b", chunkID, startChunk,
|
||||||
|
output[0], prediction, output[0]>prediction*0.9 && output[0]<prediction*1.1));
|
||||||
|
|
||||||
|
//allow 10% scrumph to take account of slight differences in Java input.
|
||||||
|
assertEquals(output[0], prediction, 0.1); //humpback whale detection
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
ind++;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,216 @@
|
|||||||
|
Selection Begin Time (s) End Time (s) High Freq (Hz) Low Freq (Hz) Prediction/Comments
|
||||||
|
1 3.8775 7.755 1000 50 0.99972177
|
||||||
|
2 7.755 11.6325 1000 50 0.89199716
|
||||||
|
3 11.6325 15.51 1000 50 0.64813995
|
||||||
|
4 15.51 19.3875 1000 50 0.9713266
|
||||||
|
5 19.3875 23.265 1000 50 0.8342721
|
||||||
|
6 23.265 27.142500000000002 1000 50 0.99634343
|
||||||
|
7 31.02 34.8975 1000 50 0.9933128
|
||||||
|
8 34.8975 38.775 1000 50 0.5325079
|
||||||
|
9 42.6525 46.53 1000 50 0.9727334
|
||||||
|
10 46.53 50.4075 1000 50 0.7700455
|
||||||
|
11 54.285 58.162499999999994 1000 50 0.93229276
|
||||||
|
12 58.1625 62.04 1000 50 0.5089565
|
||||||
|
13 62.04 65.9175 1000 50 0.53604007
|
||||||
|
14 65.9175 69.795 1000 50 0.6665228
|
||||||
|
15 69.795 73.6725 1000 50 0.8109671
|
||||||
|
16 73.6725 77.55 1000 50 0.9998325
|
||||||
|
17 77.55 81.4275 1000 50 0.6296093
|
||||||
|
18 81.4275 85.30499999999999 1000 50 0.99747694
|
||||||
|
19 93.06 96.9375 1000 50 0.99976456
|
||||||
|
20 96.9375 100.815 1000 50 0.53218305
|
||||||
|
21 104.6925 108.57 1000 50 0.98100567
|
||||||
|
22 112.4475 116.325 1000 50 0.91926867
|
||||||
|
23 124.08 127.9575 1000 50 0.9990459
|
||||||
|
24 127.9575 131.835 1000 50 0.6861532
|
||||||
|
25 135.7125 139.59 1000 50 0.5737106
|
||||||
|
26 143.4675 147.345 1000 50 0.9537415
|
||||||
|
27 147.345 151.2225 1000 50 0.5592457
|
||||||
|
28 151.2225 155.1 1000 50 0.97674406
|
||||||
|
29 155.1 158.9775 1000 50 0.55292696
|
||||||
|
30 166.7325 170.60999999999999 1000 50 0.86637044
|
||||||
|
31 170.61 174.4875 1000 50 0.8887141
|
||||||
|
32 174.4875 178.365 1000 50 0.65914917
|
||||||
|
33 182.2425 186.12 1000 50 0.78331536
|
||||||
|
34 189.9975 193.875 1000 50 0.51390845
|
||||||
|
35 193.875 197.7525 1000 50 0.8545577
|
||||||
|
36 197.7525 201.63 1000 50 0.99297434
|
||||||
|
37 209.385 213.2625 1000 50 0.91762686
|
||||||
|
38 217.14 221.01749999999998 1000 50 0.9865262
|
||||||
|
39 221.0175 224.895 1000 50 0.9802332
|
||||||
|
40 224.895 228.7725 1000 50 0.9038371
|
||||||
|
41 228.7725 232.65 1000 50 0.9299754
|
||||||
|
42 232.65 236.5275 1000 50 0.99995977
|
||||||
|
43 236.5275 240.405 1000 50 0.75877947
|
||||||
|
44 240.405 244.2825 1000 50 0.8074757
|
||||||
|
45 244.2825 248.16 1000 50 0.57404643
|
||||||
|
46 248.16 252.0375 1000 50 0.5844841
|
||||||
|
47 252.0375 255.915 1000 50 0.77901065
|
||||||
|
48 267.5475 271.425 1000 50 0.9999262
|
||||||
|
49 283.0575 286.935 1000 50 0.91496134
|
||||||
|
50 286.935 290.8125 1000 50 0.6016941
|
||||||
|
51 290.8125 294.69 1000 50 0.5288352
|
||||||
|
52 294.69 298.5675 1000 50 0.7803428
|
||||||
|
53 298.5675 302.445 1000 50 0.9457351
|
||||||
|
54 302.445 306.3225 1000 50 0.8809803
|
||||||
|
55 314.0775 317.955 1000 50 0.76862615
|
||||||
|
56 317.955 321.8325 1000 50 0.9179431
|
||||||
|
57 321.8325 325.71 1000 50 0.64783925
|
||||||
|
58 325.71 329.5875 1000 50 0.63720423
|
||||||
|
59 333.465 337.3425 1000 50 0.9080041
|
||||||
|
60 337.3425 341.21999999999997 1000 50 0.636528
|
||||||
|
61 341.22 345.0975 1000 50 0.8285956
|
||||||
|
62 348.975 352.8525 1000 50 0.5541101
|
||||||
|
63 360.6075 364.485 1000 50 0.9939563
|
||||||
|
64 364.485 368.3625 1000 50 0.5179203
|
||||||
|
65 368.3625 372.24 1000 50 0.998485
|
||||||
|
66 372.24 376.1175 1000 50 0.7255482
|
||||||
|
67 379.995 383.8725 1000 50 0.6432554
|
||||||
|
68 387.75 391.6275 1000 50 0.85360736
|
||||||
|
69 395.505 399.3825 1000 50 0.63949126
|
||||||
|
70 403.26 407.1375 1000 50 0.9875199
|
||||||
|
71 407.1375 411.015 1000 50 0.63171786
|
||||||
|
72 411.015 414.8925 1000 50 0.51271856
|
||||||
|
73 414.8925 418.77 1000 50 0.8624972
|
||||||
|
74 418.77 422.6475 1000 50 0.9287566
|
||||||
|
75 422.6475 426.525 1000 50 0.79819566
|
||||||
|
76 442.035 445.9125 1000 50 0.9992767
|
||||||
|
77 445.9125 449.79 1000 50 0.85704327
|
||||||
|
78 449.79 453.6675 1000 50 0.606248
|
||||||
|
79 465.3 469.1775 1000 50 0.6945031
|
||||||
|
80 469.1775 473.055 1000 50 0.91730964
|
||||||
|
81 476.9325 480.81 1000 50 0.8548426
|
||||||
|
82 480.81 484.6875 1000 50 0.8609153
|
||||||
|
83 484.6875 488.565 1000 50 0.53578407
|
||||||
|
84 492.4425 496.32 1000 50 0.6815063
|
||||||
|
85 504.075 507.9525 1000 50 0.5493686
|
||||||
|
86 511.83 515.7075 1000 50 0.57242775
|
||||||
|
87 515.7075 519.585 1000 50 0.802748
|
||||||
|
88 519.585 523.4625000000001 1000 50 0.75667137
|
||||||
|
89 527.34 531.2175000000001 1000 50 0.6283601
|
||||||
|
90 535.095 538.9725000000001 1000 50 0.58465177
|
||||||
|
91 538.9725 542.85 1000 50 0.7337384
|
||||||
|
92 546.7275 550.605 1000 50 0.6839575
|
||||||
|
93 562.2375 566.115 1000 50 0.6672469
|
||||||
|
94 593.2575 597.1350000000001 1000 50 0.5644848
|
||||||
|
95 604.89 608.7675 1000 50 0.78537405
|
||||||
|
96 624.2775 628.1550000000001 1000 50 0.52095556
|
||||||
|
97 632.0325 635.9100000000001 1000 50 0.86063546
|
||||||
|
98 635.91 639.7875 1000 50 0.7444124
|
||||||
|
99 643.665 647.5425 1000 50 0.59704643
|
||||||
|
100 647.5425 651.4200000000001 1000 50 0.9363932
|
||||||
|
101 666.93 670.8075 1000 50 0.78785974
|
||||||
|
102 678.5625 682.44 1000 50 0.99932384
|
||||||
|
103 690.195 694.0725000000001 1000 50 0.7276663
|
||||||
|
104 694.0725 697.95 1000 50 0.6033868
|
||||||
|
105 697.95 701.8275000000001 1000 50 0.7666113
|
||||||
|
106 705.705 709.5825000000001 1000 50 0.9996606
|
||||||
|
107 709.5825 713.46 1000 50 0.87555915
|
||||||
|
108 717.3375 721.215 1000 50 0.99977213
|
||||||
|
109 721.215 725.0925000000001 1000 50 0.6706097
|
||||||
|
110 728.97 732.8475000000001 1000 50 0.99964714
|
||||||
|
111 736.725 740.6025000000001 1000 50 0.9942172
|
||||||
|
112 740.6025 744.48 1000 50 0.99729407
|
||||||
|
113 744.48 748.3575000000001 1000 50 0.98387647
|
||||||
|
114 748.3575 752.235 1000 50 0.97733885
|
||||||
|
115 756.1125 759.99 1000 50 0.9908622
|
||||||
|
116 763.8675 767.745 1000 50 0.9963475
|
||||||
|
117 775.5 779.3775 1000 50 0.9301784
|
||||||
|
118 779.3775 783.2550000000001 1000 50 0.8671598
|
||||||
|
119 783.255 787.1325 1000 50 0.8163382
|
||||||
|
120 787.1325 791.0100000000001 1000 50 0.67742085
|
||||||
|
121 794.8875 798.7650000000001 1000 50 0.9999998
|
||||||
|
122 798.765 802.6425 1000 50 0.9092158
|
||||||
|
123 802.6425 806.5200000000001 1000 50 0.5064141
|
||||||
|
124 806.52 810.3975 1000 50 0.9245316
|
||||||
|
125 810.3975 814.2750000000001 1000 50 0.9987917
|
||||||
|
126 814.275 818.1525 1000 50 0.98765403
|
||||||
|
127 818.1525 822.0300000000001 1000 50 0.7059854
|
||||||
|
128 822.03 825.9075 1000 50 0.9687309
|
||||||
|
129 825.9075 829.7850000000001 1000 50 0.99980175
|
||||||
|
130 829.785 833.6625 1000 50 0.9667981
|
||||||
|
131 833.6625 837.5400000000001 1000 50 0.6459364
|
||||||
|
132 837.54 841.4175 1000 50 0.99052876
|
||||||
|
133 845.295 849.1725 1000 50 0.98032534
|
||||||
|
134 849.1725 853.0500000000001 1000 50 0.9769905
|
||||||
|
135 864.6825 868.5600000000001 1000 50 0.9989409
|
||||||
|
136 868.56 872.4375 1000 50 0.65797764
|
||||||
|
137 876.315 880.1925000000001 1000 50 0.8667758
|
||||||
|
138 880.1925 884.07 1000 50 0.8123294
|
||||||
|
139 884.07 887.9475000000001 1000 50 0.9994879
|
||||||
|
140 887.9475 891.825 1000 50 0.6211881
|
||||||
|
141 895.7025 899.58 1000 50 0.9882314
|
||||||
|
142 899.58 903.4575000000001 1000 50 0.988451
|
||||||
|
143 903.4575 907.335 1000 50 0.8560532
|
||||||
|
144 907.335 911.2125000000001 1000 50 0.8371353
|
||||||
|
145 911.2125 915.09 1000 50 0.9963776
|
||||||
|
146 918.9675 922.845 1000 50 0.99993306
|
||||||
|
147 930.6 934.4775000000001 1000 50 0.98831177
|
||||||
|
148 938.355 942.2325000000001 1000 50 0.6520295
|
||||||
|
149 957.7425 961.62 1000 50 0.6918473
|
||||||
|
150 961.62 965.4975000000001 1000 50 0.74858236
|
||||||
|
151 965.4975 969.375 1000 50 0.97066724
|
||||||
|
152 973.2525 977.1300000000001 1000 50 0.6426704
|
||||||
|
153 981.0075 984.8850000000001 1000 50 0.8150208
|
||||||
|
154 984.885 988.7625 1000 50 0.5683353
|
||||||
|
155 988.7625 992.6400000000001 1000 50 0.581548
|
||||||
|
156 992.64 996.5175 1000 50 0.77473736
|
||||||
|
157 1000.395 1004.2725 1000 50 0.950805
|
||||||
|
158 1004.2725 1008.1500000000001 1000 50 0.53004926
|
||||||
|
159 1012.0275 1015.9050000000001 1000 50 0.9998928
|
||||||
|
160 1015.905 1019.7825 1000 50 0.90716743
|
||||||
|
161 1023.66 1027.5375 1000 50 0.9305084
|
||||||
|
162 1031.415 1035.2925 1000 50 0.77918565
|
||||||
|
163 1039.17 1043.0475000000001 1000 50 0.9984765
|
||||||
|
164 1043.0475 1046.925 1000 50 0.5665361
|
||||||
|
165 1050.8025 1054.68 1000 50 0.999446
|
||||||
|
166 1054.68 1058.5575000000001 1000 50 0.5452138
|
||||||
|
167 1062.435 1066.3125 1000 50 0.99469894
|
||||||
|
168 1066.3125 1070.19 1000 50 0.5405148
|
||||||
|
169 1074.0675 1077.9450000000002 1000 50 0.5739461
|
||||||
|
170 1077.945 1081.8225 1000 50 0.5058043
|
||||||
|
171 1081.8225 1085.7 1000 50 0.883449
|
||||||
|
172 1089.5775 1093.4550000000002 1000 50 0.9999634
|
||||||
|
173 1093.455 1097.3325 1000 50 0.6814424
|
||||||
|
174 1097.3325 1101.21 1000 50 0.904202
|
||||||
|
175 1105.0875 1108.9650000000001 1000 50 0.55364376
|
||||||
|
176 1120.5975 1124.4750000000001 1000 50 0.719839
|
||||||
|
177 1136.1075 1139.9850000000001 1000 50 0.57873297
|
||||||
|
178 1147.74 1151.6175 1000 50 0.7904256
|
||||||
|
179 1151.6175 1155.4950000000001 1000 50 0.88318896
|
||||||
|
180 1178.76 1182.6375 1000 50 0.88804716
|
||||||
|
181 1186.515 1190.3925000000002 1000 50 0.6625152
|
||||||
|
182 1198.1475 1202.025 1000 50 0.9660911
|
||||||
|
183 1205.9025 1209.78 1000 50 0.91225654
|
||||||
|
184 1209.78 1213.6575 1000 50 0.7151032
|
||||||
|
185 1221.4125 1225.29 1000 50 0.9564372
|
||||||
|
186 1244.6775 1248.555 1000 50 0.722955
|
||||||
|
187 1248.555 1252.4325000000001 1000 50 0.7033242
|
||||||
|
188 1252.4325 1256.31 1000 50 0.72211057
|
||||||
|
189 1256.31 1260.1875 1000 50 0.6124199
|
||||||
|
190 1260.1875 1264.065 1000 50 0.7847693
|
||||||
|
191 1264.065 1267.9425 1000 50 0.6674457
|
||||||
|
192 1267.9425 1271.8200000000002 1000 50 0.76507866
|
||||||
|
193 1271.82 1275.6975 1000 50 0.8226003
|
||||||
|
194 1279.575 1283.4525 1000 50 0.5882834
|
||||||
|
195 1283.4525 1287.3300000000002 1000 50 0.94607145
|
||||||
|
196 1287.33 1291.2075 1000 50 0.5691646
|
||||||
|
197 1295.085 1298.9625 1000 50 0.9842685
|
||||||
|
198 1298.9625 1302.8400000000001 1000 50 0.9851393
|
||||||
|
199 1310.595 1314.4725 1000 50 0.5915515
|
||||||
|
200 1314.4725 1318.3500000000001 1000 50 0.56246245
|
||||||
|
201 1318.35 1322.2275 1000 50 0.996443
|
||||||
|
202 1326.105 1329.9825 1000 50 0.8811614
|
||||||
|
203 1329.9825 1333.8600000000001 1000 50 0.9826125
|
||||||
|
204 1337.7375 1341.615 1000 50 0.9936857
|
||||||
|
205 1345.4925 1349.3700000000001 1000 50 0.997924
|
||||||
|
206 1357.125 1361.0025 1000 50 0.88610935
|
||||||
|
207 1364.88 1368.7575000000002 1000 50 0.5882369
|
||||||
|
208 1388.145 1392.0225 1000 50 0.6528943
|
||||||
|
209 1395.9 1399.7775000000001 1000 50 0.7434355
|
||||||
|
210 1407.5325 1411.41 1000 50 0.53381926
|
||||||
|
211 1438.5525 1442.43 1000 50 0.7328098
|
||||||
|
212 1446.3075 1450.185 1000 50 0.65970933
|
||||||
|
213 1465.695 1469.5725 1000 50 0.539152
|
||||||
|
214 1485.0825 1488.96 1000 50 0.6864708
|
||||||
|
215 1492.8375 1496.7150000000001 1000 50 0.6845237
|
Loading…
Reference in New Issue
Block a user