/** Toma las Bandas de la imagen seleccionada en el combo Imagen */ public void getBandas() { // Antes de insertar se borra lo anterior getModeloTabla().LimpiarLista(); FLyrRasterSE rasterLayer = (FLyrRasterSE) layers.getLayer((String) getComboCapas().getSelectedItem()); String bandas[] = new String[rasterLayer.getBandCount()]; if (layers.getLayer((String) getComboCapas().getSelectedItem()) instanceof FLyrRasterSE) { for (int j = 0; j < rasterLayer.getBandCount(); j++) { String s = (PluginServices.getText(this, "banda")) + (j + 1); bandas[j] = s; } } // Insertar las bandas el la tabla for (int i = 0; i < bandas.length; i++) getModeloTabla().addRow(bandas[i], true); getTableBands().updateUI(); }
/** @return array de String con los nombre de las capas cargadas */ private String[] getLayerNames() { int i, capasraster = 0; for (i = 0; i < layers.getLayersCount(); i++) { if (layers.getLayer(i) instanceof FLyrRasterSE) capasraster++; } // Solo se toman las capas raster. String[] sNames = new String[capasraster]; capasraster = 0; for (i = 0; i < layers.getLayersCount(); i++) { if (layers.getLayer(i) instanceof FLyrRasterSE) { sNames[capasraster] = layers.getLayer(i).getName(); capasraster++; } } return sNames; }
/** * Splits up a layer group in order to get a layer by name when there are layer groups * * <p>In <code>result</code> always will be at least one layer. * * @param layer the layer we are looking for * @param result an array list that will have the results of the search */ private void splitLayerGroup(FLayer layer, ArrayList result) { int i; FLayers layerGroup; if (layer instanceof FLayers) { layerGroup = (FLayers) layer; for (i = 0; i < layerGroup.getLayersCount(); i++) { splitLayerGroup(layerGroup.getLayer(i), result); } } else { result.add(layer); } }
private boolean hasVectorLayers(FLayers layers) { for (int i = 0; i < layers.getLayersCount(); i++) { FLayer lyr = layers.getLayer(i); if (lyr instanceof FLayers) { if (hasVectorLayers((FLayers) lyr)) { return true; } } else if (lyr instanceof FLyrVect) { return true; } } return false; }
public void accept() { if (getModeloTabla().getNumSelected() > 0) { FLyrRasterSE rasterLayer = (FLyrRasterSE) layers.getLayer((String) getComboCapas().getSelectedItem()); PluginServices.getMDIManager().closeWindow(this); statisticsProcess = new PCStatisticsProcess(); statisticsProcess.addParam("inputRasterLayer", rasterLayer); selectecBands = getModeloTabla().getSeleccionadas(); statisticsProcess.addParam("selectedBands", selectecBands); statisticsProcess.setActions(this); statisticsProcess.start(); } else { JOptionPane.showMessageDialog( null, PluginServices.getText(this, "no_bandas"), PluginServices.getText(this, "principal_components"), JOptionPane.WARNING_MESSAGE); } }
public void execute(ITocItem item, FLayer[] selectedItems) { // ITocItem tocItem = (ITocItem) getNodeUserObject(); ChangeName changename = new ChangeName(null); PluginServices.getMDIManager().addWindow(changename); if (!changename.isAccepted()) return; String nombre = changename.getName(); if (nombre != null) { getMapContext().beginAtomicEvent(); FLayers parent = selectedItems[0].getParentLayer(); // FLayers newGroup = new FLayers(getMapContext(),parent); FLayers newGroup = getMapContext().getNewGroupLayer(parent); newGroup.setName(nombre); int pos = 0; for (int i = 0; i < parent.getLayersCount(); i++) { if (parent.getLayer(i).equals(selectedItems[0])) { pos = i; continue; } } for (int j = 0; j < selectedItems.length; j++) { FLayer layer = selectedItems[j]; parent.removeLayer(layer); newGroup.addLayer(layer); } parent.addLayer(pos, newGroup); getMapContext().endAtomicEvent(); // TRUCO PARA REFRESCAR. getMapContext().invalidate(); Project project = ((ProjectExtension) PluginServices.getExtension(ProjectExtension.class)).getProject(); project.setModified(true); } }