mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2025-05-08 15:47:23 +00:00
Rocca graphics
Added Rocca overlay graphics to RoccaLoggingDataBlock
This commit is contained in:
parent
f88be0ca3c
commit
0941b3ab7f
@ -704,9 +704,13 @@ public class PamDetectionOverlayGraphics extends PanelOverlayDraw {
|
||||
double[] frequency = pamDetection.getFrequency();
|
||||
Coordinate3d topLeft = generalProjector.getCoord3d(pamDetection.getTimeMilliseconds(),
|
||||
frequency[1], 0);
|
||||
double dur = 0;
|
||||
Double duration = pamDetection.getDurationInMilliseconds();
|
||||
if (duration != null) {
|
||||
dur = duration;
|
||||
}
|
||||
Coordinate3d botRight = generalProjector.getCoord3d(pamDetection.getTimeMilliseconds() +
|
||||
pamDetection.getDurationInMilliseconds(),
|
||||
frequency[0], 0);
|
||||
dur, frequency[0], 0);
|
||||
|
||||
if (botRight.x < topLeft.x){
|
||||
botRight.x = g.getClipBounds().width;
|
||||
|
@ -2973,7 +2973,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett
|
||||
}
|
||||
int wantedMap = 1<<spectrogramParameters.channelList[panelId];
|
||||
int dataChanMap = dataUnit.getSequenceBitmap();
|
||||
if ((wantedMap & dataChanMap) == 0) {
|
||||
if (dataChanMap != 0 && (wantedMap & dataChanMap) == 0) {
|
||||
continue;
|
||||
}
|
||||
if (dataSelector != null && dataSelector.scoreData(dataUnit) <= 0) {
|
||||
|
@ -21,11 +21,15 @@
|
||||
package rocca;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import PamView.GeneralProjector;
|
||||
import PamView.PamDetectionOverlayGraphics;
|
||||
import PamView.PamSymbol;
|
||||
import PamView.PamSymbolType;
|
||||
import PamView.symbol.SymbolData;
|
||||
import PamguardMVC.PamDataUnit;
|
||||
|
||||
/**
|
||||
* @author Michael Oswald
|
||||
@ -46,8 +50,8 @@ public class RoccaGraphics extends PamDetectionOverlayGraphics {
|
||||
|
||||
int iCol = 0;
|
||||
|
||||
public RoccaGraphics(RoccaProcess roccaProcess) {
|
||||
super(roccaProcess.fftDataBlockIn, new PamSymbol(defaultSymbol));
|
||||
public RoccaGraphics(RoccaProcess roccaProcess, RoccaLoggingDataBlock rldb) {
|
||||
super(rldb, new PamSymbol(defaultSymbol));
|
||||
this.roccaProcess = roccaProcess;
|
||||
// if (getPamSymbol() == null) {
|
||||
// PamSymbol mapSymbol = new PamSymbol(PamSymbolType.SYMBOL_STAR, 8, 8, true,
|
||||
@ -56,10 +60,11 @@ public class RoccaGraphics extends PamDetectionOverlayGraphics {
|
||||
// }
|
||||
}
|
||||
|
||||
// @Override
|
||||
// protected Rectangle drawOnSpectrogram(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) {
|
||||
// return drawContourShape(g, (RoccaSightingDataUnit) pamDataUnit, generalProjector);
|
||||
// }
|
||||
@Override
|
||||
protected Rectangle drawOnSpectrogram(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) {
|
||||
return super.drawOnSpectrogram(g, pamDataUnit, generalProjector);
|
||||
}
|
||||
|
||||
//
|
||||
// Rectangle drawContourShape(Graphics g, RoccaSightingDataUnit rsdu,
|
||||
// GeneralProjector projector) {
|
||||
|
@ -64,6 +64,7 @@ public class RoccaLoggingDataBlock extends PamDataBlock<RoccaLoggingDataUnit> {
|
||||
this.roccaControl = roccaControl;
|
||||
//this.setNaturalLifetime(Integer.MAX_VALUE/1000);
|
||||
this.setNaturalLifetime(10);
|
||||
setPamSymbolManager(new RoccaSymbolManager(this, RoccaGraphics.defaultSymbol));
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,10 +21,16 @@
|
||||
|
||||
package rocca;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.protobuf.Duration;
|
||||
|
||||
import PamDetection.PamDetection;
|
||||
import PamguardMVC.PamDataUnit;
|
||||
import rocca.RoccaContourStats.ParamIndx;
|
||||
import tethys.pamdata.AutoTethysProvider;
|
||||
|
||||
|
||||
/**
|
||||
@ -248,6 +254,88 @@ public class RoccaLoggingDataUnit extends PamDataUnit<PamDataUnit,PamDataUnit> i
|
||||
public void setLongitude(double longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSummaryString() {
|
||||
String base = super.getSummaryString();
|
||||
|
||||
// if (detectionCount != 0) {
|
||||
// base += String.format("Detection count: %d<br>", detectionCount);
|
||||
// }
|
||||
if (classifiedAs != null) {
|
||||
base += "Classified as: " + classifiedAs + "<br>";
|
||||
}
|
||||
if (classifierUsed != null) {
|
||||
base += "Classifier used: " + classifierUsed + "<br>";
|
||||
}
|
||||
if (classifier2Used != null) {
|
||||
base += "Second Classifier: " + classifier2Used + "<br>";
|
||||
}
|
||||
|
||||
|
||||
if (contourStats == null) {
|
||||
return base;
|
||||
}
|
||||
EnumMap<ParamIndx, Double> lst = contourStats.getContour();
|
||||
if (lst == null) {
|
||||
return base;
|
||||
}
|
||||
|
||||
int npRow = 3;
|
||||
Set<ParamIndx> keys = lst.keySet();
|
||||
int i = 0;
|
||||
for (ParamIndx aKey : keys) {
|
||||
Double data = lst.get(aKey);
|
||||
if (data == null) {
|
||||
continue;
|
||||
}
|
||||
data = AutoTethysProvider.roundDecimalPlaces(data, 3);
|
||||
base += String.format("%s: %s", aKey.toString(), data.toString());
|
||||
if (++i % npRow == 0) {
|
||||
base += ",<br>";
|
||||
}
|
||||
else {
|
||||
base += ", ";
|
||||
}
|
||||
}
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getFrequency() {
|
||||
double[] fr = super.getFrequency();
|
||||
if (fr != null && fr.length == 2 && fr[1] > 0) {
|
||||
return fr;
|
||||
}
|
||||
if (contourStats.getContour() == null) {
|
||||
return null;
|
||||
}
|
||||
ParamIndx[] ps = {RoccaContourStats.ParamIndx.FREQMIN, RoccaContourStats.ParamIndx.FREQMAX};
|
||||
fr = new double[2];
|
||||
for (int i = 0; i < 2; i++) {
|
||||
Double f = contourStats.getContour().get(ps[i]);
|
||||
if (f == null) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
fr[i] = f;
|
||||
}
|
||||
}
|
||||
return fr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getDurationInMilliseconds() {
|
||||
if (contourStats.getContour() == null) {
|
||||
return null;
|
||||
}
|
||||
Double dur = contourStats.getContour().get(RoccaContourStats.ParamIndx.DURATION);
|
||||
if (dur == null) {
|
||||
return null;
|
||||
}
|
||||
return dur*1000.;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -152,6 +152,7 @@ public class RoccaProcess extends PamProcess {
|
||||
roccaClassifier = new RoccaClassifier(this);
|
||||
rldb = new RoccaLoggingDataBlock(roccaControl, this, 0);
|
||||
|
||||
rldb.setOverlayDraw(new RoccaGraphics(this, rldb));
|
||||
rldb.SetLogging(new RoccaStatsLogger(roccaControl, rldb));
|
||||
rldb.setMixedDirection(PamDataBlock.MIX_INTODATABASE);
|
||||
addOutputDataBlock(rldb);
|
||||
|
14
src/rocca/RoccaSymbolManager.java
Normal file
14
src/rocca/RoccaSymbolManager.java
Normal file
@ -0,0 +1,14 @@
|
||||
package rocca;
|
||||
|
||||
import PamView.symbol.StandardSymbolManager;
|
||||
import PamView.symbol.SymbolData;
|
||||
import PamguardMVC.PamDataBlock;
|
||||
|
||||
public class RoccaSymbolManager extends StandardSymbolManager {
|
||||
|
||||
public RoccaSymbolManager(PamDataBlock pamDataBlock, SymbolData defaultSymbol) {
|
||||
super(pamDataBlock, defaultSymbol);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user