Esempio n. 1
0
    /**
     * Writes one waypoint entry for cache waypoint.
     *
     * @param cache The
     * @param wp
     * @param prefix
     * @throws IOException
     */
    private void writeCacheWaypoint(final cgWaypoint wp, final String prefix) throws IOException {
      gpx.write("<wpt lat=\"");
      final Geopoint coords = wp.getCoords();
      gpx.write(
          coords != null
              ? Double.toString(coords.getLatitude())
              : ""); // TODO: check whether is the best way to handle unknown waypoint coordinates
      gpx.write("\" lon=\"");
      gpx.write(coords != null ? Double.toString(coords.getLongitude()) : "");
      gpx.write("\">");

      gpx.write("<name>");
      gpx.write(StringEscapeUtils.escapeXml(prefix));
      gpx.write(StringEscapeUtils.escapeXml(wp.getGeocode().substring(2)));
      gpx.write("</name>");

      gpx.write("<cmt>");
      gpx.write(StringEscapeUtils.escapeXml(wp.getNote()));
      gpx.write("</cmt>");

      gpx.write("<desc>");
      gpx.write(StringEscapeUtils.escapeXml(wp.getName()));
      gpx.write("</desc>");

      gpx.write("<sym>");
      gpx.write(
          StringEscapeUtils.escapeXml(
              wp.getWaypointType().toString())); // TODO: Correct identifier string
      gpx.write("</sym>");

      gpx.write("<type>Waypoint|");
      gpx.write(
          StringEscapeUtils.escapeXml(
              wp.getWaypointType().toString())); // TODO: Correct identifier string
      gpx.write("</type>");

      gpx.write("</wpt>");
    }