mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-25 16:42:27 +00:00
2.02.07b
Fix ICI display bug in click detector
This commit is contained in:
parent
a89279ef81
commit
269398890e
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.pamguard</groupId>
|
<groupId>org.pamguard</groupId>
|
||||||
<artifactId>Pamguard</artifactId>
|
<artifactId>Pamguard</artifactId>
|
||||||
<version>2.02.07a</version>
|
<version>2.02.07b</version>
|
||||||
<name>Pamguard Java12+</name>
|
<name>Pamguard Java12+</name>
|
||||||
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
|
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
|
||||||
<url>www.pamguard.org</url>
|
<url>www.pamguard.org</url>
|
||||||
|
@ -31,12 +31,12 @@ public class PamguardVersionInfo {
|
|||||||
* Version number, major version.minorversion.sub-release.
|
* Version number, major version.minorversion.sub-release.
|
||||||
* Note: can't go higher than sub-release 'f'
|
* Note: can't go higher than sub-release 'f'
|
||||||
*/
|
*/
|
||||||
static public final String version = "2.02.07a";
|
static public final String version = "2.02.07b";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release date
|
* Release date
|
||||||
*/
|
*/
|
||||||
static public final String date = "10 January 2023";
|
static public final String date = "19 January 2023";
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Release type - Beta or Core
|
// * Release type - Beta or Core
|
||||||
|
@ -1697,14 +1697,13 @@ abstract public class PamDataUnit<T extends PamDataUnit, U extends PamDataUnit>
|
|||||||
*/
|
*/
|
||||||
public int getColourIndex() {
|
public int getColourIndex() {
|
||||||
/*
|
/*
|
||||||
* This can go wrong when UID > 2^31 since the colour choser takes
|
* This can go wrong when UID > 2^31 since the colour chooser takes
|
||||||
* a mod WRT number of whale colours and it doesn't like negative numbers.
|
* a mod WRT number of whale colours and it doesn't like negative numbers.
|
||||||
* So need to keep the value going in positive.
|
* So need to keep the value going in positive.
|
||||||
*/
|
*/
|
||||||
long uid = getUID();
|
long uid = getUID();
|
||||||
uid -= uid/2^31;
|
uid &= 0x7FFFFFFF; // avoid anything in top bit of an int32 or higher
|
||||||
return (int) uid;
|
return (int) uid;
|
||||||
// return (int) getUID();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,6 +47,8 @@ import java.awt.image.BufferedImage;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.ConcurrentModificationException;
|
import java.util.ConcurrentModificationException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
@ -134,7 +136,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
|
|
||||||
private PamScroller hScrollBar;
|
private PamScroller hScrollBar;
|
||||||
|
|
||||||
// private PamDataBlock<ClickDetection> trackedClicks;
|
// private PamDataBlock<ClickDetection> trackedClicks;
|
||||||
|
|
||||||
protected BTPlot btPlot;
|
protected BTPlot btPlot;
|
||||||
|
|
||||||
@ -219,7 +221,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
/**
|
/**
|
||||||
* The symbol chooser for the BT display
|
* The symbol chooser for the BT display
|
||||||
*/
|
*/
|
||||||
// private ClickDetSymbolChooser symbolChooser;
|
// private ClickDetSymbolChooser symbolChooser;
|
||||||
|
|
||||||
public ClickBTDisplay(ClickControl clickControl, ClickDisplayManager clickDisplayManager, ClickDisplayManager.ClickDisplayInfo clickDisplayInfo) {
|
public ClickBTDisplay(ClickControl clickControl, ClickDisplayManager clickDisplayManager, ClickDisplayManager.ClickDisplayInfo clickDisplayInfo) {
|
||||||
|
|
||||||
@ -265,7 +267,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
topControls = new TopControls();
|
topControls = new TopControls();
|
||||||
setNorthPanel(topControls);
|
setNorthPanel(topControls);
|
||||||
|
|
||||||
// trackedClicks = clickControl.getClickDetector().getTrackedClicks();
|
// trackedClicks = clickControl.getClickDetector().getTrackedClicks();
|
||||||
|
|
||||||
highlightSymbol.setLineThickness(3);
|
highlightSymbol.setLineThickness(3);
|
||||||
|
|
||||||
@ -369,13 +371,49 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
@Override
|
@Override
|
||||||
public void updateData(PamObservable observable, PamDataUnit pamDataUnit) {
|
public void updateData(PamObservable observable, PamDataUnit pamDataUnit) {
|
||||||
|
|
||||||
|
if (pamDataUnit instanceof ClickDetection) {
|
||||||
|
updateClick((ClickDetection) pamDataUnit);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateClick(ClickDetection clickDetection) {
|
||||||
|
// ICI may have been set when the click was added to an event
|
||||||
|
// so work it out there rather than rebuilding the entire list.
|
||||||
|
SuperDetection superDet = clickDetection.getSuperDetection(0);
|
||||||
|
if (superDet == null) {
|
||||||
|
// sortTempICIs();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Work only within the superdetection to find the previous
|
||||||
|
* click within that for this clicks channel combination and update
|
||||||
|
* the ICI accordingly. For the first click an event, it won't find
|
||||||
|
* a preceeding click, but that's OK.
|
||||||
|
*/
|
||||||
|
synchronized (superDet.getSubDetectionSyncronisation()) {
|
||||||
|
int subDetInd = superDet.findSubdetectionInfo(clickDetection);
|
||||||
|
for (int i = subDetInd-1; i >= 0; i--) {
|
||||||
|
PamDataUnit subDet = superDet.getSubDetection(i);
|
||||||
|
if (subDet.getChannelBitmap() == clickDetection.getChannelBitmap()) {
|
||||||
|
double ici = (double) (clickDetection.getTimeMilliseconds() - subDet.getTimeMilliseconds())/1000.;
|
||||||
|
clickDetection.setTempICI(ici);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changedEvent(OfflineEventDataUnit event) {
|
private void changedEvent(OfflineEventDataUnit event) {
|
||||||
|
sortTempICIs();
|
||||||
btPlot.repaint(10);
|
btPlot.repaint(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void newClick(ClickDetection clickDataUnit) {
|
public void newClick(ClickDetection clickDataUnit) {
|
||||||
|
|
||||||
|
sortTempICI(clickDataUnit);
|
||||||
|
|
||||||
if (shouldPlot(clickDataUnit)){
|
if (shouldPlot(clickDataUnit)){
|
||||||
// btPlot.drawClick(btPlot.getImageGraphics(), clickDataUnit, null);
|
// btPlot.drawClick(btPlot.getImageGraphics(), clickDataUnit, null);
|
||||||
// btPlot.repaint(minPaintTime);
|
// btPlot.repaint(minPaintTime);
|
||||||
@ -386,6 +424,71 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HashMap<Long, ClickDetection> lastClicks = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort out all ICI's for all clicks.
|
||||||
|
*/
|
||||||
|
private void sortTempICIs() {
|
||||||
|
// long t1 = System.nanoTime();
|
||||||
|
PamDataBlock<ClickDetection> clickData = clickControl.getClickDataBlock();
|
||||||
|
ArrayList<ClickDetection> allClicks = clickData.getDataCopy();
|
||||||
|
sortTempICIs(allClicks);
|
||||||
|
// long t2 = System.nanoTime();
|
||||||
|
// System.out.printf("time to sort %d ICI measures is %3.1fms\n", allClicks.size(), (double) (t2-t1)/1.e6);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear ICI history, e.g. when new data are loaded or processing starts.
|
||||||
|
*/
|
||||||
|
private void clearICIHistory() {
|
||||||
|
synchronized(lastClicks) {
|
||||||
|
lastClicks.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sorts ICI's for a list of clicks.
|
||||||
|
* @param clicks
|
||||||
|
*/
|
||||||
|
private void sortTempICIs(List<ClickDetection> clicks) {
|
||||||
|
clearICIHistory();
|
||||||
|
|
||||||
|
for (ClickDetection aClick : clicks) {
|
||||||
|
sortTempICI(aClick);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sorts ICI information for a new click.
|
||||||
|
* @param aClick
|
||||||
|
*/
|
||||||
|
private void sortTempICI(ClickDetection aClick) {
|
||||||
|
long chans = aClick.getChannelBitmap(); // int32 channel group.
|
||||||
|
long superId = 0;
|
||||||
|
SuperDetection superDet = aClick.getSuperDetection(0);
|
||||||
|
if (superDet != null) {
|
||||||
|
superId = superDet.getUID();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* make an overall id for the click in a long. This could in theory wrap
|
||||||
|
* a superdet, but that is very unlikely and we probably don't care anyway
|
||||||
|
* since it's unlikely a uid that different would be in memory at the same time.
|
||||||
|
*/
|
||||||
|
long totalId = superId<<32 | chans;
|
||||||
|
synchronized(lastClicks) {
|
||||||
|
ClickDetection prevClick = lastClicks.get(totalId);
|
||||||
|
if (prevClick == null) {
|
||||||
|
aClick.setTempICI(0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
double ici = (double) (aClick.getTimeMilliseconds() - prevClick.getTimeMilliseconds()) / 1000.;
|
||||||
|
aClick.setTempICI(ici);
|
||||||
|
}
|
||||||
|
lastClicks.put(totalId, aClick);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -467,6 +570,8 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
hScrollManager.reset();
|
hScrollManager.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearICIHistory();
|
||||||
|
|
||||||
// hScrollManager.setupScrollBar(0);
|
// hScrollManager.setupScrollBar(0);
|
||||||
// setupTimeBar();
|
// setupTimeBar();
|
||||||
repaintBoth();
|
repaintBoth();
|
||||||
@ -1193,6 +1298,8 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
hScrollBar.setUnitIncrement(getUnitIncrement(getTimeRangeMillis()));
|
hScrollBar.setUnitIncrement(getUnitIncrement(getTimeRangeMillis()));
|
||||||
hScrollBar.setBlockIncrement(getTimeRangeMillis() * 7 / 8);
|
hScrollBar.setBlockIncrement(getTimeRangeMillis() * 7 / 8);
|
||||||
|
|
||||||
|
sortTempICIs();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1265,7 +1372,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
// System.out.println("New max time = " + PamCalendar.formatTime(displayMaxMillis));
|
// System.out.println("New max time = " + PamCalendar.formatTime(displayMaxMillis));
|
||||||
// System.out.println(String.format("Set up scroll bar at %s", PamCalendar.formatDateTime(displayMaxMillis)));
|
// System.out.println(String.format("Set up scroll bar at %s", PamCalendar.formatDateTime(displayMaxMillis)));
|
||||||
long displayLength = getTimeRangeMillis();
|
long displayLength = getTimeRangeMillis();
|
||||||
// long currentStart = hScrollBar.getMinimumMillis();
|
// long currentStart = hScrollBar.getMinimumMillis();
|
||||||
long scrollRange = hScrollBar.getRangeMillis(); // total scrollable range
|
long scrollRange = hScrollBar.getRangeMillis(); // total scrollable range
|
||||||
long currentValue = hScrollBar.getValueMillis();
|
long currentValue = hScrollBar.getValueMillis();
|
||||||
long displayMinMillis = displayMaxMillis-scrollRange; // start of scrollable region.
|
long displayMinMillis = displayMaxMillis-scrollRange; // start of scrollable region.
|
||||||
@ -1444,6 +1551,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void offlineDataChanged() {
|
public void offlineDataChanged() {
|
||||||
|
sortTempICIs();
|
||||||
repaintBoth();
|
repaintBoth();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1572,9 +1680,9 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
}
|
}
|
||||||
private double clickAngleToY(ClickDetection click) {
|
private double clickAngleToY(ClickDetection click) {
|
||||||
AbstractLocalisation loc = click.getLocalisation();
|
AbstractLocalisation loc = click.getLocalisation();
|
||||||
// if (click.getUID() == 110006089) {
|
// if (click.getUID() == 110006089) {
|
||||||
// System.out.println("Click 110006089 angle " + click.getAngle());
|
// System.out.println("Click 110006089 angle " + click.getAngle());
|
||||||
// }
|
// }
|
||||||
if (loc == null) return 0;
|
if (loc == null) return 0;
|
||||||
double angle = 0;
|
double angle = 0;
|
||||||
GpsData oll;
|
GpsData oll;
|
||||||
@ -1590,20 +1698,20 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
case ArrayManager.ARRAY_TYPE_VOLUME:
|
case ArrayManager.ARRAY_TYPE_VOLUME:
|
||||||
PamVector v = getDisplayVector(click);
|
PamVector v = getDisplayVector(click);
|
||||||
angle = Math.toDegrees(PamVector.vectorToSurfaceBearing(v));
|
angle = Math.toDegrees(PamVector.vectorToSurfaceBearing(v));
|
||||||
// PamVector[] vecs = null;
|
// PamVector[] vecs = null;
|
||||||
// angle = click.getAngle();
|
// angle = click.getAngle();
|
||||||
// if (btDisplayParameters.bearingType == BTDisplayParameters.BEARING_FROMVESSEL) {
|
// if (btDisplayParameters.bearingType == BTDisplayParameters.BEARING_FROMVESSEL) {
|
||||||
// have to use real world vectors to get the array rotation vector
|
// have to use real world vectors to get the array rotation vector
|
||||||
// then subtract back off the heading
|
// then subtract back off the heading
|
||||||
// vecs = loc.getPlanarAngles()();
|
// vecs = loc.getPlanarAngles()();
|
||||||
// if (vecs == null || vecs.length < 1) {
|
// if (vecs == null || vecs.length < 1) {
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
// angle = Math.toDegrees(PamVector.vectorToSurfaceBearing(vecs[0]));
|
// angle = Math.toDegrees(PamVector.vectorToSurfaceBearing(vecs[0]));
|
||||||
// oll = click.getOriginLatLong(false);
|
// oll = click.getOriginLatLong(false);
|
||||||
// if (oll != null) {
|
// if (oll != null) {
|
||||||
// angle -= oll.getHeading();
|
// angle -= oll.getHeading();
|
||||||
// }
|
// }
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
@ -1648,7 +1756,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
if (vr != null && vr.length > 0) {
|
if (vr != null && vr.length > 0) {
|
||||||
return vr[0];
|
return vr[0];
|
||||||
}
|
}
|
||||||
// rotAngles[0] = Math.toRadians(oll.getHeading());
|
// rotAngles[0] = Math.toRadians(oll.getHeading());
|
||||||
}
|
}
|
||||||
else if (rType == BTDisplayParameters.ROTATE_TONORTH) {
|
else if (rType == BTDisplayParameters.ROTATE_TONORTH) {
|
||||||
PamVector[] vr = loc.getRealWorldVectors();
|
PamVector[] vr = loc.getRealWorldVectors();
|
||||||
@ -1656,11 +1764,11 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
return vr[0];
|
return vr[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (rotAngles[0] == 0 && rotAngles[1] == 0 && rotAngles[2] == 0) {
|
// if (rotAngles[0] == 0 && rotAngles[1] == 0 && rotAngles[2] == 0) {
|
||||||
// return v;
|
// return v;
|
||||||
// }
|
// }
|
||||||
// PamQuaternion pq = new PamQuaternion(rotAngles[0], rotAngles[1], rotAngles[2]);
|
// PamQuaternion pq = new PamQuaternion(rotAngles[0], rotAngles[1], rotAngles[2]);
|
||||||
// PamVector v2 = PamVector.rotateVector(v, pq);
|
// PamVector v2 = PamVector.rotateVector(v, pq);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1677,16 +1785,16 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
return yStart + (yMax-yPos)/yScale;
|
return yStart + (yMax-yPos)/yScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ClickDetection lastICIClick;
|
// private ClickDetection lastICIClick;
|
||||||
private double clickICIToY(ClickDetection click) {
|
private double clickICIToY(ClickDetection click) {
|
||||||
if (click.getICI() > 0) {
|
// if (click.getTempICI() > 0) {
|
||||||
return btPlot.getHeight() - yAxis.getPosition(click.getICI());
|
|
||||||
// return click.getICI() * yScale;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return btPlot.getHeight() - yAxis.getPosition(click.getTempICI());
|
return btPlot.getHeight() - yAxis.getPosition(click.getTempICI());
|
||||||
// return click.getTempICI() * yScale;
|
// return click.getICI() * yScale;
|
||||||
}
|
// }
|
||||||
|
// else {
|
||||||
|
// return btPlot.getHeight() - yAxis.getPosition(click.getTempICI());
|
||||||
|
// // return click.getTempICI() * yScale;
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1783,7 +1891,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// private JPopupMenu clickPopupMenu = null;
|
// private JPopupMenu clickPopupMenu = null;
|
||||||
|
|
||||||
public RangeSpinner rangeSpinner;
|
public RangeSpinner rangeSpinner;
|
||||||
|
|
||||||
@ -1792,20 +1900,20 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
public ClickDetSymbolChooser symbolChooser;
|
public ClickDetSymbolChooser symbolChooser;
|
||||||
|
|
||||||
private JPopupMenu getClickPUMenu(ClickDetection click) {
|
private JPopupMenu getClickPUMenu(ClickDetection click) {
|
||||||
// if (clickPopupMenu == null){
|
// if (clickPopupMenu == null){
|
||||||
// clickPopupMenu = new JPopupMenu();
|
// clickPopupMenu = new JPopupMenu();
|
||||||
// JMenuItem menuItem;
|
// JMenuItem menuItem;
|
||||||
// PamSymbol pamSymbol;
|
// PamSymbol pamSymbol;
|
||||||
// Color symbolColour;
|
// Color symbolColour;
|
||||||
// for (int i = 0; i < PamColors.getInstance().getNWhaleColours(); i++) {
|
// for (int i = 0; i < PamColors.getInstance().getNWhaleColours(); i++) {
|
||||||
// menuItem = new JMenuItem(" Whale Train " + i);
|
// menuItem = new JMenuItem(" Whale Train " + i);
|
||||||
// symbolColour = PamColors.getInstance().getWhaleColor(i);
|
// symbolColour = PamColors.getInstance().getWhaleColor(i);
|
||||||
// pamSymbol = new PamSymbol(PamSymbol.SYMBOL_CIRCLE, 12, 12, true, symbolColour, symbolColour);
|
// pamSymbol = new PamSymbol(PamSymbol.SYMBOL_CIRCLE, 12, 12, true, symbolColour, symbolColour);
|
||||||
// menuItem.setIcon(pamSymbol);
|
// menuItem.setIcon(pamSymbol);
|
||||||
// menuItem.addActionListener(new clickPUListener(i));
|
// menuItem.addActionListener(new clickPUListener(i));
|
||||||
// clickPopupMenu.add(menuItem);
|
// clickPopupMenu.add(menuItem);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
/*
|
/*
|
||||||
* Make a menu based on which whales are currently alive and active and also
|
* Make a menu based on which whales are currently alive and active and also
|
||||||
* a "new" category at the end ...
|
* a "new" category at the end ...
|
||||||
@ -1830,7 +1938,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
OfflineEventDataUnit clickGroup = it.next();
|
OfflineEventDataUnit clickGroup = it.next();
|
||||||
whaleId = clickGroup.getEventId();
|
whaleId = clickGroup.getEventId();
|
||||||
if (click.getSuperDetection(0) == clickGroup) continue;
|
if (click.getSuperDetection(0) == clickGroup) continue;
|
||||||
// if (whaleId == click.getEventId()) continue;
|
// if (whaleId == click.getEventId()) continue;
|
||||||
biggestId = Math.max(biggestId, whaleId);
|
biggestId = Math.max(biggestId, whaleId);
|
||||||
menuItem = new JMenuItem("Click Train " + whaleId);
|
menuItem = new JMenuItem("Click Train " + whaleId);
|
||||||
symbolColour = PamColors.getInstance().getWhaleColor(clickGroup.getColourIndex());
|
symbolColour = PamColors.getInstance().getWhaleColor(clickGroup.getColourIndex());
|
||||||
@ -1841,9 +1949,9 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
}
|
}
|
||||||
whaleId = biggestId + 1;
|
whaleId = biggestId + 1;
|
||||||
menuItem = new JMenuItem("New Click Train");
|
menuItem = new JMenuItem("New Click Train");
|
||||||
// symbolColour = PamColors.getInstance().getWhaleColor(whaleId);
|
// symbolColour = PamColors.getInstance().getWhaleColor(whaleId);
|
||||||
// pamSymbol = new PamSymbol(PamSymbol.SYMBOL_CIRCLE, 12, 12, true, symbolColour, symbolColour);
|
// pamSymbol = new PamSymbol(PamSymbol.SYMBOL_CIRCLE, 12, 12, true, symbolColour, symbolColour);
|
||||||
// menuItem.setIcon(pamSymbol);
|
// menuItem.setIcon(pamSymbol);
|
||||||
menuItem.addActionListener(new clickPUListener(whaleId));
|
menuItem.addActionListener(new clickPUListener(whaleId));
|
||||||
clickPopupMenu.add(menuItem, 0);
|
clickPopupMenu.add(menuItem, 0);
|
||||||
|
|
||||||
@ -1921,7 +2029,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
|
|
||||||
if (popupClick == null) return;
|
if (popupClick == null) return;
|
||||||
|
|
||||||
// popupClick.setEventId(whaleId);
|
// popupClick.setEventId(whaleId);
|
||||||
|
|
||||||
trackClick(popupClick, whaleId);
|
trackClick(popupClick, whaleId);
|
||||||
|
|
||||||
@ -1962,7 +2070,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
private void trackClick(ClickDetection click, int whaleId) {
|
private void trackClick(ClickDetection click, int whaleId) {
|
||||||
|
|
||||||
click.setTracked(true);
|
click.setTracked(true);
|
||||||
// clickControl.clickDetector.reWriteClick(click, false);
|
// clickControl.clickDetector.reWriteClick(click, false);
|
||||||
|
|
||||||
// ClickDetection newDataUnit = new ClickDetection(click.getChannelBitmap(), click.getStartSample(),
|
// ClickDetection newDataUnit = new ClickDetection(click.getChannelBitmap(), click.getStartSample(),
|
||||||
// click.getDuration(), click.clickDetector, click.triggerList);
|
// click.getDuration(), click.clickDetector, click.triggerList);
|
||||||
@ -2000,35 +2108,35 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
if (scaleManager == null) {
|
if (scaleManager == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// scaleManager
|
// scaleManager
|
||||||
// System.out.println(String.format("set y range from %s %3.4f to %3.4fs", scaleManager.getTitle(),
|
// System.out.println(String.format("set y range from %s %3.4f to %3.4fs", scaleManager.getTitle(),
|
||||||
// scaleManager.getCurrentStart(), scaleManager.getCurrentEnd()));
|
// scaleManager.getCurrentStart(), scaleManager.getCurrentEnd()));
|
||||||
yAxis.setRange(scaleManager.getCurrentStart(), scaleManager.getCurrentEnd());
|
yAxis.setRange(scaleManager.getCurrentStart(), scaleManager.getCurrentEnd());
|
||||||
yAxis.setLogScale(btDisplayParameters.logICIScale && btDisplayParameters.VScale == BTDisplayParameters.DISPLAY_ICI);
|
yAxis.setLogScale(btDisplayParameters.logICIScale && btDisplayParameters.VScale == BTDisplayParameters.DISPLAY_ICI);
|
||||||
yAxis.setInterval(scaleManager.getYAxisInterval());
|
yAxis.setInterval(scaleManager.getYAxisInterval());
|
||||||
yAxis.setLabel(scaleManager.getTitle());
|
yAxis.setLabel(scaleManager.getTitle());
|
||||||
yAxis.setAutoFormat(false);
|
yAxis.setAutoFormat(false);
|
||||||
// String format = getYAxisFormat()
|
// String format = getYAxisFormat()
|
||||||
// double range = Math.abs(scaleManager.currentRange);
|
// double range = Math.abs(scaleManager.currentRange);
|
||||||
// if (range > 30) {
|
// if (range > 30) {
|
||||||
// yAxis.setFormat("%d");
|
// yAxis.setFormat("%d");
|
||||||
// }
|
// }
|
||||||
// else if (range > 8) {
|
// else if (range > 8) {
|
||||||
// yAxis.setFormat("%3.1f");
|
// yAxis.setFormat("%3.1f");
|
||||||
// }
|
// }
|
||||||
// else if (range > 1) {
|
// else if (range > 1) {
|
||||||
// yAxis.setFormat("%3.1f");
|
// yAxis.setFormat("%3.1f");
|
||||||
// }
|
// }
|
||||||
// else if (range > .1) {
|
// else if (range > .1) {
|
||||||
// yAxis.setFormat("%3.2f");
|
// yAxis.setFormat("%3.2f");
|
||||||
// }
|
// }
|
||||||
// else if (range <= 0) {
|
// else if (range <= 0) {
|
||||||
// yAxis.setFormat("%3.2f");
|
// yAxis.setFormat("%3.2f");
|
||||||
// }
|
// }
|
||||||
// else {
|
// else {
|
||||||
// int nDP = (int)Math.ceil(Math.abs(Math.log10(range)));
|
// int nDP = (int)Math.ceil(Math.abs(Math.log10(range)));
|
||||||
// yAxis.setFormat(String.format("%%%d.%df", nDP+2, nDP));
|
// yAxis.setFormat(String.format("%%%d.%df", nDP+2, nDP));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// switch (btDisplayParameters.VScale) {
|
// switch (btDisplayParameters.VScale) {
|
||||||
//
|
//
|
||||||
@ -2227,7 +2335,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private JPopupMenu getPopupMenu(ClickDetection clickedClick) {
|
private JPopupMenu getPopupMenu(ClickDetection clickedClick) {
|
||||||
// System.out.println("Create click right click menu.....");
|
// System.out.println("Create click right click menu.....");
|
||||||
boolean isView = PamController.getInstance().getRunMode() == PamController.RUN_PAMVIEW;
|
boolean isView = PamController.getInstance().getRunMode() == PamController.RUN_PAMVIEW;
|
||||||
JPopupMenu menu = new JPopupMenu();
|
JPopupMenu menu = new JPopupMenu();
|
||||||
JMenuItem menuItem;
|
JMenuItem menuItem;
|
||||||
@ -2289,23 +2397,23 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
// menuItem = new JCheckBoxMenuItem("Colour by species id",
|
// menuItem = new JCheckBoxMenuItem("Colour by species id",
|
||||||
// btDisplayParameters.colourScheme == BTDisplayParameters.COLOUR_BY_SPECIES);
|
// btDisplayParameters.colourScheme == BTDisplayParameters.COLOUR_BY_SPECIES);
|
||||||
// menuItem.addActionListener(new ColourByAction(BTDisplayParameters.COLOUR_BY_SPECIES));
|
// menuItem.addActionListener(new ColourByAction(BTDisplayParameters.COLOUR_BY_SPECIES));
|
||||||
// menu.add(menuItem);
|
// menu.add(menuItem);
|
||||||
// menuItem = new JCheckBoxMenuItem("Colour by click train",
|
// menuItem = new JCheckBoxMenuItem("Colour by click train",
|
||||||
// btDisplayParameters.colourScheme == BTDisplayParameters.COLOUR_BY_TRAIN);
|
// btDisplayParameters.colourScheme == BTDisplayParameters.COLOUR_BY_TRAIN);
|
||||||
// menuItem.addActionListener(new ColourByAction(BTDisplayParameters.COLOUR_BY_TRAIN));
|
// menuItem.addActionListener(new ColourByAction(BTDisplayParameters.COLOUR_BY_TRAIN));
|
||||||
// menu.add(menuItem);
|
// menu.add(menuItem);
|
||||||
// menuItem = new JCheckBoxMenuItem("Colour by train, then species",
|
// menuItem = new JCheckBoxMenuItem("Colour by train, then species",
|
||||||
// btDisplayParameters.colourScheme == BTDisplayParameters.COLOUR_BY_TRAINANDSPECIES);
|
// btDisplayParameters.colourScheme == BTDisplayParameters.COLOUR_BY_TRAINANDSPECIES);
|
||||||
// menuItem.addActionListener(new ColourByAction(BTDisplayParameters.COLOUR_BY_TRAINANDSPECIES));
|
// menuItem.addActionListener(new ColourByAction(BTDisplayParameters.COLOUR_BY_TRAINANDSPECIES));
|
||||||
// menu.add(menuItem);
|
// menu.add(menuItem);
|
||||||
// // if (isNetReceiver) {
|
// // if (isNetReceiver) {
|
||||||
// menuItem = new JCheckBoxMenuItem("Colour by hydrophone",
|
// menuItem = new JCheckBoxMenuItem("Colour by hydrophone",
|
||||||
// btDisplayParameters.colourScheme == BTDisplayParameters.COLOUR_BY_HYDROPHONE);
|
// btDisplayParameters.colourScheme == BTDisplayParameters.COLOUR_BY_HYDROPHONE);
|
||||||
// menuItem.addActionListener(new ColourByAction(BTDisplayParameters.COLOUR_BY_HYDROPHONE));
|
// menuItem.addActionListener(new ColourByAction(BTDisplayParameters.COLOUR_BY_HYDROPHONE));
|
||||||
// menu.add(menuItem);
|
// menu.add(menuItem);
|
||||||
// }
|
// }
|
||||||
menuItem = new JCheckBoxMenuItem("Bearing / Time");
|
menuItem = new JCheckBoxMenuItem("Bearing / Time");
|
||||||
menuItem.addActionListener(new AxesMenuAction(BTDisplayParameters.DISPLAY_BEARING));
|
menuItem.addActionListener(new AxesMenuAction(BTDisplayParameters.DISPLAY_BEARING));
|
||||||
@ -2639,23 +2747,23 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// class ColourByAction implements ActionListener {
|
// class ColourByAction implements ActionListener {
|
||||||
//
|
//
|
||||||
// private int colourChoice;
|
// private int colourChoice;
|
||||||
//
|
//
|
||||||
// public ColourByAction(int colourChoice) {
|
// public ColourByAction(int colourChoice) {
|
||||||
// super();
|
// super();
|
||||||
// this.colourChoice = colourChoice;
|
// this.colourChoice = colourChoice;
|
||||||
// }
|
// }
|
||||||
// public void actionPerformed(ActionEvent e) {
|
// public void actionPerformed(ActionEvent e) {
|
||||||
// btDisplayParameters.colourScheme = colourChoice;
|
// btDisplayParameters.colourScheme = colourChoice;
|
||||||
// symbolChooser.setSymbolType(colourChoice);
|
// symbolChooser.setSymbolType(colourChoice);
|
||||||
//
|
//
|
||||||
// btPlot.setTotalRepaint();
|
// btPlot.setTotalRepaint();
|
||||||
// btPlot.repaint(minPaintTime);
|
// btPlot.repaint(minPaintTime);
|
||||||
// btPlot.createKey();
|
// btPlot.createKey();
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
class SettingsMenuAction implements ActionListener {
|
class SettingsMenuAction implements ActionListener {
|
||||||
|
|
||||||
@ -2670,7 +2778,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
getVScaleManager().setSelected();
|
getVScaleManager().setSelected();
|
||||||
}
|
}
|
||||||
btAxis.makeAxis();
|
btAxis.makeAxis();
|
||||||
// System.out.println("360: "+btDisplayParameters.view360);
|
// System.out.println("360: "+btDisplayParameters.view360);
|
||||||
repaintBoth();
|
repaintBoth();
|
||||||
btPlot.createKey();
|
btPlot.createKey();
|
||||||
if (clickControl.getOfflineToolbar() != null) {
|
if (clickControl.getOfflineToolbar() != null) {
|
||||||
@ -2694,16 +2802,16 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
Rectangle b = null ;
|
Rectangle b = null ;
|
||||||
if (btAmplitudeSelector != null) {
|
if (btAmplitudeSelector != null) {
|
||||||
b= btAmplitudeSelector.getFrame().getBounds();
|
b= btAmplitudeSelector.getFrame().getBounds();
|
||||||
// btAmplitudeSelector.getFrame().setVisible(true);
|
// btAmplitudeSelector.getFrame().setVisible(true);
|
||||||
// // btAmplitudeSelector.getFrame().
|
// // btAmplitudeSelector.getFrame().
|
||||||
}
|
}
|
||||||
// else {
|
// else {
|
||||||
btAmplitudeSelector = BTAmplitudeSelector.showAmplitudeFrame(clickControl, this);
|
btAmplitudeSelector = BTAmplitudeSelector.showAmplitudeFrame(clickControl, this);
|
||||||
if(b!=null){
|
if(b!=null){
|
||||||
|
|
||||||
btAmplitudeSelector.getFrame().setBounds(b);
|
btAmplitudeSelector.getFrame().setBounds(b);
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkBTAmplitudeSelectHisto() {
|
private void checkBTAmplitudeSelectHisto() {
|
||||||
@ -2895,7 +3003,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
|
|
||||||
|
|
||||||
public boolean redrawAllClicks(){
|
public boolean redrawAllClicks(){
|
||||||
// System.out.println("redrawAllClicks " + hScrollBar.getValueMillis()+ " "+vScrollBar.getValue()+" "+ hScrollBar.getMaximumMillis()+" "+hScrollBar.getStepSizeMillis());
|
// System.out.println("redrawAllClicks " + hScrollBar.getValueMillis()+ " "+vScrollBar.getValue()+" "+ hScrollBar.getMaximumMillis()+" "+hScrollBar.getStepSizeMillis());
|
||||||
if (totalRepaint) {
|
if (totalRepaint) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2914,7 +3022,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// double lastPaintTime;
|
// double lastPaintTime;
|
||||||
public void paintClicks(Graphics g, Rectangle clipRectangle) {
|
public void paintClicks(Graphics g, Rectangle clipRectangle) {
|
||||||
|
|
||||||
long t0 = System.nanoTime();
|
long t0 = System.nanoTime();
|
||||||
@ -2928,18 +3036,21 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
zoomer.paintShape(g, this, true);
|
zoomer.paintShape(g, this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// long t1 = System.nanoTime();
|
// long t1 = System.nanoTime();
|
||||||
synchronized (clickData.getSynchLock()) {
|
synchronized (clickData.getSynchLock()) {
|
||||||
// long t2 = System.nanoTime();
|
// long t2 = System.nanoTime();
|
||||||
// double ms = ((double) (t2-t1)) / 1000000.;
|
// double ms = ((double) (t2-t1)) / 1000000.;
|
||||||
|
// if (btDisplayParameters.VScale == BTDisplayParameters.DISPLAY_ICI) {
|
||||||
|
// sortTempICIs();
|
||||||
|
// }
|
||||||
|
|
||||||
ListIterator<ClickDetection> clickIterator = clickData.getListIterator(PamDataBlock.ITERATOR_END);
|
ListIterator<ClickDetection> clickIterator = clickData.getListIterator(PamDataBlock.ITERATOR_END);
|
||||||
while (clickIterator.hasPrevious()) {
|
while (clickIterator.hasPrevious()) {
|
||||||
click = clickIterator.previous();
|
click = clickIterator.previous();
|
||||||
if (shouldPlot(prevPlottedClick)){
|
if (shouldPlot(prevPlottedClick)){
|
||||||
if (btDisplayParameters.VScale == BTDisplayParameters.DISPLAY_ICI) {
|
// if (btDisplayParameters.VScale == BTDisplayParameters.DISPLAY_ICI) {
|
||||||
prevPlottedClick.setTempICI((double) (prevPlottedClick.getStartSample()-click.getStartSample()) / sampleRate);
|
// prevPlottedClick.setTempICI((double) (prevPlottedClick.getStartSample()-click.getStartSample()) / sampleRate);
|
||||||
}
|
// }
|
||||||
if (drawClick(g, prevPlottedClick, clipRectangle) < -0){
|
if (drawClick(g, prevPlottedClick, clipRectangle) < -0){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2949,16 +3060,16 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
if (shouldPlot(prevPlottedClick)){ // and draw the last one !
|
if (shouldPlot(prevPlottedClick)){ // and draw the last one !
|
||||||
drawClick(g, prevPlottedClick, clipRectangle);
|
drawClick(g, prevPlottedClick, clipRectangle);
|
||||||
}
|
}
|
||||||
// g.drawString(String.format("Wait synch %3.3fms", ms), 0, 20);
|
// g.drawString(String.format("Wait synch %3.3fms", ms), 0, 20);
|
||||||
}
|
}
|
||||||
// long t3 = System.nanoTime();
|
// long t3 = System.nanoTime();
|
||||||
// g.drawString(String.format("Last draw %3.3fms", lastPaintTime), 0, 20);
|
// g.drawString(String.format("Last draw %3.3fms", lastPaintTime), 0, 20);
|
||||||
// lastPaintTime = ((double) (t3-t0)) / 1000000.;
|
// lastPaintTime = ((double) (t3-t0)) / 1000000.;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paintPanel(Graphics g, Rectangle clipRectangle) {
|
public void paintPanel(Graphics g, Rectangle clipRectangle) {
|
||||||
// long tNow = System.currentTimeMillis();
|
// long tNow = System.currentTimeMillis();
|
||||||
redrawClicks=redrawAllClicks();
|
redrawClicks=redrawAllClicks();
|
||||||
/**
|
/**
|
||||||
* Need to call this every time since the original symbol chooser will get deleted after
|
* Need to call this every time since the original symbol chooser will get deleted after
|
||||||
@ -3090,11 +3201,11 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
if (pt.x - width > clipRegion.x + clipRegion.width) return +1;
|
if (pt.x - width > clipRegion.x + clipRegion.width) return +1;
|
||||||
}
|
}
|
||||||
if (click.tracked) {
|
if (click.tracked) {
|
||||||
// System.out.println("Drawing tracked click");
|
// System.out.println("Drawing tracked click");
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the colour scheme.
|
//set the colour scheme.
|
||||||
// symbolChooser.setSymbolType(btDisplayParameters.colourScheme);
|
// symbolChooser.setSymbolType(btDisplayParameters.colourScheme);
|
||||||
PamSymbol symbol = symbolChooser.getPamSymbol(btProjector, click);
|
PamSymbol symbol = symbolChooser.getPamSymbol(btProjector, click);
|
||||||
|
|
||||||
//.getClickSymbol(clickControl.getClickIdentifier(), click, btDisplayParameters.colourScheme);
|
//.getClickSymbol(clickControl.getClickIdentifier(), click, btDisplayParameters.colourScheme);
|
||||||
@ -3156,8 +3267,8 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String tip = click.getSummaryString();
|
String tip = click.getSummaryString();
|
||||||
// String tip = String.format("<html>UID. %d; Click No. %d; Channels %s", click.getUID(),
|
// String tip = String.format("<html>UID. %d; Click No. %d; Channels %s", click.getUID(),
|
||||||
// click.clickNumber, PamUtils.getChannelList(click.getChannelBitmap()));
|
// click.clickNumber, PamUtils.getChannelList(click.getChannelBitmap()));
|
||||||
byte type = click.getClickType();
|
byte type = click.getClickType();
|
||||||
if (clickControl.getClickIdentifier() != null) {
|
if (clickControl.getClickIdentifier() != null) {
|
||||||
String typeStr = clickControl.getClickIdentifier().getSpeciesName(type);
|
String typeStr = clickControl.getClickIdentifier().getSpeciesName(type);
|
||||||
@ -3262,7 +3373,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
setKeyPosition(CornerLayoutContraint.LAST_LINE_START);
|
setKeyPosition(CornerLayoutContraint.LAST_LINE_START);
|
||||||
}
|
}
|
||||||
catch (NullPointerException e) {
|
catch (NullPointerException e) {
|
||||||
// e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3342,7 +3453,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (btDisplayParameters.VScale == BTDisplayParameters.DISPLAY_ICI) {
|
if (btDisplayParameters.VScale == BTDisplayParameters.DISPLAY_ICI) {
|
||||||
// if (btDisplayParameters.showUnassignedICI == false && click.getICI() < 0) return false;
|
// if (btDisplayParameters.showUnassignedICI == false && click.getICI() < 0) return false;
|
||||||
if (btDisplayParameters.showUnassignedICI == false && click.getSuperDetectionsCount() <= 0) return false;
|
if (btDisplayParameters.showUnassignedICI == false && click.getSuperDetectionsCount() <= 0) return false;
|
||||||
// otherwise may be ok, since will estimate all ici's on teh fly.
|
// otherwise may be ok, since will estimate all ici's on teh fly.
|
||||||
}
|
}
|
||||||
@ -3436,7 +3547,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
* to zero. However DO call these functions which were previously in
|
* to zero. However DO call these functions which were previously in
|
||||||
* reset();
|
* reset();
|
||||||
*/
|
*/
|
||||||
// reset();
|
// reset();
|
||||||
int channels = clickControl.clickParameters.getChannelBitmap();
|
int channels = clickControl.clickParameters.getChannelBitmap();
|
||||||
int[] channelGroups = clickControl.clickParameters.getChannelGroups();
|
int[] channelGroups = clickControl.clickParameters.getChannelGroups();
|
||||||
int nChannelGroups = GroupedSourcePanel.countChannelGroups(channels, channelGroups);
|
int nChannelGroups = GroupedSourcePanel.countChannelGroups(channels, channelGroups);
|
||||||
@ -3502,8 +3613,8 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
|||||||
this.btDisplayParameters = ((BTDisplayParameters) pamControlledUnitSettings
|
this.btDisplayParameters = ((BTDisplayParameters) pamControlledUnitSettings
|
||||||
.getSettings()).clone();
|
.getSettings()).clone();
|
||||||
// rangeScrollBar.setValue(btDisplayParameters.vScrollValue);
|
// rangeScrollBar.setValue(btDisplayParameters.vScrollValue);
|
||||||
// rangeSpinner.setSpinnerValue(btDisplayParameters.getTimeRange());
|
// rangeSpinner.setSpinnerValue(btDisplayParameters.getTimeRange());
|
||||||
// btPlot.createKey();
|
// btPlot.createKey();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1511,7 +1511,7 @@ public class ClickDetection extends PamDataUnit<PamDataUnit, PamDataUnit> implem
|
|||||||
* @param iCI the iCI to set
|
* @param iCI the iCI to set
|
||||||
*/
|
*/
|
||||||
public void setICI(double iCI) {
|
public void setICI(double iCI) {
|
||||||
ICI = iCI;
|
this.ICI = iCI;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setChannelGroupDetector(ChannelGroupDetector channelGroupDetector) {
|
protected void setChannelGroupDetector(ChannelGroupDetector channelGroupDetector) {
|
||||||
|
@ -140,6 +140,7 @@ public class PamScrollSlider extends AbstractPamScrollerAWT {
|
|||||||
valueMillis = Math.max(scrollerData.minimumMillis, Math.min(scrollerData.maximumMillis, valueMillis));
|
valueMillis = Math.max(scrollerData.minimumMillis, Math.min(scrollerData.maximumMillis, valueMillis));
|
||||||
int val = (int) ((valueMillis - scrollerData.minimumMillis) / scrollerData.getStepSizeMillis());
|
int val = (int) ((valueMillis - scrollerData.minimumMillis) / scrollerData.getStepSizeMillis());
|
||||||
if (val >= slider.getMinimum() && val <= slider.getMaximum()) {
|
if (val >= slider.getMinimum() && val <= slider.getMaximum()) {
|
||||||
|
// System.out.printf("Set slider val %d in range %d to %d\n", val, slider.getMinimum(), slider.getMaximum());
|
||||||
slider.setValue(val);
|
slider.setValue(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -699,6 +699,23 @@ public class ViewerScrollerManager extends AbstractScrollManager implements PamS
|
|||||||
if (aScroller == pamScroller) {
|
if (aScroller == pamScroller) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Can end up with some horrible feedback here if two
|
||||||
|
* coupled scrollers bring in rounding errors and start
|
||||||
|
* to oscillate each other.
|
||||||
|
*/
|
||||||
|
long currentVal = aScroller.getValueMillis();
|
||||||
|
long change = Math.abs(value-currentVal);
|
||||||
|
long range = aScroller.getMaximumMillis() - aScroller.getMinimumMillis();
|
||||||
|
if (range == 0) {
|
||||||
|
aScroller.setValueMillis(aScroller.getMinimumMillis());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
double fracChange = (double) change / (double) range;
|
||||||
|
if (fracChange <= .0001) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
aScroller.setValueMillis(value);
|
aScroller.setValueMillis(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user