Revision 4193
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/VectorialEditableAdapter.java | ||
---|---|---|
45 | 45 |
* |
46 | 46 |
* $Id$ |
47 | 47 |
* $Log$ |
48 |
* Revision 1.32 2006-02-23 17:55:45 fjp |
|
48 |
* Revision 1.33 2006-02-24 07:57:58 fjp |
|
49 |
* FUNCIONA!!! (Creo) |
|
50 |
* |
|
51 |
* Revision 1.32 2006/02/23 17:55:45 fjp |
|
49 | 52 |
* Preparando para poder editar con el EditionManager |
50 | 53 |
* |
51 | 54 |
* Revision 1.31 2006/02/21 16:44:08 fjp |
... | ... | |
558 | 561 |
* |
559 | 562 |
* @param feat geometr?a a guardar. |
560 | 563 |
* |
561 |
* @return DOCUMENT ME!
|
|
564 |
* @return calculatedIndex
|
|
562 | 565 |
* |
563 | 566 |
* @throws DriverIOException |
564 | 567 |
* @throws IOException |
565 | 568 |
*/ |
566 | 569 |
public int doAddRow(IRow feat) throws DriverIOException, IOException { |
567 |
int virtualIndex=super.doAddRow(feat);
|
|
570 |
int calculatedIndex=super.doAddRow(feat);
|
|
568 | 571 |
// Actualiza el ?ndice espacial |
569 | 572 |
IGeometry g = ((IFeature)feat).getGeometry(); |
570 | 573 |
Rectangle2D r = g.getBounds2D(); |
571 | 574 |
index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(), r.getY(), |
572 |
r.getY() + r.getHeight()), new Integer(virtualIndex));
|
|
575 |
r.getY() + r.getHeight()), new Integer(calculatedIndex));
|
|
573 | 576 |
|
574 |
return virtualIndex;
|
|
577 |
return calculatedIndex;
|
|
575 | 578 |
} |
576 | 579 |
/** |
577 | 580 |
* Se desmarca como invalidada en el fichero de expansion o como eliminada |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/VectorialEditableDBAdapter.java | ||
---|---|---|
136 | 136 |
if (delRows.get(calculatedIndex) == true) |
137 | 137 |
{ |
138 | 138 |
boolean bFound = false; |
139 |
while ((delRows.get(calculatedIndex) == true) && (idFromExpansion < expansionFile.getSize()-1))
|
|
139 |
while ((!bFound) && (idFromExpansion < expansionFile.getSize()-1))
|
|
140 | 140 |
{ |
141 | 141 |
calculatedIndex++; |
142 | 142 |
idFromExpansion++; |
143 |
if (delRows.get(calculatedIndex) == false) |
|
143 |
Integer auxCalculated = new Integer(calculatedIndex); |
|
144 |
// Si no est? borrado y es una entidad v?lida, que est? siendo usada (no es algo que est? en el expansionFile sin usarse) |
|
145 |
if ((delRows.get(calculatedIndex) == false) && (relations.containsKey(auxCalculated))) |
|
144 | 146 |
{ |
145 | 147 |
bFound = true; |
148 |
calculated = auxCalculated; |
|
146 | 149 |
break; |
147 | 150 |
} |
148 | 151 |
else |
... | ... | |
369 | 372 |
* @see com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter#doAddRow(com.iver.cit.gvsig.fmap.core.IRow) |
370 | 373 |
*/ |
371 | 374 |
public int doAddRow(IRow feat) throws DriverIOException, IOException { |
372 |
int virtualIndex = super.doAddRow(feat);
|
|
373 |
Integer posInExpansionFile = (Integer) relations.get(new Integer(virtualIndex));
|
|
374 |
Integer virtual = new Integer(virtualIndex); // virtual es igual al numero de shapes originales + el numero de entidades a?adidas.
|
|
375 |
int calculatedIndex = super.doAddRow(feat);
|
|
376 |
Integer posInExpansionFile = (Integer) relations.get(new Integer(calculatedIndex));
|
|
377 |
Integer virtual = new Integer(calculatedIndex); // calculatedIndex es igual al numero de shapes originales + el numero de entidades a?adidas.
|
|
375 | 378 |
// es decir, virtual es el calculatedIndex (no tiene en cuenta los borrados) |
376 | 379 |
// calculatedIndex = indiceExterno + borrados hasta ese punto. |
377 | 380 |
mapFID2index.put(feat.getID(), virtual); |
378 | 381 |
mapIndex2FID.put(virtual, feat.getID()); |
379 |
return virtualIndex;
|
|
382 |
return calculatedIndex;
|
|
380 | 383 |
|
381 | 384 |
} |
382 | 385 |
|
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/EditableAdapter.java | ||
---|---|---|
196 | 196 |
* @throws IOException DOCUMENT ME! |
197 | 197 |
*/ |
198 | 198 |
public void addRow(IRow row,String descrip) throws DriverIOException, IOException { |
199 |
int virtualIndex = doAddRow(row);
|
|
200 |
Command command=new AddRowCommand(this, row, virtualIndex);
|
|
199 |
int calculatedIndex = doAddRow(row);
|
|
200 |
Command command=new AddRowCommand(this, row, calculatedIndex);
|
|
201 | 201 |
command.setDescription(descrip); |
202 | 202 |
if (complex) { |
203 | 203 |
commands.add(command); |
... | ... | |
426 | 426 |
* |
427 | 427 |
* @param feat geometr?a a guardar. |
428 | 428 |
* |
429 |
* @return DOCUMENT ME!
|
|
429 |
* @return calculatedIndex
|
|
430 | 430 |
* |
431 | 431 |
* @throws DriverIOException |
432 | 432 |
* @throws IOException |
... | ... | |
436 | 436 |
// int virtualIndex = 0; |
437 | 437 |
int calculatedIndex = -1; |
438 | 438 |
|
439 |
// try {
|
|
440 |
// virtualIndex = (int) ods.getRowCount() + numAdd;
|
|
441 |
int externalIndex = getRowCount(); |
|
442 |
calculatedIndex = getCalculatedIndex(externalIndex); |
|
443 |
/* } catch (DriverException e) {
|
|
439 |
try { |
|
440 |
calculatedIndex = (int) ods.getRowCount() + numAdd;
|
|
441 |
// int externalIndex = getRowCount();
|
|
442 |
// calculatedIndex = getCalculatedIndex(externalIndex);
|
|
443 |
} catch (DriverException e) { |
|
444 | 444 |
throw new DriverIOException(e); |
445 |
} */
|
|
445 |
} |
|
446 | 446 |
|
447 | 447 |
int pos = expansionFile.addRow(feat); |
448 | 448 |
relations.put(new Integer(calculatedIndex), new Integer(pos)); |
Also available in: Unified diff