right whale symbol selector for fx display

Symbol selector for right whale edge detector on FX display (needs an icon still)
This commit is contained in:
Douglas Gillespie 2024-05-07 17:12:02 +01:00
parent 475e7c42cd
commit 4e0eacde99
3 changed files with 50 additions and 15 deletions

View File

@ -268,7 +268,7 @@ public class RWEProcess extends PamProcess {
backgroundData[i] += (magData[i]-backgroundData[i])/updateConstant[0]; backgroundData[i] += (magData[i]-backgroundData[i])/updateConstant[0];
} }
if (Double.isNaN(backgroundData[i]) || Double.isInfinite(backgroundData[i])) { if (Double.isNaN(backgroundData[i]) || Double.isInfinite(backgroundData[i])) {
System.out.println(String.format("Bad bg data slice %d = %3.5f", i, backgroundData[i])); // System.out.println(String.format("Bad bg data slice %d = %3.5f", i, backgroundData[i]));
backgroundData[i] = magData[i] * 10.; backgroundData[i] = magData[i] * 10.;
} }
} }

View File

@ -3,27 +3,38 @@ package RightWhaleEdgeDetector.graphics;
import PamUtils.Coordinate3d; import PamUtils.Coordinate3d;
import PamView.GeneralProjector.ParameterType; import PamView.GeneralProjector.ParameterType;
import PamView.GeneralProjector.ParameterUnits; import PamView.GeneralProjector.ParameterUnits;
import PamView.symbol.PamSymbolChooser;
import PamguardMVC.PamDataUnit; import PamguardMVC.PamDataUnit;
import RightWhaleEdgeDetector.RWEDataBlock; import RightWhaleEdgeDetector.RWEDataBlock;
import RightWhaleEdgeDetector.RWEDataUnit; import RightWhaleEdgeDetector.RWEDataUnit;
import RightWhaleEdgeDetector.RWEProcess; import RightWhaleEdgeDetector.RWEProcess;
import RightWhaleEdgeDetector.RWESound; import RightWhaleEdgeDetector.RWESound;
import dataPlots.data.TDSymbolChooser;
import dataPlotsFX.SimpleSymbolChooserFX;
import dataPlotsFX.TDSymbolChooserFX; import dataPlotsFX.TDSymbolChooserFX;
import dataPlotsFX.data.TDDataInfoFX; import dataPlotsFX.data.TDDataInfoFX;
import dataPlotsFX.data.TDScaleInfo; import dataPlotsFX.data.TDScaleInfo;
import dataPlotsFX.data.generic.GenericDataPlotInfo;
import dataPlotsFX.data.generic.GenericSettingsPane;
import dataPlotsFX.layout.TDGraphFX; import dataPlotsFX.layout.TDGraphFX;
import dataPlotsFX.layout.TDSettingsPane;
import dataPlotsFX.projector.TDProjectorFX; import dataPlotsFX.projector.TDProjectorFX;
import fftManager.FFTDataBlock; import fftManager.FFTDataBlock;
import javafx.scene.canvas.GraphicsContext; import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
import javafx.scene.shape.Polygon; import javafx.scene.shape.Polygon;
import pamViewFX.fxNodes.PamSymbolFX;
public class RWEDataPlotinfoFX extends TDDataInfoFX { public class RWEDataPlotinfoFX extends GenericDataPlotInfo {
private RWEDataBlock rweDataBlock; private RWEDataBlock rweDataBlock;
private TDScaleInfo bearingScaleInfo; private TDScaleInfo bearingScaleInfo;
private TDScaleInfo frequencyInfo; private TDScaleInfo frequencyInfo;
private RWEProcess rweProcess; private RWEProcess rweProcess;
// private SimpleSymbolChooserFX symbolChooser = new SimpleSymbolChooserFX();
private GenericSettingsPane settingsPane;
public RWEDataPlotinfoFX(RWEDataPlotProviderFX tdDataProvider, RWEProcess rweProcess, TDGraphFX tdGraph, RWEDataBlock rweDataBlock) { public RWEDataPlotinfoFX(RWEDataPlotProviderFX tdDataProvider, RWEProcess rweProcess, TDGraphFX tdGraph, RWEDataBlock rweDataBlock) {
super(tdDataProvider, tdGraph, rweDataBlock); super(tdDataProvider, tdGraph, rweDataBlock);
this.rweProcess = rweProcess; this.rweProcess = rweProcess;
@ -38,6 +49,10 @@ public class RWEDataPlotinfoFX extends TDDataInfoFX {
//set correct frequency range based on nyquist. //set correct frequency range based on nyquist.
frequencyInfo.setMaxVal(rweDataBlock.getSampleRate()/2.); frequencyInfo.setMaxVal(rweDataBlock.getSampleRate()/2.);
settingsPane = new GenericSettingsPane(this);
settingsPane.setShowingName("Right Whale");
// settingsPane.setIcon(tdGraph)
} }
@Override @Override
@ -66,16 +81,15 @@ public class RWEDataPlotinfoFX extends TDDataInfoFX {
return super.getScaleInfo(); return super.getScaleInfo();
} }
@Override // @Override
public TDSymbolChooserFX getSymbolChooser() { // public TDSymbolChooserFX getSymbolChooser() {
// TODO Auto-generated method stub // return symbolChooser;
return null; // }
}
@Override @Override
public Polygon drawDataUnit(int plotNumber, PamDataUnit pamDataUnit, GraphicsContext g, double scrollStart, TDProjectorFX tdProjector,int type) { public Polygon drawDataUnit(int plotNumber, PamDataUnit pamDataUnit, GraphicsContext g, double scrollStart, TDProjectorFX tdProjector,int type) {
// if drawing FFT then need to use slight more complex drawing functions. // if drawing FFT then need to use slight more complex drawing functions.
if (getScaleInfoIndex()==1) { if (getScaleInfoIndex()==3) {
return drawRWContour(plotNumber, pamDataUnit, g, scrollStart, tdProjector, type); return drawRWContour(plotNumber, pamDataUnit, g, scrollStart, tdProjector, type);
} }
else { else {
@ -105,6 +119,16 @@ public class RWEDataPlotinfoFX extends TDDataInfoFX {
int fftLen = dataSource.getFftLength(); int fftLen = dataSource.getFftLength();
int fftHop = dataSource.getFftHop(); int fftHop = dataSource.getFftHop();
TDSymbolChooserFX symbols = getSymbolChooser();
if (symbols != null) {
PamSymbolFX symbFX = symbols.getPamSymbol(rweDataUnit, TDSymbolChooser.NORMAL_SYMBOL);
if (symbFX != null) {
g.setStroke(symbFX.getLineColor());
// g.setStroke(Color.ALICEBLUE);
}
}
// Polygon outer = new Poly // Polygon outer = new Poly
int nOut = hf.length*2; int nOut = hf.length*2;
double[] outsideX = new double[nOut]; double[] outsideX = new double[nOut];
@ -126,8 +150,19 @@ public class RWEDataPlotinfoFX extends TDDataInfoFX {
} }
g.strokePolygon(outsideX, outsideY, nOut); g.strokePolygon(outsideX, outsideY, nOut);
double topX = outsideX[hf.length];
double topY = outsideY[hf.length];
String txt = String.format("%d", rweSound.soundType);
g.strokeText(txt, topX, topY);
return null; return null;
} }
@Override
public TDSettingsPane getGraphSettingsPane() {
if (settingsPane == null) {
}
return settingsPane;
}
} }

View File

@ -33,7 +33,7 @@ public class GenericSettingsPane extends PamBorderPane implements TDSettingsPane
/* /*
* The raw clip info. * The raw clip info.
*/ */
private TDDataInfoFX rawClipDataInfo; private TDDataInfoFX tdDataInfoFX;
/** /**
* The icon for the pane. * The icon for the pane.
@ -52,8 +52,8 @@ public class GenericSettingsPane extends PamBorderPane implements TDSettingsPane
/** /**
* The clip plot pane. * The clip plot pane.
*/ */
public GenericSettingsPane(TDDataInfoFX rawClipDataInfo){ public GenericSettingsPane(TDDataInfoFX tdDataInfoFX){
this.rawClipDataInfo = rawClipDataInfo; this.tdDataInfoFX = tdDataInfoFX;
createPane(); createPane();
this.setPrefWidth(PREF_WIDTH); this.setPrefWidth(PREF_WIDTH);
setParams(); setParams();
@ -81,7 +81,7 @@ public class GenericSettingsPane extends PamBorderPane implements TDSettingsPane
private void newSettings(long milliswait) { private void newSettings(long milliswait) {
getParams(); getParams();
this.rawClipDataInfo.getTDGraph().repaint(milliswait); this.tdDataInfoFX.getTDGraph().repaint(milliswait);
} }
@ -112,10 +112,10 @@ public class GenericSettingsPane extends PamBorderPane implements TDSettingsPane
*/ */
private StandardSymbolOptionsPane createSymbolOptionsPane(){ private StandardSymbolOptionsPane createSymbolOptionsPane(){
PamSymbolManager<?> pamSymbolManager= rawClipDataInfo.getDataBlock().getPamSymbolManager(); PamSymbolManager<?> pamSymbolManager= tdDataInfoFX.getDataBlock().getPamSymbolManager();
symbolOptionsPane= pamSymbolManager.getFXOptionsPane(rawClipDataInfo.getTDGraph().getUniqueName(), symbolOptionsPane= pamSymbolManager.getFXOptionsPane(tdDataInfoFX.getTDGraph().getUniqueName(),
rawClipDataInfo.getTDGraph().getGraphProjector()); tdDataInfoFX.getTDGraph().getGraphProjector());
//create a new settings listener //create a new settings listener
symbolOptionsPane.addSettingsListener(()->{ symbolOptionsPane.addSettingsListener(()->{