Revision 10627 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/spatialindex/SpatialIndexTest.java

View differences:

SpatialIndexTest.java
3 3
import java.awt.geom.Rectangle2D;
4 4
import java.io.File;
5 5

  
6
import com.hardcode.driverManager.DriverLoadException;
7
import com.hardcode.driverManager.DriverManager;
8
import com.iver.cit.gvsig.fmap.DriverException;
6
import junit.framework.TestCase;
7

  
8
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
9
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
10
import com.iver.cit.gvsig.exceptions.visitors.VisitorException;
9 11
import com.iver.cit.gvsig.fmap.crs.CRSFactory;
10 12
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver;
11
import com.iver.cit.gvsig.fmap.edition.writers.shp.Prueba;
12 13
import com.iver.cit.gvsig.fmap.layers.FBitSet;
13
import com.iver.cit.gvsig.fmap.layers.FLayer;
14 14
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
15 15
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
16 16

  
17
import junit.framework.TestCase;
18

  
19 17
public class SpatialIndexTest extends TestCase {
20 18

  
21 19
	FLyrVect lyr;
22
	
20

  
23 21
	public SpatialIndexTest(String name) {
24 22
		super(name);
25 23
	}
......
27 25
	protected void setUp() throws Exception {
28 26
		super.setUp();
29 27
		LayerFactory.setDriversPath("../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers");
30
		lyr = (FLyrVect) LayerFactory.createLayer("Vias", 
28
		lyr = (FLyrVect) LayerFactory.createLayer("Vias",
31 29
				(VectorialFileDriver) LayerFactory.getDM().getDriver("gvSIG shp driver"),
32 30
				new File("C:/lics.shp"),
33 31
				CRSFactory.getCRS("EPSG:23030"));
......
38 36
		super.tearDown();
39 37
		lyr = null;
40 38
	}
41
	
42
	
43
	public void testSpatialIndexFullExtent(){
44
		try {
39

  
40

  
41
	public void testSpatialIndexFullExtent() throws ReadDriverException, ExpansionFileReadException, VisitorException{
45 42
			Rectangle2D rect2D = lyr.getFullExtent();
46 43
			FBitSet bitset = lyr.queryByRect(rect2D);
47 44
			assertTrue(bitset.cardinality() != 0);
48
			
45

  
49 46
			double x = rect2D.getCenterX();
50 47
			double y = rect2D.getCenterY();
51 48
			rect2D = new Rectangle2D.Double( x, y , 100d, 100d);
52 49
			bitset = lyr.queryByRect(rect2D);
53 50
			assertTrue(bitset.cardinality() != 0);
54
//			for(int i = bitset.nextSetBit(0); i >= 0; i = bitset.nextSetBit(i+1)) 
51
//			for(int i = bitset.nextSetBit(0); i >= 0; i = bitset.nextSetBit(i+1))
55 52
//			{
56
//				System.out.println(i);	
53
//				System.out.println(i);
57 54
//			}
58
		} catch (DriverException e) {
59
			// TODO Auto-generated catch block
60
			e.printStackTrace();
61
		}
62
		
55

  
56

  
63 57
	}
64 58

  
65 59
}

Also available in: Unified diff