Revision 4191

View differences:

trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/strategies/DBStrategy.java
109 109
	        // => MODIFICAR EL getFeatureIterator para que admita los nombres
110 110
	        // de los campos adem?s del rect?ngulo que pides.
111 111
	        String[] usedFields = null;
112
	        VectorialLegend l = null;
112 113
	        if (lyr.getLegend() instanceof VectorialLegend)
113 114
	        {
114
	            VectorialLegend legend = (VectorialLegend) lyr.getLegend();
115
	            // TODO: Meter en el interaz Legend un m?todo String[] getUsedFields()
115
	            l = (VectorialLegend) lyr.getLegend();
116 116
	        }
117 117
	        
118 118
	        Rectangle2D rectAux = viewPort.getAdjustedExtent();
......
121 121
	            rectAux = invertedCT.convert(rectAux);            
122 122
	        }
123 123
	
124
	        VectorialLegend l = (VectorialLegend) ((ClassifiableVectorial) capa).getLegend();
124
	        
125 125
	        usedFields = l.getUsedFields();
126 126
	
127 127
	        
......
153 153
	        		break;
154 154
	        	}
155 155
	        	IFeature feat = geomIt.next();
156
	        	if (feat == null) continue;
156
	        	if (feat == null)
157
	        	{
158
	        		continue;
159
	        	}
157 160
	            IGeometry geom = feat.getGeometry();
158 161
	            
159 162
	            System.out.println("PINTANDO FEATURE " + feat.getID());
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/DefaultRow.java
96 96

  
97 97
        return dr;
98 98
    }
99
    
100
	public void setID(String ID) {
101
		id = ID;
102
	}
103
    
99 104
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/IRow.java
18 18
	public Value[] getAttributes();
19 19

  
20 20
	public IRow cloneRow();
21
	
22
	public void setID(String ID);
21 23

  
22 24
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/commands/ModifyRowCommand.java
13 13
	private int indexAnt;
14 14
	private int previousIndex;
15 15

  
16
	public ModifyRowCommand(IEditableSource ef,int i,int p,IRow newRow) throws IOException, DriverIOException{
16
	/**
17
	 * @param ef IEditableSource
18
	 * @param i index of modified row
19
	 * @param p previous index in expansion file. -1 if previous is from original data source.
20
	 * @param newRow 
21
	 * @throws IOException
22
	 * @throws DriverIOException
23
	 */
24
	public ModifyRowCommand(IEditableSource ef,int i,int previousInExpansionFile,IRow newRow) throws IOException, DriverIOException{
17 25
		super();
18 26
		efs=ef;
19 27
		indexAnt=i;
20 28
		rowNext=newRow;
21
		previousIndex=p;
29
		previousIndex=previousInExpansionFile;
22 30
	}
23 31
	/**
24 32
	 * @throws DriverIOException
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/VectorialEditableAdapter.java
45 45
 *
46 46
 * $Id$
47 47
 * $Log$
48
 * Revision 1.31  2006-02-21 16:44:08  fjp
48
 * Revision 1.32  2006-02-23 17:55:45  fjp
49 49
 * Preparando para poder editar con el EditionManager
50 50
 *
51
 * Revision 1.31  2006/02/21 16:44:08  fjp
52
 * Preparando para poder editar con el EditionManager
53
 *
51 54
 * Revision 1.30  2006/02/20 18:14:59  fjp
52 55
 * Preparando para poder editar con el EditionManager
53 56
 *
......
353 356
        } else {
354 357
            int num = ((Integer) relations.get(integer)).intValue();
355 358
            IRowEdited aux = expansionFile.getRow(num);
356
            edRow = new DefaultRowEdited(aux.getLinkedRow(),
357
			        aux.getStatus(), index);
359
            edRow = new DefaultRowEdited(aux.getLinkedRow().cloneRow(), aux.getStatus(), index);
358 360
            return edRow;
359 361
        }
360
    }
362
    } 
361 363
    /**
362 364
     * Elimina una geometria. Si es una geometr?a original de la capa en
363 365
     * edici?n se marca como eliminada (haya sido modificada o no). Si es una
......
369 371
     * @throws DriverIOException
370 372
     * @throws IOException
371 373
     */
372
    public void doRemoveRow(int index) throws DriverIOException, IOException {
374
    public IRow doRemoveRow(int index) throws DriverIOException, IOException {
373 375
        //Llega el calculatedIndex
374 376
    	Integer integer = new Integer(index);
375 377

  
......
400 402

  
401 403
        }
402 404
        setSelection(new FBitSet());
405
        return feat;
403 406
    }
404 407
    /**
405 408
     * Si se intenta modificar una geometr?a original de la capa en edici?n se
......
409 412
     * invoca el m?todo modifyGeometry y se actualiza el ?ndice de la
410 413
     * geometria en el fichero.
411 414
     *
412
     * @param index DOCUMENT ME!
415
     * @param calculatedIndex DOCUMENT ME!
413 416
     * @param feat DOCUMENT ME!
414 417
     *
415 418
     * @return position inside ExpansionFile
......
417 420
     * @throws IOException
418 421
     * @throws DriverIOException
419 422
     */
420
    public int doModifyRow(int index, IRow feat)
423
    public int doModifyRow(int calculatedIndex, IRow feat)
421 424
        throws IOException, DriverIOException {
422
        int posInExpansionFile = -1;
423
        Integer integer = new Integer(index);
425
        int posAnteriorInExpansionFile = -1;
426
        Integer integer = new Integer(calculatedIndex);
424 427

  
425 428
        IFeature featAnt = null;
426
        System.err.println("Modifica una Row en la posici?n: " + index);
429
        System.err.println("Modifica una Row en la posici?n: " + calculatedIndex);
427 430
        //Si la geometr?a no ha sido modificada
428 431
        if (!relations.containsKey(integer)) {
429
        	posInExpansionFile = expansionFile.addRow(feat);
430
            relations.put(integer, new Integer(posInExpansionFile));
432
        	int newPosition = expansionFile.addRow(feat);
433
            relations.put(integer, new Integer(newPosition));
431 434

  
432 435
            //Se actualiza el ?ndice espacial
433 436
            try {
434
				featAnt = (DefaultFeature) (ova.getFeature(index));
437
				featAnt = (DefaultFeature) (ova.getFeature(calculatedIndex));
435 438
			} catch (DriverException e) {
436 439
				// TODO Auto-generated catch block
437 440
				e.printStackTrace();
......
441 444
            Rectangle2D r = ((IFeature) feat).getGeometry().getBounds2D();
442 445
            this.index.remove(new Envelope(rAnt.getX(),
443 446
                    rAnt.getX() + rAnt.getWidth(), rAnt.getY(),
444
                    rAnt.getY() + rAnt.getHeight()), new Integer(index));
447
                    rAnt.getY() + rAnt.getHeight()), new Integer(calculatedIndex));
445 448
            this.index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(),
446
                    r.getY(), r.getY() + r.getHeight()), new Integer(index));
449
                    r.getY(), r.getY() + r.getHeight()), new Integer(calculatedIndex));
447 450
        } else {
448 451
            //Obtenemos el ?ndice en el fichero de expansi?n
449 452
            int num = ((Integer) relations.get(integer)).intValue();
453
            posAnteriorInExpansionFile = num;
450 454

  
451 455
            //Obtenemos la geometr?a para actualiza el ?ndice espacialposteriormente
452 456
            featAnt = (IFeature) expansionFile.getRow(num).getLinkedRow();
......
462 466
             * de expansi?n.
463 467
             */
464 468
            relations.put(integer, new Integer(num));
465
            posInExpansionFile = num;
466 469

  
467 470
            //Se modifica el ?ndice espacial
468 471
            Rectangle2D rAnt = featAnt.getGeometry().getBounds2D();
469 472
            Rectangle2D r = ((IFeature) feat).getGeometry().getBounds2D();
470 473
            this.index.remove(new Envelope(rAnt.getX(),
471 474
                    rAnt.getX() + rAnt.getWidth(), rAnt.getY(),
472
                    rAnt.getY() + rAnt.getHeight()), new Integer(index));
475
                    rAnt.getY() + rAnt.getHeight()), new Integer(calculatedIndex));
473 476
            this.index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(),
474
                    r.getY(), r.getY() + r.getHeight()), new Integer(index));
477
                    r.getY(), r.getY() + r.getHeight()), new Integer(calculatedIndex));
475 478
        }
476 479

  
477
        return posInExpansionFile;
480
        return posAnteriorInExpansionFile;
478 481
    }
479 482
    /**
480 483
     * Actualiza en el mapa de ?ndices, la posici?n en la que estaba la
......
521 524
        } else {
522 525
            //Se obtiene la geometr?a para actualizar el ?ndice
523 526
            IGeometry g = null;
524
            g = ((DefaultFeature) getRow(geometryIndex).getLinkedRow()).getGeometry();
527
            int inverse = getInversedIndex(geometryIndex);
528
            g = ((DefaultFeature) getRow(inverse).getLinkedRow()).getGeometry();
529
            System.out.println("Actual: " + g.toString());
525 530

  
526 531
            Rectangle2D r = g.getBounds2D();
527 532
            this.index.remove(new Envelope(r.getX(), r.getX() + r.getWidth(),
......
537 542
            //expansionFile.validateRow(previousExpansionFileIndex);
538 543

  
539 544
            //Se actualizan los ?ndices
540
            g = ((DefaultFeature) getRow(geometryIndex).getLinkedRow()).getGeometry();
545
            // g = ((IFeature) (expansionFile.getRow(previousExpansionFileIndex).getLinkedRow())).getGeometry();
546
            // System.out.println("Anterior a la que volvemos : " + g.toString());
547
            g = ((DefaultFeature) getRow(inverse).getLinkedRow()).getGeometry();
541 548
            r = g.getBounds2D();
542 549
            this.index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(),
543 550
                    r.getY(), r.getY() + r.getHeight()),
......
595 602
     * @throws DriverIOException
596 603
     * @throws IOException
597 604
     */
598
    public void undoAddRow(int index) throws DriverIOException, IOException {
599
        IGeometry g = ((IFeature) getRow(index).getLinkedRow()).getGeometry();
605
    public void undoAddRow(int calculatedIndex) throws DriverIOException, IOException {
606
    	int inverse = getInversedIndex(calculatedIndex);
607
        IGeometry g = ((IFeature) getRow(inverse).getLinkedRow()).getGeometry();
600 608
        Rectangle2D r = g.getBounds2D();
601 609
        this.index.remove(new Envelope(r.getX(), r.getX() + r.getWidth(),
602
                r.getY(), r.getY() + r.getHeight()), new Integer(index));
610
                r.getY(), r.getY() + r.getHeight()), new Integer(calculatedIndex));
603 611

  
604
        super.undoAddRow(index);
612
        super.undoAddRow(calculatedIndex);
605 613
        setSelection(new FBitSet());
606 614
    }
607 615
    /**
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/VectorialEditableDBAdapter.java
9 9
import java.util.Hashtable;
10 10
import java.util.List;
11 11

  
12
import com.hardcode.gdbms.engine.values.Value;
13
import com.hardcode.gdbms.engine.values.ValueFactory;
14 12
import com.iver.cit.gvsig.fmap.DriverException;
15
import com.iver.cit.gvsig.fmap.core.DefaultFeature;
16 13
import com.iver.cit.gvsig.fmap.core.IFeature;
14
import com.iver.cit.gvsig.fmap.core.IGeometry;
17 15
import com.iver.cit.gvsig.fmap.core.IRow;
18 16
import com.iver.cit.gvsig.fmap.core.v02.FConverter;
19 17
import com.iver.cit.gvsig.fmap.drivers.DBLayerDefinition;
......
21 19
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator;
22 20
import com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver;
23 21
import com.iver.cit.gvsig.fmap.layers.ISpatialDB;
22
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial;
24 23
import com.iver.cit.gvsig.fmap.layers.VectorialDBAdapter;
25 24
import com.vividsolutions.jts.geom.Envelope;
26 25
import com.vividsolutions.jts.index.quadtree.Quadtree;
......
73 72
				if (bOriginalCursorOpened) {
74 73
					feat = featIt.next();
75 74
					int originalIndex = dbDriver.getRowIndexByFID(feat);
76
					calculatedIndex = getCalculatedIndex(originalIndex);
75
					
77 76
					// Iteramos hasta que encontremos alguno no borrado.
78
					if (delRows.get(calculatedIndex)) // Si est? borrado
77
					// Aqu? suponemos que el orden es el original. Si no, no funcionar?.
78
					if (delRows.get(originalIndex)) // Si est? borrado
79 79
					{
80 80
						feat = null;
81 81
						boolean bFound = false;
......
83 83
						{
84 84
							feat = featIt.next();
85 85
							originalIndex = dbDriver.getRowIndexByFID(feat);
86
							calculatedIndex = getCalculatedIndex(originalIndex);
87
							if (delRows.get(calculatedIndex) == false) // Si NO est? borrado
86
							// calculatedIndex = getCalculatedIndex(originalIndex);
87
							if (delRows.get(originalIndex) == false) // Si NO est? borrado
88 88
							{
89 89
								bFound = true;
90 90
								break;
......
97 97
					} // if delRows
98 98
					if (bOriginalCursorOpened) // Si todav?a quedan features por leer, y no est?n borradas
99 99
					{
100
						calculatedIndex = originalIndex; //getCalculatedIndex(originalIndex);
100 101
						Integer integer = new Integer(calculatedIndex);
101 102
						if (!relations.containsKey(integer)) { // Si no est? en el
102 103
																// fichero de
......
120 121
			} // if primer bOriginalCursorOpened
121 122
			if (!bOriginalCursorOpened) {
122 123
				// Si ya no hay m?s de las originales, todav?a tenemos
123
				// que revisar las nuevas y modificadas que hay en el fichero
124
				// que revisar las a?adidas que hay en el fichero
124 125
				// de expansi?n
125
				if (idFromExpansion < listFromExpansion.size()) {
126
					Integer i = (Integer) listFromExpansion
127
							.get(idFromExpansion);
128
					// int inverse = getInversedIndex(i.intValue());
129
					// Integer integer = new Integer(inverse);
130
					calculatedIndex = i.intValue();
131
					// TODO: REVISAR AQUI LOS BORRADOS
132
					if (delRows.get(calculatedIndex)) // Si est? borrado
126
				try {
127
					while ((idFromExpansion < expansionFile.getSize()) && (feat == null))
133 128
					{
134
						feat = null;
135
						boolean bFound = false;
136
						while (idFromExpansion < listFromExpansion.size())
129
						IRowEdited rowEd = expansionFile.getRow(idFromExpansion);
130
						IFeature aux = (IFeature) rowEd.getLinkedRow().cloneRow();
131
						Integer calculated = (Integer) mapFID2index.get(aux.getID());
132
						calculatedIndex = calculated.intValue();
133
						System.out.println("El elemento idFromExpansion = " + idFromExpansion + " es " + aux.getID());
134
						
135
						// Revisamos los borrados
136
						if (delRows.get(calculatedIndex) == true)
137 137
						{
138
							i = (Integer) listFromExpansion.get(idFromExpansion);
139
							calculatedIndex = i.intValue();
140
							if (delRows.get(calculatedIndex) == false) // Si NO est? borrado
138
							boolean bFound = false;
139
							while ((delRows.get(calculatedIndex) == true) && (idFromExpansion < expansionFile.getSize()-1))
141 140
							{
142
								bFound = true;
143
								break;
141
								calculatedIndex++;
142
								idFromExpansion++;
143
								if (delRows.get(calculatedIndex) == false)
144
								{
145
									bFound = true;
146
									break;
147
								}
148
								else
149
								{
150
									System.out.println("El elemento idFromExpansion = " + idFromExpansion + " est? borrado");									
151
								}
144 152
							}
145
						}
146
						if (bFound == false) // Todos los ?ltimos est?n borrados.
153
							if (bFound)
154
							{
155
								calculated = new Integer(calculatedIndex);
156
								rowEd = expansionFile.getRow(idFromExpansion);
157
								aux = (IFeature) rowEd.getLinkedRow().cloneRow();							
158
							}
159
							else
160
							{
161
								return false; // El resto est?n borrados
162
							}
163
						} // if primer borrado
164
						if (relations.containsKey(calculated))
147 165
						{
148
							return false; // Todos borrados. 
149
							// TODO: REVISAR. CREO QUE EN EL INDICE ESPACIAL
150
							// NO VIENEN LOS BORRADOS PORQUE LOS HEMOS QUITADO DE AH?.
151
						}
152
					} // if delRows
153
					
154
					Integer integer = new Integer(calculatedIndex);
155
					// if (!alreadyDone.containsKey(integer))
156
					{
157
						if (relations.containsKey(integer)) {
158
							int num = ((Integer) relations.get(integer))
159
									.intValue();
160
							IRowEdited auxR;
161
							try {
162
								auxR = expansionFile.getRow(num);
163
								feat = (IFeature) auxR.cloneRow();
164
								// feat = (IFeature) auxR.getLinkedRow();
165
							} catch (IOException e1) {
166
								e1.printStackTrace();
167
								throw new DriverException(e1);
166
							Integer realExpansionIndex = (Integer) relations.get(calculated);
167
							if (realExpansionIndex.intValue() == idFromExpansion)
168
							{
169
								feat = aux;
168 170
							}
169 171
						}
172
						idFromExpansion++;
170 173
					}
171
					idFromExpansion++;
174
				} catch (IOException e) {
175
					throw new DriverException(e);
172 176
				}
173 177
			}
174 178

  
175 179
			if (calculatedIndex == -1)
176 180
				return false;
177 181
			else {
178
				if (delRows.get(calculatedIndex))
179
					feat = null;
182
				if (feat == null)
183
				{
184
					if (idFromExpansion == expansionFile.getSize())
185
						return false;
186
					else
187
						System.err.println("ERROR DE ENTREGA DE FEATURE EN hasNext del Iterador");
188
				}
189
				/* if (delRows.get(calculatedIndex))
190
					feat = null; */
180 191
				return true;
181 192
			}
182 193

  
......
198 209
	}
199 210

  
200 211
	
201
	private Hashtable hashFIDtoExpansionFile = new Hashtable();
212
	private Hashtable mapFID2index = new Hashtable();
213
	private Hashtable mapIndex2FID = new Hashtable();
202 214
	/**
203 215
	 * 
204 216
	 */
......
217 229
			throws DriverException {
218 230
		ArrayList aux = new ArrayList();
219 231
		IFeatureIterator featIt = getFeatureIterator(r, strEPSG, null);
232
		int numEntities = 0;
220 233
		while (featIt.hasNext()) {
221 234
			IFeature feat = featIt.next();
222 235
			// TODO:
236
			assert(feat !=null);
223 237
			int index = getRowIndexByFID(feat);
224 238
			IRowEdited edRow = new DefaultRowEdited(feat, IRowEdited.STATUS_ORIGINAL, index);
225 239
			aux.add(edRow);
240
			numEntities++;
226 241
		}
227 242

  
228 243
		return (IRowEdited[]) aux.toArray(new IRowEdited[0]);
......
246 261
			// No metemos ninguna entidad de las originales dentro
247 262
			// de la base de datos porque esa consulta ya la
248 263
			// hace getFeatures sin tener en cuenta el ?ndice local.
264
			 for (int i = 0; i < ova.getShapeCount(); i++)
265
			 {
266
				 IFeature feat = ova.getFeature(i);
267
				 Integer calculatedIndex = new Integer(i);
268
				 mapFID2index.put(feat.getID(), calculatedIndex);
269
				 mapIndex2FID.put(calculatedIndex, feat.getID());
270
			 }
249 271

  
250 272
			/*
251 273
			 * for (int i = 0; i < ova.getShapeCount(); i++) { IGeometry g=null;
......
262 284
			 */
263 285
		} catch (IOException e) {
264 286
			throw new EditionException(e);
287
		} catch (DriverIOException e) {
288
			throw new EditionException(e);
289
		} catch (DriverException e) {
290
			throw new EditionException(e);
265 291
		}
266 292

  
267 293
		System.err.println("Se han metido en el ?ndice "
......
310 336
	}
311 337

  
312 338
	public int getRowIndexByFID(IFeature feat) {
313
		int resul;
339
		/* int resul;
314 340
		VectorialDBAdapter orig = (VectorialDBAdapter) ova;
315 341
		resul = orig.getRowIndexByFID(feat);
342
		int externalIndex = -1; 
316 343
		if (resul == -1)
317 344
		{
318 345
			// No est? en los originales. Si no est? borrado, 
319 346
			// estar? en el fichero de expansi?n.
320 347
			Integer integer = (Integer) hashFIDtoExpansionFile.get(feat.getID());
321 348
			resul = integer.intValue();
322
			// resul = getInversedIndex(resul);
349
			IRowEdited rowEd;
350
			try {
351
				rowEd = expansionFile.getRow(resul);
352
				externalIndex = rowEd.getIndex();
353
			} catch (IOException e) {
354
				// TODO Auto-generated catch block
355
				e.printStackTrace();
356
			}
357
				
323 358
			
324 359
		}
325
		return resul;
360
		else
361
		{
362
			externalIndex = getInversedIndex(resul); 
363
		} */
364
		Integer calculatedIndex = (Integer) mapFID2index.get(feat.getID());
365
		return getInversedIndex(calculatedIndex.intValue());
326 366
	}
327 367

  
328 368
	/* (non-Javadoc)
......
330 370
	 */
331 371
	public int doAddRow(IRow feat) throws DriverIOException, IOException {
332 372
		int virtualIndex = super.doAddRow(feat);
333
		int externalIndex = getInversedIndex(virtualIndex);
334
		hashFIDtoExpansionFile.put(feat.getID(), new Integer(externalIndex));
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
					// es decir, virtual es el calculatedIndex (no tiene en cuenta los borrados)
376
					// calculatedIndex = indiceExterno + borrados hasta ese punto.
377
		mapFID2index.put(feat.getID(), virtual);
378
		mapIndex2FID.put(virtual, feat.getID());
335 379
		return virtualIndex;
336 380
		
337 381
	}
......
339 383
	/* (non-Javadoc)
340 384
	 * @see com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter#doModifyRow(int, com.iver.cit.gvsig.fmap.core.IRow)
341 385
	 */
342
	public int doModifyRow(int index, IRow feat) throws IOException, DriverIOException {
343
		int virtualIndex = super.doModifyRow(index, feat);
344
		// int externalIndex = getInversedIndex(virtualIndex);
345
		hashFIDtoExpansionFile.put(feat.getID(), new Integer(index));
346
		return virtualIndex;
386
	public int doModifyRow(int calculatedIndex, IRow feat) throws IOException, DriverIOException {
387
		int posAnteriorInExpansionFile = super.doModifyRow(calculatedIndex, feat); // devolver? -1 si es original
388
		// No hacemos nada con las modificaciones sobre los ?ndices.
389
		// Suponiendo que feat tenga la misma ID que la que hab?a antes.
390
		Integer virtual = new Integer(calculatedIndex);
391
		String theIDoriginal = (String) mapIndex2FID.get(virtual);
392
		if (!theIDoriginal.equals(feat.getID()))
393
		{
394
			AssertionError err = new AssertionError("Fallo al modificar la fila. ID viejo=" + theIDoriginal + " ID nuevo = " + feat.getID());
395
			err.printStackTrace();
396
		}
397
		// hashFIDtoExpansionFile.put(feat.getID(), new Integer(posInExpansionFile));
398
		return posAnteriorInExpansionFile;
347 399
	}
348 400

  
349 401
	/* (non-Javadoc)
350 402
	 * @see com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter#doRemoveRow(int)
351 403
	 */
352
	public void doRemoveRow(int index) throws DriverIOException, IOException {
404
	public IRow doRemoveRow(int index) throws DriverIOException, IOException {
353 405
		// Le entra un calculatedIndex, as? que delRows tiene guardados
354 406
		// los ?ndices internos, no los externos.
355
		super.doRemoveRow(index);
407
		IFeature deletedFeat = (IFeature) super.doRemoveRow(index);
408
		// Lo borramos de hashFIDtoExpansionFile
409
		// hashFIDtoExpansionFile.remove(deletedFeat.getID());
410
		return deletedFeat;
356 411
	}
357 412

  
413
	/* (non-Javadoc)
414
	 * @see com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter#getFeature(int)
415
	 */
416
	public IFeature getFeature(int numReg) throws DriverException {
417
		// TODO Auto-generated method stub
418
		return super.getFeature(numReg);
419
	}
420

  
421
	/* (non-Javadoc)
422
	 * @see com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter#getRow(int)
423
	 */
424
	public IRowEdited getRow(int index) throws DriverIOException, IOException {
425
		// TODO Auto-generated method stub
426
		return super.getRow(index);
427
	}
428

  
429
	/* (non-Javadoc)
430
	 * @see com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter#getShape(int)
431
	 */
432
	public IGeometry getShape(int rowIndex) throws DriverIOException {
433
		// TODO Auto-generated method stub
434
		return super.getShape(rowIndex);
435
	}
436

  
437
	/* (non-Javadoc)
438
	 * @see com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter#getShapeBounds(int)
439
	 */
440
	public Rectangle2D getShapeBounds(int index) throws IOException {
441
		// TODO Auto-generated method stub
442
		return super.getShapeBounds(index);
443
	}
444

  
445
	/* (non-Javadoc)
446
	 * @see com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter#getShapeType(int)
447
	 */
448
	public int getShapeType(int index) {
449
		// TODO Auto-generated method stub
450
		return super.getShapeType(index);
451
	}
452

  
453
	/* (non-Javadoc)
454
	 * @see com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter#setOriginalVectorialAdapter(com.iver.cit.gvsig.fmap.layers.ReadableVectorial)
455
	 */
456
	public void setOriginalVectorialAdapter(ReadableVectorial rv) {
457
		// El ?ndice espacial se est? calcualndo en el startEdition, pero
458
		// OJO: No se hace con un while, sino con un getRow().
459
		// Si va lento, habr? que reescribirlo.
460
		super.setOriginalVectorialAdapter(rv);
461
	}
462

  
463
	/* (non-Javadoc)
464
	 * @see com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter#undoAddRow(int)
465
	 */
466
	public void undoAddRow(int index) throws DriverIOException, IOException {
467
		// TODO Auto-generated method stub
468
		super.undoAddRow(index);
469
	}
470

  
471
	/* (non-Javadoc)
472
	 * @see com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter#undoModifyRow(int, int)
473
	 */
474
	public void undoModifyRow(int geometryIndex, int previousExpansionFileIndex) throws IOException, DriverIOException {
475
		// TODO Auto-generated method stub
476
		super.undoModifyRow(geometryIndex, previousExpansionFileIndex);
477
	}
478

  
479
	/* (non-Javadoc)
480
	 * @see com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter#undoRemoveRow(int)
481
	 */
482
	public void undoRemoveRow(int index) throws IOException, DriverIOException {
483
		// TODO Auto-generated method stub
484
		super.undoRemoveRow(index);
485
	}
486

  
358 487
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/DefaultRowEdited.java
16 16
	 *
17 17
	 * @param baseRow
18 18
	 * @param status
19
	 * @param linkedId
19
	 * @param externalIndex
20 20
	 */
21 21
	public DefaultRowEdited(IRow baseRow, int status, int index)
22 22
	{
......
48 48
	public int getIndex() {
49 49
		return index;
50 50
	}
51
	public void setID(String ID) {
52
		row.setID(ID);
53
	}
51 54

  
52 55
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/MemoryExpansionFile.java
155 155

  
156 156
	}
157 157

  
158
	public int getSize() {
159
		return rows.size();
160
	}
161

  
158 162
	/* (non-Javadoc)
159 163
	 * @see com.iver.cit.gvsig.fmap.edition.ExpansionFile#validateRow(int)
160 164
	 */
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/IEditableSource.java
194 194
     */
195 195
    void endComplexRow() throws IOException, DriverIOException;
196 196
    public void undoModifyRow(int geometryIndex,int previousExpansionFileIndex) throws IOException, DriverIOException;
197
    public void doRemoveRow(int index)throws DriverIOException, IOException;
197
    public IRow doRemoveRow(int index)throws DriverIOException, IOException;
198 198
    public int doModifyRow(int index, IRow feat)throws IOException, DriverIOException;
199 199
    public int doAddRow(IRow feat) throws DriverIOException, IOException;
200 200
    public void undoRemoveRow(int index)throws IOException, DriverIOException;
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/ExpansionFile.java
103 103
	 */
104 104
	//void validateRow(int previousExpansionFileIndex);
105 105
	//BitSet getInvalidRows();
106
    
107
    int getSize();
106 108
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/EditableAdapter.java
145 145
    public IRowEdited getRow(int index) throws DriverIOException, IOException {
146 146
    	int calculatedIndex=getCalculatedIndex(index);
147 147
    	Integer integer = new Integer(calculatedIndex);
148

  
148
    	DefaultRowEdited edRow = null;
149 149
        //Si no est? en el fichero de expansi?n
150
        if (!relations.containsKey(integer)) {
151
                DefaultRowEdited edRow = null;
152

  
150
        if (!relations.containsKey(integer)) {                
153 151
                try {
154
                    edRow = new DefaultRowEdited(new DefaultRow(ods.getRow(calculatedIndex), "" + index),
152
                    /* edRow = new DefaultRowEdited(new DefaultRow(ods.getRow(calculatedIndex), "" + index),
153
                            DefaultRowEdited.STATUS_ORIGINAL, index); */
154
                    edRow = new DefaultRowEdited(new DefaultRow(ods.getRow(calculatedIndex)),
155 155
                            DefaultRowEdited.STATUS_ORIGINAL, index);
156 156
                } catch (DriverException e) {
157 157
                    throw new DriverIOException(e);
......
160 160
                return edRow;
161 161
        } else {
162 162
            int num = ((Integer) relations.get(integer)).intValue();
163

  
164
            return expansionFile.getRow(num);
163
            
164
            // return expansionFile.getRow(num);
165
            IRowEdited rowFromExpansion = expansionFile.getRow(num); 
166
            // ?Habr?a que hacer aqu? setID(index + "")?
167
            edRow = new DefaultRowEdited(rowFromExpansion.getLinkedRow().cloneRow(), rowFromExpansion.getStatus(), index);
168
            return edRow; 
165 169
        }
166 170
    }
167 171

  
......
362 366
     * @throws DriverIOException
363 367
     * @throws IOException
364 368
     */
365
    public void doRemoveRow(int index) throws DriverIOException, IOException {
369
    public IRow doRemoveRow(int index) throws DriverIOException, IOException {
366 370
//Llega un calculatedIndex
367 371
            delRows.set(index, true);
368 372
            System.err.println("Elimina una Row en la posici?n: " + index);
373
            // TODO: Con tablas no es necesario devolver la anterior feature. Por ahora.
374
            return null;
369 375
    }
370 376

  
371 377
    /**
......
427 433
     */
428 434
    public int doAddRow(IRow feat) throws DriverIOException, IOException {
429 435
        // A?ade la geometr?a
430
        int virtualIndex = 0;
436
        // int virtualIndex = 0;
437
        int calculatedIndex = -1;
431 438

  
432
        try {
433
            virtualIndex = (int) ods.getRowCount() + numAdd;
434
        } catch (DriverException e) {
439
        // try {
440
            // virtualIndex = (int) ods.getRowCount() + numAdd;
441
        	int externalIndex = getRowCount();
442
        	calculatedIndex = getCalculatedIndex(externalIndex);
443
        /* } catch (DriverException e) {
435 444
        	throw new DriverIOException(e);
436
        }
445
        } */
437 446

  
438 447
        int pos = expansionFile.addRow(feat);
439
        relations.put(new Integer(virtualIndex), new Integer(pos));
448
        relations.put(new Integer(calculatedIndex), new Integer(pos));
440 449
        numAdd++;
441
        System.err.println("A?ade una Row en la posici?n: " + virtualIndex);
442
        return virtualIndex;
450
        System.err.println("A?ade una Row en la posici?n: " + calculatedIndex);
451
        return calculatedIndex;
443 452
    }
444 453

  
445 454
    /**
......
465 474
     * @throws DriverIOException
466 475
     * @throws IOException
467 476
     */
468
    public void undoAddRow(int index) throws DriverIOException, IOException {
477
    public void undoAddRow(int calculatedIndex) throws DriverIOException, IOException {
469 478
        expansionFile.deleteLastRow();
470
        relations.remove(new Integer(index));
479
        relations.remove(new Integer(calculatedIndex));
471 480
        numAdd--;
472 481
    }
473 482

  
trunk/libraries/libCorePlugin/src/com/iver/core/configExtensions/ConfigPlugins.java
631 631
            Locale eu = new Locale("eu"); // euskera
632 632
            Locale brasil = new Locale("pt", "BR");
633 633
            Locale de = new Locale("de"); // Alem?n
634
            Locale gr = new Locale("el", "GR"); // Griego
634 635
			
635 636
			// Parche para valenciano/catal?n valenci?/catal?
636 637
			String strValenciano = PluginServices.getText(this, "__catalan");
......
653 654
                    new LanguageItem(cs, cs.getDisplayLanguage()),
654 655
                    new LanguageItem(eu, strEuskera),
655 656
                    new LanguageItem(brasil, brasil.getDisplayLanguage()),
656
					new LanguageItem(de, de.getDisplayLanguage())};
657
					new LanguageItem(de, de.getDisplayLanguage()),
658
					new LanguageItem(gr, gr.getDisplayLanguage())};
657 659
						
658 660
			DefaultComboBoxModel model = new DefaultComboBoxModel(lenguajes);
659 661
			

Also available in: Unified diff