Revision 5223 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/VectorialEditableAdapter.java

View differences:

VectorialEditableAdapter.java
45 45
 *
46 46
 * $Id$
47 47
 * $Log$
48
 * Revision 1.50  2006-05-16 07:07:46  caballero
48
 * Revision 1.51  2006-05-16 16:07:19  fjp
49
 * snapping. Revisar
50
 *
51
 * Revision 1.50  2006/05/16 07:07:46  caballero
49 52
 * Modificar la geometr?a desde fuera
50 53
 *
51 54
 * Revision 1.49  2006/05/15 10:52:23  caballero
......
207 210
import com.hardcode.gdbms.engine.values.Value;
208 211
import com.iver.cit.gvsig.fmap.DriverException;
209 212
import com.iver.cit.gvsig.fmap.core.DefaultFeature;
210
import com.iver.cit.gvsig.fmap.core.DefaultRow;
211 213
import com.iver.cit.gvsig.fmap.core.FShape;
212 214
import com.iver.cit.gvsig.fmap.core.IFeature;
213 215
import com.iver.cit.gvsig.fmap.core.IGeometry;
......
225 227

  
226 228
/**
227 229
 * @author fjp
228
 *
230
 * 
229 231
 */
230
public class VectorialEditableAdapter extends EditableAdapter implements ReadableVectorial, BoundedShapes {
232
public class VectorialEditableAdapter extends EditableAdapter implements
233
		ReadableVectorial, BoundedShapes {
231 234
	protected ReadableVectorial ova;
235

  
232 236
	protected Quadtree index;
233 237

  
234 238
	protected Rectangle2D fullExtent;
239

  
235 240
	protected Image selectionImage;
241

  
236 242
	protected BufferedImage handlersImage;
237 243

  
244
	/*
245
	 * private class MyFeatureIterator implements IFeatureIterator { int numReg =
246
	 * 0; Rectangle2D rect; String epsg; IFeatureIterator origFeatIt; boolean
247
	 * bHasNext = true;
248
	 * 
249
	 * public MyFeatureIterator(Rectangle2D r, String strEPSG) throws
250
	 * DriverException { rect = r; epsg = strEPSG; origFeatIt =
251
	 * ova.getFeatureIterator(r, epsg); } public boolean hasNext() throws
252
	 * DriverException { return bHasNext; }
253
	 * 
254
	 * public IFeature next() throws DriverException { IFeature aux =
255
	 * origFeatIt.next(); return null; }
256
	 * 
257
	 * public void closeIterator() throws DriverException {
258
	 *  }
259
	 *  }
260
	 */
238 261

  
239
	/* private class MyFeatureIterator implements IFeatureIterator
240
	{
241
		int numReg = 0;
242
		Rectangle2D rect;
243
		String epsg;
244
		IFeatureIterator origFeatIt;
245
		boolean bHasNext = true;
246

  
247
		public MyFeatureIterator(Rectangle2D r, String strEPSG) throws DriverException
248
		{
249
			rect = r;
250
			epsg = strEPSG;
251
			origFeatIt = ova.getFeatureIterator(r, epsg);
252
		}
253
		public boolean hasNext() throws DriverException {
254
				return bHasNext;
255
		}
256

  
257
		public IFeature next() throws DriverException {
258
			IFeature aux = origFeatIt.next();
259
			return null;
260
		}
261

  
262
		public void closeIterator() throws DriverException {
263

  
264
		}
265

  
266
	} */
267

  
268
	public VectorialEditableAdapter(){
262
	public VectorialEditableAdapter() {
269 263
		super();
270 264
	}
271
	public void setOriginalVectorialAdapter(ReadableVectorial rv){
272
		ova=rv;
265

  
266
	public void setOriginalVectorialAdapter(ReadableVectorial rv) {
267
		ova = rv;
273 268
		try {
274 269
			setOriginalDataSource(rv.getRecordset());
275 270
		} catch (DriverLoadException e) {
276 271
			e.printStackTrace();
277 272
		}
278 273
	}
274

  
279 275
	/*
280 276
	 * (non-Javadoc)
281
	 *
277
	 * 
282 278
	 * @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#start()
283 279
	 */
284 280
	public void start() throws DriverIOException {
......
287 283

  
288 284
	/*
289 285
	 * (non-Javadoc)
290
	 *
286
	 * 
291 287
	 * @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#stop()
292 288
	 */
293 289
	public void stop() throws DriverIOException {
......
296 292

  
297 293
	/*
298 294
	 * (non-Javadoc)
299
	 *
295
	 * 
300 296
	 * @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShape(int)
301 297
	 */
302 298
	public IGeometry getShape(int rowIndex) throws DriverIOException {
303 299
		// Si no est? en el fichero de expansi?n
304
		int calculatedIndex=getCalculatedIndex(rowIndex);
300
		int calculatedIndex = getCalculatedIndex(rowIndex);
305 301
		Integer integer = new Integer(calculatedIndex);
306 302
		if (!relations.containsKey(integer)) {
307 303
			// Si ha sido eliminada
308
			/*if (delRows.get(integer.intValue())) {
309
				return null;
310
			} else {*/
311
				return ova.getShape(calculatedIndex);
312
			//}
304
			/*
305
			 * if (delRows.get(integer.intValue())) { return null; } else {
306
			 */
307
			return ova.getShape(calculatedIndex);
308
			// }
313 309
		} else {
314 310
			int num = ((Integer) relations.get(integer)).intValue();
315 311
			DefaultRowEdited feat;
316 312
			try {
317 313
				feat = (DefaultRowEdited) expansionFile.getRow(num);
318
				return ((IFeature)feat.getLinkedRow()).getGeometry().cloneGeometry();//getGeometry();
314
				return ((IFeature) feat.getLinkedRow()).getGeometry()
315
						.cloneGeometry();// getGeometry();
319 316
			} catch (IOException e) {
320 317
				e.printStackTrace();
321 318
				throw new DriverIOException(e);
......
326 323

  
327 324
	/*
328 325
	 * (non-Javadoc)
329
	 *
326
	 * 
330 327
	 * @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShapeType()
331 328
	 */
332 329
	public int getShapeType() throws DriverIOException {
333 330
		return ova.getShapeType();
334 331
	}
335
	public ReadableVectorial getOriginalAdapter(){
332

  
333
	public ReadableVectorial getOriginalAdapter() {
336 334
		return ova;
337 335
	}
336

  
338 337
	public VectorialDriver getDriver() {
339 338
		return ova.getDriver();
340 339
	}
340

  
341 341
	public void setDriver(VectorialDriver driver) {
342 342
		this.ova.setDriver(driver);
343 343
	}
344
	public DriverAttributes getDriverAttributes(){
344

  
345
	public DriverAttributes getDriverAttributes() {
345 346
		return ova.getDriverAttributes();
346 347
	}
347 348

  
348
	 /**
349
     * DOCUMENT ME!
350
     *
351
     * @throws EditionException DOCUMENT ME!
352
     */
353
    public void startEdition(int sourceType) throws EditionException {
354
    	super.startEdition(sourceType);
349
	/**
350
	 * DOCUMENT ME!
351
	 * 
352
	 * @throws EditionException
353
	 *             DOCUMENT ME!
354
	 */
355
	public void startEdition(int sourceType) throws EditionException {
356
		super.startEdition(sourceType);
355 357

  
356
        try {
357
            expansionFile.open();
358
            if (index==null || fullExtent==null){
359
            // TODO: Si la capa dispone de un ?ndice espacial, hacer
360
            // algo aqu? para que se use ese ?ndice espacial.
361
            index = new Quadtree();
358
		try {
359
			expansionFile.open();
360
			if (index == null || fullExtent == null) {
361
				// TODO: Si la capa dispone de un ?ndice espacial, hacer
362
				// algo aqu? para que se use ese ?ndice espacial.
363
				index = new Quadtree();
362 364

  
363
            for (int i = 0; i < ova.getShapeCount(); i++) {
364
                IGeometry g=null;
365
				try {
366
					g = ((DefaultFeature) ova.getFeature(i)).getGeometry();
367
				} catch (DriverException e1) {
368
					// TODO Auto-generated catch block
369
					e1.printStackTrace();
370
				}
365
				for (int i = 0; i < ova.getShapeCount(); i++) {
366
					IGeometry g = null;
367
					try {
368
						g = ((DefaultFeature) ova.getFeature(i)).getGeometry();
369
					} catch (DriverException e1) {
370
						// TODO Auto-generated catch block
371
						e1.printStackTrace();
372
					}
371 373

  
372
                if (g == null) {
373
                    continue;
374
                }
374
					if (g == null) {
375
						continue;
376
					}
375 377

  
376
                Rectangle2D r = g.getBounds2D();
377
                Envelope e = new Envelope(r.getX(), r.getX() + r.getWidth(),
378
                        r.getY(), r.getY() + r.getHeight());
379
                index.insert(e, new Integer(i));
380
                if (fullExtent == null)
381
                {
382
                	fullExtent = r;
383
                }
384
                else
385
                {
386
                	fullExtent = fullExtent.createUnion(r);
387
                }
388
            }
389
            }
390
        } catch (DriverIOException e) {
391
            throw new EditionException(e);
392
        } catch (IOException e) {
393
            throw new EditionException(e);
394
        }
378
					Rectangle2D r = g.getBounds2D();
379
					Envelope e = new Envelope(r.getX(),
380
							r.getX() + r.getWidth(), r.getY(), r.getY()
381
									+ r.getHeight());
382
					index.insert(e, new Integer(i));
383
					if (fullExtent == null) {
384
						fullExtent = r;
385
					} else {
386
						fullExtent = fullExtent.createUnion(r);
387
					}
388
				}
389
			}
390
		} catch (DriverIOException e) {
391
			throw new EditionException(e);
392
		} catch (IOException e) {
393
			throw new EditionException(e);
394
		}
395 395

  
396
        System.err.println("Se han metido en el ?ndice " +
397
            index.queryAll().size() + " geometr?as");
398
    }
396
		System.err.println("Se han metido en el ?ndice "
397
				+ index.queryAll().size() + " geometr?as");
398
	}
399 399

  
400
    /* (non-Javadoc)
401
     * @see com.iver.cit.gvsig.fmap.edition.IEditableSource#getRow(int)
402
     */
403
    public IRowEdited getRow(int index) throws DriverIOException, IOException {
404
    	int calculatedIndex=getCalculatedIndex(index);
405
    	Integer integer = new Integer(calculatedIndex);
406
        //Si no est? en el fichero de expansi?n
407
    	DefaultRowEdited edRow=null;
408
        if (!relations.containsKey(integer)) {
400
	/*
401
	 * (non-Javadoc)
402
	 * 
403
	 * @see com.iver.cit.gvsig.fmap.edition.IEditableSource#getRow(int)
404
	 */
405
	public IRowEdited getRow(int index) throws DriverIOException, IOException {
406
		int calculatedIndex = getCalculatedIndex(index);
407
		Integer integer = new Integer(calculatedIndex);
408
		// Si no est? en el fichero de expansi?n
409
		DefaultRowEdited edRow = null;
410
		if (!relations.containsKey(integer)) {
409 411
			try {
410 412
				edRow = new DefaultRowEdited(ova.getFeature(calculatedIndex),
411
				        DefaultRowEdited.STATUS_ORIGINAL, index);
412
				///System.out.println("Piden la feature con ID= " + index);
413
				/* Exception e = new Exception();
414
				e.printStackTrace(); */
413
						DefaultRowEdited.STATUS_ORIGINAL, index);
414
				// /System.out.println("Piden la feature con ID= " + index);
415
				/*
416
				 * Exception e = new Exception(); e.printStackTrace();
417
				 */
415 418
			} catch (DriverException e) {
416 419
				// TODO Auto-generated catch block
417 420
				e.printStackTrace();
418 421
			}
419 422

  
420
            return edRow;
421
        } else {
422
            int num = ((Integer) relations.get(integer)).intValue();
423
            IRowEdited aux = expansionFile.getRow(num);
424
            edRow = new DefaultRowEdited(aux.getLinkedRow().cloneRow(), aux.getStatus(), index);
425
            return edRow;
426
        }
427
    }
428
    /**
429
     * Elimina una geometria. Si es una geometr?a original de la capa en
430
     * edici?n se marca como eliminada (haya sido modificada o no). Si es una
431
     * geometr?a a?adida posteriormente se invalida en el fichero de
432
     * expansi?n, para que una futura compactaci?n termine con ella.
433
     *
434
     * @param index ?ndice de la geometr?a.
435
     *
436
     * @throws DriverIOException
437
     * @throws IOException
438
     */
439
    public IRow doRemoveRow(int index, int sourceType) throws DriverIOException, IOException {
440
    	boolean cancel = fireBeforeRemoveRow(index, sourceType);
423
			return edRow;
424
		} else {
425
			int num = ((Integer) relations.get(integer)).intValue();
426
			IRowEdited aux = expansionFile.getRow(num);
427
			edRow = new DefaultRowEdited(aux.getLinkedRow().cloneRow(), aux
428
					.getStatus(), index);
429
			return edRow;
430
		}
431
	}
432

  
433
	/**
434
	 * Elimina una geometria. Si es una geometr?a original de la capa en edici?n
435
	 * se marca como eliminada (haya sido modificada o no). Si es una geometr?a
436
	 * a?adida posteriormente se invalida en el fichero de expansi?n, para que
437
	 * una futura compactaci?n termine con ella.
438
	 * 
439
	 * @param index
440
	 *            ?ndice de la geometr?a.
441
	 * 
442
	 * @throws DriverIOException
443
	 * @throws IOException
444
	 */
445
	public IRow doRemoveRow(int index, int sourceType)
446
			throws DriverIOException, IOException {
447
		boolean cancel = fireBeforeRemoveRow(index, sourceType);
441 448
		if (cancel)
442 449
			return null;
443
    	//Llega el calculatedIndex
444
    	Integer integer = new Integer(index);
450
		// Llega el calculatedIndex
451
		Integer integer = new Integer(index);
445 452

  
446
        IFeature feat = null;
447
        delRows.set(index, true);
448
        //Si la geometr?a no ha sido modificada
449
        if (!relations.containsKey(integer)) {
453
		IFeature feat = null;
454
		delRows.set(index, true);
455
		// Si la geometr?a no ha sido modificada
456
		if (!relations.containsKey(integer)) {
450 457

  
451
            try {
458
			try {
452 459
				feat = (DefaultFeature) (ova.getFeature(index));
453 460
			} catch (DriverException e) {
454 461
				// TODO Auto-generated catch block
455 462
				e.printStackTrace();
456 463
			}
457
       } else {
464
		} else {
458 465
			int num = ((Integer) relations.get(integer)).intValue();
459 466
			feat = (IFeature) expansionFile.getRow(num).getLinkedRow();
460
			//expansionFile.invalidateRow(num);
467
			// expansionFile.invalidateRow(num);
461 468
		}
462
        System.err.println("Elimina una Row en la posici?n: " + index);
463
        //Se actualiza el ?ndice
464
        if (feat != null) {
465
            Rectangle2D r = feat.getGeometry().getBounds2D();
466
            boolean borrado=this.index.remove(new Envelope(r.getX(), r.getX() + r.getWidth(),
467
                    r.getY(), r.getY() + r.getHeight()), new Integer(index));
468
            System.out.println("Est? borrado : "+ borrado);
469
            System.out.println("Index.lenght : "+ this.index.size());
469
		System.err.println("Elimina una Row en la posici?n: " + index);
470
		// Se actualiza el ?ndice
471
		if (feat != null) {
472
			Rectangle2D r = feat.getGeometry().getBounds2D();
473
			boolean borrado = this.index.remove(new Envelope(r.getX(), r.getX()
474
					+ r.getWidth(), r.getY(), r.getY() + r.getHeight()),
475
					new Integer(index));
476
			System.out.println("Est? borrado : " + borrado);
477
			System.out.println("Index.lenght : " + this.index.size());
470 478

  
471
        }
472
        setSelection(new FBitSet());
473
        fireAfterRemoveRow(index, sourceType);
474
        return feat;
475
    }
476
    /**
477
     * Si se intenta modificar una geometr?a original de la capa en edici?n se
478
     * a?ade al fichero de expansi?n y se registra la posici?n en la que se
479
     * a?adi?. Si se intenta modificar una geometria que se encuentra en el
480
     * fichero de expansi?n (por ser nueva o original pero modificada) se
481
     * invoca el m?todo modifyGeometry y se actualiza el ?ndice de la
482
     * geometria en el fichero.
483
     *
484
     * @param calculatedIndex DOCUMENT ME!
485
     * @param feat DOCUMENT ME!
486
     *
487
     * @return position inside ExpansionFile
488
     *
489
     * @throws IOException
490
     * @throws DriverIOException
491
     */
492
    public int doModifyRow(int calculatedIndex, IRow feat,int sourceType)
493
        throws IOException, DriverIOException {
494
    	boolean cancel = fireBeforeModifyRow(feat,calculatedIndex, sourceType);
479
		}
480
		setSelection(new FBitSet());
481
		fireAfterRemoveRow(index, sourceType);
482
		return feat;
483
	}
484

  
485
	/**
486
	 * Si se intenta modificar una geometr?a original de la capa en edici?n se
487
	 * a?ade al fichero de expansi?n y se registra la posici?n en la que se
488
	 * a?adi?. Si se intenta modificar una geometria que se encuentra en el
489
	 * fichero de expansi?n (por ser nueva o original pero modificada) se invoca
490
	 * el m?todo modifyGeometry y se actualiza el ?ndice de la geometria en el
491
	 * fichero.
492
	 * 
493
	 * @param calculatedIndex
494
	 *            DOCUMENT ME!
495
	 * @param feat
496
	 *            DOCUMENT ME!
497
	 * 
498
	 * @return position inside ExpansionFile
499
	 * 
500
	 * @throws IOException
501
	 * @throws DriverIOException
502
	 */
503
	public int doModifyRow(int calculatedIndex, IRow feat, int sourceType)
504
			throws IOException, DriverIOException {
505
		boolean cancel = fireBeforeModifyRow(feat, calculatedIndex, sourceType);
495 506
		if (cancel)
496 507
			return -1;
497
    	int posAnteriorInExpansionFile = -1;
498
        Integer integer = new Integer(calculatedIndex);
508
		int posAnteriorInExpansionFile = -1;
509
		Integer integer = new Integer(calculatedIndex);
499 510

  
500
        IFeature featAnt = null;
501
        System.err.println("Modifica una Row en la posici?n: " + calculatedIndex);
502
        //Si la geometr?a no ha sido modificada
503
        if (!relations.containsKey(integer)) {
504
        	int newPosition = expansionFile.addRow(feat, IRowEdited.STATUS_MODIFIED);
505
            relations.put(integer, new Integer(newPosition));
511
		IFeature featAnt = null;
512
		System.err.println("Modifica una Row en la posici?n: "
513
				+ calculatedIndex);
514
		// Si la geometr?a no ha sido modificada
515
		if (!relations.containsKey(integer)) {
516
			int newPosition = expansionFile.addRow(feat,
517
					IRowEdited.STATUS_MODIFIED);
518
			relations.put(integer, new Integer(newPosition));
506 519

  
507
            //Se actualiza el ?ndice espacial
508
            try {
520
			// Se actualiza el ?ndice espacial
521
			try {
509 522
				featAnt = (DefaultFeature) (ova.getFeature(calculatedIndex));
510 523
			} catch (DriverException e) {
511 524
				e.printStackTrace();
512 525
			}
513
			IGeometry g=featAnt.getGeometry();
514
            Rectangle2D rAnt = g.getBounds2D();
515
            Rectangle2D r = ((IFeature) feat).getGeometry().getBounds2D();
516
            this.index.remove(new Envelope(rAnt.getX(),
517
                    rAnt.getX() + rAnt.getWidth(), rAnt.getY(),
518
                    rAnt.getY() + rAnt.getHeight()), new Integer(calculatedIndex));
519
            this.index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(),
520
                    r.getY(), r.getY() + r.getHeight()), new Integer(calculatedIndex));
521
        } else {
522
            //Obtenemos el ?ndice en el fichero de expansi?n
523
            int num = ((Integer) relations.get(integer)).intValue();
524
            posAnteriorInExpansionFile = num;
526
			IGeometry g = featAnt.getGeometry();
527
			Rectangle2D rAnt = g.getBounds2D();
528
			Rectangle2D r = ((IFeature) feat).getGeometry().getBounds2D();
529
			this.index.remove(new Envelope(rAnt.getX(), rAnt.getX()
530
					+ rAnt.getWidth(), rAnt.getY(), rAnt.getY()
531
					+ rAnt.getHeight()), new Integer(calculatedIndex));
532
			this.index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(), r
533
					.getY(), r.getY() + r.getHeight()), new Integer(
534
					calculatedIndex));
535
		} else {
536
			// Obtenemos el ?ndice en el fichero de expansi?n
537
			int num = ((Integer) relations.get(integer)).intValue();
538
			posAnteriorInExpansionFile = num;
525 539

  
526
            //Obtenemos la geometr?a para actualiza el ?ndice espacialposteriormente
527
            featAnt = (IFeature) expansionFile.getRow(num).getLinkedRow();
540
			// Obtenemos la geometr?a para actualiza el ?ndice
541
			// espacialposteriormente
542
			featAnt = (IFeature) expansionFile.getRow(num).getLinkedRow();
528 543

  
529
            /*
530
             * Se modifica la geometr?a y nos guardamos el ?ndice dentro del fichero
531
             * de expansi?n en el que se encuentra la geometr?a modificada
532
             */
533
            num = expansionFile.modifyRow(num, feat);
544
			/*
545
			 * Se modifica la geometr?a y nos guardamos el ?ndice dentro del
546
			 * fichero de expansi?n en el que se encuentra la geometr?a
547
			 * modificada
548
			 */
549
			num = expansionFile.modifyRow(num, feat);
534 550

  
535
            /*
536
             * Actualiza la relaci?n del ?ndice de la geometr?a al ?ndice en el fichero
537
             * de expansi?n.
538
             */
539
            relations.put(integer, new Integer(num));
551
			/*
552
			 * Actualiza la relaci?n del ?ndice de la geometr?a al ?ndice en el
553
			 * fichero de expansi?n.
554
			 */
555
			relations.put(integer, new Integer(num));
540 556

  
541
            //Se modifica el ?ndice espacial
542
            Rectangle2D rAnt = featAnt.getGeometry().getBounds2D();
543
            Rectangle2D r = ((IFeature) feat).getGeometry().getBounds2D();
544
            this.index.remove(new Envelope(rAnt.getX(),
545
                    rAnt.getX() + rAnt.getWidth(), rAnt.getY(),
546
                    rAnt.getY() + rAnt.getHeight()), new Integer(calculatedIndex));
547
            this.index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(),
548
                    r.getY(), r.getY() + r.getHeight()), new Integer(calculatedIndex));
549
        }
550
        fireAfterModifyRow(calculatedIndex, sourceType);
551
        return posAnteriorInExpansionFile;
552
    }
553
    /**
554
     * Actualiza en el mapa de ?ndices, la posici?n en la que estaba la
555
     * geometr?a antes de ser modificada. Se marca como v?lida, en caso de que
556
     * fuera una modificaci?n de una geometr?a que estuviese en el fichero de
557
     * expansi?n antes de ser modificada y se pone el puntero de escritura del
558
     * expansion file a justo despues de la penultima geometr?a
559
     *
560
     * @param calculatedIndex ?ndice de la geometr?a que se quiere deshacer su
561
     *        modificaci?n
562
     * @param previousExpansionFileIndex ?ndice que ten?a antes la geometr?a en
563
     *        el expansionFile. Si vale -1 quiere decir que es una
564
     *        modificaci?n de una geometr?a original y por tanto no hay que
565
     *        actualizar el mapa de indices sino eliminar su entrada.
566
     *
567
     * @throws IOException
568
     * @throws DriverIOException
569
     */
570
    public void undoModifyRow(int calculatedIndex, int previousExpansionFileIndex, int sourceType)
571
        throws IOException, DriverIOException {
557
			// Se modifica el ?ndice espacial
558
			Rectangle2D rAnt = featAnt.getGeometry().getBounds2D();
559
			Rectangle2D r = ((IFeature) feat).getGeometry().getBounds2D();
560
			this.index.remove(new Envelope(rAnt.getX(), rAnt.getX()
561
					+ rAnt.getWidth(), rAnt.getY(), rAnt.getY()
562
					+ rAnt.getHeight()), new Integer(calculatedIndex));
563
			this.index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(), r
564
					.getY(), r.getY() + r.getHeight()), new Integer(
565
					calculatedIndex));
566
		}
567
		fireAfterModifyRow(calculatedIndex, sourceType);
568
		return posAnteriorInExpansionFile;
569
	}
572 570

  
573
    	//Llega el CalculatedIndex
574
    	/*
575
         * Si la acci?n de modificar se realiz? sobre una geometr?a original
576
         */
577
        if (previousExpansionFileIndex == -1) {
571
	/**
572
	 * Actualiza en el mapa de ?ndices, la posici?n en la que estaba la
573
	 * geometr?a antes de ser modificada. Se marca como v?lida, en caso de que
574
	 * fuera una modificaci?n de una geometr?a que estuviese en el fichero de
575
	 * expansi?n antes de ser modificada y se pone el puntero de escritura del
576
	 * expansion file a justo despues de la penultima geometr?a
577
	 * 
578
	 * @param calculatedIndex
579
	 *            ?ndice de la geometr?a que se quiere deshacer su modificaci?n
580
	 * @param previousExpansionFileIndex
581
	 *            ?ndice que ten?a antes la geometr?a en el expansionFile. Si
582
	 *            vale -1 quiere decir que es una modificaci?n de una geometr?a
583
	 *            original y por tanto no hay que actualizar el mapa de indices
584
	 *            sino eliminar su entrada.
585
	 * 
586
	 * @throws IOException
587
	 * @throws DriverIOException
588
	 */
589
	public void undoModifyRow(int calculatedIndex,
590
			int previousExpansionFileIndex, int sourceType) throws IOException,
591
			DriverIOException {
578 592

  
579
            //Se obtiene la geometr?a para actualizar el ?ndice
580
            // IGeometry g = ((DefaultFeature) getRow(calculatedIndex).getLinkedRow()).getGeometry();
581
        	int inverse = getInversedIndex(calculatedIndex);
582
        	DefaultFeature df=(DefaultFeature) getRow(inverse).getLinkedRow();
583
        	boolean cancel = fireBeforeModifyRow(df,calculatedIndex,sourceType);
593
		// Llega el CalculatedIndex
594
		/*
595
		 * Si la acci?n de modificar se realiz? sobre una geometr?a original
596
		 */
597
		if (previousExpansionFileIndex == -1) {
598

  
599
			// Se obtiene la geometr?a para actualizar el ?ndice
600
			// IGeometry g = ((DefaultFeature)
601
			// getRow(calculatedIndex).getLinkedRow()).getGeometry();
602
			int inverse = getInversedIndex(calculatedIndex);
603
			DefaultFeature df = (DefaultFeature) getRow(inverse).getLinkedRow();
604
			boolean cancel = fireBeforeModifyRow(df, calculatedIndex,
605
					sourceType);
584 606
			if (cancel)
585 607
				return;
586
        	IGeometry g = df.getGeometry();
587
        	// IGeometry g = ova.getShape(calculatedIndex);
588
            Rectangle2D r = g.getBounds2D();
608
			IGeometry g = df.getGeometry();
609
			// IGeometry g = ova.getShape(calculatedIndex);
610
			Rectangle2D r = g.getBounds2D();
589 611

  
590
            //Se elimina de las relaciones y del fichero de expansi?n
591
            relations.remove(new Integer(calculatedIndex));
592
            expansionFile.deleteLastRow();
612
			// Se elimina de las relaciones y del fichero de expansi?n
613
			relations.remove(new Integer(calculatedIndex));
614
			expansionFile.deleteLastRow();
593 615

  
594
            //Se actualizan los ?ndices
595
            IGeometry gAnt = ova.getShape(calculatedIndex);
596
            /* IGeometry gAnt = ((DefaultFeature) getRow(calculatedIndex)
597
                                                   .getLinkedRow()).getGeometry(); */
598
            Rectangle2D rAnt = gAnt.getBounds2D();
599
            this.index.remove(new Envelope(r.getX(), r.getX() + r.getWidth(),
600
                    r.getY(), r.getY() + r.getHeight()),
601
                new Integer(calculatedIndex));
602
            this.index.insert(new Envelope(rAnt.getX(),
603
                    rAnt.getX() + rAnt.getWidth(), rAnt.getY(),
604
                    rAnt.getY() + rAnt.getHeight()), new Integer(calculatedIndex));
605
        } else {
606
            //Se obtiene la geometr?a para actualizar el ?ndice
607
            IGeometry g = null;
608
            int inverse = getInversedIndex(calculatedIndex);
609
            DefaultFeature df=(DefaultFeature) getRow(inverse).getLinkedRow();
610
            boolean cancel = fireBeforeModifyRow(df,calculatedIndex,sourceType);
616
			// Se actualizan los ?ndices
617
			IGeometry gAnt = ova.getShape(calculatedIndex);
618
			/*
619
			 * IGeometry gAnt = ((DefaultFeature) getRow(calculatedIndex)
620
			 * .getLinkedRow()).getGeometry();
621
			 */
622
			Rectangle2D rAnt = gAnt.getBounds2D();
623
			this.index.remove(new Envelope(r.getX(), r.getX() + r.getWidth(), r
624
					.getY(), r.getY() + r.getHeight()), new Integer(
625
					calculatedIndex));
626
			this.index.insert(new Envelope(rAnt.getX(), rAnt.getX()
627
					+ rAnt.getWidth(), rAnt.getY(), rAnt.getY()
628
					+ rAnt.getHeight()), new Integer(calculatedIndex));
629
		} else {
630
			// Se obtiene la geometr?a para actualizar el ?ndice
631
			IGeometry g = null;
632
			int inverse = getInversedIndex(calculatedIndex);
633
			DefaultFeature df = (DefaultFeature) getRow(inverse).getLinkedRow();
634
			boolean cancel = fireBeforeModifyRow(df, calculatedIndex,
635
					sourceType);
611 636
			if (cancel)
612 637
				return;
613
            g = df.getGeometry();
614
            System.out.println("Actual: " + g.toString());
638
			g = df.getGeometry();
639
			System.out.println("Actual: " + g.toString());
615 640

  
616
            Rectangle2D r = g.getBounds2D();
617
            this.index.remove(new Envelope(r.getX(), r.getX() + r.getWidth(),
618
                    r.getY(), r.getY() + r.getHeight()),
619
                new Integer(calculatedIndex));
641
			Rectangle2D r = g.getBounds2D();
642
			this.index.remove(new Envelope(r.getX(), r.getX() + r.getWidth(), r
643
					.getY(), r.getY() + r.getHeight()), new Integer(
644
					calculatedIndex));
620 645

  
621
            //Se actualiza la relaci?n de ?ndices
622
            //Integer integer = new Integer(geometryIndex);
623
            relations.put(new Integer(calculatedIndex),
624
                new Integer(previousExpansionFileIndex));
646
			// Se actualiza la relaci?n de ?ndices
647
			// Integer integer = new Integer(geometryIndex);
648
			relations.put(new Integer(calculatedIndex), new Integer(
649
					previousExpansionFileIndex));
625 650

  
626
            //Se recupera la geometr?a
627
            //expansionFile.validateRow(previousExpansionFileIndex);
651
			// Se recupera la geometr?a
652
			// expansionFile.validateRow(previousExpansionFileIndex);
628 653

  
629
            //Se actualizan los ?ndices
630
            // g = ((IFeature) (expansionFile.getRow(previousExpansionFileIndex).getLinkedRow())).getGeometry();
631
            // System.out.println("Anterior a la que volvemos : " + g.toString());
632
            g = ((DefaultFeature) getRow(inverse).getLinkedRow()).getGeometry();
633
            r = g.getBounds2D();
634
            this.index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(),
635
                    r.getY(), r.getY() + r.getHeight()),
636
                new Integer(calculatedIndex));
654
			// Se actualizan los ?ndices
655
			// g = ((IFeature)
656
			// (expansionFile.getRow(previousExpansionFileIndex).getLinkedRow())).getGeometry();
657
			// System.out.println("Anterior a la que volvemos : " +
658
			// g.toString());
659
			g = ((DefaultFeature) getRow(inverse).getLinkedRow()).getGeometry();
660
			r = g.getBounds2D();
661
			this.index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(), r
662
					.getY(), r.getY() + r.getHeight()), new Integer(
663
					calculatedIndex));
637 664

  
638
        }
639
        fireAfterModifyRow(calculatedIndex, sourceType);
640
    }
665
		}
666
		fireAfterModifyRow(calculatedIndex, sourceType);
667
	}
641 668

  
642
    /**
643
     * A?ade una geometria al fichero de expansi?n y guarda la correspondencia
644
     * en la tabla relations.
645
     *
646
     * @param feat geometr?a a guardar.
647
     *
648
     * @return calculatedIndex
649
     *
650
     * @throws DriverIOException
651
     * @throws IOException
652
     */
653
    public int doAddRow(IRow feat, int sourceType) throws DriverIOException, IOException {
654
        int calculatedIndex=super.doAddRow(feat, sourceType);
669
	/**
670
	 * A?ade una geometria al fichero de expansi?n y guarda la correspondencia
671
	 * en la tabla relations.
672
	 * 
673
	 * @param feat
674
	 *            geometr?a a guardar.
675
	 * 
676
	 * @return calculatedIndex
677
	 * 
678
	 * @throws DriverIOException
679
	 * @throws IOException
680
	 */
681
	public int doAddRow(IRow feat, int sourceType) throws DriverIOException,
682
			IOException {
683
		int calculatedIndex = super.doAddRow(feat, sourceType);
655 684
		// Actualiza el ?ndice espacial
656
        IGeometry g = ((IFeature)feat).getGeometry();
657
        Rectangle2D r = g.getBounds2D();
658
        index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(), r.getY(),
659
                r.getY() + r.getHeight()), new Integer(calculatedIndex));
685
		IGeometry g = ((IFeature) feat).getGeometry();
686
		Rectangle2D r = g.getBounds2D();
687
		index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(), r.getY(),
688
				r.getY() + r.getHeight()), new Integer(calculatedIndex));
660 689

  
661
        return calculatedIndex;
662
    }
663
    /**
664
     * Se desmarca como invalidada en el fichero de expansion o como eliminada
665
     * en el fichero original
666
     *
667
     * @param index DOCUMENT ME!
668
     *
669
     * @throws IOException
670
     * @throws DriverIOException
671
     */
672
    public void undoRemoveRow(int index, int sourceType) throws IOException, DriverIOException {
673
       super.undoRemoveRow(index, sourceType);
690
		return calculatedIndex;
691
	}
674 692

  
675
        IGeometry g = null;
676
        g = ((IFeature) getRow(index).getLinkedRow()).getGeometry();
693
	/**
694
	 * Se desmarca como invalidada en el fichero de expansion o como eliminada
695
	 * en el fichero original
696
	 * 
697
	 * @param index
698
	 *            DOCUMENT ME!
699
	 * 
700
	 * @throws IOException
701
	 * @throws DriverIOException
702
	 */
703
	public void undoRemoveRow(int index, int sourceType) throws IOException,
704
			DriverIOException {
705
		super.undoRemoveRow(index, sourceType);
677 706

  
678
        Rectangle2D r = g.getBounds2D();
679
        this.index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(),
680
                r.getY(), r.getY() + r.getHeight()), new Integer(index));
681
    }
682
    /**
683
     * Se elimina del final del fichero de expansi?n poniendo el puntero de
684
     * escritura apuntando al final de la pen?ltima geometr?a. Deber? quitar
685
     * la relaci?n del mapa de relaciones
686
     *
687
     * @param index ?ndice de la geometr?a que se a?adi?
688
     *
689
     * @throws DriverIOException
690
     * @throws IOException
691
     */
692
    public void undoAddRow(int calculatedIndex,int sourceType) throws DriverIOException, IOException {
693
    	int inverse = getInversedIndex(calculatedIndex);
694
        IGeometry g = ((IFeature) getRow(inverse).getLinkedRow()).getGeometry();
695
        Rectangle2D r = g.getBounds2D();
696
        this.index.remove(new Envelope(r.getX(), r.getX() + r.getWidth(),
697
                r.getY(), r.getY() + r.getHeight()), new Integer(calculatedIndex));
707
		IGeometry g = null;
708
		g = ((IFeature) getRow(index).getLinkedRow()).getGeometry();
698 709

  
699
        super.undoAddRow(calculatedIndex, sourceType);
700
        setSelection(new FBitSet());
701
    }
702
    /**
703
     * Obtiene las geometr?as que se encuentran en el rect?ngulo que se pasa
704
     * como par?metro haciendo uso del ?ndice espacial
705
     *
706
     * @param r Rect?ngulo indicando la porci?n del espacio para el cual se
707
     *        quiere saber los ?ndices de las geometr?as que se encuentran
708
     *        dentro de ?l
709
     *
710
     * @return Array de ?ndices para su uso con getGeometry, removeGeometry,
711
     *         ...
712
     */
713
    /* public int[] getRowsIndexes_OL(Rectangle2D r) {
714
        Envelope e = new Envelope(r.getX(), r.getX() + r.getWidth(), r.getY(),
715
                r.getY() + r.getHeight());
716
        List l = index.query(e);
717
        int[] indexes = new int[l.size()];
710
		Rectangle2D r = g.getBounds2D();
711
		this.index.insert(new Envelope(r.getX(), r.getX() + r.getWidth(), r
712
				.getY(), r.getY() + r.getHeight()), new Integer(index));
713
	}
718 714

  
719
        for (int index = 0; index < l.size(); index++) {
720
            Integer i = (Integer) l.get(index);
721
            indexes[index] = getInversedIndex(i.intValue());
722
        }
715
	/**
716
	 * Se elimina del final del fichero de expansi?n poniendo el puntero de
717
	 * escritura apuntando al final de la pen?ltima geometr?a. Deber? quitar la
718
	 * relaci?n del mapa de relaciones
719
	 * 
720
	 * @param index
721
	 *            ?ndice de la geometr?a que se a?adi?
722
	 * 
723
	 * @throws DriverIOException
724
	 * @throws IOException
725
	 */
726
	public void undoAddRow(int calculatedIndex, int sourceType)
727
			throws DriverIOException, IOException {
728
		int inverse = getInversedIndex(calculatedIndex);
729
		IGeometry g = ((IFeature) getRow(inverse).getLinkedRow()).getGeometry();
730
		Rectangle2D r = g.getBounds2D();
731
		this.index.remove(new Envelope(r.getX(), r.getX() + r.getWidth(), r
732
				.getY(), r.getY() + r.getHeight()),
733
				new Integer(calculatedIndex));
723 734

  
724
        return indexes;
725
    } */
726
    /**
735
		super.undoAddRow(calculatedIndex, sourceType);
736
		setSelection(new FBitSet());
737
	}
738

  
739
	/**
740
	 * Obtiene las geometr?as que se encuentran en el rect?ngulo que se pasa
741
	 * como par?metro haciendo uso del ?ndice espacial
742
	 * 
743
	 * @param r
744
	 *            Rect?ngulo indicando la porci?n del espacio para el cual se
745
	 *            quiere saber los ?ndices de las geometr?as que se encuentran
746
	 *            dentro de ?l
747
	 * 
748
	 * @return Array de ?ndices para su uso con getGeometry, removeGeometry, ...
749
	 */
750
	/*
751
	 * public int[] getRowsIndexes_OL(Rectangle2D r) { Envelope e = new
752
	 * Envelope(r.getX(), r.getX() + r.getWidth(), r.getY(), r.getY() +
753
	 * r.getHeight()); List l = index.query(e); int[] indexes = new
754
	 * int[l.size()];
755
	 * 
756
	 * for (int index = 0; index < l.size(); index++) { Integer i = (Integer)
757
	 * l.get(index); indexes[index] = getInversedIndex(i.intValue()); }
758
	 * 
759
	 * return indexes; }
760
	 */
761
	/**
727 762
	 * @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShapeCount()
728 763
	 */
729 764
	public int getShapeCount() throws DriverIOException {
730 765
		try {
731 766
			return getRowCount();
732
		}  catch (IOException e) {
767
		} catch (IOException e) {
733 768
			throw new DriverIOException(e);
734 769
		}
735 770
	}
......
738 773
	 * @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getFullExtent()
739 774
	 */
740 775
	public Rectangle2D getFullExtent() throws DriverIOException {
741
        if (getShapeCount()>0){
742
        	fullExtent=getShape(0).getBounds2D();
743
        	for (int i=1;i<getShapeCount();i++){
744
        		fullExtent.add(getShape(i).getBounds2D());
745
        	}
746
        }else{
747
        	fullExtent=ova.getFullExtent();
748
        }
776
		if (fullExtent == null) {
777
			fullExtent = ova.getFullExtent();
778
		}
779
		return fullExtent;
780
	}
749 781

  
750
		/* if (fullExtent == null)
751
        {
752
        	fullExtent = ova.getFullExtent();
753
        }
754
        else
755
        {
756
        	List all = index.queryAll();
757
        	for (int i=0; i < all.size(); i++)
758
        	{
759
        		Integer in = (Integer) all.get(i);
760
        		Envelope env = (Envelope) all.get(i);
761
        		Rectangle2D r = FConverter.convertEnvelopeToRectangle2D(env);
762
        		fullExtent = fullExtent.createUnion(r);
763
        	}
764
        // }*/
765
    	return fullExtent;
782
	/**
783
	 * Use it BEFORE writing to a file.
784
	 * 
785
	 * @return real full extent.
786
	 * @throws DriverIOException
787
	 */
788
	public Rectangle2D reCalculateFullExtent() throws DriverIOException {
789
		if (getShapeCount() > 0) {
790
			fullExtent = getShape(0).getBounds2D();
791
			for (int i = 1; i < getShapeCount(); i++) {
792
				fullExtent.add(getShape(i).getBounds2D());
793
			}
794
		} else {
795
			fullExtent = ova.getFullExtent();
796
		}
797
		return fullExtent;
766 798
	}
767
    /**
768
     * En la implementaci?n por defecto podemos hacer que cada
769
     * feature tenga ID = numero de registro.
770
     * En el DBAdapter podr?amos "overrride" este m?todo y poner
771
     * como ID de la Feature el campo ?nico escogido en
772
     * la base de datos.
773
     * @param numReg
774
     * @return
775
     * @throws DriverException
776
     */
777
    public IFeature getFeature(int numReg) throws DriverException
778
    {
779
        IGeometry geom;
780
        IFeature feat = null;
781
        try {
782
            geom = getShape(numReg);
783
            DataSource rs = getRecordset();
784
            Value[] regAtt = new Value[rs.getFieldCount()];
785
            for (int fieldId=0; fieldId < rs.getFieldCount(); fieldId++ )
786
            {
787
                regAtt[fieldId] =  rs.getFieldValue(numReg, fieldId);
788
            }
789 799

  
790
            feat = new DefaultFeature(geom, regAtt, numReg + "");
791
        } catch (DriverIOException e) {
792
            throw new DriverException(e);
793
        } catch (DriverLoadException e) {
794
            throw new DriverException(e);
795
        } catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
796
            throw new DriverException(e);
797
        }
798
        return feat;
799
    }
800
	public void stopEdition(IWriter writer,int sourceType) throws EditionException {
800
	/**
801
	 * En la implementaci?n por defecto podemos hacer que cada feature tenga ID =
802
	 * numero de registro. En el DBAdapter podr?amos "overrride" este m?todo y
803
	 * poner como ID de la Feature el campo ?nico escogido en la base de datos.
804
	 * 
805
	 * @param numReg
806
	 * @return
807
	 * @throws DriverException
808
	 */
809
	public IFeature getFeature(int numReg) throws DriverException {
810
		IGeometry geom;
811
		IFeature feat = null;
812
		try {
813
			geom = getShape(numReg);
814
			DataSource rs = getRecordset();
815
			Value[] regAtt = new Value[rs.getFieldCount()];
816
			for (int fieldId = 0; fieldId < rs.getFieldCount(); fieldId++) {
817
				regAtt[fieldId] = rs.getFieldValue(numReg, fieldId);
818
			}
819

  
820
			feat = new DefaultFeature(geom, regAtt, numReg + "");
821
		} catch (DriverIOException e) {
822
			throw new DriverException(e);
823
		} catch (DriverLoadException e) {
824
			throw new DriverException(e);
825
		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
826
			throw new DriverException(e);
827
		}
828
		return feat;
829
	}
830

  
831
	public void stopEdition(IWriter writer, int sourceType)
832
			throws EditionException {
801 833
		super.stopEdition(writer, sourceType);
802 834
		try {
803 835
			ova.getDriver().reLoad();
......
806 838
			throw new EditionException(e);
807 839
		}
808 840
	}
841

  
809 842
	public Rectangle2D getShapeBounds(int index) throws IOException {
810
		//Solo se utiliza cuando el driver es BoundedShapes
811
//		 Si no est? en el fichero de expansi?n
843
		// Solo se utiliza cuando el driver es BoundedShapes
844
		// Si no est? en el fichero de expansi?n
812 845
		Integer integer = new Integer((int) index);
813 846
		if (!relations.containsKey(integer)) {
814
			if (ova.getDriver() instanceof BoundedShapes){
847
			if (ova.getDriver() instanceof BoundedShapes) {
815 848
				BoundedShapes bs = (BoundedShapes) ova.getDriver();
816 849
				return bs.getShapeBounds(index);
817
			}else{
850
			} else {
818 851
				return ova.getDriver().getShape(index).getBounds2D();
819 852
			}
820 853

  
......
824 857
			feat = (DefaultRowEdited) expansionFile.getRow(num);
825 858
			if (feat.getStatus() == IRowEdited.STATUS_DELETED)
826 859
				return null;
827
			IGeometry geom = ((IFeature)feat.getLinkedRow()).getGeometry();
828
			return geom.getBounds2D();//getGeometry();
860
			IGeometry geom = ((IFeature) feat.getLinkedRow()).getGeometry();
861
			return geom.getBounds2D();// getGeometry();
829 862
		}
830 863

  
831 864
	}
865

  
832 866
	public int getShapeType(int index) {
833 867
		try {
834 868
			return ova.getShapeType();
......
838 872
		}
839 873
		return FShape.MULTI;
840 874
	}
875

  
841 876
	/**
842
	 * Usar solo cuando est?s seguro de que puedes
843
	 * gastar memoria. Nosotros lo usamos para las
844
	 * b?squedas por ?ndice espacial con el handle.
845
	 * La idea es usarlo una vez, guardar las geometr?as que
846
	 * necesitas en ese extent y trabajar con ellas
847
	 * hasta el siguiente cambio de extent.
877
	 * Usar solo cuando est?s seguro de que puedes gastar memoria. Nosotros lo
878
	 * usamos para las b?squedas por ?ndice espacial con el handle. La idea es
879
	 * usarlo una vez, guardar las geometr?as que necesitas en ese extent y
880
	 * trabajar con ellas hasta el siguiente cambio de extent.
881
	 * 
848 882
	 * @param r
849 883
	 * @param strEPSG
850 884
	 * @return
851 885
	 * @throws DriverException
852 886
	 */
853
	public IRowEdited[] getFeatures(Rectangle2D r, String strEPSG) throws DriverException {
887
	public IRowEdited[] getFeatures(Rectangle2D r, String strEPSG)
888
			throws DriverException {
854 889
		// En esta clase suponemos random access.
855 890
		// Luego tendremos otra clase que sea VectorialEditableDBAdapter
856 891
		// que reescribir? este m?todo.
857
        Envelope e = FConverter.convertRectangle2DtoEnvelope(r);
858
        List l = index.query(e);
859
        IRowEdited[] feats = new IRowEdited[l.size()];
860
        try {
861
	        for (int index = 0; index < l.size(); index++) {
862
	            Integer i = (Integer) l.get(index);
863
	            int inverse = getInversedIndex(i.intValue());
892
		Envelope e = FConverter.convertRectangle2DtoEnvelope(r);
893
		List l = index.query(e);
894
		IRowEdited[] feats = new IRowEdited[l.size()];
895
		try {
896
			for (int index = 0; index < l.size(); index++) {
897
				Integer i = (Integer) l.get(index);
898
				int inverse = getInversedIndex(i.intValue());
864 899
				feats[index] = (IRowEdited) getRow(inverse);
865
	        }
900
			}
866 901
		} catch (DriverIOException e1) {
867 902
			throw new DriverException(e1);
868 903
		} catch (IOException e1) {
......
871 906

  
872 907
		return feats;
873 908
	}
909

  
874 910
	public void setSpatialIndex(SpatialIndex spatialIndex) {
875
		index=(Quadtree)spatialIndex;
911
		index = (Quadtree) spatialIndex;
876 912
	}
913

  
877 914
	public void setFullExtent(Rectangle2D fullExtent2) {
878
		fullExtent=fullExtent2;
915
		fullExtent = fullExtent2;
879 916
	}
917

  
880 918
	/**
881 919
	 * DOCUMENT ME!
882
	 *
920
	 * 
883 921
	 * @return DOCUMENT ME!
884 922
	 */
885 923
	public Image getSelectionImage() {
886
	    return selectionImage;
924
		return selectionImage;
887 925
	}
926

  
888 927
	public Image getHandlersImage() {
889 928
		return handlersImage;
890 929
	}
930

  
891 931
	/**
892 932
	 * DOCUMENT ME!
893
	 *
894
	 * @param i DOCUMENT ME!
933
	 * 
934
	 * @param i
935
	 *            DOCUMENT ME!
895 936
	 */
896 937
	public void setSelectionImage(Image i) {
897
	    selectionImage = i;
938
		selectionImage = i;
898 939
	}
940

  
899 941
	public void setHandlersImage(BufferedImage handlersImage) {
900
		this.handlersImage=handlersImage;
942
		this.handlersImage = handlersImage;
901 943
	}
902 944
}

Also available in: Unified diff