FileDocCategorySizeDatePackage
KMLFormatter.javaAPI DocAndroid 5.1 API2847Thu Mar 12 22:22:44 GMT 2015com.android.locationtracker.data

KMLFormatter

public class KMLFormatter extends Object implements IFormatter
Formats tracker data as KML output

Fields Summary
Constructors Summary
Methods Summary
public java.lang.StringgetFooter()

        LineBuilder builder = new LineBuilder();
        builder.addLine("</Document>");
        builder.addLine("</kml>");
        return builder.toString();
    
public java.lang.StringgetHeader()

        LineBuilder builder = new LineBuilder();
        builder.addLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        builder.addLine("<kml xmlns=\"http://earth.google.com/kml/2.2\">");
        builder.addLine("<Document>");
        return builder.toString();
    
public java.lang.StringgetOutput(TrackerEntry entry)

        LineBuilder builder = new LineBuilder();

        if (entry.getType() == EntryType.LOCATION_TYPE) {

            Location loc = entry.getLocation();
            builder.addLine("<Placemark>");
            builder.addLine("<description>");
            builder.addLine("accuracy = " + loc.getAccuracy());
            builder.addLine("distance from last network location  = "
                    + entry.getDistFromNetLocation());
            builder.addLine("</description>");
            builder.addLine("<TimeStamp>");
            builder.addLine("<when>" + entry.getTimestamp() + "</when>");
            builder.addLine("</TimeStamp>");
            builder.addLine("<Point>");
            builder.addLine("<coordinates>");
            builder.addLine(loc.getLongitude() + "," + loc.getLatitude() + ","
                    + loc.getAltitude());
            builder.addLine("</coordinates>");
            builder.addLine("</Point>");
            builder.addLine("</Placemark>");
        }
        return builder.toString();