mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-21 22:52:22 +00:00
Merge branch 'main' of https://github.com/douggillespie/PAMGuard into main
This commit is contained in:
commit
36da1bcbeb
@ -6,7 +6,7 @@
|
|||||||
<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">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<groupId>org.pamguard</groupId>
|
<groupId>org.pamguard</groupId>
|
||||||
<artifactId>Pamguard</artifactId>
|
<artifactId>Pamguard</artifactId>
|
||||||
<name>Pamguard Java12+</name>
|
<name>Pamguard Java12+</name>
|
||||||
<version>2.02.07ab</version>
|
<version>2.02.08</version>
|
||||||
<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>
|
||||||
<organization>
|
<organization>
|
||||||
|
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.07ab</version>
|
<version>2.02.08</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>
|
||||||
|
@ -861,7 +861,19 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D
|
|||||||
long[] allFileStarts = new long[allFiles.size()];
|
long[] allFileStarts = new long[allFiles.size()];
|
||||||
for (int i = 0; i < allFiles.size(); i++) {
|
for (int i = 0; i < allFiles.size(); i++) {
|
||||||
allFileStarts[i] = getFileStartTime(allFiles.get(i).getAbsoluteFile());
|
allFileStarts[i] = getFileStartTime(allFiles.get(i).getAbsoluteFile());
|
||||||
|
if (allFileStarts[i] < firstFileStart) {
|
||||||
|
// System.out.printf("Swap first file from %s to %s\n", firstFile.getName(), allFiles.get(i).getName());
|
||||||
|
firstFile = allFiles.get(i);
|
||||||
|
firstFileStart = allFileStarts[i];
|
||||||
|
}
|
||||||
|
if (allFileStarts[i] > lastFileEnd) {
|
||||||
|
// System.out.printf("Swap last file from %s to %s\n", lastFile.getName(), allFiles.get(i).getName());
|
||||||
|
lastFile = allFiles.get(i);
|
||||||
|
lastFileEnd = allFileStarts[i] + (long) (lastFile.getDurationInSeconds()*1000.);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
storeInfo.setFirstFileStart(firstFileStart); // just incase changed.
|
||||||
|
storeInfo.setLastFileEnd(lastFileEnd); // just incase changed
|
||||||
storeInfo.setFileStartTimes(allFileStarts);
|
storeInfo.setFileStartTimes(allFileStarts);
|
||||||
}
|
}
|
||||||
return storeInfo;
|
return storeInfo;
|
||||||
|
@ -11,6 +11,7 @@ import java.util.Vector;
|
|||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
|
import PamController.PamController;
|
||||||
import PamUtils.LatLong;
|
import PamUtils.LatLong;
|
||||||
import PamUtils.PamFileChooser;
|
import PamUtils.PamFileChooser;
|
||||||
import PamView.dialog.warn.WarnOnce;
|
import PamView.dialog.warn.WarnOnce;
|
||||||
@ -118,10 +119,19 @@ public class GebcoMapFile implements MapFileManager {
|
|||||||
int pointCount;
|
int pointCount;
|
||||||
int depth;
|
int depth;
|
||||||
MapContour mapContour;
|
MapContour mapContour;
|
||||||
|
boolean error = false;
|
||||||
try {
|
try {
|
||||||
|
int iLine = 0;
|
||||||
while((line = reader.readLine())!=null){
|
while((line = reader.readLine())!=null){
|
||||||
|
iLine++;
|
||||||
line = line.trim();
|
line = line.trim();
|
||||||
spaceIndex = line.indexOf(' ');
|
spaceIndex = line.indexOf(' ');
|
||||||
|
if (spaceIndex < 0) {
|
||||||
|
String msg = String.format("Error in map file at line %d \"%s\"", iLine, line);
|
||||||
|
WarnOnce.showNamedWarning("Gebco Map File Warning", PamController.getMainFrame(), gebcoFile.getName(), msg, WarnOnce.WARNING_MESSAGE);
|
||||||
|
error = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
num1 = line.substring(0,spaceIndex).trim();
|
num1 = line.substring(0,spaceIndex).trim();
|
||||||
num2 = line.substring(spaceIndex).trim();
|
num2 = line.substring(spaceIndex).trim();
|
||||||
depth = Integer.valueOf(num1);
|
depth = Integer.valueOf(num1);
|
||||||
@ -152,11 +162,22 @@ public class GebcoMapFile implements MapFileManager {
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException nex) {
|
catch (NumberFormatException nex) {
|
||||||
nex.printStackTrace();
|
nex.printStackTrace();
|
||||||
return false;
|
error = true;
|
||||||
|
}
|
||||||
|
catch (IndexOutOfBoundsException iex) {
|
||||||
|
iex.printStackTrace();
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
if (reader != null) {
|
||||||
|
try {
|
||||||
|
reader.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Collections.sort(mapContours);
|
Collections.sort(mapContours);
|
||||||
Collections.sort(availableContours);
|
Collections.sort(availableContours);
|
||||||
return true;
|
return !error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,6 +75,27 @@ public class InputStoreInfo {
|
|||||||
public long[] getFileStartTimes() {
|
public long[] getFileStartTimes() {
|
||||||
return fileStartTimes;
|
return fileStartTimes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param firstFileStart the firstFileStart to set
|
||||||
|
*/
|
||||||
|
public void setFirstFileStart(long firstFileStart) {
|
||||||
|
this.firstFileStart = firstFileStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param lastFileStart the lastFileStart to set
|
||||||
|
*/
|
||||||
|
public void setLastFileStart(long lastFileStart) {
|
||||||
|
this.lastFileStart = lastFileStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param lastFileEnd the lastFileEnd to set
|
||||||
|
*/
|
||||||
|
public void setLastFileEnd(long lastFileEnd) {
|
||||||
|
this.lastFileEnd = lastFileEnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -519,9 +519,15 @@ public class PamSettingManager {
|
|||||||
|
|
||||||
if (initializationComplete == false) {
|
if (initializationComplete == false) {
|
||||||
// if PAMGAURD hasn't finished loading, then don't save the settings
|
// if PAMGAURD hasn't finished loading, then don't save the settings
|
||||||
// or the file will get wrecked (bug tracker 2269579)
|
// or the file will get wrecked (bug tracker 2269579)
|
||||||
System.out.println("Settings have not yet loaded. Don't save file");
|
String msg = "There was an error loading settings from this configuration, so the configuration"
|
||||||
return false;
|
+ " may be incomplete. <p>Do you want to save anyway ? <p>"
|
||||||
|
+ " If you have added new modules, the answer is probably \"Yes\"";
|
||||||
|
int ans = WarnOnce.showWarning("Confuguration file warning", msg, WarnOnce.YES_NO_OPTION);
|
||||||
|
if (ans == WarnOnce.CANCEL_OPTION) {
|
||||||
|
System.out.println("Settings have not yet loaded. Don't save file");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
saveGlobalSettings();
|
saveGlobalSettings();
|
||||||
|
@ -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.07f";
|
static public final String version = "2.02.08";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release date
|
* Release date
|
||||||
*/
|
*/
|
||||||
static public final String date = "4 April 2023";
|
static public final String date = "9 May 2023";
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Release type - Beta or Core
|
// * Release type - Beta or Core
|
||||||
|
@ -3,9 +3,11 @@ package PamController.command;
|
|||||||
import PamController.PamController;
|
import PamController.PamController;
|
||||||
|
|
||||||
public class StopCommand extends ExtCommand {
|
public class StopCommand extends ExtCommand {
|
||||||
|
|
||||||
|
public static final String commandId = "stop";
|
||||||
|
|
||||||
public StopCommand() {
|
public StopCommand() {
|
||||||
super("stop", false);
|
super(commandId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,6 +24,7 @@ import javafx.scene.control.Alert.AlertType;
|
|||||||
public class WarnOnce implements PamSettings {
|
public class WarnOnce implements PamSettings {
|
||||||
|
|
||||||
public static final int OK_CANCEL_OPTION = JOptionPane.OK_CANCEL_OPTION;
|
public static final int OK_CANCEL_OPTION = JOptionPane.OK_CANCEL_OPTION;
|
||||||
|
public static final int YES_NO_OPTION = JOptionPane.YES_NO_OPTION;
|
||||||
public static final int WARNING_MESSAGE = JOptionPane.DEFAULT_OPTION;
|
public static final int WARNING_MESSAGE = JOptionPane.DEFAULT_OPTION;
|
||||||
public static final int OK_OPTION = JOptionPane.OK_OPTION;
|
public static final int OK_OPTION = JOptionPane.OK_OPTION;
|
||||||
public static final int CANCEL_OPTION = JOptionPane.CANCEL_OPTION;
|
public static final int CANCEL_OPTION = JOptionPane.CANCEL_OPTION;
|
||||||
|
@ -92,12 +92,17 @@ public class WarnOnceDialog extends PamDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if the message type is OK_OPTION, hide the cancel button
|
// if the message type is OK_OPTION, hide the cancel button
|
||||||
if (messageType == WarnOnce.OK_OPTION) {
|
if (messageType == WarnOnce.YES_NO_OPTION) {
|
||||||
|
getOkButton().setText("Yes");
|
||||||
|
getCancelButton().setText("No");
|
||||||
|
}
|
||||||
|
else if (messageType == WarnOnce.OK_OPTION) {
|
||||||
getCancelButton().setVisible(false);
|
getCancelButton().setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
getCancelButton().setVisible(true);
|
getCancelButton().setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// change the button text to custom text, if needed
|
// change the button text to custom text, if needed
|
||||||
if (okButtonText!=null) {
|
if (okButtonText!=null) {
|
||||||
getOkButton().setText(okButtonText);
|
getOkButton().setText(okButtonText);
|
||||||
|
@ -848,6 +848,30 @@ public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable {
|
|||||||
|
|
||||||
return unitsInInterval;
|
return unitsInInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do data exist which cover the given time range ?
|
||||||
|
* @param startMillis
|
||||||
|
* @param endMillis
|
||||||
|
* @return true if data exist covering that time range.
|
||||||
|
*/
|
||||||
|
public boolean hasDataRange(long startMillis, long endMillis) {
|
||||||
|
PamDataUnit first = null, last = null;
|
||||||
|
synchronized (synchronizationLock) {
|
||||||
|
first = getFirstUnit();
|
||||||
|
last = getLastUnit();
|
||||||
|
}
|
||||||
|
if (first == null || last == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (first.getTimeMilliseconds() > startMillis) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (last.getEndTimeInMilliseconds() < endMillis) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// recursive search for the correct unit
|
// recursive search for the correct unit
|
||||||
// private Tunit searchFirstUnitAfter(int i1, int i2, long timems) {
|
// private Tunit searchFirstUnitAfter(int i1, int i2, long timems) {
|
||||||
@ -1019,6 +1043,9 @@ public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable {
|
|||||||
* @return true if we need to reload offline data.
|
* @return true if we need to reload offline data.
|
||||||
*/
|
*/
|
||||||
public boolean needViewerDataLoad(OfflineDataLoadInfo offlineDataLoadInfo) {
|
public boolean needViewerDataLoad(OfflineDataLoadInfo offlineDataLoadInfo) {
|
||||||
|
if (pamDataUnits.size() == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (offlineDataLoadInfo.getStartMillis() == currentViewDataStart
|
if (offlineDataLoadInfo.getStartMillis() == currentViewDataStart
|
||||||
&& offlineDataLoadInfo.getEndMillis() == currentViewDataEnd) {
|
&& offlineDataLoadInfo.getEndMillis() == currentViewDataEnd) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -527,7 +527,10 @@ public class OfflineDataLoading<T extends PamDataUnit> {
|
|||||||
public void notifyOfflineObservers(T pamDataUnit) {
|
public void notifyOfflineObservers(T pamDataUnit) {
|
||||||
if (requestingObservers != null) {
|
if (requestingObservers != null) {
|
||||||
for (int i = 0; i < requestingObservers.size(); i++) {
|
for (int i = 0; i < requestingObservers.size(); i++) {
|
||||||
requestingObservers.get(i).addData(pamDataBlock, pamDataUnit);
|
PamObserver obs = requestingObservers.get(i);
|
||||||
|
if (obs != null) {
|
||||||
|
obs.addData(pamDataBlock, pamDataUnit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public class AnalogArraySensorDataUnit extends PamDataUnit implements Array.sens
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Double getFieldVal(int iVal) {
|
private Double getFieldVal(int iVal) {
|
||||||
if (sensorData == null || sensorData.length <= iVal) {
|
if (sensorData == null || sensorData.length <= iVal || iVal < 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
AnalogSensorData sensDat = sensorData[iVal];
|
AnalogSensorData sensDat = sensorData[iVal];
|
||||||
|
@ -225,7 +225,8 @@ public class AnalogDiagnosticsDisplay extends UserDisplayComponentAdapter implem
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (allItemData[rowIndex] != null) {
|
ItemAllData data = allItemData[rowIndex];
|
||||||
|
if (data != null) {
|
||||||
return allItemData[rowIndex].getIntValue();
|
return allItemData[rowIndex].getIntValue();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -4,6 +4,7 @@ import java.util.ListIterator;
|
|||||||
|
|
||||||
import PamguardMVC.PamDataBlock;
|
import PamguardMVC.PamDataBlock;
|
||||||
import PamguardMVC.PamDataUnit;
|
import PamguardMVC.PamDataUnit;
|
||||||
|
import PamguardMVC.dataOffline.OfflineDataLoadInfo;
|
||||||
import bearinglocaliser.BearingLocaliserControl;
|
import bearinglocaliser.BearingLocaliserControl;
|
||||||
import bearinglocaliser.BearingProcess;
|
import bearinglocaliser.BearingProcess;
|
||||||
import dataMap.OfflineDataMapPoint;
|
import dataMap.OfflineDataMapPoint;
|
||||||
@ -28,6 +29,9 @@ public class BLOfflineTask extends OfflineTask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
if (bearingLocaliserControl == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return bearingLocaliserControl.getUnitName();
|
return bearingLocaliserControl.getUnitName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,15 +71,21 @@ public class BLOfflineTask extends OfflineTask {
|
|||||||
if (rawOrFFTBlock == null) {
|
if (rawOrFFTBlock == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ListIterator it = rawOrFFTBlock.getListIterator(dataUnit.getTimeMilliseconds(), rawOrFFTBlock.getChannelMap(),
|
long dataStart = dataUnit.getTimeMilliseconds();
|
||||||
PamDataBlock.MATCH_BEFORE, PamDataBlock.POSITION_BEFORE);
|
long dataEnd = dataUnit.getEndTimeInMilliseconds();
|
||||||
if (it == null || it.hasNext() == false) {
|
boolean haveData = rawOrFFTBlock.hasDataRange(dataStart, dataEnd);
|
||||||
long dataStart = dataUnit.getTimeMilliseconds();
|
if (haveData == false) {
|
||||||
long dataEnd = dataUnit.getEndTimeInMilliseconds();
|
// ListIterator it = rawOrFFTBlock.getListIterator(dataUnit.getTimeMilliseconds(), rawOrFFTBlock.getChannelMap(),
|
||||||
if (dataEnd-dataStart <= 0) {
|
// PamDataBlock.MATCH_BEFORE, PamDataBlock.POSITION_BEFORE);
|
||||||
dataEnd = dataStart + 1000;
|
// if (it == null || it.hasNext() == false) {
|
||||||
}
|
// if (dataEnd-dataStart <= 0) {
|
||||||
rawOrFFTBlock.loadViewerData(dataStart, dataEnd, null);
|
// dataEnd = dataStart + 1000;
|
||||||
|
// }
|
||||||
|
OfflineDataLoadInfo offlineLoadInfo = new OfflineDataLoadInfo(dataStart, dataEnd);
|
||||||
|
offlineLoadInfo.setLoadKeepLayers(2);
|
||||||
|
rawOrFFTBlock.getOfflineData(offlineLoadInfo);
|
||||||
|
// System.out.printf("Loaded some FFT data I hope\n");
|
||||||
|
// rawOrFFTBlock.loadViewerData(dataStart, dataEnd, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -391,6 +391,9 @@ public class ScrollingDataPanel extends PamBorderPanel {
|
|||||||
public void scrollToData(PamDataBlock dataBlock) {
|
public void scrollToData(PamDataBlock dataBlock) {
|
||||||
long startTime = dataBlock.getCurrentViewDataStart();
|
long startTime = dataBlock.getCurrentViewDataStart();
|
||||||
int val = (int) ((startTime - getScreenStartMillis())/1000 - getScreenSeconds()/5) ;
|
int val = (int) ((startTime - getScreenStartMillis())/1000 - getScreenSeconds()/5) ;
|
||||||
|
val += hScrollBar.getValue();
|
||||||
|
// System.out.printf("Scroll bar %d to %d set %d\n", hScrollBar.getMinimum(),
|
||||||
|
// hScrollBar.getMaximum(), val);
|
||||||
hScrollBar.setValue(val);
|
hScrollBar.setValue(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
|
||||||
|
import PamController.PamController;
|
||||||
import PamController.SettingsNameProvider;
|
import PamController.SettingsNameProvider;
|
||||||
import PamDetection.RawDataUnit;
|
import PamDetection.RawDataUnit;
|
||||||
import PamUtils.PamUtils;
|
import PamUtils.PamUtils;
|
||||||
@ -143,6 +144,11 @@ public class FFTDataOrganiser {
|
|||||||
if (rawOrFFTData == null) {
|
if (rawOrFFTData == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (PamController.getInstance().getRunMode() == PamController.RUN_PAMVIEW) {
|
||||||
|
// checkOfflineDataLoad(rawOrFFTData, pamDataUnit.getTimeMilliseconds(), pamDataUnit.getEndTimeInMilliseconds());
|
||||||
|
// }
|
||||||
|
|
||||||
switch (inputType) {
|
switch (inputType) {
|
||||||
case FFTData:
|
case FFTData:
|
||||||
return createFromFFTData(pamDataUnit, sampleRate, channelMap);
|
return createFromFFTData(pamDataUnit, sampleRate, channelMap);
|
||||||
@ -157,6 +163,52 @@ public class FFTDataOrganiser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when running offline to try to ensure required raw or fft data are in memory.
|
||||||
|
* @param sourceData
|
||||||
|
* @param timeMilliseconds
|
||||||
|
* @param endTimeInMilliseconds
|
||||||
|
*/
|
||||||
|
private boolean checkOfflineDataLoad(PamDataBlock sourceData, long startMilliseconds, long endMilliseconds) {
|
||||||
|
if (sourceData == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
boolean needData = needOfflineDataLoad(sourceData, startMilliseconds, endMilliseconds);
|
||||||
|
if (needData) {
|
||||||
|
sourceData.loadViewerData(startMilliseconds, endMilliseconds, null);
|
||||||
|
}
|
||||||
|
return needOfflineDataLoad(sourceData, startMilliseconds, endMilliseconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test to see if we still need to load offline data.
|
||||||
|
* @param sourceData
|
||||||
|
* @param startMilliseconds
|
||||||
|
* @param endMilliseconds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean needOfflineDataLoad(PamDataBlock sourceData, long startMilliseconds, long endMilliseconds) {
|
||||||
|
if (sourceData == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
synchronized (sourceData.getSynchLock()) {
|
||||||
|
PamDataUnit first = sourceData.getFirstUnit();
|
||||||
|
PamDataUnit last = sourceData.getLastUnit();
|
||||||
|
if (first == null || last == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (first.getTimeMilliseconds() > startMilliseconds) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (last.getEndTimeInMilliseconds() < endMilliseconds) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get FFT data units matching in time from the source
|
* Get FFT data units matching in time from the source
|
||||||
* @param pamDataUnit data unit we need FFT data for (can be anything, just needs it's times)
|
* @param pamDataUnit data unit we need FFT data for (can be anything, just needs it's times)
|
||||||
|
@ -3,6 +3,8 @@ package fileOfflineData;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileFilter;
|
import java.io.FileFilter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a list of files with the given file filter.
|
* Make a list of files with the given file filter.
|
||||||
@ -29,6 +31,21 @@ public class OfflineFileList {
|
|||||||
addFiles(current);
|
addFiles(current);
|
||||||
return files.size();
|
return files.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sortByFileName() {
|
||||||
|
if (files == null || files.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Collections.sort(files, new Comparator<File>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(File file1, File file2) {
|
||||||
|
String n1 = file1.getName();
|
||||||
|
String n2 = file2.getName();
|
||||||
|
return n1.compareTo(n2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void addFiles(File current) {
|
private void addFiles(File current) {
|
||||||
if (current.exists() == false) {
|
if (current.exists() == false) {
|
||||||
|
@ -140,7 +140,7 @@ public class BBED549 {
|
|||||||
public static double hexToEngineering(int range, int data) {
|
public static double hexToEngineering(int range, int data) {
|
||||||
/**
|
/**
|
||||||
* convert integer data to engineering units.
|
* convert integer data to engineering units.
|
||||||
* @param range range on device, asumed the same for all channels.
|
* @param range range on device, assumed the same for all channels.
|
||||||
* @param data data array
|
* @param data data array
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -127,7 +127,8 @@ public class NIFilePlayback implements FilePlaybackDevice, PamSettings {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean preparePlayback(PlaybackParameters playbackParameters) {
|
public boolean preparePlayback(PlaybackParameters playbackParameters) {
|
||||||
if (niDeviceLUT == null || niDeviceLUT.length <= playbackParameters.deviceNumber) {
|
if (niDeviceLUT == null || niDeviceLUT.length <= playbackParameters.deviceNumber
|
||||||
|
|| playbackParameters.deviceNumber < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int bn = niDeviceLUT[playbackParameters.deviceNumber];
|
int bn = niDeviceLUT[playbackParameters.deviceNumber];
|
||||||
|
Loading…
Reference in New Issue
Block a user