mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-22 07:02:29 +00:00
Click event output
This commit is contained in:
parent
5fe0927c10
commit
4d294b56a8
@ -259,6 +259,7 @@ public class StreamerDialog extends PamDialog {
|
||||
// }
|
||||
singleInstance.currentArray = currentArray;
|
||||
singleInstance.defaultStreamer = streamer;//.clone();
|
||||
// singleInstance.st
|
||||
singleInstance.setParams();
|
||||
singleInstance.setVisible(true);
|
||||
return singleInstance.defaultStreamer;
|
||||
@ -549,6 +550,17 @@ public class StreamerDialog extends PamDialog {
|
||||
pack();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
OriginSettings os = defaultStreamer.getOriginSettings(currentOriginMethod.getClass());
|
||||
if (os != null) {
|
||||
currentOriginMethod.setOriginSettings(os);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
// will throw if it tries to set the wrong type of settings.
|
||||
}
|
||||
|
||||
enableControls();
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@ package clickDetector;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import pamScrollSystem.ViewLoadObserver;
|
||||
import tethys.TethysControl;
|
||||
import tethys.pamdata.TethysDataProvider;
|
||||
import tethys.species.DataBlockSpeciesManager;
|
||||
//import staticLocaliser.StaticLocaliserControl;
|
||||
//import staticLocaliser.StaticLocaliserProvider;
|
||||
@ -14,6 +16,7 @@ import binaryFileStorage.BinaryStore;
|
||||
import clickDetector.ClickClassifiers.ClickBlockSpeciesManager;
|
||||
import clickDetector.dataSelector.ClickDataSelectCreator;
|
||||
import clickDetector.offlineFuncs.OfflineClickLogging;
|
||||
import clickDetector.tethys.ClickTethysDataProvider;
|
||||
import clickDetector.toad.ClickTOADCalculator;
|
||||
import dataMap.OfflineDataMap;
|
||||
import fftManager.fftorganiser.FFTDataOrganiser;
|
||||
@ -26,6 +29,8 @@ import PamUtils.PamUtils;
|
||||
import PamView.GroupedDataSource;
|
||||
import PamView.GroupedSourceParameters;
|
||||
import PamguardMVC.AcousticDataBlock;
|
||||
import PamguardMVC.DataAutomation;
|
||||
import PamguardMVC.DataAutomationInfo;
|
||||
import PamguardMVC.FFTDataHolderBlock;
|
||||
import PamguardMVC.PamDataBlock;
|
||||
import PamguardMVC.PamDataUnit;
|
||||
@ -69,6 +74,8 @@ public class ClickDataBlock extends AcousticDataBlock<ClickDetection> implement
|
||||
|
||||
private ClickTOADCalculator clickTOADCalculator;
|
||||
|
||||
private ClickTethysDataProvider clickTethysDataProvider;
|
||||
|
||||
/**
|
||||
* Click detector loading has to be a bit different to normal - first
|
||||
* data are loaded from the binary store, then a subset of these data
|
||||
@ -316,5 +323,18 @@ public class ClickDataBlock extends AcousticDataBlock<ClickDetection> implement
|
||||
return clickBlockSpeciesManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TethysDataProvider getTethysDataProvider(TethysControl tethysControl) {
|
||||
if (clickTethysDataProvider == null) {
|
||||
clickTethysDataProvider = new ClickTethysDataProvider(tethysControl, this);
|
||||
}
|
||||
return clickTethysDataProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataAutomationInfo getDataAutomationInfo() {
|
||||
return new DataAutomationInfo(DataAutomation.AUTOMATIC);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,10 @@ import PamController.PamViewParameters;
|
||||
import PamUtils.PamCalendar;
|
||||
import PamView.symbol.StandardSymbolManager;
|
||||
import pamScrollSystem.ViewLoadObserver;
|
||||
import tethys.TethysControl;
|
||||
import tethys.pamdata.TethysDataProvider;
|
||||
import tethys.species.DataBlockSpeciesManager;
|
||||
import clickDetector.ClickDetection;
|
||||
//import staticLocaliser.StaticLocaliserControl;
|
||||
//import staticLocaliser.StaticLocaliserProvider;
|
||||
//import staticLocaliser.panels.AbstractLocaliserControl;
|
||||
@ -23,7 +27,12 @@ import pamScrollSystem.ViewLoadObserver;
|
||||
import clickDetector.ClickDetector;
|
||||
import clickDetector.ClickTrainDetection;
|
||||
import clickDetector.dataSelector.ClickTrainDataSelectorCreator;
|
||||
import clickDetector.tethys.ClickEventSpeciesManager;
|
||||
import clickDetector.tethys.ClickEventTethysDataProvider;
|
||||
import clickDetector.tethys.ClickTethysDataProvider;
|
||||
import dataMap.OfflineDataMap;
|
||||
import PamguardMVC.DataAutomation;
|
||||
import PamguardMVC.DataAutomationInfo;
|
||||
import PamguardMVC.PamDataBlock;
|
||||
import PamguardMVC.PamDataUnit;
|
||||
import PamguardMVC.dataOffline.OfflineDataLoadInfo;
|
||||
@ -49,6 +58,8 @@ public class OfflineEventDataBlock extends SuperDetDataBlock<OfflineEventDataUni
|
||||
|
||||
private ClickDetector clickDetector;
|
||||
private ClickTrainDataSelectorCreator clickTrainDataSelectorCreator;
|
||||
private ClickEventSpeciesManager eventSpeciesManager;
|
||||
private ClickEventTethysDataProvider eventTethysDataProvider;
|
||||
|
||||
public OfflineEventDataBlock(String dataName,
|
||||
ClickDetector parentProcess, int channelMap) {
|
||||
@ -284,17 +295,28 @@ public class OfflineEventDataBlock extends SuperDetDataBlock<OfflineEventDataUni
|
||||
return (clickDetector.getClickDataBlock() == subDataBlock || clickDetector.getTrackedClicks() == subDataBlock);
|
||||
}
|
||||
|
||||
// int nName = 0;
|
||||
// @Override
|
||||
// public String getDataName() {
|
||||
// // TODO Auto-generated method stub
|
||||
// System.out.println("Call into getDataName " + ++nName);
|
||||
// if (nName == 58) {
|
||||
//
|
||||
// System.out.println("Call into getDataName " + ++nName);
|
||||
// }
|
||||
// return super.getDataName();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public DataBlockSpeciesManager<OfflineEventDataUnit> getDatablockSpeciesManager() {
|
||||
if (eventSpeciesManager == null) {
|
||||
eventSpeciesManager = new ClickEventSpeciesManager(clickDetector, this);
|
||||
}
|
||||
return eventSpeciesManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TethysDataProvider getTethysDataProvider(TethysControl tethysControl) {
|
||||
if (eventTethysDataProvider == null) {
|
||||
eventTethysDataProvider = new ClickEventTethysDataProvider(tethysControl, this);
|
||||
}
|
||||
return eventTethysDataProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataAutomationInfo getDataAutomationInfo() {
|
||||
return new DataAutomationInfo(DataAutomation.MANUALANDAUTOMATIC);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
53
src/clickDetector/tethys/ClickEventSpeciesManager.java
Normal file
53
src/clickDetector/tethys/ClickEventSpeciesManager.java
Normal file
@ -0,0 +1,53 @@
|
||||
package clickDetector.tethys;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import PamguardMVC.PamDataUnit;
|
||||
import clickDetector.ClickControl;
|
||||
import clickDetector.ClickDetector;
|
||||
import clickDetector.offlineFuncs.ClicksOffline;
|
||||
import clickDetector.offlineFuncs.OfflineEventDataBlock;
|
||||
import clickDetector.offlineFuncs.OfflineEventDataUnit;
|
||||
import generalDatabase.lookupTables.LookUpTables;
|
||||
import generalDatabase.lookupTables.LookupItem;
|
||||
import generalDatabase.lookupTables.LookupList;
|
||||
import tethys.species.DataBlockSpeciesCodes;
|
||||
import tethys.species.DataBlockSpeciesManager;
|
||||
|
||||
public class ClickEventSpeciesManager extends DataBlockSpeciesManager {
|
||||
|
||||
private OfflineEventDataBlock eventDataBlock;
|
||||
private ClickDetector clickDetector;
|
||||
private ClickControl clickControl;
|
||||
private ClicksOffline clicksOffline;
|
||||
|
||||
public ClickEventSpeciesManager(ClickDetector clickDetector, OfflineEventDataBlock eventDataBlock) {
|
||||
super(eventDataBlock);
|
||||
this.clickDetector = clickDetector;
|
||||
this.eventDataBlock = eventDataBlock;
|
||||
clickControl = clickDetector.getClickControl();
|
||||
clicksOffline = clickControl.getClicksOffline();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataBlockSpeciesCodes getSpeciesCodes() {
|
||||
LookupList lutList = LookUpTables.getLookUpTables().getLookupList(ClicksOffline.ClickTypeLookupName);
|
||||
if (lutList == null || lutList.getLutList().size() == 0) {
|
||||
return new DataBlockSpeciesCodes("Unknown");
|
||||
}
|
||||
Vector<LookupItem> spList = lutList.getLutList();
|
||||
String[] spNames = new String[spList.size()];
|
||||
int i = 0;
|
||||
for (LookupItem lItem : spList) {
|
||||
spNames[i++] = lItem.getCode();
|
||||
}
|
||||
return new DataBlockSpeciesCodes("Unknown", spNames);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSpeciesCode(PamDataUnit dataUnit) {
|
||||
OfflineEventDataUnit eventDataUnit = (OfflineEventDataUnit) dataUnit;
|
||||
return eventDataUnit.getEventType();
|
||||
}
|
||||
|
||||
}
|
72
src/clickDetector/tethys/ClickEventTethysDataProvider.java
Normal file
72
src/clickDetector/tethys/ClickEventTethysDataProvider.java
Normal file
@ -0,0 +1,72 @@
|
||||
package clickDetector.tethys;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import PamguardMVC.PamDataUnit;
|
||||
import clickDetector.offlineFuncs.OfflineEventDataBlock;
|
||||
import clickDetector.offlineFuncs.OfflineEventDataUnit;
|
||||
import nilus.Detection;
|
||||
import nilus.GranularityEnumType;
|
||||
import nilus.Detection.Parameters;
|
||||
import nilus.Detection.Parameters.UserDefined;
|
||||
import tethys.TethysControl;
|
||||
import tethys.output.StreamExportParams;
|
||||
import tethys.output.TethysExportParams;
|
||||
import tethys.pamdata.AutoTethysProvider;
|
||||
import tethys.swing.export.ExportWizardCard;
|
||||
import tethys.swing.export.GranularityCard;
|
||||
|
||||
public class ClickEventTethysDataProvider extends AutoTethysProvider {
|
||||
|
||||
private OfflineEventDataBlock eventDataBlock;
|
||||
|
||||
public ClickEventTethysDataProvider(TethysControl tethysControl, OfflineEventDataBlock eventDataBlock) {
|
||||
super(tethysControl, eventDataBlock);
|
||||
this.eventDataBlock = eventDataBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GranularityEnumType[] getAllowedGranularities() {
|
||||
GranularityEnumType[] allowed = {GranularityEnumType.GROUPED};
|
||||
return allowed;
|
||||
}
|
||||
@Override
|
||||
public Detection createDetection(PamDataUnit dataUnit, TethysExportParams tethysExportParams,
|
||||
StreamExportParams streamExportParams) {
|
||||
Detection detection = super.createDetection(dataUnit, tethysExportParams, streamExportParams);
|
||||
if (detection == null) {
|
||||
return null;
|
||||
}
|
||||
OfflineEventDataUnit eventDataUnit = (OfflineEventDataUnit) dataUnit;
|
||||
detection.setCount(BigInteger.valueOf(eventDataUnit.getSubDetectionsCount()));
|
||||
String comment = eventDataUnit.getComment();
|
||||
if (comment != null && comment.length() > 0) {
|
||||
detection.setComment(comment);
|
||||
}
|
||||
Parameters params = detection.getParameters();
|
||||
addUserNumber(params, "MinNumber", eventDataUnit.getMinNumber());
|
||||
addUserNumber(params, "BestNumber", eventDataUnit.getBestNumber());
|
||||
addUserNumber(params, "MaxNumber", eventDataUnit.getMaxNumber());
|
||||
|
||||
|
||||
return detection;
|
||||
}
|
||||
|
||||
private void addUserNumber(Parameters params, String numName, Short number) {
|
||||
if (number == null) {
|
||||
return;
|
||||
}
|
||||
addUserDefined(params, numName, number.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean wantExportDialogCard(ExportWizardCard wizPanel) {
|
||||
if (wizPanel.getClass() == GranularityCard.class) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
22
src/clickDetector/tethys/ClickTethysDataProvider.java
Normal file
22
src/clickDetector/tethys/ClickTethysDataProvider.java
Normal file
@ -0,0 +1,22 @@
|
||||
package clickDetector.tethys;
|
||||
|
||||
import clickDetector.ClickDataBlock;
|
||||
import nilus.GranularityEnumType;
|
||||
import tethys.TethysControl;
|
||||
import tethys.pamdata.AutoTethysProvider;
|
||||
|
||||
public class ClickTethysDataProvider extends AutoTethysProvider {
|
||||
|
||||
private ClickDataBlock clickDataBlock;
|
||||
|
||||
public ClickTethysDataProvider(TethysControl tethysControl, ClickDataBlock clickDataBlock) {
|
||||
super(tethysControl, clickDataBlock);
|
||||
this.clickDataBlock = clickDataBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GranularityEnumType[] getAllowedGranularities() {
|
||||
return GranularityEnumType.values(); // everything !
|
||||
}
|
||||
|
||||
}
|
@ -387,6 +387,7 @@ public class SQLTypes {
|
||||
return timestamp.getTime() + tz.getOffset(timestamp.getTime());
|
||||
}
|
||||
else if (timeValue instanceof String) {
|
||||
timeValue = ((String) timeValue).replace("'", "");
|
||||
return PamCalendar.millisFromDateString((String) timeValue, false);
|
||||
}
|
||||
if (timeValue instanceof Long) {
|
||||
|
@ -2,6 +2,7 @@ package tethys.deployment;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
@ -302,7 +303,7 @@ public class DeploymentHandler implements TethysStateObserver {
|
||||
// do the lot, whatever ...
|
||||
selectedDeployments = getDeploymentOverview().getRecordingPeriods();
|
||||
int freeId = getTethysControl().getDeploymentHandler().getFirstFreeDeploymentId();
|
||||
RecordingPeriod onePeriod = new RecordingPeriod(selectedDeployments.get(freeId).getRecordStart(),
|
||||
RecordingPeriod onePeriod = new RecordingPeriod(selectedDeployments.get(0).getRecordStart(),
|
||||
selectedDeployments.get(selectedDeployments.size()-1).getRecordStop());
|
||||
Deployment deployment = createDeploymentDocument(freeId, onePeriod);
|
||||
// fill in a few things from here
|
||||
@ -487,7 +488,15 @@ public class DeploymentHandler implements TethysStateObserver {
|
||||
ons[i] = tempPeriods.get(i).getDuration()/1000.;
|
||||
gaps[i] = (tempPeriods.get(i+1).getRecordStart()-tempPeriods.get(i).getRecordStop())/1000.;
|
||||
}
|
||||
// now look at how consistent those values are
|
||||
/* now look at how consistent those values are
|
||||
* But some data gets messed by small gaps, so want to
|
||||
* remove outliers and concentrate on say 80% of the data.
|
||||
*/
|
||||
ons = getDistributionCentre(ons, 80);
|
||||
gaps = getDistributionCentre(gaps, 80);
|
||||
Arrays.sort(gaps);
|
||||
|
||||
|
||||
STD std = new STD();
|
||||
double onsMean = std.getMean(ons);
|
||||
double onsSTD = std.getSTD(ons);
|
||||
@ -498,6 +507,27 @@ public class DeploymentHandler implements TethysStateObserver {
|
||||
return cycleInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the central part of a distribution without any outliers so
|
||||
* that we can get a better assessment of duty cycle.
|
||||
* @param data unsorted distribution data.
|
||||
* @param percent percentage to include (half this removed from top and bottom)
|
||||
* @return
|
||||
*/
|
||||
private double[] getDistributionCentre(double[] data, double percent) {
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
Arrays.sort(data);
|
||||
int nRem = (int) Math.round(data.length * (100-percent)/200);
|
||||
int newLen = data.length-nRem*2;
|
||||
double[] subdata = Arrays.copyOfRange(data, nRem, data.length-2*nRem);
|
||||
if (subdata.length < 2) {
|
||||
return data;
|
||||
}
|
||||
return subdata;
|
||||
}
|
||||
|
||||
private ArrayList<RecordingPeriod> extractTimesFromStatus(ArrayList<DaqStatusDataUnit> allStatusData) {
|
||||
ArrayList<RecordingPeriod> tempPeriods = new ArrayList<>();
|
||||
long dataStart = Long.MAX_VALUE;
|
||||
|
@ -14,6 +14,8 @@ import PamguardMVC.PamDataBlock;
|
||||
import PamguardMVC.PamDataUnit;
|
||||
import PamguardMVC.PamProcess;
|
||||
import PamguardMVC.dataSelector.DataSelector;
|
||||
import PamguardMVC.superdet.SuperDetDataBlock;
|
||||
import PamguardMVC.superdet.SuperDetDataBlock.ViewerLoadPolicy;
|
||||
import dataMap.OfflineDataMap;
|
||||
import dataMap.OfflineDataMapPoint;
|
||||
import nilus.AlgorithmType;
|
||||
@ -25,6 +27,7 @@ import nilus.DetectionEffort;
|
||||
import nilus.DetectionEffortKind;
|
||||
import nilus.DetectionGroup;
|
||||
import nilus.Detections;
|
||||
import nilus.GranularityEnumType;
|
||||
import nilus.Helper;
|
||||
import tethys.TethysControl;
|
||||
import tethys.TethysTimeFuncs;
|
||||
@ -337,12 +340,42 @@ public class DetectionsHandler {
|
||||
* @param exportWorkerCard
|
||||
*/
|
||||
public void startExportThread(PamDataBlock pamDataBlock, StreamExportParams streamExportParams, DetectionExportObserver exportObserver) {
|
||||
checkGranularity(pamDataBlock, streamExportParams);
|
||||
tethysControl.getTethysExportParams().setStreamParams(pamDataBlock, streamExportParams);
|
||||
activeExport = true;
|
||||
exportWorker = new ExportWorker(pamDataBlock, streamExportParams, exportObserver);
|
||||
exportWorker.execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fudge because some outputs don't show the granularity card, but need to
|
||||
* make sure that it's set to the correct only option ..
|
||||
* @param pamDataBlock
|
||||
* @param streamExportParams
|
||||
*/
|
||||
private void checkGranularity(PamDataBlock pamDataBlock, StreamExportParams streamExportParams) {
|
||||
if (streamExportParams == null) {
|
||||
return;
|
||||
}
|
||||
TethysDataProvider tethysProvider = pamDataBlock.getTethysDataProvider(tethysControl);
|
||||
if (tethysProvider == null) return;
|
||||
GranularityEnumType[] allowed = tethysProvider.getAllowedGranularities();
|
||||
if (allowed == null || allowed.length == 0) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < allowed.length; i++) {
|
||||
if (allowed[i] == streamExportParams.granularity) {
|
||||
return; // matches allowed value, so OK
|
||||
}
|
||||
}
|
||||
/*
|
||||
* if we get here, it's all wrong, so set to the first allowed value
|
||||
* which will be the only one if the card wasn't shown
|
||||
*/
|
||||
streamExportParams.granularity = allowed[0];
|
||||
}
|
||||
|
||||
|
||||
public void cancelExport() {
|
||||
activeExport = false;
|
||||
}
|
||||
@ -382,6 +415,14 @@ public class DetectionsHandler {
|
||||
int exportCount = 0;
|
||||
long lastUnitTime = 0;
|
||||
DetectionExportProgress prog;
|
||||
ViewerLoadPolicy viewerLoadPolicy = ViewerLoadPolicy.LOAD_UTCNORMAL;
|
||||
if (dataBlock instanceof SuperDetDataBlock) {
|
||||
SuperDetDataBlock superDataBlock = (SuperDetDataBlock) dataBlock;
|
||||
viewerLoadPolicy = superDataBlock.getViewerLoadPolicy();
|
||||
}
|
||||
if (viewerLoadPolicy == null) {
|
||||
viewerLoadPolicy = ViewerLoadPolicy.LOAD_UTCNORMAL;
|
||||
}
|
||||
GranularityHandler granularityHandler = GranularityHandler.getHandler(streamExportParams.granularity, tethysControl, dataBlock, exportParams, streamExportParams);
|
||||
for (PDeployment deployment : deployments) {
|
||||
int documentCount = 0;
|
||||
@ -392,6 +433,7 @@ public class DetectionsHandler {
|
||||
// export everything in that deployment.
|
||||
// need to loop through all map points in this interval.
|
||||
List<OfflineDataMapPoint> mapPoints = dataMap.getMapPoints();
|
||||
|
||||
for (OfflineDataMapPoint mapPoint : mapPoints) {
|
||||
if (!activeExport) {
|
||||
prog = new DetectionExportProgress(deployment, null,
|
||||
@ -418,6 +460,12 @@ public class DetectionsHandler {
|
||||
if (dets != null) {
|
||||
exportCount+=dets.length;
|
||||
documentCount+=dets.length;
|
||||
|
||||
if (exportCount % 100 == 0) {
|
||||
prog = new DetectionExportProgress(deployment, null,
|
||||
lastUnitTime, totalCount, exportCount, skipCount, DetectionExportProgress.STATE_COUNTING);
|
||||
exportObserver.update(prog);
|
||||
}
|
||||
}
|
||||
// Detection det = dataProvider.createDetection(dataUnit, exportParams, streamExportParams);
|
||||
// exportCount++;
|
||||
@ -430,6 +478,10 @@ public class DetectionsHandler {
|
||||
lastUnitTime, totalCount, exportCount, skipCount, DetectionExportProgress.STATE_COUNTING);
|
||||
exportObserver.update(prog);
|
||||
|
||||
if (viewerLoadPolicy == ViewerLoadPolicy.LOAD_ALWAYS_EVERYTHING) {
|
||||
break;
|
||||
}
|
||||
|
||||
// if (documentCount > 500000 && mapPoint != dataMap.getLastMapPoint()) {
|
||||
// prog = new DetectionExportProgress(deployment, currentDetections,
|
||||
// lastUnitTime, totalCount, exportCount, skipCount, DetectionExportProgress.STATE_WRITING);
|
||||
@ -480,11 +532,19 @@ public class DetectionsHandler {
|
||||
int exportCount = 0;
|
||||
long lastUnitTime = 0;
|
||||
DetectionExportProgress prog;
|
||||
ViewerLoadPolicy viewerLoadPolicy = ViewerLoadPolicy.LOAD_UTCNORMAL;
|
||||
if (dataBlock instanceof SuperDetDataBlock) {
|
||||
SuperDetDataBlock superDataBlock = (SuperDetDataBlock) dataBlock;
|
||||
viewerLoadPolicy = superDataBlock.getViewerLoadPolicy();
|
||||
}
|
||||
if (viewerLoadPolicy == null) {
|
||||
viewerLoadPolicy = ViewerLoadPolicy.LOAD_UTCNORMAL;
|
||||
}
|
||||
GranularityHandler granularityHandler = GranularityHandler.getHandler(streamExportParams.granularity, tethysControl, dataBlock, exportParams, streamExportParams);
|
||||
for (PDeployment deployment : deployments) {
|
||||
int documentCount = 0;
|
||||
prog = new DetectionExportProgress(deployment, null,
|
||||
lastUnitTime, totalCount, exportCount, skipCount, DetectionExportProgress.STATE_GATHERING);
|
||||
lastUnitTime, totalCount, exportCount, skipCount, DetectionExportProgress.STATE_COUNTING);
|
||||
exportObserver.update(prog);
|
||||
granularityHandler.prepare(deployment.getAudioStart());
|
||||
// export everything in that deployment.
|
||||
@ -523,10 +583,11 @@ public class DetectionsHandler {
|
||||
onEffort.getDetection().add(dets[dd]);
|
||||
}
|
||||
}
|
||||
// Detection det = dataProvider.createDetection(dataUnit, exportParams, streamExportParams);
|
||||
// exportCount++;
|
||||
// documentCount++;
|
||||
// onEffort.getDetection().add(det);
|
||||
if (exportCount % 100 == 0) {
|
||||
prog = new DetectionExportProgress(deployment, null,
|
||||
lastUnitTime, totalCount, exportCount, skipCount, DetectionExportProgress.STATE_GATHERING);
|
||||
exportObserver.update(prog);
|
||||
}
|
||||
lastUnitTime = dataUnit.getTimeMilliseconds();
|
||||
}
|
||||
|
||||
@ -546,6 +607,10 @@ public class DetectionsHandler {
|
||||
}
|
||||
currentDetections = null;
|
||||
}
|
||||
|
||||
if (viewerLoadPolicy == ViewerLoadPolicy.LOAD_ALWAYS_EVERYTHING) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,30 +7,26 @@ import tethys.TethysControl;
|
||||
import tethys.output.StreamExportParams;
|
||||
import tethys.output.TethysExportParams;
|
||||
|
||||
public class GroupedGranularityHandler extends GranularityHandler {
|
||||
public class GroupedGranularityHandler extends CallGranularityHandler {
|
||||
|
||||
public GroupedGranularityHandler(TethysControl tethysControl, PamDataBlock dataBlock,
|
||||
TethysExportParams tethysExportParams, StreamExportParams streamExportParams) {
|
||||
super(tethysControl, dataBlock, tethysExportParams, streamExportParams);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare(long timeMillis) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
super.prepare(timeMillis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Detection[] addDataUnit(PamDataUnit dataUnit) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return super.addDataUnit(dataUnit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Detection[] cleanup(long timeMillis) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return super.cleanup(timeMillis);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public class TethysExportParams implements Serializable, Cloneable{
|
||||
public static final long serialVersionUID = 1L;
|
||||
|
||||
/*
|
||||
* Need to add lots of other parameters here, such as the connection detils
|
||||
* Need to add lots of other parameters here, such as the connection details
|
||||
* for the tethys database.
|
||||
*/
|
||||
public String serverName = "http://localhost";
|
||||
|
@ -63,8 +63,8 @@ public class TethysExportDialog extends PamDialog {
|
||||
setResizable(true);
|
||||
|
||||
}
|
||||
|
||||
public static TethysExportParams showDialog(Window parentFrame, TethysControl tethysControl) {
|
||||
@Deprecated
|
||||
private static TethysExportParams showDialog(Window parentFrame, TethysControl tethysControl) {
|
||||
if (singleInstance == null || singleInstance.getOwner() != parentFrame || singleInstance.tethysControl != tethysControl) {
|
||||
singleInstance = new TethysExportDialog(parentFrame, tethysControl);
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ abstract public class AutoTethysProvider implements TethysDataProvider {
|
||||
nilus.Detection.Parameters detParams = new nilus.Detection.Parameters();
|
||||
detection.setParameters(detParams);
|
||||
double[] freqs = dataUnit.getFrequency();
|
||||
if (freqs != null) {
|
||||
if (freqs != null && freqs[1] != 0) {
|
||||
detParams.setMinFreqHz(freqs[0]);
|
||||
detParams.setMaxFreqHz(freqs[1]);
|
||||
}
|
||||
@ -366,11 +366,14 @@ abstract public class AutoTethysProvider implements TethysDataProvider {
|
||||
el.setAttribute("BinaryFile", fileInf.getShortFileName(2048));
|
||||
el.setAttribute("FileIndex", Long.valueOf(fileInf.getIndexInFile()).toString());
|
||||
}
|
||||
if (dataUnit.getDatabaseIndex() >= 0) {
|
||||
addUserDefined(detParams, "DatabaseId", String.format("%d", dataUnit.getDatabaseIndex()));
|
||||
}
|
||||
|
||||
return detection;
|
||||
}
|
||||
|
||||
private Element addUserDefined(Parameters parameters, String parameterName, String parameterValue) {
|
||||
public Element addUserDefined(Parameters parameters, String parameterName, String parameterValue) {
|
||||
UserDefined userDefined = parameters.getUserDefined();
|
||||
if (userDefined == null) {
|
||||
userDefined = new UserDefined();
|
||||
|
@ -183,7 +183,7 @@ public class DatablockSynchPanel extends TethysGUIPanel {
|
||||
OfflineDataMap dataMap = synchInfo.getDataBlock().getPrimaryDataMap();
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return synchInfo.getDataBlock().getDataName();
|
||||
return synchInfo.getDataBlock().getLongDataName();
|
||||
case 1:
|
||||
if (dataMap == null) {
|
||||
return null;
|
||||
|
@ -53,7 +53,7 @@ public class DetectionsExportPanel extends TethysGUIPanel implements StreamTable
|
||||
if (selectedDataBlock == null) {
|
||||
return;
|
||||
}
|
||||
DetectionsExportWizard.showDilaog(getTethysControl().getGuiFrame(), getTethysControl(), selectedDataBlock);
|
||||
DetectionsExportWizard.showDialog(getTethysControl().getGuiFrame(), getTethysControl(), selectedDataBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,7 +82,7 @@ public class DetectionsExportWizard extends PamDialog {
|
||||
}
|
||||
}
|
||||
|
||||
public static void showDilaog(Window parentFrame, TethysControl tethysControl, PamDataBlock dataBlock) {
|
||||
public static void showDialog(Window parentFrame, TethysControl tethysControl, PamDataBlock dataBlock) {
|
||||
DetectionsExportWizard wiz = new DetectionsExportWizard(parentFrame, tethysControl, dataBlock);
|
||||
wiz.setParams();
|
||||
wiz.setVisible(true);
|
||||
|
@ -103,6 +103,7 @@ public class ExportWorkerCard extends ExportWizardCard implements DetectionExpor
|
||||
|
||||
protected void exportData() {
|
||||
DetectionsHandler detHandler = getTethysControl().getDetectionsHandler();
|
||||
|
||||
detHandler.startExportThread(getDataBlock(), streamExportParams, this);
|
||||
enableControls(DetectionExportProgress.STATE_GATHERING);
|
||||
}
|
||||
@ -128,7 +129,14 @@ public class ExportWorkerCard extends ExportWizardCard implements DetectionExpor
|
||||
if (progress == null) {
|
||||
return;
|
||||
}
|
||||
if (progress.totalUnits > 0) {
|
||||
if (progress.state == DetectionExportProgress.STATE_COUNTING) {
|
||||
itemCount.setText("0");
|
||||
projectedCount.setText(String.format("%d", progress.exportCount));
|
||||
skipCount.setText(String.format("%d", progress.skipCount));
|
||||
long perc = (progress.exportCount+progress.skipCount) * 100 / progress.totalUnits;
|
||||
progressBar.setValue((int) perc);
|
||||
}
|
||||
else if (progress.totalUnits > 0) {
|
||||
itemCount.setText(String.format("%d", progress.exportCount));
|
||||
skipCount.setText(String.format("%d", progress.skipCount));
|
||||
long totExpected = progress.totalUnits;
|
||||
@ -136,7 +144,6 @@ public class ExportWorkerCard extends ExportWizardCard implements DetectionExpor
|
||||
totExpected *= progress.exportCount/(progress.exportCount+progress.skipCount);
|
||||
}
|
||||
projectedCount.setText(String.format("%d", totExpected));
|
||||
itemCount.setText(String.format("%d", totExpected));
|
||||
long perc = (progress.exportCount+progress.skipCount) * 100 / progress.totalUnits;
|
||||
progressBar.setValue((int) perc);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user