Example #1
0
 public void addDataLayer(IDataContent datacontent) throws ParseException {
   IImageLayer iil = null;
   if (datacontent instanceof IGeoRaster) {
     iil = new FastImageLayer(root, (IGeoRaster) datacontent);
     root.addLayer(iil);
     root.render(geocontext);
     for (IDataContent vectordatacontent : m_tmplayers) {
       addDataLayer(vectordatacontent);
     }
     m_tmplayers.clear();
   }
   if (datacontent instanceof IVectorData) {
     IVectorData vectordata = (IVectorData) datacontent;
     for (ILayer layer : root.getLayers()) {
       if (layer.isActive()) {
         iil = (IImageLayer) layer;
       }
     }
     if (iil != null) {
       IGeoRaster gir = iil.getImage();
       GeometricLayer layer = GeoUtils.createImageProjectedLayer(vectordata, gir, "EPSG:4326");
       iil.addLayer(new SimpleVectorLayer(vectordata.getName(), iil, vectordata, layer));
     } else {
       m_tmplayers.add(datacontent);
     }
   }
 }
Example #2
0
 public void removeDataLayer(IDataContent datacontent) throws ParseException {
   IImageLayer iil = null;
   for (ILayer layer : root.getLayers()) {
     if (layer.isActive()) {
       iil = (IImageLayer) layer;
       if (iil.represents(datacontent)) {
         root.removeLayer(iil);
       }
     }
   }
   for (ILayer layer : iil.getLayers()) {
     // need to find a way to keep track of data content used for layers
     if (layer.represents(datacontent)) {
       iil.removeLayer(layer);
     }
   }
 }