mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-25 16:42:27 +00:00
Updates to DL data selector and POM
This commit is contained in:
parent
f4fa3323b7
commit
3f06d8faf0
2
pom.xml
2
pom.xml
@ -309,7 +309,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.macster110</groupId>
|
<groupId>io.github.macster110</groupId>
|
||||||
<artifactId>jdl4pam</artifactId>
|
<artifactId>jdl4pam</artifactId>
|
||||||
<version>0.0.99a</version>
|
<version>0.0.99b</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/gov.nist.math/jama -->
|
<!-- https://mvnrepository.com/artifact/gov.nist.math/jama -->
|
||||||
|
@ -1,45 +1,45 @@
|
|||||||
package PamguardMVC.dataSelector;
|
package PamguardMVC.dataSelector;
|
||||||
|
|
||||||
import java.awt.GridBagConstraints;
|
|
||||||
import java.awt.GridBagLayout;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import javax.swing.JComponent;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
|
|
||||||
import PamView.dialog.PamDialogPanel;
|
|
||||||
import PamView.dialog.PamGridBagContraints;
|
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import pamViewFX.fxNodes.PamBorderPane;
|
|
||||||
import pamViewFX.fxNodes.PamVBox;
|
import pamViewFX.fxNodes.PamVBox;
|
||||||
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
|
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* shows multiple data selectors in a pane. This would be used, for example, in a situation where
|
||||||
|
* a data unit has multiple associated data selectors, for example if is annotated with an annotation
|
||||||
|
* that has a data selector.
|
||||||
|
*/
|
||||||
public class CompoundDialogPaneFX extends DynamicSettingsPane<Boolean> {
|
public class CompoundDialogPaneFX extends DynamicSettingsPane<Boolean> {
|
||||||
|
|
||||||
|
|
||||||
private CompoundDataSelector compoundDataSelector;
|
private CompoundDataSelector compoundDataSelector;
|
||||||
|
|
||||||
private ArrayList<DataSelector> selectorList;
|
private ArrayList<DataSelector> selectorList;
|
||||||
private ArrayList<PamDialogPanel> selectorPanels;
|
private ArrayList<DataSelectorDialogPaneFX> selectorPanels;
|
||||||
|
|
||||||
private PamVBox mainPanel;
|
private PamVBox mainPanel;
|
||||||
|
|
||||||
public CompoundDialogPaneFX(CompoundDataSelector compoundDataSelector) {
|
public CompoundDialogPaneFX(CompoundDataSelector compoundDataSelector) {
|
||||||
|
super(null);
|
||||||
|
|
||||||
this.compoundDataSelector = compoundDataSelector;
|
this.compoundDataSelector = compoundDataSelector;
|
||||||
this.selectorList = compoundDataSelector.getSelectorList();
|
this.selectorList = compoundDataSelector.getSelectorList();
|
||||||
|
|
||||||
mainPanel = new PamVBox();
|
mainPanel = new PamVBox();
|
||||||
mainPanel.setSpacing(5);
|
mainPanel.setSpacing(10);
|
||||||
selectorPanels = new ArrayList<PamDialogPanel>(selectorList.size());
|
selectorPanels = new ArrayList<DataSelectorDialogPaneFX>(selectorList.size());
|
||||||
int ind = 0;
|
int ind = 0;
|
||||||
for (DataSelector ds : selectorList) {
|
for (DataSelector ds : selectorList) {
|
||||||
DynamicSettingsPane<Boolean> panel = ds.getDialogPaneFX();
|
DynamicSettingsPane<Boolean> panel = ds.getDialogPaneFX();
|
||||||
// turn all these panels into the compound ones with the extra enable options.
|
// turn all these panels into the compound ones with the extra enable options.
|
||||||
|
|
||||||
// DataSelectorDialogPanel dsp = new DataSelectorDialogPanel(ds, panel, ind++);
|
DataSelectorDialogPaneFX dsp = new DataSelectorDialogPaneFX(ds, panel, ind++);
|
||||||
// selectorPanels.add(dsp);
|
selectorPanels.add(dsp);
|
||||||
|
|
||||||
mainPanel.getChildren().add(panel.getContentNode());
|
mainPanel.getChildren().add(dsp.getContentNode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,8 +48,8 @@ public class CompoundDialogPaneFX extends DynamicSettingsPane<Boolean> {
|
|||||||
public Boolean getParams(Boolean currParams) {
|
public Boolean getParams(Boolean currParams) {
|
||||||
boolean ok = true;
|
boolean ok = true;
|
||||||
for (int i = 0; i < selectorPanels.size(); i++) {
|
for (int i = 0; i < selectorPanels.size(); i++) {
|
||||||
PamDialogPanel panel = selectorPanels.get(i);
|
DataSelectorDialogPaneFX panel = selectorPanels.get(i);
|
||||||
ok |= panel.getParams();
|
ok |= panel.getParams(currParams);
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@ -57,8 +57,8 @@ public class CompoundDialogPaneFX extends DynamicSettingsPane<Boolean> {
|
|||||||
@Override
|
@Override
|
||||||
public void setParams(Boolean input) {
|
public void setParams(Boolean input) {
|
||||||
for (int i = 0; i < selectorPanels.size(); i++) {
|
for (int i = 0; i < selectorPanels.size(); i++) {
|
||||||
PamDialogPanel panel = selectorPanels.get(i);
|
DataSelectorDialogPaneFX panel = selectorPanels.get(i);
|
||||||
panel.setParams();
|
panel.setParams(input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,36 +1,193 @@
|
|||||||
package PamguardMVC.dataSelector;
|
package PamguardMVC.dataSelector;
|
||||||
|
|
||||||
|
import org.controlsfx.control.SegmentedButton;
|
||||||
|
|
||||||
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.Separator;
|
||||||
|
import javafx.scene.control.ToggleButton;
|
||||||
|
import javafx.scene.control.ToggleGroup;
|
||||||
|
import javafx.scene.control.Tooltip;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
|
import pamViewFX.PamGuiManagerFX;
|
||||||
|
import pamViewFX.fxNodes.PamVBox;
|
||||||
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
|
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dialog panel to wrap around a standard dialog panel from a data selector.
|
||||||
|
* This adds a wrapper the data selector which enables or disables it based on
|
||||||
|
* whether it has been selected or not.
|
||||||
|
* @author Jamie Macaulay
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class DataSelectorDialogPaneFX extends DynamicSettingsPane<Boolean> {
|
public class DataSelectorDialogPaneFX extends DynamicSettingsPane<Boolean> {
|
||||||
|
|
||||||
public DataSelectorDialogPaneFX(Object ownerWindow) {
|
private static final double PREF_TOGGLE_WIDTH = 60;
|
||||||
super(ownerWindow);
|
|
||||||
// TODO Auto-generated constructor stub
|
private DataSelector dataSelector;
|
||||||
|
private DynamicSettingsPane<Boolean> innerPanel;
|
||||||
|
private int setIndex;
|
||||||
|
|
||||||
|
private PamVBox dsPane;
|
||||||
|
private ToggleGroup buttonGroup;
|
||||||
|
private ToggleButton andButton, orButton, disableButton;
|
||||||
|
private HBox buttonPane;
|
||||||
|
private Node contentPane;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the DataSelectorDialogPaneFX
|
||||||
|
* @param dataSelector
|
||||||
|
* @param innerPanel
|
||||||
|
* @param setIndex
|
||||||
|
*/
|
||||||
|
public DataSelectorDialogPaneFX(DataSelector dataSelector, DynamicSettingsPane<Boolean> innerPanel, int setIndex) {
|
||||||
|
super(null);
|
||||||
|
this.dataSelector = dataSelector;
|
||||||
|
this.innerPanel = innerPanel;
|
||||||
|
this.setIndex = setIndex;
|
||||||
|
|
||||||
|
dsPane = new PamVBox(); // Use VBox for vertical layout
|
||||||
|
dsPane.setSpacing(5);
|
||||||
|
|
||||||
|
contentPane = innerPanel.getContentNode();
|
||||||
|
|
||||||
|
// Border exBorder = innerComponent.getBorder();
|
||||||
|
//
|
||||||
|
// if (exBorder instanceof TitledBorder) {
|
||||||
|
// innerComponent.setBorder(null);
|
||||||
|
// // Set a lower bevel border if desired:
|
||||||
|
// // innerComponent.setBorder(new BevelBorder(BevelBorder.LOWERED));
|
||||||
|
// dsPane.setBorder(exBorder);
|
||||||
|
// } else {
|
||||||
|
// dsPane.setBorder(new TitledBorder(dataSelector.getSelectorTitle()));
|
||||||
|
// }
|
||||||
|
|
||||||
|
Label title = new Label(innerPanel.getName());
|
||||||
|
title.setTooltip(new Tooltip("Data selector: " + dataSelector.getLongSelectorName()));
|
||||||
|
PamGuiManagerFX.titleFont2style(title);
|
||||||
|
|
||||||
|
|
||||||
|
buttonGroup = new ToggleGroup();
|
||||||
|
andButton = new ToggleButton(setIndex == 0 ? "Enable" : "AND");
|
||||||
|
andButton.setPrefWidth(PREF_TOGGLE_WIDTH);
|
||||||
|
|
||||||
|
disableButton = new ToggleButton("Skip");
|
||||||
|
disableButton.setPrefWidth(PREF_TOGGLE_WIDTH);
|
||||||
|
|
||||||
|
orButton = new ToggleButton("OR");
|
||||||
|
orButton.setPrefWidth(PREF_TOGGLE_WIDTH);
|
||||||
|
|
||||||
|
buttonGroup.getToggles().addAll(andButton, orButton, disableButton);
|
||||||
|
|
||||||
|
SegmentedButton segmentedButton ;
|
||||||
|
if (setIndex > 0) {
|
||||||
|
segmentedButton = new SegmentedButton(andButton, orButton, disableButton);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
segmentedButton = new SegmentedButton(andButton, disableButton);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean getParams(Boolean currParams) {
|
andButton.setOnAction(event -> enableComponent());
|
||||||
// TODO Auto-generated method stub
|
orButton.setOnAction(event -> enableComponent());
|
||||||
return null;
|
disableButton.setOnAction(event -> enableComponent());
|
||||||
|
|
||||||
|
buttonPane = new HBox(); // Use HBox for horizontal button layout
|
||||||
|
buttonPane.setSpacing(5);
|
||||||
|
buttonPane.setAlignment(Pos.CENTER);
|
||||||
|
buttonPane.getChildren().addAll(segmentedButton);
|
||||||
|
|
||||||
|
//add everything to the main pane
|
||||||
|
if (setIndex > 0) {
|
||||||
|
dsPane.getChildren().add(new Separator());
|
||||||
|
}
|
||||||
|
dsPane.getChildren().add(title);
|
||||||
|
dsPane.getChildren().add(buttonPane); // Add button pane at top
|
||||||
|
dsPane.getChildren().add(contentPane);
|
||||||
|
|
||||||
|
|
||||||
|
orButton.setVisible(setIndex > 0);
|
||||||
|
if (dataSelector instanceof CompoundDataSelector || setIndex < 0) {
|
||||||
|
buttonPane.setVisible(false);
|
||||||
|
dsPane.setBorder(null);
|
||||||
|
}
|
||||||
|
enableComponent();
|
||||||
|
//buttonPane.setTooltip(new Tooltip("Options for " + dataSelector.getLongSelectorName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void enableComponent() {
|
||||||
|
contentPane.setDisable(disableButton.isSelected());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setParams(Boolean input) {
|
public void setParams(Boolean input) {
|
||||||
// TODO Auto-generated method stub
|
DataSelectParams params = dataSelector.getParams();
|
||||||
|
if (params == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (buttonPane.isVisible()) {
|
||||||
|
andButton.setSelected(params.getCombinationFlag() == DataSelectParams.DATA_SELECT_AND);
|
||||||
|
orButton.setSelected(params.getCombinationFlag() == DataSelectParams.DATA_SELECT_OR);
|
||||||
|
disableButton.setSelected(params.getCombinationFlag() == DataSelectParams.DATA_SELECT_DISABLE);
|
||||||
|
} else {
|
||||||
|
andButton.setSelected(true);
|
||||||
|
orButton.setSelected(false);
|
||||||
|
disableButton.setSelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
innerPanel.setParams(input);
|
||||||
|
enableComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean getParams(Boolean a) {
|
||||||
|
DataSelectParams params = dataSelector.getParams();
|
||||||
|
|
||||||
|
if (disableButton.isSelected()) {
|
||||||
|
if (params != null) {
|
||||||
|
params.setCombinationFlag(DataSelectParams.DATA_SELECT_DISABLE);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean innerOk = innerPanel.getParams(a);
|
||||||
|
if (!innerOk) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
params = dataSelector.getParams(); // Might have been recreated
|
||||||
|
|
||||||
|
if (params != null) {
|
||||||
|
if (andButton.isSelected()) {
|
||||||
|
params.setCombinationFlag(DataSelectParams.DATA_SELECT_AND);
|
||||||
|
} else if (orButton.isSelected()) {
|
||||||
|
params.setCombinationFlag(DataSelectParams.DATA_SELECT_OR);
|
||||||
|
} else if (disableButton.isSelected()) {
|
||||||
|
params.setCombinationFlag(DataSelectParams.DATA_SELECT_DISABLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return innerOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Utility method for disabling/enabling a Node (doesn't work recursively)
|
||||||
|
public static void setEnabled(Node node, boolean enabled) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "Data selector wrapper pane";
|
return "Data selector";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Node getContentNode() {
|
public Node getContentNode() {
|
||||||
// TODO Auto-generated method stub
|
return dsPane;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -38,5 +195,4 @@ public class DataSelectorDialogPaneFX extends DynamicSettingsPane<Boolean> {
|
|||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -987,3 +987,27 @@
|
|||||||
.spinner {
|
.spinner {
|
||||||
-fx-pref-width: 100px;
|
-fx-pref-width: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************
|
||||||
|
* *
|
||||||
|
* Segmented button *
|
||||||
|
* *
|
||||||
|
*********************************************/
|
||||||
|
|
||||||
|
.segmented-button .toggle-button.left-pill {
|
||||||
|
-fx-border-radius: 5 0 0 5;
|
||||||
|
-fx-background-radius: 5 0 0 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.segmented-button .toggle-button.center-pill {
|
||||||
|
-fx-border-radius: 0 0 0 0;
|
||||||
|
-fx-background-radius: 0 0 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.segmented-button .toggle-button.right-pill {
|
||||||
|
-fx-border-radius: 0 5 5 0;
|
||||||
|
-fx-background-radius: 0 5 5 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public class ClickSelectPaneFX extends DynamicSettingsPane<Boolean> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "Click Type Selection";
|
return "Filter by click type";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -185,6 +185,7 @@ public class TemplateSpectrumPane extends PamBorderPane {
|
|||||||
this.currentSpectrum = new SpectrumTemplateDataUnit(spectrumTemplate);
|
this.currentSpectrum = new SpectrumTemplateDataUnit(spectrumTemplate);
|
||||||
templateDisplay.setDataUnit(currentSpectrum);
|
templateDisplay.setDataUnit(currentSpectrum);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -226,7 +227,6 @@ public class TemplateSpectrumPane extends PamBorderPane {
|
|||||||
if (templateImporters.get(i).getExtension()[j].equals(extension)) {
|
if (templateImporters.get(i).getExtension()[j].equals(extension)) {
|
||||||
// System.out.println("Import using the extensions: " + extension);
|
// System.out.println("Import using the extensions: " + extension);
|
||||||
template=templateImporters.get(i).importTemplate(file);
|
template=templateImporters.get(i).importTemplate(file);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -288,7 +288,7 @@ public class TemplateSpectrumPane extends PamBorderPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double[][] getPowerSpectrum(SpectrumTemplateDataUnit data, int strat, int end) {
|
public double[][] getPowerSpectrum(SpectrumTemplateDataUnit data, int start, int end) {
|
||||||
return new double[][]{data.spectrumTemplate.waveform};
|
return new double[][]{data.spectrumTemplate.waveform};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,6 +296,7 @@ public class TemplateSpectrumPane extends PamBorderPane {
|
|||||||
@Override
|
@Override
|
||||||
public double getSampleRate(SpectrumTemplateDataUnit data) {
|
public double getSampleRate(SpectrumTemplateDataUnit data) {
|
||||||
//bit of a hack to get sample rate but works.
|
//bit of a hack to get sample rate but works.
|
||||||
|
// System.out.println("Set sample rate: " + data.spectrumTemplate.sR);
|
||||||
return data.spectrumTemplate.sR;
|
return data.spectrumTemplate.sR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,6 +215,7 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
|
|||||||
scrollPane2.setHbarPolicy(ScrollBarPolicy.NEVER);
|
scrollPane2.setHbarPolicy(ScrollBarPolicy.NEVER);
|
||||||
scrollPane2.getStyleClass().clear();
|
scrollPane2.getStyleClass().clear();
|
||||||
symbolTab.setContent(scrollPane2);
|
symbolTab.setContent(scrollPane2);
|
||||||
|
|
||||||
Tab dataView=new Tab("Data");
|
Tab dataView=new Tab("Data");
|
||||||
dataView.setContent(dataSelectHolder);
|
dataView.setContent(dataSelectHolder);
|
||||||
dataView.getStyleClass().add("tab-square");
|
dataView.getStyleClass().add("tab-square");
|
||||||
@ -242,7 +243,7 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
|
|||||||
* @return the data select pane.
|
* @return the data select pane.
|
||||||
*/
|
*/
|
||||||
private DynamicSettingsPane<Boolean> createDataSelectPane(){
|
private DynamicSettingsPane<Boolean> createDataSelectPane(){
|
||||||
System.out.println("Data selector: " + clickPlotInfo.getClickDataSelector());
|
System.out.println("DATA SELECTOR: " + clickPlotInfo.getClickDataSelector());
|
||||||
return clickPlotInfo.getClickDataSelector().getDialogPaneFX();
|
return clickPlotInfo.getClickDataSelector().getDialogPaneFX();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ public abstract class SpectrumPlot <D extends PamDataUnit> implements Detection
|
|||||||
private SpectrumSettingsPane spectrumSettingsPane;
|
private SpectrumSettingsPane spectrumSettingsPane;
|
||||||
|
|
||||||
|
|
||||||
private double sR;
|
private double storedsR;
|
||||||
|
|
||||||
|
|
||||||
// //TODO
|
// //TODO
|
||||||
@ -132,7 +132,7 @@ public abstract class SpectrumPlot <D extends PamDataUnit> implements Detection
|
|||||||
|
|
||||||
if (data ==null) return;
|
if (data ==null) return;
|
||||||
|
|
||||||
this.sR=sR;
|
this.storedsR=sR;
|
||||||
|
|
||||||
int[] minmax = getAxisMinMaxSamples(plotProjector);
|
int[] minmax = getAxisMinMaxSamples(plotProjector);
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ public abstract class SpectrumPlot <D extends PamDataUnit> implements Detection
|
|||||||
}
|
}
|
||||||
|
|
||||||
private double getSampleRate() {
|
private double getSampleRate() {
|
||||||
return sR;
|
return storedsR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -235,6 +235,8 @@ public abstract class SpectrumPlot <D extends PamDataUnit> implements Detection
|
|||||||
storedSpectrum=this.getPowerSpectrum(data, minmax[0], minmax[1]);
|
storedSpectrum=this.getPowerSpectrum(data, minmax[0], minmax[1]);
|
||||||
storedCepstrum=this.getCepstrum(data, minmax[0], minmax[1]);
|
storedCepstrum=this.getCepstrum(data, minmax[0], minmax[1]);
|
||||||
|
|
||||||
|
storedsR = getSampleRate(data);
|
||||||
|
|
||||||
if (spectrumPlotParams.logScale) {
|
if (spectrumPlotParams.logScale) {
|
||||||
paintLogSpectrum(gc, clipRect,projector);
|
paintLogSpectrum(gc, clipRect,projector);
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ public class DLSymbolOptionPane extends StandardSymbolModifierPane {
|
|||||||
|
|
||||||
b1 = new ToggleButton("Prediction");
|
b1 = new ToggleButton("Prediction");
|
||||||
b1.setPrefWidth(80);
|
b1.setPrefWidth(80);
|
||||||
b1.setStyle("-fx-border-radius: 5 0 0 5; -fx-background-radius: 5 0 0 5;");
|
// b1.setStyle("-fx-border-radius: 5 0 0 5; -fx-background-radius: 5 0 0 5;");
|
||||||
|
|
||||||
b2 = new ToggleButton("Class");
|
b2 = new ToggleButton("Class");
|
||||||
b2.setPrefWidth(80);
|
b2.setPrefWidth(80);
|
||||||
@ -105,7 +105,7 @@ public class DLSymbolOptionPane extends StandardSymbolModifierPane {
|
|||||||
//change the colour of the colour range slider.
|
//change the colour of the colour range slider.
|
||||||
notifySettingsListeners();
|
notifySettingsListeners();
|
||||||
});
|
});
|
||||||
b2.setStyle("-fx-border-radius: 0 5 5 0; -fx-background-radius: 0 5 5 0;");
|
// b2.setStyle("-fx-border-radius: 0 5 5 0; -fx-background-radius: 0 5 5 0;");
|
||||||
|
|
||||||
|
|
||||||
b2.setOnAction((a)->{
|
b2.setOnAction((a)->{
|
||||||
@ -117,6 +117,8 @@ public class DLSymbolOptionPane extends StandardSymbolModifierPane {
|
|||||||
SegmentedButton segmentedButton = new SegmentedButton();
|
SegmentedButton segmentedButton = new SegmentedButton();
|
||||||
segmentedButton.getButtons().addAll(b1, b2);
|
segmentedButton.getButtons().addAll(b1, b2);
|
||||||
segmentedButton.setPadding(new Insets(5,0,5,0));
|
segmentedButton.setPadding(new Insets(5,0,5,0));
|
||||||
|
segmentedButton.getStyleClass().add(SegmentedButton.STYLE_CLASS_DARK);
|
||||||
|
|
||||||
|
|
||||||
BorderPane.setAlignment(segmentedButton, Pos.CENTER);
|
BorderPane.setAlignment(segmentedButton, Pos.CENTER);
|
||||||
b1.setSelected(true);
|
b1.setSelected(true);
|
||||||
@ -162,7 +164,9 @@ public class DLSymbolOptionPane extends StandardSymbolModifierPane {
|
|||||||
classNameBox2.setMaxWidth(Double.MAX_VALUE);
|
classNameBox2.setMaxWidth(Double.MAX_VALUE);
|
||||||
|
|
||||||
classNameBox2.setOnAction((action)->{
|
classNameBox2.setOnAction((action)->{
|
||||||
|
if (classNameBox2.getSelectionModel().getSelectedIndex()>=0){
|
||||||
colourPicker.setValue(PamUtilsFX.intToColor(dlSymbolModifier.getSymbolModifierParams().classColors[classNameBox2.getSelectionModel().getSelectedIndex()]));
|
colourPicker.setValue(PamUtilsFX.intToColor(dlSymbolModifier.getSymbolModifierParams().classColors[classNameBox2.getSelectionModel().getSelectedIndex()]));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
classNameBox2.setPrefWidth(CLASS_NAME_BOX_WIDTH);
|
classNameBox2.setPrefWidth(CLASS_NAME_BOX_WIDTH);
|
||||||
|
@ -2,6 +2,7 @@ package rawDeepLearningClassifier.dataSelector;
|
|||||||
|
|
||||||
import PamguardMVC.PamDataUnit;
|
import PamguardMVC.PamDataUnit;
|
||||||
import PamguardMVC.dataSelector.DataSelectParams;
|
import PamguardMVC.dataSelector.DataSelectParams;
|
||||||
|
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Score a data unit with a deep learning annotation. Note that this could be an
|
* Score a data unit with a deep learning annotation. Note that this could be an
|
||||||
@ -31,5 +32,11 @@ public interface DLDataFilter {
|
|||||||
*/
|
*/
|
||||||
public void setParams(DataSelectParams params);
|
public void setParams(DataSelectParams params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Settings controls for this filter.
|
||||||
|
* @return the cotnrols for this filter.
|
||||||
|
*/
|
||||||
|
public DynamicSettingsPane<DataSelectParams> getSettingsPane();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import PamguardMVC.dataSelector.DataSelectParams;
|
|||||||
import PamguardMVC.dataSelector.DataSelector;
|
import PamguardMVC.dataSelector.DataSelector;
|
||||||
import annotation.DataAnnotationType;
|
import annotation.DataAnnotationType;
|
||||||
import annotation.dataselect.AnnotationDataSelector;
|
import annotation.dataselect.AnnotationDataSelector;
|
||||||
|
import javafx.scene.Node;
|
||||||
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
|
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
|
||||||
import rawDeepLearningClassifier.DLControl;
|
import rawDeepLearningClassifier.DLControl;
|
||||||
import rawDeepLearningClassifier.logging.DLAnnotation;
|
import rawDeepLearningClassifier.logging.DLAnnotation;
|
||||||
@ -139,4 +140,12 @@ public class DLDataSelector extends AnnotationDataSelector<DLAnnotation> {
|
|||||||
return score>=0 ? 1 : 0;
|
return score>=0 ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DLDataFilter getCurrentDataSelector() {
|
||||||
|
return dataFilters.get(dlDataSelectParams.dataSelectorIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DLDataFilter> getDataSelectors() {
|
||||||
|
return dataFilters;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package rawDeepLearningClassifier.dataSelector;
|
|||||||
|
|
||||||
import PamguardMVC.PamDataUnit;
|
import PamguardMVC.PamDataUnit;
|
||||||
import PamguardMVC.dataSelector.DataSelectParams;
|
import PamguardMVC.dataSelector.DataSelectParams;
|
||||||
|
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
|
||||||
import rawDeepLearningClassifier.DLControl;
|
import rawDeepLearningClassifier.DLControl;
|
||||||
import rawDeepLearningClassifier.dlClassification.DLDetection;
|
import rawDeepLearningClassifier.dlClassification.DLDetection;
|
||||||
import rawDeepLearningClassifier.dlClassification.PredictionResult;
|
import rawDeepLearningClassifier.dlClassification.PredictionResult;
|
||||||
@ -81,6 +82,13 @@ public class DLPredictionFilter implements DLDataFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DynamicSettingsPane<DataSelectParams> getSettingsPane() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Get the index of the highest prediciton value a list of results.
|
// * Get the index of the highest prediciton value a list of results.
|
||||||
// * @param predictions - index of the highest prediction within a matrix of predicitons.
|
// * @param predictions - index of the highest prediction within a matrix of predicitons.
|
||||||
|
@ -0,0 +1,77 @@
|
|||||||
|
package rawDeepLearningClassifier.dataSelector;
|
||||||
|
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
|
import pamViewFX.fxNodes.PamHBox;
|
||||||
|
import pamViewFX.fxNodes.PamSpinner;
|
||||||
|
import pamViewFX.fxNodes.PamVBox;
|
||||||
|
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Settings pane for filtering deep learning results by class prediciton.
|
||||||
|
*/
|
||||||
|
public class DLPredictonPane extends DynamicSettingsPane<DLPredictionFilterParams>{
|
||||||
|
|
||||||
|
private DLPredictionFilter predicitonFilter;
|
||||||
|
|
||||||
|
private PamVBox mainPane;
|
||||||
|
|
||||||
|
public DLPredictonPane(DLPredictionFilter predicitonFilter) {
|
||||||
|
super(null);
|
||||||
|
this.predicitonFilter=predicitonFilter;
|
||||||
|
|
||||||
|
createPane();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void createPane() {
|
||||||
|
mainPane = new PamVBox();
|
||||||
|
mainPane.setSpacing(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
class ClassDataSelector extends PamHBox {
|
||||||
|
|
||||||
|
PamSpinner<Double> spinner;
|
||||||
|
|
||||||
|
CheckBox enable;
|
||||||
|
|
||||||
|
ClassDataSelector(String classType, int index) {
|
||||||
|
|
||||||
|
enable = new CheckBox(classType);
|
||||||
|
spinner = new PamSpinner<Double>(0., 1., 0.7, 0.1);
|
||||||
|
spinner.setEditable(true);
|
||||||
|
|
||||||
|
this.getChildren().addAll(getChildrenUnmodifiable());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DLPredictionFilterParams getParams(DLPredictionFilterParams currParams) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return currParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setParams(DLPredictionFilterParams input) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Deep learning prediciton filter";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Node getContentNode() {
|
||||||
|
return mainPane;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paneInitialized() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,41 +1,70 @@
|
|||||||
package rawDeepLearningClassifier.dataSelector;
|
package rawDeepLearningClassifier.dataSelector;
|
||||||
|
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
import pamViewFX.fxNodes.PamHBox;
|
||||||
|
import pamViewFX.fxNodes.PamSpinner;
|
||||||
|
import pamViewFX.fxNodes.PamVBox;
|
||||||
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
|
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JavaFX pane for the deep learning data selector.
|
* JavaFX pane for the deep learning data selector. This simply selects the rype
|
||||||
|
* of filter to use and sets that as the controls.
|
||||||
*
|
*
|
||||||
* @author Jamie Macaulay
|
* @author Jamie Macaulay
|
||||||
*/
|
*/
|
||||||
public class DLSelectPaneFX extends DynamicSettingsPane<Boolean>{
|
public class DLSelectPaneFX extends DynamicSettingsPane<Boolean>{
|
||||||
|
|
||||||
public DLSelectPaneFX(Object ownerWindow) {
|
private PamVBox mainPane;
|
||||||
super(ownerWindow);
|
|
||||||
// TODO Auto-generated constructor stub
|
/**
|
||||||
|
* Refrence to the deep learning data selector.
|
||||||
|
*/
|
||||||
|
private DLDataSelector dlDataSelector;
|
||||||
|
|
||||||
|
private int currentIndex = 0;
|
||||||
|
|
||||||
|
public DLSelectPaneFX(DLDataSelector dlDataSelector) {
|
||||||
|
super(null);
|
||||||
|
this.dlDataSelector=dlDataSelector;
|
||||||
|
|
||||||
|
//there is currently one implemented fitler so no
|
||||||
|
//need for a comboBox etc. to select.
|
||||||
|
createPane();
|
||||||
|
|
||||||
|
// mainPane.getChildren().add(dlDataSelector.getDataSelectors().getSettingsPane().getContentNode());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createPane() {
|
||||||
|
mainPane = new PamVBox();
|
||||||
|
mainPane.setSpacing(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean getParams(Boolean currParams) {
|
public Boolean getParams(Boolean currParams) {
|
||||||
// TODO Auto-generated method stub
|
dlDataSelector.getDataSelectors().get(currentIndex).getSettingsPane().getParams(null);
|
||||||
|
|
||||||
|
|
||||||
return currParams;
|
return currParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setParams(Boolean input) {
|
public void setParams(Boolean input) {
|
||||||
// TODO Auto-generated method stub
|
dlDataSelector.getDataSelectors().get(currentIndex).getSettingsPane().getParams(null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "Deep Learning Data Selector:";
|
return "Filter by deep learning result";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Node getContentNode() {
|
public Node getContentNode() {
|
||||||
return new Label("Hello data selector");
|
return new Label("Hello DL data selector");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user