mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-25 08:32:32 +00:00
Merge branch 'deep_learning' of https://github.com/macster110/PAMGuard into deep_learning
This commit is contained in:
commit
ea0be6ae9c
4
pom.xml
4
pom.xml
@ -389,7 +389,7 @@
|
||||
<dependency>
|
||||
<groupId>net.synedra</groupId>
|
||||
<artifactId>validatorfx</artifactId>
|
||||
<version>0.4.0</version>
|
||||
<version>0.4.2</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-compress -->
|
||||
@ -445,7 +445,7 @@
|
||||
<dependency>
|
||||
<groupId>org.controlsfx</groupId>
|
||||
<artifactId>controlsfx</artifactId>
|
||||
<version>11.0.0</version>
|
||||
<version>11.2.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.openjfx</groupId>
|
||||
|
@ -290,7 +290,7 @@ public class AcquisitionPaneFX extends SettingsPane<AcquisitionParameters>{
|
||||
//custom pane for each aquisition system.
|
||||
systemPane=new PamBorderPane();
|
||||
|
||||
offlineDAQPaneFX= new OfflineDAQPane(acquisitionControl, this);
|
||||
offlineDAQPaneFX= new OfflineDAQPane(acquisitionControl);
|
||||
|
||||
//the main pane is for reference only in viewer mode.
|
||||
Pane samplingPane=createSamplingPane();
|
||||
|
@ -30,8 +30,7 @@ public class OfflineDAQPane extends SettingsPane<OfflineFileParameters>{
|
||||
private PamBorderPane mainPane;
|
||||
|
||||
|
||||
public OfflineDAQPane(OfflineFileDataStore acquisitionControl,
|
||||
AcquisitionPaneFX acquisitionPaneFX){
|
||||
public OfflineDAQPane(OfflineFileDataStore acquisitionControl){
|
||||
super(null);
|
||||
this.mainPane= new PamBorderPane();
|
||||
mainPane.setCenter(createOfflinePane());
|
||||
|
@ -408,7 +408,7 @@ public class Array3DPane extends PamBorderPane {
|
||||
newPoint =new Point3D(streamer.getCoordinate(0)*scaleFactor, -streamer.getCoordinate(2)*scaleFactor, streamer.getCoordinate(1)*scaleFactor);
|
||||
streamerPoints.add(newPoint);
|
||||
|
||||
System.out.println("Streamer points: " + streamerPoints.size());
|
||||
//System.out.println("Streamer points: " + streamerPoints.size());
|
||||
|
||||
PolyLine3D polyLine3D=new PolyLine3D(streamerPoints, 4f, Color.DODGERBLUE);
|
||||
arrayGroup.getChildren().add(polyLine3D);
|
||||
|
@ -31,7 +31,7 @@ public class PamguardVersionInfo {
|
||||
* Version number, major version.minorversion.sub-release.
|
||||
* Note: can't go higher than sub-release 'f'
|
||||
*/
|
||||
static public final String version = "2.02.09c";
|
||||
static public final String version = "2.02.11";
|
||||
|
||||
/**
|
||||
* Release date
|
||||
|
@ -293,4 +293,6 @@
|
||||
.tree-table-view:focused > .virtual-flow > .clipped-container > .sheet > .tree-table-row-cell:filled:selected {
|
||||
-color-cell-fg: -color-cell-fg-selected;
|
||||
-fx-background-color: -color-cell-border, -color-cell-bg-selected;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -130,13 +130,14 @@
|
||||
-fx-border-color: -fx-highlight;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Button for closing a hiding panel. Right indicates bottoms points towards the right, closing a hiding panel
|
||||
* on the right hand side of the screen. These buttons have a transparent background and rounded corners.
|
||||
*/
|
||||
/** top-left, top-right, bottom-right, and bottom-left corners, in that order. */
|
||||
.close-button-right{
|
||||
-fx-background-color: transparent;
|
||||
-fx-background-color: -fx-darkbackground-trans;
|
||||
-fx-background-radius: 0 10 10 0;
|
||||
-fx-border-color: transparent;
|
||||
-fx-border-radius: 0 10 10 0;
|
||||
@ -144,7 +145,7 @@
|
||||
|
||||
|
||||
.close-button-left{
|
||||
-fx-background-color: transparent;
|
||||
-fx-background-color: -fx-darkbackground-trans;
|
||||
-fx-background-radius: 10 0 0 10;
|
||||
-fx-border-color: transparent;
|
||||
-fx-border-radius: 10 0 0 10;
|
||||
@ -152,21 +153,22 @@
|
||||
|
||||
|
||||
.close-button-top{
|
||||
-fx-background-color: transparent;
|
||||
-fx-background-color: -fx-darkbackground-trans;
|
||||
-fx-background-radius: 10 10 0 0;
|
||||
-fx-border-color: transparent;
|
||||
-fx-border-color: transparent;
|
||||
-fx-border-radius: 10 10 0 0;
|
||||
}
|
||||
|
||||
|
||||
.close-button-bottom{
|
||||
-fx-background-color: transparent;
|
||||
-fx-background-color: -fx-darkbackground-trans;
|
||||
-fx-background-radius: 0 0 10 10;
|
||||
-fx-border-color: transparent;
|
||||
-fx-border-color: transparent;
|
||||
-fx-border-radius: 0 0 10 10;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.close-button-bottom-trans{
|
||||
-fx-border-color: transparent;
|
||||
-fx-background-color: transparent;
|
||||
@ -329,8 +331,6 @@
|
||||
* Spinner *
|
||||
* *
|
||||
*********************************************/
|
||||
|
||||
|
||||
.spinner {
|
||||
-fx-pref-width: 120px;
|
||||
}
|
||||
@ -416,6 +416,13 @@
|
||||
-fx-background-color: -fx-highlight_border_settings;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Dialog *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
|
||||
.dialog-pane > .content {
|
||||
-fx-padding: 0,0,0,0;
|
||||
}
|
@ -132,7 +132,7 @@ public class ModuleIconFactory {
|
||||
|
||||
long time2 = System.currentTimeMillis();
|
||||
|
||||
System.out.println("GET MODULE ICON: " + icon + " load time: " + (time2-time1));
|
||||
//System.out.println("GET MODULE ICON: " + icon + " load time: " + (time2-time1));
|
||||
|
||||
return iconNode;
|
||||
};
|
||||
|
@ -290,5 +290,13 @@ public class DecimatorControl extends PamControlledUnit implements PamSettings,
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the decimator process.
|
||||
* @return the decimator process.
|
||||
*/
|
||||
public DecimatorProcessW getDecimatorProcess() {
|
||||
return this.decimatorProcess;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class DecimatorParams implements Serializable, Cloneable, ManagedParamete
|
||||
* @see java.lang.Object#clone()
|
||||
*/
|
||||
@Override
|
||||
protected DecimatorParams clone() {
|
||||
public DecimatorParams clone() {
|
||||
try {
|
||||
DecimatorParams dp = (DecimatorParams) super.clone();
|
||||
dp.filterParams = filterParams.clone();
|
||||
|
@ -1,57 +1,106 @@
|
||||
package decimator.layoutFX;
|
||||
|
||||
import java.awt.GridBagConstraints;
|
||||
|
||||
import org.controlsfx.control.PopOver;
|
||||
|
||||
import Acquisition.layoutFX.OfflineDAQPane;
|
||||
import Filters.FilterBand;
|
||||
import Filters.FilterParams;
|
||||
import Filters.FilterType;
|
||||
import PamController.PamController;
|
||||
import PamController.SettingsPane;
|
||||
import PamDetection.RawDataUnit;
|
||||
import PamView.dialog.PamGridBagContraints;
|
||||
import PamView.dialog.warn.WarnOnce;
|
||||
import PamguardMVC.PamDataBlock;
|
||||
import PamguardMVC.PamRawDataBlock;
|
||||
import dataMap.filemaps.OfflineFileParameters;
|
||||
import decimator.DecimatorControl;
|
||||
import decimator.DecimatorParams;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TabPane;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.Region;
|
||||
import pamViewFX.PamGuiManagerFX;
|
||||
import pamViewFX.fxNodes.PamBorderPane;
|
||||
import pamViewFX.fxNodes.PamButton;
|
||||
import pamViewFX.fxNodes.PamGridPane;
|
||||
import pamViewFX.fxNodes.PamVBox;
|
||||
import pamViewFX.fxNodes.pamDialogFX.PamDialogFX;
|
||||
import pamViewFX.fxNodes.utilityPanes.FilterPaneFX;
|
||||
import pamViewFX.fxNodes.utilityPanes.SourcePaneFX;
|
||||
import pamViewFX.fxStyles.PamStylesManagerFX;
|
||||
|
||||
/**
|
||||
*
|
||||
* Settings for the decimator.
|
||||
*
|
||||
* @author Jamie Macaulay
|
||||
* @author Jamie Macaulay
|
||||
* @author Dougals Gillespie
|
||||
*
|
||||
*/
|
||||
public class DecimatorSettingsPane extends SettingsPane<DecimatorParams> {
|
||||
|
||||
private DecimatorParams decimatorParams;
|
||||
|
||||
private PamBorderPane mainPane;
|
||||
|
||||
/**
|
||||
* Reference to the decimator control.
|
||||
*/
|
||||
private DecimatorControl decimatorControl;
|
||||
|
||||
/**
|
||||
* Allows users to slect the input source.
|
||||
*/
|
||||
private SourcePaneFX sourcePanel;
|
||||
|
||||
/**
|
||||
* Shows the sample rate of the source
|
||||
*/
|
||||
private Label sourceSampleRate;
|
||||
|
||||
private float inputSampleRate;
|
||||
|
||||
private TextField newSampleRate;
|
||||
|
||||
private PamButton filterButton;
|
||||
|
||||
private PamButton defaultFilterButton;
|
||||
|
||||
private Label filterInfo;
|
||||
|
||||
private FilterPaneFX filterPaneFX;
|
||||
|
||||
private ComboBox<String> interpolator;
|
||||
|
||||
private boolean isViewer;
|
||||
|
||||
private OfflineDAQPane offlineDAQPaneFX;
|
||||
|
||||
public DecimatorSettingsPane(DecimatorControl aquisitionControl) {
|
||||
super(null);
|
||||
|
||||
mainPane= new PamBorderPane();
|
||||
this.decimatorControl = aquisitionControl;
|
||||
|
||||
mainPane.setCenter(new Label("Hello Decimator Pane"));
|
||||
mainPane.setCenter(createPane() );
|
||||
|
||||
}
|
||||
|
||||
private Pane createPane() {
|
||||
private Region createPane() {
|
||||
|
||||
PamVBox mainPanel = new PamVBox();
|
||||
PamVBox holder = new PamVBox();
|
||||
holder.setSpacing(5);
|
||||
|
||||
GridBagConstraints constraints = new PamGridBagContraints();
|
||||
// insets = new Insets(2,2,2,2);
|
||||
// insets = new Insets(2,2,2,2);
|
||||
|
||||
Label srcLabel = new Label("Decimator settings");
|
||||
|
||||
PamGuiManagerFX.titleFont2style(srcLabel);
|
||||
holder.getChildren().add(srcLabel);
|
||||
|
||||
sourcePanel = new SourcePaneFX( RawDataUnit.class, true, true);
|
||||
sourcePanel.addSelectionListener((obsval, oldVal, newVal)->{
|
||||
@ -59,86 +108,253 @@ public class DecimatorSettingsPane extends SettingsPane<DecimatorParams> {
|
||||
});
|
||||
|
||||
// sourcePanel.addSourcePanelMonitor(new SPMonitor());
|
||||
mainPanel.getChildren().add(sourcePanel.getPane());
|
||||
holder.getChildren().addAll(sourcePanel);
|
||||
|
||||
PamGridPane decimatorPanel = new PamGridPane();
|
||||
PamGridPane decimatorPane = new PamGridPane();
|
||||
|
||||
|
||||
//Decimator Settings
|
||||
Label label = new Label("Decimator settings");
|
||||
|
||||
PamGuiManagerFX.titleFont2style(label);
|
||||
holder.getChildren().add(label);
|
||||
|
||||
int gridx = 0;
|
||||
int gridy = 0;
|
||||
decimatorPanel.add(new Label("Source sample rate "), gridx, gridy);
|
||||
decimatorPane.add(new Label("Source sample rate "), gridx, gridy);
|
||||
gridx++;
|
||||
decimatorPanel.add(sourceSampleRate = new Label(" - Hz"), gridx, gridy);
|
||||
decimatorPane.add(sourceSampleRate = new Label(" - Hz"), gridx, gridy);
|
||||
gridx = 0;
|
||||
gridy ++;
|
||||
// decimatorPanel.add(new JLabel("Output sample rate "), gridx, gridy);
|
||||
// gridx ++;
|
||||
// decimatorPanel.add(newSampleRate = new TextField(), gridx, gridy);
|
||||
// gridx ++;
|
||||
// decimatorPanel.add(new JLabel(" Hz"), gridx, gridy);
|
||||
// gridy ++;
|
||||
// gridx = 0;
|
||||
|
||||
decimatorPane.add(new Label("Output sample rate "), gridx, gridy);
|
||||
gridx ++;
|
||||
decimatorPane.add(newSampleRate = new TextField(), gridx, gridy);
|
||||
gridx ++;
|
||||
decimatorPane.add(new Label(" Hz"), gridx, gridy);
|
||||
gridy ++;
|
||||
gridx = 0;
|
||||
// gridwidth = 1;
|
||||
// decimatorPanel.add(filterButton = new PamButton("Filter settings"), gridx, gridy);
|
||||
|
||||
filterPaneFX = new FilterPaneFX();
|
||||
decimatorPane.add(filterButton = new PamButton("Filter settings"), gridx, gridy);
|
||||
filterButton.setOnAction((action)->{
|
||||
selectFilters(filterButton);
|
||||
});
|
||||
|
||||
|
||||
// filterButton.addActionListener(new FilterButton());
|
||||
// gridx = 1;
|
||||
gridx = 1;
|
||||
// gridwidth = 2;
|
||||
// addComponent(decimatorPanel, defaultFilterButton = new PamButton("Default Filter"), gridx, gridy);
|
||||
// defaultFilterButton.addActionListener(new DefaultFilterButton());
|
||||
// gridx = 0;
|
||||
// gridwidth = 3;
|
||||
// gridy++;
|
||||
// addComponent(decimatorPanel, filterInfo = new JLabel("Filter: "), gridx, gridy);
|
||||
// gridx = 0;
|
||||
|
||||
|
||||
decimatorPane.add(defaultFilterButton = new PamButton("Default Filter"), gridx, gridy);
|
||||
defaultFilterButton.setOnAction((action)->{
|
||||
restoreDefaultSettings();
|
||||
});
|
||||
|
||||
gridx = 0;
|
||||
gridy++;
|
||||
decimatorPane.add(filterInfo = new Label("Filter: "), gridx, gridy);
|
||||
PamGridPane.setColumnSpan(filterInfo, 3);
|
||||
|
||||
gridx = 0;
|
||||
// gridwidth = 1;
|
||||
// gridy++;
|
||||
// addComponent(decimatorPanel, new JLabel("Interpolation: ", JLabel.RIGHT), gridx, gridy);
|
||||
gridy++;
|
||||
|
||||
Label interpLabel = new Label("Interpolation: ");
|
||||
|
||||
decimatorPane.add(interpLabel, gridx, gridy);
|
||||
gridx++;
|
||||
// gridx += gridwidth;
|
||||
// gridwidth = 2;
|
||||
// addComponent(decimatorPanel, interpolator = new JComboBox<String>(), gridx, gridy);
|
||||
// interpolator.addItem("None");
|
||||
// interpolator.addItem("Linear");
|
||||
// interpolator.addItem("Quadratic");
|
||||
decimatorPane.add(interpolator = new ComboBox<String>(), gridx, gridy);
|
||||
interpolator.getItems().add("None");
|
||||
interpolator.getItems().add("Linear");
|
||||
interpolator.getItems().add("Quadratic");
|
||||
|
||||
holder.getChildren().add(decimatorPane);
|
||||
//
|
||||
// isViewer = PamController.getInstance().getRunMode() == PamController.RUN_PAMVIEW;
|
||||
// if (isViewer) {
|
||||
// JTabbedPane tabbedPane = new JTabbedPane();
|
||||
// offlineDAQDialogPanel = new OfflineFileDialogPanel(decimatorControl, this);
|
||||
// tabbedPane.add("Offline Files", offlineDAQDialogPanel.getComponent());
|
||||
// tabbedPane.add("Runtime Settings", mainPanel);
|
||||
// setDialogComponent(tabbedPane);
|
||||
// }
|
||||
// else {
|
||||
// setDialogComponent(mainPanel);
|
||||
// }
|
||||
isViewer = PamController.getInstance().getRunMode() == PamController.RUN_PAMVIEW;
|
||||
Region mainPane;
|
||||
if (isViewer) {
|
||||
TabPane tabbedPane = new TabPane();
|
||||
|
||||
offlineDAQPaneFX= new OfflineDAQPane(decimatorControl);
|
||||
|
||||
tabbedPane.getTabs().add(new Tab("Offline Files",offlineDAQPaneFX.getContentNode()));
|
||||
tabbedPane.getTabs().add(new Tab("Decimator Settings", holder));
|
||||
mainPane = tabbedPane;
|
||||
}
|
||||
else {
|
||||
mainPane = holder;
|
||||
}
|
||||
//
|
||||
// setHelpPoint("sound_processing.decimatorHelp.docs.decimator_decimator");
|
||||
// filterButton.setToolTipText("Manual adjustment of filter settings");
|
||||
// defaultFilterButton.setToolTipText("Set a default filter (6th order Butterworth low pass at Decimator Nyquist frequency)");
|
||||
// interpolator.setToolTipText("If Decimation / upsampling is not by an integer value, you should use interpolation to improve waveform reconstruction");
|
||||
|
||||
return mainPanel;
|
||||
return mainPane;
|
||||
}
|
||||
|
||||
private void selectFilters(PamButton button) {
|
||||
float filtSampleRate = Math.max(inputSampleRate, getOutputSampleRate());
|
||||
|
||||
PopOver popOver = new PopOver();
|
||||
|
||||
popOver.setContentNode(filterPaneFX.getContentNode());
|
||||
|
||||
filterPaneFX.setParams(decimatorParams.filterParams);
|
||||
filterPaneFX.setSampleRate(filtSampleRate);
|
||||
|
||||
popOver.setOnHidden((e)->{
|
||||
if (decimatorParams.filterParams==null) {
|
||||
restoreDefaultSettings();
|
||||
}
|
||||
|
||||
FilterParams newFP = filterPaneFX.getParams(decimatorParams.filterParams);
|
||||
|
||||
if (newFP != null) {
|
||||
decimatorParams.filterParams = newFP.clone();
|
||||
}
|
||||
|
||||
sayFilter();
|
||||
|
||||
});
|
||||
|
||||
popOver.show(button);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* display filter information
|
||||
*/
|
||||
private void sayFilter() {
|
||||
if (decimatorParams == null || decimatorParams.filterParams == null) {
|
||||
filterInfo.setText("No filter");
|
||||
}
|
||||
else {
|
||||
filterInfo.setText("Filter: " + decimatorParams.filterParams.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private float getOutputSampleRate() {
|
||||
try {
|
||||
float fs = Float.valueOf(newSampleRate.getText());
|
||||
return fs;
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
return inputSampleRate;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void restoreDefaultSettings() {
|
||||
/*
|
||||
* does not set the output sample rate, but does set sensible values for the
|
||||
* filter.
|
||||
*/
|
||||
float newFS = 0;
|
||||
try {
|
||||
newFS = java.lang.Float.valueOf(newSampleRate.getText());
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
}
|
||||
PamDataBlock sourceblock = sourcePanel.getSource();
|
||||
if (sourceblock.getSampleRate() > 0) {
|
||||
newFS = Math.min(newFS, sourceblock.getSampleRate());
|
||||
}
|
||||
if (newFS <= 0) {
|
||||
PamDialogFX.showWarning("Invalid output samplerate : " + newSampleRate.getText());
|
||||
return;
|
||||
}
|
||||
decimatorParams.filterParams.lowPassFreq = newFS/2;
|
||||
decimatorParams.filterParams.filterType = FilterType.BUTTERWORTH;
|
||||
decimatorParams.filterParams.filterOrder = 6;
|
||||
decimatorParams.filterParams.filterBand = FilterBand.LOWPASS;
|
||||
|
||||
sayFilter();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DecimatorParams getParams(DecimatorParams currParams) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
try {
|
||||
// ArrayList<PamDataBlock> rawBlocks = PamController.getInstance().getRawDataBlocks();
|
||||
decimatorParams.rawDataSource = sourcePanel.getSource().getDataName();
|
||||
decimatorParams.channelMap = sourcePanel.getChannelList();
|
||||
decimatorParams.newSampleRate = java.lang.Float.valueOf(newSampleRate.getText());
|
||||
}
|
||||
catch (Exception Ex) {
|
||||
PamDialogFX.showWarning("There is an unknown error - get in touch with PMAGuard support. ");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (decimatorParams.rawDataSource == null) {
|
||||
PamDialogFX.showWarning("You must select a raw data source");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (decimatorParams.channelMap == 0) {
|
||||
PamDialogFX.showWarning("You must select at least one channel for decimation");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (offlineDAQPaneFX != null) {
|
||||
OfflineFileParameters ofp = offlineDAQPaneFX.getParams();
|
||||
if (ofp == null) {
|
||||
return null;
|
||||
}
|
||||
decimatorControl.getOfflineFileServer().setOfflineFileParameters(ofp);
|
||||
}
|
||||
|
||||
decimatorParams.interpolation = interpolator.getSelectionModel().getSelectedIndex();
|
||||
boolean isInt = decimatorControl.isIntegerDecimation(sourcePanel.getSource().getSampleRate(), decimatorParams.newSampleRate);
|
||||
if (isInt && decimatorParams.interpolation > 0) {
|
||||
int ans = WarnOnce.showWarning("Decimator", "With in / out sample rate ratio equal to a whole number, there is no need to interpolate", WarnOnce.OK_CANCEL_OPTION);
|
||||
if (ans == WarnOnce.CANCEL_OPTION) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
decimatorParams.interpolation = 0;
|
||||
}
|
||||
}
|
||||
if (!isInt && decimatorParams.interpolation == 0) {
|
||||
int ans = WarnOnce.showWarning("Decimator", "With in / out sample rate ratio NOT equal to a whole number, it is recommended that you use linear or quadratic interpolation",
|
||||
WarnOnce.OK_CANCEL_OPTION);
|
||||
if (ans == WarnOnce.CANCEL_OPTION) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
// decimatorParams.interpolation = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return decimatorParams;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParams(DecimatorParams input) {
|
||||
// TODO Auto-generated method stub
|
||||
this.decimatorParams = input.clone();
|
||||
|
||||
sourcePanel.excludeDataBlock(decimatorControl.getDecimatorProcess().getOutputDataBlock(0), true);
|
||||
sourcePanel.setSourceList();
|
||||
PamRawDataBlock currentBlock = PamController.getInstance().getRawDataBlock(decimatorParams.rawDataSource);
|
||||
sourcePanel.setSource(currentBlock);
|
||||
sourcePanel.setChannelList(decimatorParams.channelMap);
|
||||
newSampleRate.setText(String.format("%.1f", decimatorParams.newSampleRate));
|
||||
newDataSource();
|
||||
if (offlineDAQPaneFX != null) {
|
||||
offlineDAQPaneFX.setParams(decimatorControl.getOfflineFileServer().getOfflineFileParameters());
|
||||
}
|
||||
interpolator.getSelectionModel().select(decimatorParams.interpolation);
|
||||
sayFilter();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return "Decimator Settings";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -174,7 +174,7 @@ public class PamGuiFX extends StackPane implements PamViewInterface {
|
||||
// showButtonRight.setGraphic(PamGlyphDude.createPamGlyph(FontAwesomeIcon.CHEVRON_LEFT, PamGuiManagerFX.iconColor, PamGuiManagerFX.iconSize));
|
||||
showButtonRight.setGraphic(PamGlyphDude.createPamIcon("mdi2c-chevron-left", PamGuiManagerFX.iconColor, PamGuiManagerFX.iconSize));
|
||||
//showLeftButton.setText(PamFontAwesome.ICON_CHEVRON_LEFT);
|
||||
showButtonRight.getStyleClass().add("close-button-left");
|
||||
showButtonRight.getStyleClass().add("close-button-left-trans");
|
||||
showButtonRight.setStyle("-fx-background-radius: 0 0 0 0;");
|
||||
|
||||
//alter animations to remove/add showButton to tab pane.
|
||||
@ -199,8 +199,8 @@ public class PamGuiFX extends StackPane implements PamViewInterface {
|
||||
});
|
||||
|
||||
PamButton closeButtonLeft=hidingSidePane.getHideButton();
|
||||
closeButtonLeft.getStyleClass().add("close-button-right-trans");
|
||||
// closeButtonLeft.setGraphic(PamGlyphDude.createPamGlyph(FontAwesomeIcon.CHEVRON_RIGHT, Color.DARKGRAY.darker(), PamGuiManagerFX.iconSize));
|
||||
closeButtonLeft.setGraphic(PamGlyphDude.createPamIcon("mdi2c-chevron-right", Color.DARKGRAY.darker(), PamGuiManagerFX.iconSize));
|
||||
closeButtonLeft.prefHeightProperty().bind(mainTabPane.getHeaderHeightProperty());
|
||||
|
||||
//add hiding pane to main pane.
|
||||
@ -217,7 +217,7 @@ public class PamGuiFX extends StackPane implements PamViewInterface {
|
||||
PamButton showButtonLeft=hidingPaneLeft.getShowButton();
|
||||
// showButtonLeft.setGraphic(PamGlyphDude.createPamGlyph(FontAwesomeIcon.BARS, Color.LIGHTGRAY, PamGuiManagerFX.iconSize));
|
||||
showButtonLeft.setGraphic(PamGlyphDude.createPamIcon("mdi2m-menu", Color.LIGHTGRAY, PamGuiManagerFX.iconSize));
|
||||
showButtonLeft.getStyleClass().add("close-button-right");
|
||||
showButtonLeft.getStyleClass().add("close-button-right-trans");
|
||||
showButtonLeft.setStyle(" -fx-background-radius: 0 0 0 0;");
|
||||
|
||||
PamButton closeRightButton=hidingPaneLeft.getHideButton();
|
||||
@ -546,6 +546,7 @@ public class PamGuiFX extends StackPane implements PamViewInterface {
|
||||
this.setRight(rightHBox);
|
||||
|
||||
this.setPrefHeight(prefHeight);
|
||||
this.getStyleClass().add("pane-opaque");
|
||||
|
||||
|
||||
//this.setPadding(new Insets(0,0,0,0));
|
||||
|
@ -466,7 +466,7 @@ public class FilterPaneFX extends SettingsPane<FilterParams> {
|
||||
public void changed(ObservableValue<? extends Number> observable,
|
||||
Number oldValue, Number newValue) {
|
||||
if (axisInitialised) {
|
||||
updateBodeGraph();
|
||||
if (filterMethod!=null) updateBodeGraph();
|
||||
axisInitialised=false;
|
||||
}
|
||||
}
|
||||
@ -689,6 +689,8 @@ public class FilterPaneFX extends SettingsPane<FilterParams> {
|
||||
* @return a data series to add to the line chart
|
||||
*/
|
||||
private Series<Number, Number> createFilterPoints(ValueAxis<Number> axis){
|
||||
|
||||
if (filterMethod==null) return null;
|
||||
|
||||
Series<Number, Number> series = new Series<Number, Number>();
|
||||
/*
|
||||
|
@ -12,12 +12,10 @@ import javafx.scene.control.ToggleGroup;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.Priority;
|
||||
import net.synedra.validatorfx.Validator;
|
||||
import pamViewFX.PamGuiManagerFX;
|
||||
import pamViewFX.fxNodes.PamGridPane;
|
||||
import pamViewFX.fxNodes.PamHBox;
|
||||
import pamViewFX.fxNodes.PamVBox;
|
||||
import pamViewFX.validator.PamValidator;
|
||||
import PamUtils.PamUtils;
|
||||
import PamView.GroupedSourceParameters;
|
||||
import PamguardMVC.PamConstants;
|
||||
@ -29,6 +27,7 @@ import PamguardMVC.PamDataBlock;
|
||||
* @author Jamie Macaulay
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class GroupedSourcePaneFX extends SourcePaneFX {
|
||||
|
||||
|
||||
@ -59,11 +58,6 @@ public class GroupedSourcePaneFX extends SourcePaneFX {
|
||||
*/
|
||||
private PamVBox channelPanel;
|
||||
|
||||
/**
|
||||
* Validator for channels
|
||||
*/
|
||||
private Validator channelValidator;
|
||||
|
||||
|
||||
public GroupedSourcePaneFX(Class sourceType, boolean hasChannels, boolean includeSubClasses, boolean autoGrouping) {
|
||||
super(sourceType, hasChannels, includeSubClasses);
|
||||
@ -76,9 +70,7 @@ public class GroupedSourcePaneFX extends SourcePaneFX {
|
||||
|
||||
@Override
|
||||
protected void createPanel() {
|
||||
|
||||
channelValidator = new PamValidator();
|
||||
|
||||
|
||||
sourcePane=new PamGridPane();
|
||||
sourcePane.setVgap(5);
|
||||
sourcePane.setHgap(5);
|
||||
@ -197,34 +189,6 @@ public class GroupedSourcePaneFX extends SourcePaneFX {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validator for the channel. This can identify errors
|
||||
* in
|
||||
* @return
|
||||
*/
|
||||
public Validator getChannelValidator() {
|
||||
return channelValidator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if
|
||||
* @return
|
||||
*/
|
||||
private boolean isAChannelSelected() {
|
||||
int channels = 0;
|
||||
PamDataBlock sb = getSource();
|
||||
if (sb != null) {
|
||||
// channels = sb.getChannelMap();
|
||||
channels = sb.getSequenceMap();
|
||||
}
|
||||
int n=0;
|
||||
//remove all channels from vertical box pane.
|
||||
for (int i = 0; i < Math.min(PamConstants.MAX_CHANNELS, channelBoxes.length); i++) {
|
||||
if ((channels & 1<<i) != 0 && this.channelBoxes[i].isSelected()) n++;
|
||||
}
|
||||
if (n==0) return false;
|
||||
else return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showChannels() {
|
||||
|
@ -5,7 +5,6 @@ import javafx.stage.StageStyle;
|
||||
import pamViewFX.PamGuiManagerFX;
|
||||
import pamViewFX.fxNodes.pamDialogFX.PamDialogFX;
|
||||
import pamViewFX.fxStyles.PamStylesManagerFX;
|
||||
import PamController.PamController;
|
||||
import PamController.SettingsPane;
|
||||
|
||||
/**
|
||||
@ -22,23 +21,22 @@ public class SettingsDialog<T> extends PamDialogFX<T>{
|
||||
|
||||
public SettingsDialog(SettingsPane<T> settingsPane){
|
||||
super(PamGuiManagerFX.getInstance().getPrimaryStage() /*TODO - add stage*/, settingsPane.getName(), StageStyle.DECORATED);
|
||||
this.getDialogPane().getStylesheets().addAll(PamStylesManagerFX.getPamStylesManagerFX().getCurStyle().getDialogCSS());
|
||||
this.setResizable(true);
|
||||
this.settingsPane=settingsPane;
|
||||
|
||||
|
||||
this.setContent(settingsPane.getContentNode());
|
||||
// this.getDialogPane().getStylesheets().add(PamController.getInstance().getGuiManagerFX().getPamSettingsCSS());
|
||||
|
||||
|
||||
Stage stage = (Stage) this.getDialogPane().getScene().getWindow();
|
||||
stage.toFront();
|
||||
|
||||
// //set results converter
|
||||
// this.setResultConverter(dialogButton -> {
|
||||
// if (dialogButton == ButtonType.OK) {
|
||||
// T params = getParams();
|
||||
// if (params!=null) pamControlledUnit.setParams(params);
|
||||
// }
|
||||
// return null;
|
||||
// });
|
||||
this.getDialogPane().getStylesheets().addAll(PamStylesManagerFX.getPamStylesManagerFX().getCurStyle().getDialogCSS());
|
||||
|
||||
// System.out.println("SettingsPane: DIALOG " + this.getDialogPane().getStylesheets().size());
|
||||
// for (int i=0;i<this.getDialogPane().getStylesheets().size();i++) {
|
||||
// System.out.println(this.getDialogPane().getStylesheets().get(i));
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,14 +15,13 @@ import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Tooltip;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Window;
|
||||
import pamViewFX.PamGuiManagerFX;
|
||||
import pamViewFX.fxNodes.PamBorderPane;
|
||||
import pamViewFX.fxNodes.PamVBox;
|
||||
import pamViewFX.fxNodes.pamDialogFX.PamDialogFX2AWT;
|
||||
import pamViewFX.validator.PamValidator;
|
||||
import PamController.PamController;
|
||||
import PamController.PamGUIManager;
|
||||
import PamDetection.LocalisationInfo;
|
||||
@ -43,7 +42,6 @@ import PamguardMVC.PamDataBlock;
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class SourcePaneFX extends PamBorderPane {
|
||||
|
||||
private PamBorderPane panel;
|
||||
private ArrayList<SourceSelection> sourceType = new ArrayList<>();
|
||||
private boolean hasChannels;
|
||||
private String borderTitle;
|
||||
@ -85,6 +83,11 @@ public class SourcePaneFX extends PamBorderPane {
|
||||
*/
|
||||
private Label titleLabel;
|
||||
|
||||
/**
|
||||
* Validator for channels
|
||||
*/
|
||||
protected PamValidator channelValidator;
|
||||
|
||||
/**
|
||||
* Construct a panel with a titles border
|
||||
* @param borderTitle Title to go in border
|
||||
@ -96,6 +99,7 @@ public class SourcePaneFX extends PamBorderPane {
|
||||
if (sourceType != null) {
|
||||
this.sourceType.add(new SourceSelection(sourceType, includeSubClasses));
|
||||
}
|
||||
channelValidator = new PamValidator();
|
||||
this.setHasChannels(hasChannels);
|
||||
this.setBorderTitle(borderTitle);
|
||||
createPanel();
|
||||
@ -110,6 +114,7 @@ public class SourcePaneFX extends PamBorderPane {
|
||||
*/
|
||||
public SourcePaneFX(Class sourceType, boolean hasChannels, boolean includeSubClasses) {
|
||||
this.sourceType.add(new SourceSelection(sourceType, includeSubClasses));
|
||||
channelValidator = new PamValidator();
|
||||
this.setHasChannels(hasChannels);
|
||||
createPanel();
|
||||
setSourceList();
|
||||
@ -148,6 +153,7 @@ public class SourcePaneFX extends PamBorderPane {
|
||||
* Add a listener to the data source drop down list
|
||||
* @param listener listener
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void addSelectionListener(ChangeListener listener) {
|
||||
sourceList.valueProperty().addListener(listener);
|
||||
}
|
||||
@ -159,7 +165,7 @@ public class SourcePaneFX extends PamBorderPane {
|
||||
|
||||
|
||||
protected void createPanel() {
|
||||
|
||||
|
||||
PamVBox comboBoxPane=new PamVBox();
|
||||
comboBoxPane.setSpacing(5);
|
||||
|
||||
@ -192,8 +198,11 @@ public class SourcePaneFX extends PamBorderPane {
|
||||
channelPanel.getChildren().add(selectAll =new CheckBox("All"));
|
||||
channelBoxes =new CheckBox[PamConstants.MAX_CHANNELS];
|
||||
selectAll.setOnAction((action)->{
|
||||
System.out.println("Stylesheets: 0: " + getStylesheets().size());
|
||||
if (selectAll.isSelected()) selectAllChannels();
|
||||
else selectNoChannels();
|
||||
channelValidator.validate(); //makes sure any error signs are removed.
|
||||
System.out.println("Stylesheets: 1: " + getStylesheets().size());
|
||||
});
|
||||
}
|
||||
|
||||
@ -205,10 +214,21 @@ public class SourcePaneFX extends PamBorderPane {
|
||||
if (isHasChannels()){
|
||||
for (int i = 0; i < PamConstants.MAX_CHANNELS; i++){
|
||||
channelBoxes[i] = new CheckBox("Channel " + i);
|
||||
channelValidator.createCheck()
|
||||
.dependsOn(("channel_" + i + "_" + this), channelBoxes[i].selectedProperty())
|
||||
.withMethod(c -> {
|
||||
if (!isAChannelSelected() ) {
|
||||
c.error("At least one channel needs to be selected for the module to work");
|
||||
}
|
||||
})
|
||||
.decorates(channelBoxes[i])
|
||||
.immediate();
|
||||
|
||||
//channelPanel.getChildren().add(channelBoxes[i]);
|
||||
final int n=i;
|
||||
channelBoxes[i].setOnAction((action)->{
|
||||
selectionChanged(n);
|
||||
channelValidator.validate(); //makes sure any error signs are removed.
|
||||
});
|
||||
//System.out.println("SourcePanel.java creatPanel"+i);
|
||||
}
|
||||
@ -221,6 +241,27 @@ public class SourcePaneFX extends PamBorderPane {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a single channel is selected.
|
||||
* @return true if at least one channel is selected.
|
||||
*/
|
||||
public boolean isAChannelSelected() {
|
||||
int channels = 0;
|
||||
PamDataBlock sb = getSource();
|
||||
if (sb != null) {
|
||||
// channels = sb.getChannelMap();
|
||||
channels = sb.getSequenceMap();
|
||||
}
|
||||
int n=0;
|
||||
//remove all channels from vertical box pane.
|
||||
for (int i = 0; i < Math.min(PamConstants.MAX_CHANNELS, channelBoxes.length); i++) {
|
||||
if ((channels & 1<<i) != 0 && this.channelBoxes[i].isSelected()) n++;
|
||||
}
|
||||
if (n==0) return false;
|
||||
else return true;
|
||||
}
|
||||
|
||||
protected void selectNoChannels() {
|
||||
for (int i = 0; i < channelBoxes.length; i++) {
|
||||
if (channelBoxes[i] != null) {
|
||||
@ -306,6 +347,7 @@ public class SourcePaneFX extends PamBorderPane {
|
||||
private int currentNShown = 0;
|
||||
private Class requiredClassType;
|
||||
|
||||
|
||||
/**
|
||||
* Repack the owner window if the number of channels has changed
|
||||
* @param channelsMap bitmap of used channels.
|
||||
@ -362,7 +404,6 @@ public class SourcePaneFX extends PamBorderPane {
|
||||
// }
|
||||
}
|
||||
currentNShown = PamUtils.getNumChannels(channelsMap);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -626,13 +667,6 @@ public class SourcePaneFX extends PamBorderPane {
|
||||
return sourceList.getSelectionModel().getSelectedIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a reference to the JPanel containing the controls
|
||||
* @return JPanel container
|
||||
*/
|
||||
public Pane getPane() {
|
||||
return panel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude specific data blocks from the source list. e.g. a process would normally not
|
||||
@ -776,6 +810,15 @@ public class SourcePaneFX extends PamBorderPane {
|
||||
*/
|
||||
public ComboBox<PamDataBlock> getDataBlockBox() {
|
||||
return this.sourceList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the channel validator for the source pane.
|
||||
* @return the channel validator
|
||||
*/
|
||||
public PamValidator getChannelValidator() {
|
||||
return channelValidator;
|
||||
}
|
||||
}
|
||||
|
@ -101,6 +101,7 @@ public class PamAtlantaStyle extends PamDefaultStyle {
|
||||
cssStyles.add(getClass().getResource(primerdark).toExternalForm());
|
||||
}
|
||||
cssStyles.add(getClass().getResource(primerPAMGuard).toExternalForm());
|
||||
cssStyles.add(getClass().getResource(primerPAMGuardDark).toExternalForm());
|
||||
return cssStyles;
|
||||
}
|
||||
|
||||
|
@ -67,9 +67,8 @@ public class PamguardFX extends Application {
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
//this is called from launch(args)
|
||||
try {
|
||||
PamController.create(runMode, primaryStage);
|
||||
|
||||
|
||||
System.out.println("javafx.runtime.version: " + System.getProperty("javafx.runtime.version"));
|
||||
PamController.create(runMode, primaryStage);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
Loading…
Reference in New Issue
Block a user