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); } } }
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); } } }
@Override public void moveLayer(com.metaaps.eoclipse.common.views.ILayer layer, boolean up) { List<ILayer> layers = root.getLayers(); layers.lastIndexOf(layer); int curindex = layers.lastIndexOf(layer); if (curindex > 0) { layers.remove(curindex); if (curindex + 1 < layers.size()) { layers.add(curindex + 1, (ILayer) layer); } else { layers.add((ILayer) layer); } } }
@Override public List<com.metaaps.eoclipse.common.views.ILayer> getLayers() { ArrayList<com.metaaps.eoclipse.common.views.ILayer> layers = new ArrayList<com.metaaps.eoclipse.common.views.ILayer>(); // layers.add(root); for (ILayer layer : root.getLayers()) { if (layer instanceof IImageLayer) { layers.add((com.metaaps.eoclipse.common.views.ILayer) layer); for (ILayer vectorlayer : ((IImageLayer) layer).getLayers()) { layers.add((com.metaaps.eoclipse.common.views.ILayer) vectorlayer); } } } return layers; }
@Override public void refresh() { geocontext.setDirty(true); root.render(geocontext); }