예제 #1
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;
  }
예제 #2
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);
  }
 private Collection<Layer> layersWithoutDataSource(Task task) {
   ArrayList<Layer> layersWithoutDataSource = new ArrayList<Layer>();
   for (Iterator i = task.getLayerManager().getLayers().iterator(); i.hasNext(); ) {
     Layer layer = (Layer) i.next();
     if (!layer.hasReadableDataSource()) {
       layersWithoutDataSource.add(layer);
     }
   }
   return layersWithoutDataSource;
 }