private void storeOriginalSelection() throws ReadDriverException { FBitSet bs = layer.getSelectionSupport().getSelection(); ReadableVectorial source = layer.getSource(); source.start(); for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) { IFeature feature = source.getFeature(i); pksSelected.add(feature.getID()); } source.stop(); }
private void doRestoreSelection() throws ReadDriverException { ReadableVectorial source = layer.getSource(); Collection<String> pks = new ArrayList<String>(pksSelected); source.start(); FBitSet selection = layer.getSelectionSupport().getSelection(); selection.clear(); for (int i = 0; i < source.getShapeCount(); i++) { IFeature feat = source.getFeature(i); String id = feat.getID(); if (pks.contains(id)) { pks.remove(id); selection.set(i); if (pks.isEmpty()) { break; } } } source.stop(); }