Ejemplo n.º 1
0
  public void setDescriptor(String xmlDescriptor) throws JDOMException, IOException {

    SAXBuilder builder = new SAXBuilder(false);
    InputStream inStream = new ByteArrayInputStream(xmlDescriptor.getBytes());
    Document doc = builder.build(inStream);
    Element raiz = doc.getRootElement();
    Element descriptionElement = raiz.getChild("description");
    Element mapUnitsElement = raiz.getChild("mapUnits");
    Element mapScaleElement = raiz.getChild("mapScale");
    Element mapProjectionElement = raiz.getChild("mapProjection");
    Element mapSrid = raiz.getChild("mapSrid");
    Element mapNameElement = raiz.getChild("mapName");

    String localDescription = descriptionElement.getText();
    String localMapUnits = mapUnitsElement.getText();
    String localMapScale = mapScaleElement.getText();
    String localMapProjection = mapProjectionElement.getText();
    String srid = mapSrid.getText();
    String localMapName = mapNameElement.getText();

    this.description = localDescription;
    this.mapUnits = localMapUnits;
    this.mapScale = localMapScale;
    setMapProjection(localMapProjection);
    setMapSrid(srid);
    super.setName(localMapName);
  }
Ejemplo n.º 2
0
  public Task createTask() {
    Task task = new Task();

    // LayerManager shouldn't automatically add categories in its
    // constructor.
    // Sometimes we want to create a LayerManager with no categories
    // (e.g. in OpenProjectPlugIn). [Jon Aquino]
    task.getLayerManager().addCategory(StandardCategoryNames.WORKING);
    task.getLayerManager().addCategory(StandardCategoryNames.SYSTEM);
    task.setName("Task " + taskSequence++);

    return task;
  }