summaryrefslogtreecommitdiff
path: root/altoslib
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2015-05-18 10:52:24 -0700
committerKeith Packard <keithp@keithp.com>2015-05-18 10:52:24 -0700
commit3fbf0a29a1b8a67b90ef965ee3e2e972c0ec33a1 (patch)
tree19a2b0a9f4090a8f40946c9fae41ab4abe9203a7 /altoslib
parent1cc1900e13d79e0451587439c23bbb062d86cee3 (diff)
altoslib: Use Locale.ROOT for KML export
This avoids locale-specific number formatting, which breaks googleearth when importing the resulting file. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib')
-rw-r--r--altoslib/AltosKML.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/altoslib/AltosKML.java b/altoslib/AltosKML.java
index aa80fc21..1a0fcf3d 100644
--- a/altoslib/AltosKML.java
+++ b/altoslib/AltosKML.java
@@ -18,11 +18,22 @@
package org.altusmetrum.altoslib_6;
import java.io.*;
+import java.util.*;
+
+class KMLWriter extends PrintWriter {
+ public PrintWriter printf(String format, Object ... arguments) {
+ return printf(Locale.ROOT, format, arguments);
+ }
+
+ public KMLWriter(File name) throws FileNotFoundException {
+ super(name);
+ }
+}
public class AltosKML implements AltosWriter {
File name;
- PrintStream out;
+ PrintWriter out;
int flight_state = -1;
AltosState prev = null;
double gps_start_altitude;
@@ -137,6 +148,10 @@ public class AltosKML implements AltosWriter {
end();
prev = null;
}
+ if (out != null) {
+ out.close();
+ out = null;
+ }
}
public void write(AltosState state) {
@@ -177,7 +192,7 @@ public class AltosKML implements AltosWriter {
public AltosKML(File in_name) throws FileNotFoundException {
name = in_name;
- out = new PrintStream(name);
+ out = new KMLWriter(name);
}
public AltosKML(String in_string) throws FileNotFoundException {