Ejemplo n.º 1
0
  /**
   * Inserts layers and properties to this collection of layers.
   *
   * <p>This root node has the same properties that return <code>FlyrDefault#getXMLEntity()</code>
   * adding:
   *
   * <ul>
   *   <li><i>numLayers</i> : number of first-level layers of this collection
   *   <li><i>LayerNames</i> : an array list with the name of the first-level layers of this
   *       collection <code>FLayer.getXMLEntity()</code>
   * </ul>
   *
   * @see FLyrDefault#setXMLEntity()
   * @see FLyrDefault#getXMLEntity()
   * @see CopyOfFLayers#addLayerFromXML(XMLEntity, String)
   * @param xml an <code>XMLEntity</code> with the information
   * @throws XMLException if there is an error setting the object.
   */
  public void setXMLEntity(XMLEntity xml) throws XMLException {
    super.setXMLEntity(xml);
    // LoadLayerException loadLayerException=new LoadLayerException();

    String[] s = xml.getStringArrayProperty("LayerNames");
    // try {
    fmap.clearErrors();
    int numLayers = xml.getIntProperty("numLayers");
    Iterator iter = xml.findChildren("tagName", "layer");
    XMLEntity xmlLayer;
    while (iter.hasNext()) {
      xmlLayer = (XMLEntity) iter.next();
      try {
        this.addLayerFromXML(xmlLayer, null);
      } catch (LoadLayerException e) {
        throw new XMLLayerException(getName(), e);
      }
    }
    if (numLayers != this.layers.size()) {
      logger.warn(this.getName() + ": layer count no match");
    }
  }