Difference between revisions of "Beanshell:Combine two selected layers"
Jump to navigation
Jump to search
(Created page with 'Combine two selected layers (untested) { firstLayer = wc.layerViewPanel.selectionManager.layersWithSelectedItems.iterator().next(); firstFeature = wc.layerViewPanel.selection…') |
|||
| Line 7: | Line 7: | ||
firstFeature.geometry = firstFeature.geometry.union(feature.geometry); | firstFeature.geometry = firstFeature.geometry.union(feature.geometry); | ||
} | } | ||
| − | for (layer : wc.layerViewPanel.selectionManager.layersWithSelectedItems) { layer.featureCollectionWrapper.removeAll(wc.layerViewPanel.selectionManager.getFeaturesWithSelectedItems(layer)); | + | for (layer : wc.layerViewPanel.selectionManager.layersWithSelectedItems){ |
| − | + | layer.featureCollectionWrapper.removeAll(wc.layerViewPanel.selectionManager.getFeaturesWithSelectedItems(layer)); | |
| + | } | ||
firstLayer.featureCollectionWrapper.add(firstFeature); | firstLayer.featureCollectionWrapper.add(firstFeature); | ||
wc.layerViewPanel.repaint(); | wc.layerViewPanel.repaint(); | ||
} | } | ||
Latest revision as of 00:58, 12 October 2009
Combine two selected layers (untested)
{
firstLayer = wc.layerViewPanel.selectionManager.layersWithSelectedItems.iterator().next();
firstFeature = wc.layerViewPanel.selectionManager.getFeaturesWithSelectedItems(firstLayer).iterator().next();
for (feature : wc.layerViewPanel.selectionManager.featuresWithSelectedItems) {
firstFeature.geometry = firstFeature.geometry.union(feature.geometry);
}
for (layer : wc.layerViewPanel.selectionManager.layersWithSelectedItems){
layer.featureCollectionWrapper.removeAll(wc.layerViewPanel.selectionManager.getFeaturesWithSelectedItems(layer));
}
firstLayer.featureCollectionWrapper.add(firstFeature);
wc.layerViewPanel.repaint();
}