Revision 3996 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/VectorialEditableAdapter.java
VectorialEditableAdapter.java | ||
---|---|---|
45 | 45 |
* |
46 | 46 |
* $Id$ |
47 | 47 |
* $Log$ |
48 |
* Revision 1.17 2006-02-07 10:18:44 caballero |
|
48 |
* Revision 1.18 2006-02-08 15:18:45 caballero |
|
49 |
* control de las rows eliminadas |
|
50 |
* |
|
51 |
* Revision 1.17 2006/02/07 10:18:44 caballero |
|
49 | 52 |
* Con BoundedShape |
50 | 53 |
* |
51 | 54 |
* Revision 1.16 2006/02/06 12:01:41 caballero |
... | ... | |
165 | 168 |
*/ |
166 | 169 |
public IGeometry getShape(int rowIndex) throws DriverIOException { |
167 | 170 |
// Si no est? en el fichero de expansi?n |
168 |
Integer integer = new Integer((int) rowIndex); |
|
171 |
int calculatedIndex=getCalculatedIndex(rowIndex); |
|
172 |
Integer integer = new Integer(calculatedIndex); |
|
169 | 173 |
if (!relations.containsKey(integer)) { |
170 | 174 |
// Si ha sido eliminada |
171 |
if (delRows.get(integer.intValue())) { |
|
175 |
/*if (delRows.get(integer.intValue())) {
|
|
172 | 176 |
return null; |
173 |
} else { |
|
174 |
return ova.getShape(rowIndex);
|
|
175 |
} |
|
177 |
} else {*/
|
|
178 |
return ova.getShape(calculatedIndex);
|
|
179 |
//}
|
|
176 | 180 |
} else { |
177 | 181 |
int num = ((Integer) relations.get(integer)).intValue(); |
178 | 182 |
DefaultRowEdited feat; |
... | ... | |
293 | 297 |
* @throws IOException |
294 | 298 |
*/ |
295 | 299 |
public void doRemoveRow(int index) throws DriverIOException, IOException { |
296 |
Integer integer = new Integer(index); |
|
300 |
//Llega el calculatedIndex |
|
301 |
Integer integer = new Integer(index); |
|
297 | 302 |
|
298 | 303 |
IFeature feat = null; |
299 |
|
|
304 |
delRows.set(index, true); |
|
300 | 305 |
//Si la geometr?a no ha sido modificada |
301 | 306 |
if (!relations.containsKey(integer)) { |
302 |
delRows.set(index, true); |
|
307 |
|
|
303 | 308 |
try { |
304 | 309 |
feat = (DefaultFeature) (ova.getFeature(index)); |
305 | 310 |
} catch (DriverException e) { |
... | ... | |
309 | 314 |
} else { |
310 | 315 |
int num = ((Integer) relations.get(integer)).intValue(); |
311 | 316 |
feat = (IFeature) expansionFile.getRow(num).getLinkedRow(); |
312 |
expansionFile.invalidateRow(num); |
|
317 |
//expansionFile.invalidateRow(num);
|
|
313 | 318 |
} |
314 |
|
|
319 |
System.err.println("Elimina una Row en la posici?n: " + index); |
|
315 | 320 |
//Se actualiza el ?ndice |
316 | 321 |
if (feat != null) { |
317 | 322 |
Rectangle2D r = feat.getGeometry().getBounds2D(); |
318 |
this.index.remove(new Envelope(r.getX(), r.getX() + r.getWidth(), |
|
323 |
boolean borrado=this.index.remove(new Envelope(r.getX(), r.getX() + r.getWidth(),
|
|
319 | 324 |
r.getY(), r.getY() + r.getHeight()), new Integer(index)); |
325 |
System.out.println("Est? borrado : "+ borrado); |
|
326 |
System.out.println("Index.lenght : "+ this.index.size()); |
|
327 |
|
|
320 | 328 |
} |
321 | 329 |
} |
322 | 330 |
/** |
... | ... | |
341 | 349 |
Integer integer = new Integer(index); |
342 | 350 |
|
343 | 351 |
IFeature featAnt = null; |
344 |
|
|
352 |
System.err.println("Modifica una Row en la posici?n: " + index); |
|
345 | 353 |
//Si la geometr?a no ha sido modificada |
346 | 354 |
if (!relations.containsKey(integer)) { |
347 | 355 |
int expansionIndex = expansionFile.addRow(feat); |
... | ... | |
413 | 421 |
*/ |
414 | 422 |
public void undoModifyRow(int geometryIndex, int previousExpansionFileIndex) |
415 | 423 |
throws IOException, DriverIOException { |
416 |
/* |
|
424 |
//Llega el CalculatedIndex |
|
425 |
/* |
|
417 | 426 |
* Si la acci?n de modificar se realiz? sobre una geometr?a original |
418 | 427 |
*/ |
419 | 428 |
if (previousExpansionFileIndex == -1) { |
... | ... | |
451 | 460 |
new Integer(previousExpansionFileIndex)); |
452 | 461 |
|
453 | 462 |
//Se recupera la geometr?a |
454 |
expansionFile.validateRow(previousExpansionFileIndex); |
|
463 |
//expansionFile.validateRow(previousExpansionFileIndex);
|
|
455 | 464 |
|
456 | 465 |
//Se actualizan los ?ndices |
457 | 466 |
g = ((DefaultFeature) getRow(geometryIndex).getLinkedRow()).getGeometry(); |
... | ... | |
539 | 548 |
|
540 | 549 |
for (int index = 0; index < l.size(); index++) { |
541 | 550 |
Integer i = (Integer) l.get(index); |
542 |
indexes[index] = i.intValue();
|
|
551 |
indexes[index] = getInversedIndex(i.intValue());
|
|
543 | 552 |
} |
544 | 553 |
|
545 | 554 |
return indexes; |
... | ... | |
548 | 557 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShapeCount() |
549 | 558 |
*/ |
550 | 559 |
public int getShapeCount() throws DriverIOException { |
551 |
return ova.getShapeCount()+numAdd; |
|
560 |
try { |
|
561 |
return getRowCount(); |
|
562 |
} catch (IOException e) { |
|
563 |
throw new DriverIOException(e); |
|
564 |
} |
|
552 | 565 |
} |
553 | 566 |
|
554 | 567 |
/** |
Also available in: Unified diff