diff --git a/src/PamView/symbol/StandardSymbolOptions.java b/src/PamView/symbol/StandardSymbolOptions.java index 09b413f0..6a8c87a6 100644 --- a/src/PamView/symbol/StandardSymbolOptions.java +++ b/src/PamView/symbol/StandardSymbolOptions.java @@ -2,6 +2,7 @@ package PamView.symbol; import java.awt.Color; import java.io.Serializable; +import java.util.Arrays; import java.util.HashMap; import PamUtils.PamArrayUtils; @@ -131,6 +132,12 @@ public class StandardSymbolOptions extends PamSymbolOptions implements Serializa * @param i - the index of the symbol modifier (not modified). */ public void setEnabled(boolean enabled, int i) { + if (isEnabled == null) { + isEnabled = new boolean[i+1]; + } + else if (isEnabled.length < i+1) { + isEnabled = Arrays.copyOf(isEnabled, i+1); + } isEnabled[i] = enabled; } diff --git a/src/dataPlotsFX/data/generic/GenericDataPlotInfo.java b/src/dataPlotsFX/data/generic/GenericDataPlotInfo.java index eddf4d7b..a530ec89 100644 --- a/src/dataPlotsFX/data/generic/GenericDataPlotInfo.java +++ b/src/dataPlotsFX/data/generic/GenericDataPlotInfo.java @@ -24,11 +24,13 @@ import dataPlotsFX.data.TDDataInfoFX; import dataPlotsFX.data.TDDataProviderFX; import dataPlotsFX.data.TDScaleInfo; import dataPlotsFX.layout.TDGraphFX; +import dataPlotsFX.layout.TDSettingsPane; import dataPlotsFX.projector.TDProjectorFX; import javafx.geometry.Point2D; import javafx.scene.canvas.GraphicsContext; import javafx.scene.paint.Color; import javafx.scene.shape.Polygon; +import pamViewFX.fxNodes.PamSymbolFX; /** * Generic data plot info which can work for a wide variety of data types. May still @@ -57,7 +59,7 @@ public class GenericDataPlotInfo extends TDDataInfoFX { private TDSymbolChooserFX managedSymbolChooser; - + private GenericSettingsPane genericSettingsPane; /** * The frequency info */ @@ -76,10 +78,10 @@ public class GenericDataPlotInfo extends TDDataInfoFX { bearingScaleInfo.setReverseAxis(true); //set the axis to be reverse so 0 is at top of graph ampScaleInfo = new GenericScaleInfo(100, 200, ParameterType.AMPLITUDE, ParameterUnits.DB); slantScaleInfo = new GenericScaleInfo(0, 180, ParameterType.SLANTBEARING, ParameterUnits.DEGREES); - frequencyInfo = new GenericScaleInfo(0, 1, ParameterType.FREQUENCY, ParameterUnits.HZ); Arrays.fill(frequencyInfo.getPlotChannels(),1); //TODO-manage plot pane channels somehow. frequencyInfo.setMaxVal(pamDataBlock.getSampleRate()/2); + genericSettingsPane = new GenericSettingsPane(this); addScaleInfo(bearingScaleInfo); addScaleInfo(slantScaleInfo); @@ -118,6 +120,11 @@ public class GenericDataPlotInfo extends TDDataInfoFX { g.setLineDashes(null); g.setLineWidth(2); + TDSymbolChooserFX symbolChooser = getSymbolChooser(); + PamSymbolFX symbol = null; + if (symbolChooser != null) { + symbol = symbolChooser.getPamSymbol(pamDataUnit, type); + } double[] f = pamDataUnit.getFrequency(); if (f == null) { @@ -131,10 +138,14 @@ public class GenericDataPlotInfo extends TDDataInfoFX { double y1 = tdProjector.getYPix(f[1]); double x0 = tdProjector.getTimePix(pamDataUnit.getTimeMilliseconds()-scrollStart); double x1 = tdProjector.getTimePix(pamDataUnit.getEndTimeInMilliseconds()-scrollStart); - g.setStroke(getSymbolChooser().getPamSymbol(pamDataUnit, type).getLineColor()); + if (symbol != null) { + g.setStroke(symbol.getLineColor()); + g.setLineWidth(symbol.getLineThickness()); + Color fillCol = symbol.getFillColor(); + double alpha = fillCol.getOpacity(); + g.setFill(Color.color(fillCol.getRed(), fillCol.getGreen(), fillCol.getBlue(), alpha)); //add alpha + } - Color fillCol = getSymbolChooser().getPamSymbol(pamDataUnit, type).getFillColor(); - g.setFill(Color.color(fillCol.getRed(), fillCol.getGreen(), fillCol.getBlue(), 0.4)); //add alpha double y = Math.min(y0, y1); double h = Math.abs(y1-y0); @@ -174,6 +185,11 @@ public class GenericDataPlotInfo extends TDDataInfoFX { } + @Override + public TDSettingsPane getGraphSettingsPane() { + return genericSettingsPane; + } + @Override public Double getDataValue(PamDataUnit pamDataUnit) { @@ -261,9 +277,9 @@ public class GenericDataPlotInfo extends TDDataInfoFX { @Override public TDSymbolChooserFX getSymbolChooser() { - if (managedSymbolChooser == null) { +// if (managedSymbolChooser == null) { managedSymbolChooser = createSymbolChooser(); - } +// } return managedSymbolChooser; } diff --git a/src/ravendata/RavenProcess.java b/src/ravendata/RavenProcess.java index 25993477..3aff79c8 100644 --- a/src/ravendata/RavenProcess.java +++ b/src/ravendata/RavenProcess.java @@ -12,7 +12,9 @@ import PamView.symbol.StandardSymbolManager; import PamView.symbol.SymbolData; import PamguardMVC.PamProcess; import dataMap.OfflineDataMap; +import dataPlotsFX.data.TDDataProviderRegisterFX; import generalDatabase.DBControlUnit; +import ravendata.fx.RavenPlotProviderFX; import ravendata.swing.RavenGraphics; public class RavenProcess extends PamProcess { @@ -34,6 +36,8 @@ public class RavenProcess extends PamProcess { ravenDataBlock.SetLogging(ravenLogging); ravenDataBlock.setOverlayDraw(new RavenGraphics(ravenDataBlock)); ravenDataBlock.setPamSymbolManager(new StandardSymbolManager(ravenDataBlock, standardSymbol)); + + TDDataProviderRegisterFX.getInstance().registerDataInfo(new RavenPlotProviderFX(ravenDataBlock)); } @Override diff --git a/src/ravendata/fx/RavenDataPlotInfo.java b/src/ravendata/fx/RavenDataPlotInfo.java new file mode 100644 index 00000000..d707274a --- /dev/null +++ b/src/ravendata/fx/RavenDataPlotInfo.java @@ -0,0 +1,28 @@ +package ravendata.fx; + +import PamDetection.AbstractLocalisation; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamDataUnit; +import dataPlotsFX.data.generic.GenericDataPlotInfo; +import dataPlotsFX.layout.TDGraphFX; + +public class RavenDataPlotInfo extends GenericDataPlotInfo { + + public RavenDataPlotInfo(RavenPlotProviderFX tdDataProvider, TDGraphFX tdGraph, PamDataBlock pamDataBlock) { + super(tdDataProvider, tdGraph, pamDataBlock); + // TODO Auto-generated constructor stub + } + + public Double getBearingValue(PamDataUnit pamDataUnit) { + AbstractLocalisation locData = pamDataUnit.getLocalisation(); + if (locData == null) { + return null; + } + double[] angles = locData.getAngles(); + if (angles != null) { + return Math.toDegrees(angles[0]); + } + + return null; + } +} diff --git a/src/ravendata/fx/RavenPlotProviderFX.java b/src/ravendata/fx/RavenPlotProviderFX.java new file mode 100644 index 00000000..58cadffe --- /dev/null +++ b/src/ravendata/fx/RavenPlotProviderFX.java @@ -0,0 +1,21 @@ +package ravendata.fx; + +import PamguardMVC.PamDataBlock; +import dataPlotsFX.data.TDDataInfoFX; +import dataPlotsFX.data.TDDataProviderFX; +import dataPlotsFX.data.generic.GenericDataPlotProvider; +import dataPlotsFX.layout.TDGraphFX; +import ravendata.RavenDataBlock; + +public class RavenPlotProviderFX extends GenericDataPlotProvider { + + public RavenPlotProviderFX(RavenDataBlock parentDataBlock) { + super(parentDataBlock); + } + + @Override + public TDDataInfoFX createDataInfo(TDGraphFX tdGraph) { + return new RavenDataPlotInfo(this, tdGraph, getDataBlock()); + } + +}