Revision 12099

View differences:

trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/strategies/ShpStrategy.java
234 234
				} else {
235 235
					i = aux;
236 236
				}
237
				bounds = shapeBounds.getShapeBounds(i);
237
				
238
				if (getCapa().isEditing())
239
					bounds=adapter.getShape(i).getBounds2D();
240
				else
241
					bounds = shapeBounds.getShapeBounds(i);
242
				
238 243
				if (ct != null) {
239 244
					bounds = ct.convert(bounds);
240 245
				}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/AnnotationEditableAdapter.java
185 185
		///lyrAnnotation.deleteSpatialIndex();
186 186

  
187 187
		int calculatedIndex = -1;
188
		calculatedIndex = getRowCount()+delRows.cardinality() ;
188
		calculatedIndex = getNewIndex() ;
189 189

  
190 190
		int pos = expansionFile.addRow(feat, IRowEdited.STATUS_ADDED, actualIndexFields);
191 191
		labelExpansion.addLabel(label);
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/EditableAdapter.java
1234 1234

  
1235 1235
	protected boolean fireBeforeRowAdded(int sourceType) throws ReadDriverException{
1236 1236
		Cancel cancel = new Cancel();
1237
		BeforeRowEditEvent event = new BeforeRowEditEvent(this, getRowCount(),
1237
		BeforeRowEditEvent event = new BeforeRowEditEvent(this, getNewIndex(),
1238 1238
				EditionEvent.CHANGE_TYPE_ADD, cancel, sourceType);
1239 1239
		for (int i = 0; i < editionListeners.size(); i++) {
1240 1240
			IEditionListener listener = (IEditionListener) editionListeners
......
1626 1626
	public FieldDescription[] getFieldsDescription() {
1627 1627
		return (FieldDescription[]) fastAccessFields.toArray(new FieldDescription[0]);
1628 1628
	}
1629
	public int getNewIndex() throws ReadDriverException {
1630
		int index=(int)ods.getRowCount() + numAdd;
1631
		return index;
1632
	}
1629 1633

  
1630

  
1631 1634
//	private InternalField getInternalFieldByIndex(int fieldId)
1632 1635
//	{
1633 1636
//		for (Iterator iter = actualFields.values().iterator(); iter.hasNext();) {
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/VectorialEditableDBAdapter.java
40 40
 */
41 41
public class VectorialEditableDBAdapter extends VectorialEditableAdapter
42 42
		implements ISpatialDB {
43

  
43
	private int maxIndex=0;
44 44
	private class MyIterator implements IFeatureIterator {
45 45
		private Rectangle2D extent = null;
46 46

  
......
62 62

  
63 63
		private boolean bOriginalCursorOpened = true;
64 64

  
65

  
66 65
		public MyIterator(Rectangle2D r, String strEPSG) throws ReadDriverException {
67 66
			extent = r;
68 67
			epsg = strEPSG;
......
314 313
				 IFeature feat = ova.getFeature(i);
315 314
				 Integer calculatedIndex = new Integer(i);
316 315
				 mapFID2index.put(feat.getID(), calculatedIndex);
316
				 int featInt=Integer.parseInt(feat.getID());
317
				 if (maxIndex<featInt){
318
					 maxIndex=featInt;
319
				 }
317 320
				 mapIndex2FID.put(calculatedIndex, feat.getID());
318 321
			 }
319 322

  
......
461 464
		mapFID2index.clear();
462 465
		mapIndex2FID.clear();
463 466
	}
467
	public int getNewIndex(){
468
		int index = maxIndex+1;
469
		while(mapFID2index.containsKey(String.valueOf(index))){
470
			index++;
471
		}
472
		return index;
473
	}
464 474

  
465

  
466 475
}

Also available in: Unified diff