Пример #1
0
 @Override
 public Element export(ExportSupport support) throws IOException {
   Element layerElem = support.createElement("layer");
   layerElem.setAttribute("type", "imagery");
   layerElem.setAttribute("version", "0.1");
   ImageryPreferenceEntry e = new ImageryPreferenceEntry(layer.getInfo());
   Map<String, String> data = Preferences.serializeStruct(e, ImageryPreferenceEntry.class);
   for (Map.Entry<String, String> entry : data.entrySet()) {
     Element attrElem = support.createElement(entry.getKey());
     layerElem.appendChild(attrElem);
     attrElem.appendChild(support.createTextNode(entry.getValue()));
   }
   return layerElem;
 }
Пример #2
0
  @Override
  public Element export(ExportSupport support) throws IOException {
    Element layerEl = support.createElement("layer");
    layerEl.setAttribute("type", "osm-data");
    layerEl.setAttribute("version", "0.1");

    Element file = support.createElement("file");
    layerEl.appendChild(file);

    if (requiresZip()) {
      String zipPath = "layers/" + String.format("%02d", support.getLayerIndex()) + "/data.osm";
      file.appendChild(support.createTextNode(zipPath));
      addDataFile(support.getOutputStreamZip(zipPath));
    } else {
      URI uri = layer.getAssociatedFile().toURI();
      URL url = null;
      try {
        url = uri.toURL();
      } catch (MalformedURLException e) {
        throw new IOException(e);
      }
      file.appendChild(support.createTextNode(url.toString()));
    }
    return layerEl;
  }