Revision 7355 branches/v10/extensions/extWFS2/src-test/com/iver/cit/gvsig/fmap/layers/gml/GMLParseTest.java

View differences:

GMLParseTest.java
2 2
import java.io.File;
3 3
import java.io.FileInputStream;
4 4
import java.io.InputStream;
5
import java.net.URL;
6 5

  
7
import javax.xml.parsers.DocumentBuilderFactory;
8

  
9
import org.geotools.data.DefaultQuery;
10
import org.geotools.data.FeatureReader;
11
import org.geotools.data.Transaction;
12
import org.geotools.data.wfs.WFSDataStore;
13
import org.geotools.data.wfs.WFSDataStoreFactory;
14
import org.geotools.data.wfs.WFSFeatureReader;
15
import org.geotools.data.wfs.WFSFeatureStore;
16
import org.geotools.feature.Feature;
17
import org.geotools.feature.FeatureFactory;
18
import org.w3c.dom.Document;
19

  
20
import com.iver.cit.gvsig.fmap.core.DefaultFeature;
21
import com.iver.cit.gvsig.fmap.drivers.geotools.WFSFeaturesIterator;
22
import com.vividsolutions.jts.util.GeometricShapeFactory;
23

  
24 6
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
25 7
 *
26 8
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
......
65 47
 *
66 48
 * $Id$
67 49
 * $Log$
68
 * Revision 1.1  2006-07-24 07:30:33  jorpiell
50
 * Revision 1.1.2.1  2006-09-19 12:27:35  jorpiell
51
 * Ya no se depende de geotools
52
 *
53
 * Revision 1.2  2006/09/18 12:07:31  jorpiell
54
 * Se ha sustituido geotools por el driver de remoteservices
55
 *
56
 * Revision 1.1  2006/07/24 07:30:33  jorpiell
69 57
 * Se han eliminado las partes duplicadas y se est? usando el parser de GML de FMAP.
70 58
 *
71 59
 *
......
74 62
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
75 63
 */
76 64
public class GMLParseTest {
77
	private static String sfile = new String("E:\\cities.gml");
65
	private static String sfile = new String("E:\\wfs_getFeature.xml");
78 66
	
79 67
	public static void main(String[] args) throws Exception {
80 68
		parseFile(sfile);
......
83 71
	public static void parseFile(String sfile) throws Exception{
84 72
		InputStream is = new FileInputStream(new File(sfile));		
85 73
			
86
		FeatureReader r = WFSFeatureReader.getFeatureReader(is, 
87
				10000,
88
				10000,
89
				null,
90
				null);		
91
				
92
		int i=0;
74
//		FeatureReader r = WFSFeatureReader.getFeatureReader(is, 
75
//				10000,
76
//				10000,
77
//				null,
78
//				null);		
79
//				
80
//		int i=0;
81
//		
82
//		try{
83
//		while (r.hasNext()){
84
//			r.next();
85
//			System.out.println(i++);
86
//			
87
//		}
88
//		}catch (Exception e){
89
//			e.printStackTrace();
90
//		}
91
//		System.out.println("NUM FEATURES: " + i);
93 92
		
94
		try{
95
		while (r.hasNext()){
96
			r.next();
97
			System.out.println(i++);
98
			
99
		}
100
		}catch (Exception e){
101
			e.printStackTrace();
102
		}
103
		System.out.println("NUM FEATURES: " + i);
104
		
105 93
		//URL url = new File(sfile).toURL();
106 94
		//GMLDataStore dataStore = new GMLDataStore(new File(sfile).toURI());//(GMLDataStore) new GMLDataStoreFactory().createDataStore(url);
107 95
		//FeatureReader reader = dataStore.getFeatureReader(new DefaultQuery("places"),Transaction.AUTO_COMMIT);

Also available in: Unified diff