Revision 4895 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/strategies/ShpStrategy.java

View differences:

ShpStrategy.java
204 204

  
205 205
			for (int aux = 0; aux < sc; aux++) {
206 206
				// Salimos si alguien cancela
207
				if (cancel.isCanceled()) {
208
					break;
207
				if(cancel != null){//azabala (por si acaso, al arreglar bug de process)
208
					if (cancel.isCanceled()) {
209
						break;
210
					}
209 211
				}
210 212
                if (bUseSpatialIndex)
211 213
                {
......
570 572
            	if(cancel != null){
571 573
            		cancel.reportStep();
572 574
            		if(cancel.isCanceled()){
573
            			break;
575
            			va.stop();
576
            			return bitset;
574 577
            		}
575 578
            	}
576
            	if(cancel.isCanceled()){
577
            		va.stop();
578
            		return bitset;
579
            	}
580 579
                idRec = (Integer) lstRecs.get(i);
581 580
                index = idRec.intValue();
582 581
                IGeometry geom = va.getShape(index);
......
598 597
    }
599 598
    
600 599

  
600
    public void process(FeatureVisitor visitor, Rectangle2D rectangle) throws DriverException, VisitException{
601
    	process(visitor, rectangle, null);
602
    }
603
    
604
    
605
    /**
606
     * Processes (by calling visitor.process() method) only those
607
     * features of the vectorial layer associated which intersects given
608
     * rectangle2d.
609
     * 
610
     */
611
   
601 612
    public void process(FeatureVisitor visitor, Rectangle2D rectangle, CancellableMonitorable cancel) throws DriverException, VisitException {
602 613
        FLyrVect lyr = (FLyrVect) capa;
603 614
        if (lyr.getSpatialIndex() == null){
......
611 622
        Coordinate c1 = new Coordinate(bounds.getMinX(), bounds.getMinY());
612 623
        Coordinate c2 = new Coordinate(bounds.getMaxX(), bounds.getMaxY());
613 624
        Envelope env = new Envelope(c1, c2);
625
        
626
 long t0 = System.currentTimeMillis();       
614 627
        List lstRecs = lyr.getSpatialIndex().query(env);
615
        Integer idRec;
628
System.out.println((System.currentTimeMillis() - t0)+" en atacar el indice espacial");        
629
       
630
		Integer idRec;
616 631
        int index;
617 632
        try {
618 633
            va.start();
......
641 656
                        geom = geom.cloneGeometry();
642 657
                    geom.reProject(ct);
643 658
                }
659
  t0 = System.currentTimeMillis();                  
644 660
                if (geom.intersects(rectangle))
645 661
                    visitor.visit(geom, index);
646
            }
662
                System.out.println((System.currentTimeMillis() - t0)+" en procesar la geometria "+i);               
663
            }//for
647 664
            va.stop();
648 665
        } catch (DriverIOException e) {
649 666
            // TODO Auto-generated catch block

Also available in: Unified diff