示例#1
0
  public String toCreateKML() {
    this.createdNodes = removeDescendants(this.createdNodes);

    StringBuilder create = new StringBuilder();
    if (this.createdNodes != null) {
      for (Iterator iter = this.createdNodes.iterator(); iter.hasNext(); ) {
        Node newNode = (Node) iter.next();
        if (newNode.parent instanceof ObjectNode) // ie. not Kml
        // node
        {
          ObjectNode newNodeParent = (ObjectNode) newNode.parent;
          create.append(
              "<"
                  + newNodeParent.getClass().getSimpleName()
                  + " targetId=\""
                  + newNodeParent.getId()
                  + "\">\n");
          create.append(newNode.toKML());
          create.append("</" + newNodeParent.getClass().getSimpleName() + ">\n");
        } else {
          create.append(newNode.toKML());
        }
        newNode.setRecursiveNotDirty();
      }
      this.createdNodes.clear();
    }
    return create.toString();
  }
示例#2
0
  public String toDeleteKML() {
    this.deletedNodes = removeDescendants(this.deletedNodes);

    StringBuilder delete = new StringBuilder();
    if (this.deletedNodes != null) {
      for (Iterator iter = this.deletedNodes.iterator(); iter.hasNext(); ) {
        Node newNode = (Node) iter.next();
        delete.append(
            "<"
                + newNode.getClass().getSimpleName()
                + " targetId=\""
                + ((ObjectNode) newNode).getId()
                + "\"></>\n");
      }
      this.deletedNodes.clear();
    }
    return delete.toString();
  }