Fixed display bug.

Fixed several display bugs including predictions not showing on PAMGuard stop start.
This commit is contained in:
Jamie Mac 2024-03-08 17:10:17 +00:00
parent ed5968360b
commit 89627f94dc
22 changed files with 107 additions and 100 deletions

View File

@ -6,8 +6,9 @@
<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/jdk-21.0.2.13-hotspot">
<attributes> <attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>

View File

@ -502,6 +502,7 @@ final public class PamModel implements PamSettings {
mi.setModulesMenuGroup(sensorsGroup); mi.setModulesMenuGroup(sensorsGroup);
mi.setToolTipText("Imports CPOD data"); mi.setToolTipText("Imports CPOD data");
mi.setHidden(SMRUEnable.isEnable() == false); mi.setHidden(SMRUEnable.isEnable() == false);
mi.addGUICompatabilityFlag(PamGUIManager.FX); //has FX enabled GUI.
/* /*
* ************* Start Displays Group ******************* * ************* Start Displays Group *******************

View File

@ -235,6 +235,7 @@
-fx-background-color: -fx-darkbackground; -fx-background-color: -fx-darkbackground;
-fx-background-radius: 5; -fx-background-radius: 5;
-fx-border-radius: 5; -fx-border-radius: 5;
-fx-padding: 0 0 0 0;
} }
.popover > .arrow { .popover > .arrow {

View File

@ -60,7 +60,12 @@ public class CPODDDDataInfo extends DDDataInfo<CPODClick> {
public void setupAxis(PamDataUnit data, double sR, DetectionPlotProjector plotProjector) { public void setupAxis(PamDataUnit data, double sR, DetectionPlotProjector plotProjector) {
super.setupAxis(data, sR, plotProjector); super.setupAxis(data, sR, plotProjector);
CPODClick click = (CPODClick) data; CPODClick click = (CPODClick) data;
if (click.getWaveData()==null) {
return;
}
double lenMS = (1000.*click.getWaveData()[0].length)/FPODReader.FPOD_WAV_SAMPLERATE; double lenMS = (1000.*click.getWaveData()[0].length)/FPODReader.FPOD_WAV_SAMPLERATE;
//set the scroller minimum and maximum //set the scroller minimum and maximum
plotProjector.setMinScrollLimit(0); plotProjector.setMinScrollLimit(0);
@ -68,7 +73,6 @@ public class CPODDDDataInfo extends DDDataInfo<CPODClick> {
plotProjector.setMaxScrollLimit(lenMS); plotProjector.setMaxScrollLimit(lenMS);
plotProjector.setEnableScrollBar(true); plotProjector.setEnableScrollBar(true);
plotProjector.setAxisMinMax(0, 250, Side.BOTTOM); plotProjector.setAxisMinMax(0, 250, Side.BOTTOM);
} }
@ -89,7 +93,6 @@ public class CPODDDDataInfo extends DDDataInfo<CPODClick> {
public CPODWaveformPlot(DetectionPlotDisplay detectionPlotDisplay) { public CPODWaveformPlot(DetectionPlotDisplay detectionPlotDisplay) {
super(detectionPlotDisplay); super(detectionPlotDisplay);
// TODO Auto-generated constructor stub
} }
@Override @Override

View File

@ -325,7 +325,6 @@ public class CPODPlotInfoFX extends GenericDataPlotInfo {
y2= tdProjector.getYPix(nycl); y2= tdProjector.getYPix(nycl);
break; break;
} }
if (tdProjector.getOrientation()==Orientation.VERTICAL){ if (tdProjector.getOrientation()==Orientation.VERTICAL){
@ -381,10 +380,12 @@ public class CPODPlotInfoFX extends GenericDataPlotInfo {
@Override @Override
public PamSymbolFX getPamSymbol(PamDataUnit dataUnit, int type) { public PamSymbolFX getPamSymbol(PamDataUnit dataUnit, int type) {
PamSymbolFX symbol = super.getPamSymbol(dataUnit, type); PamSymbolFX symbol = super.getPamSymbol(dataUnit, type);
if (((CPODClick) dataUnit).getWaveData()!=null && type!=TDSymbolChooserFX.HIGHLIGHT_SYMBOL) { if (((CPODClick) dataUnit).getWaveData()!=null && type!=TDSymbolChooserFX.HIGHLIGHT_SYMBOL) {
symbol.setLineColor(symbol.getFillColor().darker()); symbol.setLineColor(symbol.getFillColor().darker());
symbol.setHeight(symbol.getHeight()*1.5); symbol.setHeight(symbol.getHeight()*1.5);
symbol.setWidth(symbol.getWidth()*1.5); symbol.setWidth(symbol.getWidth()*1.5);
return symbol;
} }
return symbol; return symbol;

View File

@ -46,7 +46,7 @@ public class CPODTDSettingsPane implements TDSettingsPane {
public CPODTDSettingsPane(CPODPlotInfoFX cpodPlotInfoFX) { public CPODTDSettingsPane(CPODPlotInfoFX cpodPlotInfoFX) {
this.cpodPlotInfoFX=cpodPlotInfoFX; this.cpodPlotInfoFX=cpodPlotInfoFX;
mainPane = createMainPane(); mainPane = createMainPane();
mainPane.setPrefWidth(330); mainPane.setPrefWidth(400);
} }
/** /**

View File

@ -10,12 +10,12 @@ import pamViewFX.PamControlledGUIFX;
public class CPODGUIFX extends PamControlledGUIFX { public class CPODGUIFX extends PamControlledGUIFX {
/** /**
* The dl control. * Reference to the CPOD control.
*/ */
private CPODControl2 dlControl; private CPODControl2 cpodControl;
public CPODGUIFX(CPODControl2 cpodControl2) { public CPODGUIFX(CPODControl2 cpodControl2) {
// TODO Auto-generated constructor stub cpodControl = cpodControl2;
} }
@ -27,19 +27,19 @@ public class CPODGUIFX extends PamControlledGUIFX {
* @return a Pane containing controls to change settings for module. * @return a Pane containing controls to change settings for module.
*/ */
public SettingsPane<?> getSettingsPane(){ public SettingsPane<?> getSettingsPane(){
dlControl.getSettingsPane().setParams(dlControl.getCPODParam()); cpodControl.getSettingsPane().setParams(cpodControl.getCPODParam());
return dlControl.getSettingsPane(); return cpodControl.getSettingsPane();
} }
@Override @Override
public void updateParams() { public void updateParams() {
CPODParams newParams=dlControl.getSettingsPane().getParams(dlControl.getCPODParam()); CPODParams newParams=cpodControl.getSettingsPane().getParams(cpodControl.getCPODParam());
if (newParams!=null) { if (newParams!=null) {
dlControl.setCPODParams(newParams); cpodControl.setCPODParams(newParams);
} }
//setup the controlled unit. //setup the controlled unit.
dlControl.setupControlledUnit(); cpodControl.setupControlledUnit();
} }
@Override @Override

View File

@ -539,6 +539,8 @@ public class DatagramManager {
else { else {
PamController.getInstance().notifyTaskProgress( PamController.getInstance().notifyTaskProgress(
new SimplePamTaskUpdate("Finished Datagram Mapping", PamTaskUpdate.STATUS_DONE)); new SimplePamTaskUpdate("Finished Datagram Mapping", PamTaskUpdate.STATUS_DONE));
publish(new DatagramProgress(PamTaskUpdate.STATUS_DONE, 1, 1));
} }
} }

View File

@ -77,8 +77,7 @@ public class DatagramProgress extends PamTaskUpdate {
} }
@Override @Override
public double getProgress() { public double getProgress2() {
System.out.println("DatagramProgress: " + processedUnits + " tot: " + totalUnits);
double progress= ProgressIndicator.INDETERMINATE_PROGRESS; double progress= ProgressIndicator.INDETERMINATE_PROGRESS;
switch(getStatus()) { switch(getStatus()) {
case DatagramProgress.STATUS_BLOCKCOUNT: case DatagramProgress.STATUS_BLOCKCOUNT:
@ -95,13 +94,17 @@ public class DatagramProgress extends PamTaskUpdate {
else progress=0; else progress=0;
break; break;
} }
//System.out.println("DatagramProgress: " + processedUnits + " tot: " + totalUnits + " progress: " + progress);
return progress; return progress;
} }
@Override @Override
public double getProgress2(){ public double getProgress(){
//seems like the current point is simply the percentage done...
double progress; double progress;
if (pointsToUpdate>0) progress=((double)currentPoint)/pointsToUpdate; if (pointsToUpdate>0) progress=((double)currentPoint)/100.;
else progress=0; else progress=0;
switch(getStatus()) { switch(getStatus()) {
case DatagramProgress.STATUS_BLOCKCOUNT: case DatagramProgress.STATUS_BLOCKCOUNT:
@ -110,14 +113,16 @@ public class DatagramProgress extends PamTaskUpdate {
progress=0; progress=0;
break; break;
case DatagramProgress.STATUS_STARTINGFILE: case DatagramProgress.STATUS_STARTINGFILE:
progress=((double)currentPoint)/pointsToUpdate; progress=((double)currentPoint)/100.;
break; break;
case DatagramProgress.STATUS_ENDINGFILE: case DatagramProgress.STATUS_ENDINGFILE:
progress=((double)currentPoint)/pointsToUpdate; progress=((double)currentPoint)/100.;
break; break;
case DatagramProgress.STATUS_UNITCOUNT: case DatagramProgress.STATUS_UNITCOUNT:
break; break;
} }
//System.out.println("DatagramProgress2: " + currentPoint + " tot: " + pointsToUpdate + " progress: " + progress);
return progress; return progress;
} }

View File

@ -2,6 +2,7 @@ package dataModelFX.connectionNodes;
import dataModelFX.DataModelStyle; import dataModelFX.DataModelStyle;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
@ -35,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 DECIMATOR, CPOD
} }
/** /**
@ -126,6 +127,9 @@ public class ModuleIconFactory {
case DECIMATOR: case DECIMATOR:
iconNode = getSVGIcon("/Resources/modules/decimator.svg"); iconNode = getSVGIcon("/Resources/modules/decimator.svg");
break; break;
case CPOD:
iconNode = new Label("CPOD"); //TEMP
break;
default: default:
break; break;
} }
@ -261,6 +265,9 @@ public class ModuleIconFactory {
case "decimator.DecimatorControl": case "decimator.DecimatorControl":
icon=ModuleIcon.DECIMATOR; icon=ModuleIcon.DECIMATOR;
break; break;
case "cpod.CPODControl2":
icon=ModuleIcon.CPOD;
break;
} }
return icon; return icon;
} }

View File

@ -12,6 +12,7 @@ import javafx.scene.canvas.GraphicsContext;
import javafx.scene.shape.Polygon; import javafx.scene.shape.Polygon;
import PamController.PamController; import PamController.PamController;
import PamUtils.Coordinate3d; import PamUtils.Coordinate3d;
import PamUtils.PamCalendar;
import PamUtils.PamUtils; import PamUtils.PamUtils;
import PamView.HoverData; import PamView.HoverData;
import PamView.GeneralProjector.ParameterType; import PamView.GeneralProjector.ParameterType;
@ -373,8 +374,8 @@ public abstract class TDDataInfoFX {
*/ */
public void drawAllDataUnits(int plotNumber, GraphicsContext g, double scrollStart, TDProjectorFX tdProjector) { public void drawAllDataUnits(int plotNumber, GraphicsContext g, double scrollStart, TDProjectorFX tdProjector) {
// System.out.println("Max double value: " + PamCalendar.formatDateTime((long) Double.MAX_EXPONENT)); // System.out.println("Max double value: " + this.getDataName() + PamCalendar.formatDateTime((long) Double.MAX_EXPONENT));
// System.out.println("Max long value: " + PamCalendar.formatDateTime((long) Long.MAX_VALUE)); // System.out.println("Max long value: " + this.getDataName() + PamCalendar.formatDateTime((long) Long.MAX_VALUE));
PamDataUnit dataUnit = null; PamDataUnit dataUnit = null;
@ -391,7 +392,10 @@ public abstract class TDDataInfoFX {
// scrollStart = PamCalendar.getTimeInMillis(); // scrollStart = PamCalendar.getTimeInMillis();
//work out start and stop times //work out start and stop times
long loopEnd = (long) (scrollStart + (tdProjector.getVisibleTime() * 1.5)); long loopEnd = (long) (scrollStart + (tdProjector.getVisibleTime() * 1.5));
long loopStart = (long) (scrollStart - (tdProjector.getVisibleTime() * .5)); long loopStart = (long) (scrollStart - (tdProjector.getVisibleTime() * 1.5));
// System.out.println("Loop start: " + this.getDataName() + PamCalendar.formatDateTime((long) loopStart));
// System.out.println("Loop end: " + this.getDataName() + PamCalendar.formatDateTime((long) loopEnd));
//find a number close to the index start, //find a number close to the index start,
ListIterator<PamDataUnit> it = getUnitIterator( loopStart, plotNumber); ListIterator<PamDataUnit> it = getUnitIterator( loopStart, plotNumber);
@ -402,6 +406,7 @@ public abstract class TDDataInfoFX {
dataUnit = it.next(); dataUnit = it.next();
count++; count++;
if (dataUnit!=null && shouldDraw(plotNumber, dataUnit)) { if (dataUnit!=null && shouldDraw(plotNumber, dataUnit)) {
if (dataUnit.getEndTimeInMilliseconds() < loopStart) { if (dataUnit.getEndTimeInMilliseconds() < loopStart) {
continue; continue;
} }
@ -409,11 +414,13 @@ public abstract class TDDataInfoFX {
break; break;
} }
drawCalls++;
drawDataUnit(plotNumber, dataUnit, g, scrollStart, drawDataUnit(plotNumber, dataUnit, g, scrollStart,
tdProjector ,TDSymbolChooserFX.NORMAL_SYMBOL); tdProjector ,TDSymbolChooserFX.NORMAL_SYMBOL);
} }
} }
// System.out.println("Found: " + drawCalls + " " + this.getDataName() + " to draw");
lastUnitDrawn(g, scrollStart, tdProjector, plotNumber); lastUnitDrawn(g, scrollStart, tdProjector, plotNumber);
} }
//System.out.println("Total data units: " + count+ " draw calls: " +drawCalls ); //System.out.println("Total data units: " + count+ " draw calls: " +drawCalls );

View File

@ -2,6 +2,7 @@ package dataPlotsFX.data.generic;
import PamController.PamController; import PamController.PamController;
import PamUtils.Coordinate3d; import PamUtils.Coordinate3d;
import PamUtils.PamCalendar;
import PamView.GeneralProjector; import PamView.GeneralProjector;
import PamView.HoverData; import PamView.HoverData;
import PamView.symbol.PamSymbolChooser; import PamView.symbol.PamSymbolChooser;
@ -47,21 +48,18 @@ public abstract class GenericLinePlotInfo extends TDDataInfoFX {
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see dataPlotsFX.data.TDDataInfoFX#drawDataUnit(int, PamguardMVC.PamDataUnit, javafx.scene.canvas.GraphicsContext, long, dataPlotsFX.projector.TDProjectorFX, int) * @see dataPlotsFX.data.TDDataInfoFX#drawDataUnit(int, PamguardMVC.PamDataUnit, javafx.scene.canvas.GraphicsContext, long, dataPlotsFX.projector.TDProjectorFX, int)
*/ */
@Override @Override
public Polygon drawDataUnit(int plotNumber, PamDataUnit pamDataUnit, GraphicsContext g, double scrollStart, public Polygon drawDataUnit(int plotNumber, PamDataUnit pamDataUnit, GraphicsContext g, double scrollStart,
TDProjectorFX tdProjector, int type) { TDProjectorFX tdProjector, int type) {
return drawPredicition(plotNumber, pamDataUnit, g, scrollStart, tdProjector, type); return drawPredicition(plotNumber, pamDataUnit, g, scrollStart, tdProjector, type);
} }
/** /**
* Get the line data. Each double[] is a seperate line with N evenly spaced data points. * Get the line data. Each double[] is a separate line with N evenly spaced data points.
* @param pamDataUnit - the pam data unit containing the data. * @param pamDataUnit - the pam data unit containing the data.
* @return the line data. * @return the line data.
*/ */
@ -98,15 +96,12 @@ public abstract class GenericLinePlotInfo extends TDDataInfoFX {
double timeMillis = pamDataUnit.getTimeMilliseconds()+pamDataUnit.getDurationInMilliseconds()/2; double timeMillis = pamDataUnit.getTimeMilliseconds()+pamDataUnit.getDurationInMilliseconds()/2;
double tC=tdProjector.getTimePix(timeMillis-scrollStart); double tC=tdProjector.getTimePix(timeMillis-scrollStart);
//draws lines so tc should be some slop in pixels. //draws lines so tc should be some slop in pixels.
if (tC < -1000 || tC>tdProjector.getWidth()+1000) { if (tC < -1000 || tC>tdProjector.getWidth()+1000) {
//System.out.println("Line is outside display " + tC);
return null; return null;
} }
//TODO -must sort out wrap
//dlControl.getDLParams().sampleHop;
double dataPixel; double dataPixel;
Coordinate3d c; Coordinate3d c;
Color color; Color color;
@ -128,16 +123,13 @@ public abstract class GenericLinePlotInfo extends TDDataInfoFX {
//brighten the colour up. //brighten the colour up.
//color = Color.color(color.getRed()*0.8, color.getGreen()*0.8, color.getBlue()*0.8); //color = Color.color(color.getRed()*0.8, color.getGreen()*0.8, color.getBlue()*0.8);
// System.out.println("TDDataInfoFX: tc: "+tC+ " dataUnitTime: "+PamCalendar.formatTime((long) timeMillis)+" scrollStart: "
//System.out.println("TDDataInfoFX: tc: "+tC+ " dataUnitTime: "+PamCalendar.formatTime(timeMillis)+" scrollStart: "
// +PamCalendar.formatTime((long) scrollStart)+" (timeMillis-scrollStart)/1000. "+((timeMillis-scrollStart)/1000.)); // +PamCalendar.formatTime((long) scrollStart)+" (timeMillis-scrollStart)/1000. "+((timeMillis-scrollStart)/1000.));
c = tdProjector.getCoord3d(timeMillis, detData[i][j], 0); c = tdProjector.getCoord3d(timeMillis, detData[i][j], 0);
dataPixel = tdProjector.getYPix(detData[i][j]); dataPixel = tdProjector.getYPix(detData[i][j]);
if (lastUnits[chan][i]==null) { if (lastUnits[chan][i]==null) {
lastUnits[chan][i] = new Point2D(tC, dataPixel); lastUnits[chan][i] = new Point2D(tC, dataPixel);
g.fillOval(tC, dataPixel, 5,5); g.fillOval(tC, dataPixel, 5,5);
@ -147,7 +139,6 @@ public abstract class GenericLinePlotInfo extends TDDataInfoFX {
if (tC>lastUnits[chan][i].getX() && (!this.getTDGraph().isWrap() || if (tC>lastUnits[chan][i].getX() && (!this.getTDGraph().isWrap() ||
(tC<tdProjector.getWidth()) && tC>=0 && lastUnits[chan][i].getX()<tdProjector.getWidth() && lastUnits[chan][i].getX()>0)) { (tC<tdProjector.getWidth()) && tC>=0 && lastUnits[chan][i].getX()<tdProjector.getWidth() && lastUnits[chan][i].getX()>0)) {
//in wrap mode we can get some weird effects with tC co-ordintates. Still have not quite cracked this... //in wrap mode we can get some weird effects with tC co-ordintates. Still have not quite cracked this...
// if (Math.abs(tC - lastUnits[chan][i].getX())>100) { // if (Math.abs(tC - lastUnits[chan][i].getX())>100) {
// System.out.println("tC: " + tC + " lastUnits[i].getX(): " + lastUnits[chan][i].getX() // System.out.println("tC: " + tC + " lastUnits[i].getX(): " + lastUnits[chan][i].getX()
// + " " + tdProjector. getTimeAxis().getPosition((timeMillis-scrollStart)/1000.) + " " + tdProjector.getWidth()); // + " " + tdProjector. getTimeAxis().getPosition((timeMillis-scrollStart)/1000.) + " " + tdProjector.getWidth());
@ -155,12 +146,9 @@ public abstract class GenericLinePlotInfo extends TDDataInfoFX {
g.strokeLine(tC, dataPixel, lastUnits[chan][i].getX(), lastUnits[chan][i].getY()); g.strokeLine(tC, dataPixel, lastUnits[chan][i].getX(), lastUnits[chan][i].getY());
} }
lastUnits[chan][i] = new Point2D(tC, dataPixel); lastUnits[chan][i] = new Point2D(tC, dataPixel);
} }
tdProjector.addHoverData(new HoverData(c , pamDataUnit, 0, plotNumber)); tdProjector.addHoverData(new HoverData(c , pamDataUnit, 0, plotNumber));
} }
//getSymbolChooser().getPamSymbol(pamDataUnit,type).draw(g, new Point2D(tC, dataPixel)); //getSymbolChooser().getPamSymbol(pamDataUnit,type).draw(g, new Point2D(tC, dataPixel));
} }
} }
@ -193,6 +181,7 @@ public abstract class GenericLinePlotInfo extends TDDataInfoFX {
*/ */
public abstract LineInfo getColor(int i); public abstract LineInfo getColor(int i);
@Override @Override
public Double getDataValue(PamDataUnit pamDataUnit) { public Double getDataValue(PamDataUnit pamDataUnit) {
//this is not used because we have overridden the super drawing class. //this is not used because we have overridden the super drawing class.
@ -206,15 +195,13 @@ public abstract class GenericLinePlotInfo extends TDDataInfoFX {
* @param changeType - notification flag. * @param changeType - notification flag.
*/ */
public void notifyChange(int changeType) { public void notifyChange(int changeType) {
//System.out.println("Prediction NOTIFYMODELCHANGED: "); // System.out.println("Prediction NOTIFYMODELCHANGED: " + changeType);
switch (changeType) { switch (changeType) {
case PamController.CHANGED_PROCESS_SETTINGS: case PamController.CHANGED_PROCESS_SETTINGS:
lastUnits = new Point2D[PamConstants.MAX_CHANNELS][]; lastUnits = new Point2D[PamConstants.MAX_CHANNELS][];
;
break; break;
case PamController.RUN_NORMAL: case PamController.RUN_NORMAL:
lastUnits = new Point2D[PamConstants.MAX_CHANNELS][]; lastUnits = new Point2D[PamConstants.MAX_CHANNELS][];
break; break;
case PamController.PAM_STOPPING: case PamController.PAM_STOPPING:
lastUnits = new Point2D[PamConstants.MAX_CHANNELS][]; lastUnits = new Point2D[PamConstants.MAX_CHANNELS][];

View File

@ -616,7 +616,8 @@ public class TDDisplayFX extends PamBorderPane {
*/ */
public void scrollDisplayEnd(long milliSeconds) { public void scrollDisplayEnd(long milliSeconds) {
if (!isViewer() && milliSeconds <= lastUpdate && milliSeconds > lastUpdate - tdParametersFX.visibleTimeRange) {
if (!isViewer() && lastUpdate>0 && milliSeconds <= lastUpdate && milliSeconds > lastUpdate - tdParametersFX.visibleTimeRange) {
// System.out.println("milliSeconds <= lastUpdate && milliSeconds > lastUpdate - visibleRange"); // System.out.println("milliSeconds <= lastUpdate && milliSeconds > lastUpdate - visibleRange");
return; return;
} }
@ -849,7 +850,6 @@ public class TDDisplayFX extends PamBorderPane {
@Override @Override
public void scrollValueChanged(AbstractPamScroller pamScroller) { public void scrollValueChanged(AbstractPamScroller pamScroller) {
// System.out.println("TDDisplayFX: Scroll Value changed: " + System.currentTimeMillis());
// System.out.println(String.format("Scroller value changed get start %s, End %s, pos %s", PamCalendar.formatTime(timeScrollerFX.getMinimumMillis()), // System.out.println(String.format("Scroller value changed get start %s, End %s, pos %s", PamCalendar.formatTime(timeScrollerFX.getMinimumMillis()),
// PamCalendar.formatTime(timeScrollerFX.getMaximumMillis()),PamCalendar.formatTime(timeScrollerFX.getValueMillis()))); // PamCalendar.formatTime(timeScrollerFX.getMaximumMillis()),PamCalendar.formatTime(timeScrollerFX.getValueMillis())));
//have to set the repaint wait millis param to zero or else when scroll bar is moved quickly painting does not occur correctly. //have to set the repaint wait millis param to zero or else when scroll bar is moved quickly painting does not occur correctly.
@ -1183,11 +1183,15 @@ public class TDDisplayFX extends PamBorderPane {
break; break;
} }
//forces a repaint after any changes.
lastUpdate=-1;
if (tdGraphs != null) { if (tdGraphs != null) {
for (TDGraphFX tdg:tdGraphs) { for (TDGraphFX tdg:tdGraphs) {
tdg.notifyModelChanged(changeType); tdg.notifyModelChanged(changeType);
} }
} }
} }
/** /**

View File

@ -1151,9 +1151,11 @@ public class TDGraphFX extends PamBorderPane {
boolean hasBase = false; boolean hasBase = false;
synchronized (dataList) { synchronized (dataList) {
for (TDDataInfoFX dataInfo : dataList) { for (TDDataInfoFX dataInfo : dataList) {
base = false; base = false;
if (!dataInfo.isShowing()) { if (!dataInfo.isShowing()) {
// System.out.println("dataInfo.isShowing(): " + dataInfo.getDataName()); System.out.println("!dataInfo.isShowing(): " + dataInfo.getDataName());
continue; continue;
} }
@ -1183,7 +1185,7 @@ public class TDGraphFX extends PamBorderPane {
} }
; ;
// ok so only repaint if we have the right CANVAS // OK so only repaint if we have the right CANVAS
if (base && hasCanvas(flag, BASE_CANVAS)) { if (base && hasCanvas(flag, BASE_CANVAS)) {
paintDataUnits(gc, dataInfo, false); paintDataUnits(gc, dataInfo, false);
} else if (!base && hasCanvas(flag, FRONT_CANVAS)) { } else if (!base && hasCanvas(flag, FRONT_CANVAS)) {
@ -1287,6 +1289,7 @@ public class TDGraphFX extends PamBorderPane {
// PamDataBlock<PamDataUnit> dataBlock = dataInfo.getDataBlock(); // PamDataBlock<PamDataUnit> dataBlock = dataInfo.getDataBlock();
// scroll start is the end of the display i.e. the last visible time in the past // scroll start is the end of the display i.e. the last visible time in the past
// in real time mode. // in real time mode.
scrollStart = tdDisplay.getTimeScroller().getValueMillisD(); scrollStart = tdDisplay.getTimeScroller().getValueMillisD();

View File

@ -66,7 +66,8 @@ public class TDPopUpMenuAdv implements ExtPopMenu {
} }
if (PamGUIManager.isFX()) { if (PamGUIManager.isFX()) {
popOver.show(tdGraphFX.getScene().getWindow(), e.getScreenX(), e.getScreenY()); //FX //TODO - need to shift by the distance to arrow- not arbitrary 40 pixels
popOver.show(tdGraphFX.getScene().getWindow(), e.getScreenX(), e.getScreenY()-40); //FX
} }
else { else {
popOver.show(tdGraphFX, e.getScreenX(), e.getScreenY()); //Swing popOver.show(tdGraphFX, e.getScreenX(), e.getScreenY()); //Swing

View File

@ -55,29 +55,6 @@ public class RawSpectrumPlot extends SpectrumPlot<PamDataUnit> {
} }
// @Override
// public double[][] getPowerSpectrum(PamDataUnit data) {
// return ((RawDataHolder) data).getDataTransforms().getPowerSpectrum(((RawDataHolder) data).getWaveData()[0].length);
// }
// @Override
// public double[][] getCepstrum(PamDataUnit data) {
// return ((RawDataHolder) data).getDataTransforms().getCepstrum(((RawDataHolder) data).getWaveData()[0].length);
// //return data.getRawDataTransforms().getCepstrum(channel, cepLength)
// }
//
// public ClickSpectrumPlot(DetectionPlotDisplay displayPlot) {
// super(displayPlot);
// }
//
//
// @Override
// public String getName() {
// return "Spectrum";
// }
//
/** /**
* New click added to the display. * New click added to the display.
* @param newClick * @param newClick
@ -169,18 +146,16 @@ public class RawSpectrumPlot extends SpectrumPlot<PamDataUnit> {
@Override @Override
public void paintPlot(PamDataUnit data, GraphicsContext gc, Rectangle rectangle, DetectionPlotProjector projector, int flag) { public void paintPlot(PamDataUnit data, GraphicsContext gc, Rectangle rectangle, DetectionPlotProjector projector, int flag) {
// this.lastDataUnit=data;
//System.out.println("Paint plot projector: "+ projector); if (((RawDataHolder) data).getWaveData()==null) {
gc.clearRect(0, 0, rectangle.getWidth(), rectangle.getHeight());
return;
}
if (flag== DetectionPlot.SCROLLPANE_DRAW) { if (flag== DetectionPlot.SCROLLPANE_DRAW) {
double[][] waveformTemp = ((RawDataHolder) data).getWaveData(); double[][] waveformTemp = ((RawDataHolder) data).getWaveData();
if (waveformTemp==null) return;
// System.out.println("Spectrum plot: " + " " + projector.getMinScrollLimit() + " "
// + projector.getMaxScrollLimit() + " " + projector.getAxis(Side.TOP).getMaxVal() + " wvfrm: " + WaveformPlot.getYScale(waveformTemp));
WaveformPlot.paintWaveform(waveformTemp, data.getSequenceBitmap(), gc, rectangle, 0, waveformTemp[0].length, WaveformPlot.paintWaveform(waveformTemp, data.getSequenceBitmap(), gc, rectangle, 0, waveformTemp[0].length,
WaveformPlot.getYScale(waveformTemp), null, true, false); WaveformPlot.getYScale(waveformTemp), null, true, false);
} }

View File

@ -34,11 +34,13 @@ public class LoadQueueProgressData extends PamTaskUpdate {
this.loadEnd = loadEnd; this.loadEnd = loadEnd;
this.loadCurrent = loadCurrent; this.loadCurrent = loadCurrent;
this.nLoaded = nLoaded; this.nLoaded = nLoaded;
setDualProgressUpdate(true);
} }
public LoadQueueProgressData(int status) { public LoadQueueProgressData(int status) {
super(); super();
this.setStatus(PamTaskUpdate.STATUS_DONE); this.setStatus(PamTaskUpdate.STATUS_DONE);
setDualProgressUpdate(true);
} }
@ -119,6 +121,7 @@ public class LoadQueueProgressData extends PamTaskUpdate {
@Override @Override
public double getProgress() { public double getProgress() {
// System.out.println( getStreamName() + " progress: " + iStream + " of " + totalStreams);
if (getStreamName() != null) { if (getStreamName() != null) {
return (double )iStream/ (double) totalStreams; return (double )iStream/ (double) totalStreams;
} }
@ -127,6 +130,7 @@ public class LoadQueueProgressData extends PamTaskUpdate {
@Override @Override
public String getProgressString() { public String getProgressString() {
if (getState() == LoadQueueProgressData.STATE_LINKINGSUBTABLE) { if (getState() == LoadQueueProgressData.STATE_LINKINGSUBTABLE) {
return String.format("Linking subtable data %d of %d", return String.format("Linking subtable data %d of %d",
getIStream(), getTotalStreams()); getIStream(), getTotalStreams());
@ -142,12 +146,14 @@ public class LoadQueueProgressData extends PamTaskUpdate {
@Override @Override
public double getProgress2() { public double getProgress2() {
// System.out.println( getStreamName() + " progress2: " + getLoadStart() );
long interval =getLoadEnd() - getLoadStart(); long interval =getLoadEnd() - getLoadStart();
if (interval == 0) { if (interval <= 0) {
return ProgressIndicator.INDETERMINATE_PROGRESS; return ProgressIndicator.INDETERMINATE_PROGRESS;
} }
else { else {
long done =getLoadCurrent() - getLoadStart(); long done =getLoadCurrent() - getLoadStart();
// System.out.println( getStreamName() + " progress2: " + done + " " + interval + " start " + getLoadStart() + " end " + getLoadEnd())
return ((double) done )/ interval; return ((double) done )/ interval;
} }
} }

View File

@ -252,7 +252,7 @@ public class PamGuiFX extends StackPane implements PamViewInterface {
/**create left hiding pane**/ /**create left hiding pane**/
loadPane=new PamLoadingPane(this.pamGuiManagerFX); loadPane=new PamLoadingPane(this.pamGuiManagerFX);
hidingLoadPane=new HidingPane(Side.TOP, loadPane, this, false); hidingLoadPane=new HidingPane(Side.TOP, loadPane, this, false);
hidingLoadPane.setPrefHeight(90); hidingLoadPane.setPrefHeight(110);
hidingLoadPane.removeHideButton(); hidingLoadPane.removeHideButton();
hidingLoadPane.showHidePane(false); hidingLoadPane.showHidePane(false);

View File

@ -210,7 +210,7 @@ public class DLPredictionPlotInfoFX extends GenericLinePlotInfo {
public Polygon drawDataUnit(int plotNumber, PamDataUnit pamDataUnit, GraphicsContext g, double scrollStart, public Polygon drawDataUnit(int plotNumber, PamDataUnit pamDataUnit, GraphicsContext g, double scrollStart,
TDProjectorFX tdProjector, int type) { TDProjectorFX tdProjector, int type) {
//System.out.println("Get data type: " + getScaleInfo().getDataType()); // System.out.println("Get prediciton data type: " + getScaleInfo().getDataType());
if (getScaleInfo().getDataType().equals(ParameterType.FREQUENCY)) { // frequency data ! if (getScaleInfo().getDataType().equals(ParameterType.FREQUENCY)) { // frequency data !
return drawFrequencyData(plotNumber, pamDataUnit, g, scrollStart, tdProjector, type); return drawFrequencyData(plotNumber, pamDataUnit, g, scrollStart, tdProjector, type);
} }

View File

@ -113,8 +113,8 @@ public class ArchiveModelWorker extends GenericModelWorker {
//HACK there seems to be some sort of bug in ketos where the params input shape is correct but the model input shape is wrong. //HACK there seems to be some sort of bug in ketos where the params input shape is correct but the model input shape is wrong.
if (dlModel.getInputShape()==null || !dlModel.getInputShape().equals(modelParams.defaultInputShape)) { if (dlModel.getInputShape()==null || !dlModel.getInputShape().equals(modelParams.defaultInputShape)) {
System.out.println("Model input shape: " + modelParams.defaultInputShape); System.err.println("Model input shape does not match: params: " + modelParams.defaultInputShape + " model: " + dlModel.getInputShape());
WarnOnce.showWarning("Model shape", "The model shape does not match the model metadata. \n Metadata shape will be used used.", WarnOnce.OK_OPTION); //WarnOnce.showWarning("Model shape", "The model shape does not match the model metadata. \n Metadata shape will be used used.", WarnOnce.OK_OPTION);
dlModel.setInputShape(modelParams.defaultInputShape); dlModel.setInputShape(modelParams.defaultInputShape);
} }

View File

@ -39,6 +39,12 @@ public class GenericPrediction implements PredictionResult {
public double analysisTime=0; public double analysisTime=0;
/**
* Constructor for a typical generic prediciton.
* @param prob - the probability for each class.
* @param classNameID - the ID's of the class names.
* @param isBinary - true if the model result passed a binary test (usually one species above a threshold)
*/
public GenericPrediction(float[] prob, short[] classNameID, boolean isBinary) { public GenericPrediction(float[] prob, short[] classNameID, boolean isBinary) {
this.prob=prob; this.prob=prob;
this.classNameID = classNameID; this.classNameID = classNameID;

View File

@ -115,7 +115,6 @@ public class ModelResultBinaryFactory {
try { try {
//System.out.println("Make model result: "); //System.out.println("Make model result: ");
int type = dis.readByte(); int type = dis.readByte();
boolean isBinary = dis.readBoolean(); boolean isBinary = dis.readBoolean();
double scale = dis.readFloat(); double scale = dis.readFloat();
@ -150,9 +149,7 @@ public class ModelResultBinaryFactory {
result = new GenericPrediction(data, isBinary); result = new GenericPrediction(data, isBinary);
break; break;
} }
//System.out.println("New model result: "+ type); //System.out.println("New model result: "+ type);
return result; return result;
} catch (IOException e) { } catch (IOException e) {