Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / drivers / gml / GMLFeaturesParser.java @ 6507

History | View | Annotate | Download (3.21 KB)

1
package com.iver.cit.gvsig.fmap.drivers.gml;
2

    
3
import java.io.File;
4
import java.io.FileInputStream;
5
import java.io.InputStream;
6
import java.util.Vector;
7

    
8
import org.geotools.data.FeatureReader;
9
import org.geotools.data.wfs.WFSFeatureReader;
10
import org.geotools.data.wfs.WFSTransactionState;
11
import org.geotools.factory.FactoryConfigurationError;
12
import org.geotools.feature.AttributeType;
13
import org.geotools.feature.AttributeTypeFactory;
14
import org.geotools.feature.FeatureType;
15
import org.geotools.feature.FeatureTypeBuilder;
16
import org.geotools.feature.SchemaException;
17
import org.geotools.xml.gml.GMLFeatureCollection;
18
import org.xml.sax.SAXException;
19

    
20
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
21
*
22
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
23
*
24
* This program is free software; you can redistribute it and/or
25
* modify it under the terms of the GNU General Public License
26
* as published by the Free Software Foundation; either version 2
27
* of the License, or (at your option) any later version.
28
*
29
* This program is distributed in the hope that it will be useful,
30
* but WITHOUT ANY WARRANTY; without even the implied warranty of
31
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32
* GNU General Public License for more details.
33
*
34
* You should have received a copy of the GNU General Public License
35
* along with this program; if not, write to the Free Software
36
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
37
*
38
* For more information, contact:
39
*
40
*  Generalitat Valenciana
41
*   Conselleria d'Infraestructures i Transport
42
*   Av. Blasco Ib??ez, 50
43
*   46010 VALENCIA
44
*   SPAIN
45
*
46
*      +34 963862235
47
*   gvsig@gva.es
48
*      www.gvsig.gva.es
49
*
50
*    or
51
*
52
*   IVER T.I. S.A
53
*   Salamanca 50
54
*   46005 Valencia
55
*   Spain
56
*
57
*   +34 963163400
58
*   dac@iver.es
59
*/
60
/* CVS MESSAGES:
61
*
62
* $Id: GMLFeaturesParser.java 6507 2006-07-24 07:36:40Z jorpiell $
63
* $Log$
64
* Revision 1.2  2006-07-24 07:36:40  jorpiell
65
* Se han hecho un cambio en los nombres de los metodos para clarificar
66
*
67
* Revision 1.1  2006/07/19 12:29:39  jorpiell
68
* A?adido el driver de GML
69
*
70
*
71
*/
72
/**
73
 * It parses a getFeature request file
74
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
75
 */
76
public class GMLFeaturesParser{
77
        private static int buffer  = 100000000;
78
        private static int timeout = 100000000;
79
        
80
        /**
81
         * Return an iterrator of features
82
         * @param file
83
         * File to parse
84
         * @param currentSRS
85
         * Curerent SRS (to reproject)
86
         * @return
87
         * Iterator
88
         * @throws Exception
89
         */
90
        public static GMLFeaturesIterator getFeatureReader(File file) throws Exception{
91
                FileInputStream is = new FileInputStream(file);
92
                        
93
                FeatureReader featureReader = getFeatureReader(is,
94
                                buffer,
95
                                timeout,
96
                                null,
97
                                null);                        
98
                        
99
                return new GMLFeaturesIterator(featureReader);
100
        }
101
        
102
        /**
103
         * Gets a feature reader
104
         * @param is
105
         * WFS getFeature XML File
106
         * @param bufferSize
107
         * buffer size
108
         * @param timeout
109
         * Request timeout
110
         * @param transaction
111
         * @param ft
112
         * Feature schema
113
         * @return
114
         * @throws SAXException 
115
         */
116
        public static FeatureReader getFeatureReader(InputStream is,
117
                int bufferSize, int timeout, WFSTransactionState transaction, FeatureType ft) throws SAXException{
118
            return WFSFeatureReader.getFeatureReader(is, bufferSize,
119
                            timeout, transaction, ft);
120
    }
121

    
122
        
123
        
124
}