Revision 10716 branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/strategies/DefaultStrategy.java

View differences:

DefaultStrategy.java
441 441

  
442 442
	}
443 443

  
444
	/**
445
	 * Similar to process, but calls visitWithSymbol in FeatureVisitor.
446
	 * @param visitor
447
	 * @param rectangle
448
	 * @param cancel
449
	 * @throws DriverException
450
	 * @throws VisitException
451
	 */
452
	public void processWithSymbols(ExtendsFeatureVisitor visitor, Rectangle2D extent, CancellableMonitorable cancel) throws DriverException, VisitException {
453
		
454
		if (visitor==null)
455
			return;
456
		
457
		/*IGeometry geom = null;
458
		int index = -1;
459
		ISymbol symbol = null;
460
		visitor.visitWithSymbol(geom, index, symbol); // TEST */
461
		
462
		try {
463
			ReadableVectorial adapter = ((SingleLayer) capa).getSource();
464
			ICoordTrans ct = getCapa().getCoordTrans();
465
			//logger.debug("adapter.start()");
466
			adapter.start();
467

  
468
			//logger.debug("getCapa().getRecordset().start()");
469
			SelectableDataSource rsSel = ((AlphanumericData) getCapa()).getRecordset();
470
			if (rsSel != null)
471
			    rsSel.start();
472

  
473
			int sc = adapter.getShapeCount();
474
			
475
			// TODO: A revisar si es o no conveniente este sistema
476
			// de comunicaci?n con los drivers.
477
			DriverAttributes attr = adapter.getDriverAttributes();
478
			boolean bMustClone = false;
479
			if (attr != null)
480
			{
481
			    if (attr.isLoadedInMemory())
482
			    {
483
			        bMustClone = attr.isLoadedInMemory();
484
			    }
485
			}
486
			VectorialLegend l = (VectorialLegend) ((ClassifiableVectorial) capa).getLegend();
487
            FBitSet bitSet = null;
488
            if (getCapa() instanceof Selectable){
489
                Selectable selection = (Selectable) getCapa();
490
                bitSet = selection.getSelection();
491
            }
492
			for (int i = 0; i < sc; i++) {
493
				if (cancel!=null && cancel.isCanceled()) {
494
					break;
495
				}
496

  
497
				IGeometry geom = adapter.getShape(i);
498

  
499
				if (geom == null) {
500
					continue;
501
				}
502

  
503
				if (ct != null) {
504
				    if (bMustClone)
505
				        geom = geom.cloneGeometry();
506
					geom.reProject(ct);
507
				}
508

  
509
				if (extent == null || 
510
						geom.fastIntersects(extent.getMinX(), extent.getMinY(),
511
				             extent.getWidth(), extent.getHeight())) {
512
					ISymbol symbol = l.getSymbol(i);
513

  
514
                    if (symbol ==null)
515
                        continue;
516
                    if (bitSet != null)
517
                        if (bitSet.get(i)) {
518
    						symbol = symbol.getSymbolForSelection();
519
    					}
520
					// send feature for process in visitor
521
					visitor.visitWithSymbol(geom, i, symbol);
522
					
523
				}
524
				/* else
525
				{
526
				    System.out.println("no pinto id=" + i);
527
				} */
528
			}
529

  
530
			//logger.debug("getCapa().getRecordset().stop()");
531
			if (rsSel != null)
532
			    rsSel.stop();
533

  
534
			//logger.debug("adapter.stop()");
535
			adapter.stop();
536

  
537
		} catch (DriverIOException e) {
538
			throw new DriverException(e);
539
		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
540
		    throw new DriverException(e);
541
		} catch (DriverException e) {
542
		    throw new DriverException(e);
543
        }
544
	}
545

  
546

  
444 547
}

Also available in: Unified diff