+ // Output all route points (if any)
+ numSaved += writeTrackPoints(inWriter, inInfo, exportSelection, exportTrackpoints, exportPhotos,
+ exportAudios, exportTimestamps, true, inGpxCachers, "<rtept", "\t<rte><number>1</number>\n",
+ null, "\t</rte>\n");
+ // Output all track points, if any
+ String trackStart = "\t<trk>\n\t\t<name>" + trackName + "</name>\n\t\t<number>1</number>\n\t\t<trkseg>\n";
+ numSaved += writeTrackPoints(inWriter, inInfo, exportSelection, exportTrackpoints, exportPhotos,
+ exportAudios, exportTimestamps, false, inGpxCachers, "<trkpt", trackStart,
+ "\t</trkseg>\n\t<trkseg>\n", "\t\t</trkseg>\n\t</trk>\n");
+ }
+
+ inWriter.write("</gpx>\n");
+ return numSaved;
+ }
+
+
+ /**
+ * Write the name and description according to the GPX version number
+ * @param inWriter writer object
+ * @param inName name, or null if none supplied
+ * @param inDesc description, or null if none supplied
+ * @param inIsVersion1_1 true if gpx version 1.1, false for version 1.0
+ */
+ private static void writeNameAndDescription(OutputStreamWriter inWriter,
+ String inName, String inDesc, boolean inIsVersion1_1) throws IOException
+ {
+ String desc = (inDesc != null && !inDesc.equals("")) ? inDesc : "Export from GpsPrune";
+ // Position of name and description fields needs to be different for GPX1.0 and GPX1.1
+ if (inIsVersion1_1)
+ {
+ // GPX 1.1 has the name and description inside a metadata tag
+ inWriter.write("\t<metadata>\n");
+ }
+ if (inName != null && !inName.equals(""))
+ {
+ if (inIsVersion1_1) {inWriter.write('\t');}