Fix issue 396. Format to latlon 0.00#####

This commit is contained in:
Victor Shcherb 2011-04-24 19:31:47 +02:00
parent 05a23c737f
commit 80028ec87a
2 changed files with 11 additions and 6 deletions

View file

@ -8,13 +8,14 @@ package net.osmand;
public class ToDoConstants {
// == Osmand application (TODO 123) ==
// == Osmand application (TODO 124) ==
// === Refactoring issues ===
// || 116 || Move all messages.properties related Android application inside strings.xml to have better access with their translation ||
// === Common issues ===
// || 123 || Improve gpx file showing (very slow for big files) ||
// || 122 || Frozen sqlite db images (bug?). When images are loaded into sqlite the whole map is frozen ||
// || 121 || Filter network location from GPS location (wait for 10 seconds before start using network location) ||
// || 120 || Show icons over poi circle ||

View file

@ -4,6 +4,8 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@ -27,8 +29,9 @@ public class GPXUtilities {
public final static Log log = LogUtil.getLog(GPXUtilities.class);
private final static String GPX_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'"; //$NON-NLS-1$
public final static String GPX_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'"; //$NON-NLS-1$
private final static NumberFormat latLonFormat = new DecimalFormat("0.00#####");
public static class TrkPt {
public double lat;
@ -45,6 +48,7 @@ public class GPXUtilities {
}
public static boolean saveToXMLFiles(File fout, List<WptPt> data, Context ctx ){
try {
FileOutputStream output = new FileOutputStream(fout);
@ -61,8 +65,8 @@ public class GPXUtilities {
for (WptPt l : data) {
serializer.startTag(null, "wpt"); //$NON-NLS-1$
serializer.attribute(null, "lat", l.lat + ""); //$NON-NLS-1$ //$NON-NLS-2$
serializer.attribute(null, "lon", l.lon + ""); //$NON-NLS-1$ //$NON-NLS-2$
serializer.attribute(null, "lat", latLonFormat.format(l.lat)); //$NON-NLS-1$
serializer.attribute(null, "lon", latLonFormat.format(l.lon)); //$NON-NLS-1$ //$NON-NLS-2$
serializer.startTag(null, "name"); //$NON-NLS-1$
serializer.text(l.name);
serializer.endTag(null, "name"); //$NON-NLS-1$
@ -113,8 +117,8 @@ public class GPXUtilities {
serializer.startTag(null, "trkseg"); //$NON-NLS-1$
for(TrkPt p : l){
serializer.startTag(null, "trkpt"); //$NON-NLS-1$
serializer.attribute(null, "lat", p.lat+""); //$NON-NLS-1$ //$NON-NLS-2$
serializer.attribute(null, "lon", p.lon+""); //$NON-NLS-1$ //$NON-NLS-2$
serializer.attribute(null, "lat", latLonFormat.format(p.lat)); //$NON-NLS-1$ //$NON-NLS-2$
serializer.attribute(null, "lon", latLonFormat.format(p.lon)); //$NON-NLS-1$ //$NON-NLS-2$
serializer.startTag(null, "time"); //$NON-NLS-1$
serializer.text(format.format(new Date(p.time)));
serializer.endTag(null, "time"); //$NON-NLS-1$