mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2025-05-05 22:27:23 +00:00
Fix array manager
Fix so that it's possible to load a VERY old psf file that didn't have a lot of the new array managmeent features.
This commit is contained in:
parent
2bf023ffed
commit
11bb7d5fe1
src/Array
@ -1541,7 +1541,9 @@ public class PamArray implements Serializable, Cloneable, ManagedParameters {
|
||||
* so it can get data out of the localisers, etc.
|
||||
*/
|
||||
public void prepareToSerialize() {
|
||||
masterLocator.getLocatorSettings();
|
||||
if (masterLocator != null) {
|
||||
masterLocator.getLocatorSettings();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1549,8 +1551,10 @@ public class PamArray implements Serializable, Cloneable, ManagedParameters {
|
||||
* data can be loaded back into the Hydrophone localisers.
|
||||
*/
|
||||
public void arrayDeserialized() {
|
||||
masterLocator.setupLocators(this);
|
||||
masterLocator.setLocatorSettings(null);
|
||||
if (masterLocator != null) {
|
||||
masterLocator.setupLocators(this);
|
||||
masterLocator.setLocatorSettings(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,8 +151,18 @@ public class Streamer implements Serializable, Cloneable, ManagedParameters {
|
||||
public Streamer clone() {
|
||||
try {
|
||||
Streamer newStreamer = (Streamer) super.clone();
|
||||
newStreamer.allLocatorSettings = new ArrayList<>(allLocatorSettings);
|
||||
newStreamer.allOriginSettings = new ArrayList<>(allOriginSettings);
|
||||
if (allLocatorSettings != null) {
|
||||
newStreamer.allLocatorSettings = new ArrayList<>(allLocatorSettings);
|
||||
}
|
||||
else {
|
||||
newStreamer.allLocatorSettings = new ArrayList<>();
|
||||
}
|
||||
if (allOriginSettings != null) {
|
||||
newStreamer.allOriginSettings = new ArrayList<>(allOriginSettings);
|
||||
}
|
||||
else {
|
||||
newStreamer.allOriginSettings = new ArrayList<>();
|
||||
}
|
||||
newStreamer.checkAllocations();
|
||||
OriginSettings os = this.getOriginSettings();
|
||||
if (os != null) {
|
||||
@ -497,7 +507,7 @@ public class Streamer implements Serializable, Cloneable, ManagedParameters {
|
||||
//// HydrophoneOriginMethod origin = HydrophoneOriginMethods.getInstance().getMethod(originClass);
|
||||
// }
|
||||
// else
|
||||
if (pamArray.getArrayLocatorClass() == StraightHydrophoneLocator.class) {
|
||||
if (pamArray != null && pamArray.getArrayLocatorClass() == StraightHydrophoneLocator.class) {
|
||||
locatorClass = StraightHydrophoneLocator.class;
|
||||
originClass = GPSOriginMethod.class;
|
||||
HydrophoneLocator locator = HydrophoneLocators.getInstance().getLocatorSystem(locatorClass).getLocator(pamArray, this);
|
||||
@ -559,7 +569,7 @@ public class Streamer implements Serializable, Cloneable, ManagedParameters {
|
||||
}
|
||||
|
||||
public void notifyModelChanged(int changeType, boolean initComplete) {
|
||||
if (initComplete) {
|
||||
if (initComplete && hydrophoneOrigin != null) {
|
||||
hydrophoneOrigin.prepare();
|
||||
}
|
||||
switch (changeType) {
|
||||
|
Loading…
Reference in New Issue
Block a user