mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-10-29 23:30:44 +00:00
Small fixes
Deal with null in xml settings output Deal with -Infinity going into constrainAngle - however many times you add 360 to -Inf, it remains -Inf, so the function was never returning.
This commit is contained in:
parent
8252034f13
commit
3e2de8f5dc
@ -36,7 +36,7 @@ public class PamguardVersionInfo {
|
||||
/**
|
||||
* Release date
|
||||
*/
|
||||
static public final String date = "22 March 2024";
|
||||
static public final String date = "29 March 2024";
|
||||
|
||||
// /**
|
||||
// * Release type - Beta or Core
|
||||
|
@ -570,6 +570,9 @@ public class PamguardXMLWriter implements PamSettings {
|
||||
*/
|
||||
private Element writeSettings(Document doc, PamSettings pamSettings, Object data, ArrayList<Object> objectHierarchy) {
|
||||
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
Element el = doc.createElement("SETTINGS");
|
||||
el.setAttribute("Type", pamSettings.getUnitType());
|
||||
el.setAttribute("Name", pamSettings.getUnitName());
|
||||
|
@ -354,6 +354,9 @@ public class PamUtils {
|
||||
* @return output angle (degrees)
|
||||
*/
|
||||
static public double constrainedAngle(double angle) {
|
||||
if (Double.isInfinite(angle) || Double.isNaN(angle)) {
|
||||
return angle;
|
||||
}
|
||||
while (angle >= 360) {
|
||||
angle -= 360;
|
||||
}
|
||||
@ -369,6 +372,9 @@ public class PamUtils {
|
||||
* @return output angle (radians)
|
||||
*/
|
||||
static public double constrainedAngleR(double angle) {
|
||||
if (Double.isInfinite(angle) || Double.isNaN(angle)) {
|
||||
return angle;
|
||||
}
|
||||
while (angle >= 2*Math.PI) {
|
||||
angle -= 2*Math.PI;
|
||||
}
|
||||
@ -384,6 +390,9 @@ public class PamUtils {
|
||||
* @return output angle (degrees)
|
||||
*/
|
||||
static public double constrainedAngle(double angle, double maxAngle) {
|
||||
if (Double.isInfinite(angle) || Double.isNaN(angle)) {
|
||||
return angle;
|
||||
}
|
||||
while (angle >= maxAngle) {
|
||||
angle -= 360;
|
||||
}
|
||||
@ -401,6 +410,9 @@ public class PamUtils {
|
||||
* @return output angle (radians)
|
||||
*/
|
||||
static public double constrainedAngleR(double angle, double maxAngle) {
|
||||
if (Double.isInfinite(angle) || Double.isNaN(angle)) {
|
||||
return angle;
|
||||
}
|
||||
while (angle > maxAngle) {
|
||||
angle -= 2*Math.PI;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user