mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-21 22:52:22 +00:00
Logger form plotting
Fixed logger form plotting in Viewer so that points can find their correct GPS position (based on time)
This commit is contained in:
parent
0085215eff
commit
1461808b14
@ -38,6 +38,14 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
|
||||
import Array.streamerOrigin.GPSOriginMethod;
|
||||
import Array.streamerOrigin.GPSOriginSystem;
|
||||
import Array.streamerOrigin.HydrophoneOriginMethod;
|
||||
import Array.streamerOrigin.HydrophoneOriginMethods;
|
||||
import Array.streamerOrigin.OriginIterator;
|
||||
import Array.streamerOrigin.StaticOriginSystem;
|
||||
import GPS.GpsData;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
@ -49,6 +57,7 @@ import pamScrollSystem.ScrollPaneAddon;
|
||||
import PamView.PamTabPanel;
|
||||
import PamView.panel.PamPanel;
|
||||
import PamView.symbol.StandardSymbolManager;
|
||||
import PamguardMVC.PamDataBlock;
|
||||
import PamguardMVC.PamDataUnit;
|
||||
import PamController.PamControlledUnitSettings;
|
||||
import PamController.PamController;
|
||||
@ -2021,4 +2030,32 @@ public class FormDescription implements Cloneable, Comparable<FormDescription> {
|
||||
public void setNeedsUDFSave(boolean needsUDFSave) {
|
||||
this.needsUDFSave = needsUDFSave;
|
||||
}
|
||||
|
||||
public GpsData getOriginLatLong(FormsDataUnit formsDataUnit) {
|
||||
GpsData gps = getOrigin(GPSOriginSystem.class, formsDataUnit);
|
||||
if (gps != null) {
|
||||
return gps;
|
||||
}
|
||||
gps = getOrigin(StaticOriginSystem.class, formsDataUnit);
|
||||
return gps;
|
||||
}
|
||||
|
||||
private GpsData getOrigin(Class originClass, FormsDataUnit formsDataUnit) {
|
||||
HydrophoneOriginMethods origins = HydrophoneOriginMethods.getInstance();
|
||||
HydrophoneOriginMethod origin = origins.getMethod(GPSOriginMethod.class, null, null);
|
||||
if (origin == null) {
|
||||
return null;
|
||||
}
|
||||
OriginIterator gpsIter = origin.getGpsDataIterator(PamDataBlock.ITERATOR_END);
|
||||
GpsData prev = null;
|
||||
while (gpsIter.hasPrevious()) {
|
||||
prev = gpsIter.previous();
|
||||
if (prev.getTimeInMillis() < formsDataUnit.getTimeMilliseconds()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return prev;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -87,7 +87,9 @@ public class FormsDataUnit extends PamDataUnit {
|
||||
* we want to as a reference, etc.
|
||||
*/
|
||||
if (recalculate || formOriginLatLong == null) {
|
||||
formOriginLatLong = loggerForm.getOriginLatLong(this);
|
||||
if (formDescription != null) {
|
||||
formOriginLatLong = formDescription.getOriginLatLong(this);
|
||||
}
|
||||
}
|
||||
return formOriginLatLong;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public class FormsLogging extends SQLLogging {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// formDescription.getf
|
||||
|
||||
FormsDataUnit formsDataUnit = new FormsDataUnit(null, timeMilliseconds, formDescription, formData);
|
||||
formsDataUnit.setDatabaseIndex(databaseIndex);
|
||||
|
@ -104,7 +104,7 @@ public class LoggerForm{
|
||||
private CounterControl counter;
|
||||
|
||||
|
||||
private HydrophoneOriginMethods origins = HydrophoneOriginMethods.getInstance();
|
||||
// private HydrophoneOriginMethods origins = HydrophoneOriginMethods.getInstance();
|
||||
|
||||
/**
|
||||
* @return the hasCounter
|
||||
@ -911,30 +911,30 @@ public class LoggerForm{
|
||||
return saveButton;
|
||||
}
|
||||
|
||||
public GpsData getOriginLatLong(FormsDataUnit formsDataUnit) {
|
||||
GpsData gps = getOrigin(GPSOriginSystem.class, formsDataUnit);
|
||||
if (gps != null) {
|
||||
return gps;
|
||||
}
|
||||
gps = getOrigin(StaticOriginSystem.class, formsDataUnit);
|
||||
return gps;
|
||||
}
|
||||
|
||||
private GpsData getOrigin(Class originClass, FormsDataUnit formsDataUnit) {
|
||||
HydrophoneOriginMethod origin = origins.getMethod(GPSOriginMethod.class, null, null);
|
||||
if (origin == null) {
|
||||
return null;
|
||||
}
|
||||
OriginIterator gpsIter = origin.getGpsDataIterator(PamDataBlock.ITERATOR_END);
|
||||
GpsData prev = null;
|
||||
while (gpsIter.hasPrevious()) {
|
||||
prev = gpsIter.previous();
|
||||
if (prev.getTimeInMillis() < formsDataUnit.getTimeMilliseconds()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return prev;
|
||||
}
|
||||
// public GpsData getOriginLatLong(FormsDataUnit formsDataUnit) {
|
||||
// GpsData gps = getOrigin(GPSOriginSystem.class, formsDataUnit);
|
||||
// if (gps != null) {
|
||||
// return gps;
|
||||
// }
|
||||
// gps = getOrigin(StaticOriginSystem.class, formsDataUnit);
|
||||
// return gps;
|
||||
// }
|
||||
//
|
||||
// private GpsData getOrigin(Class originClass, FormsDataUnit formsDataUnit) {
|
||||
// HydrophoneOriginMethod origin = origins.getMethod(GPSOriginMethod.class, null, null);
|
||||
// if (origin == null) {
|
||||
// return null;
|
||||
// }
|
||||
// OriginIterator gpsIter = origin.getGpsDataIterator(PamDataBlock.ITERATOR_END);
|
||||
// GpsData prev = null;
|
||||
// while (gpsIter.hasPrevious()) {
|
||||
// prev = gpsIter.previous();
|
||||
// if (prev.getTimeInMillis() < formsDataUnit.getTimeMilliseconds()) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// return prev;
|
||||
// }
|
||||
|
||||
|
||||
// /**
|
||||
|
Loading…
Reference in New Issue
Block a user