root / trunk / libraries / libGPE / src / org / gvsig / gpe / writers / GPEWriterHandler.java @ 11247
History | View | Annotate | Download (6.26 KB)
1 | 11178 | jorpiell | package org.gvsig.gpe.writers; |
---|---|---|---|
2 | |||
3 | import java.io.File; |
||
4 | |||
5 | 11208 | jorpiell | import org.gvsig.gpe.GPEDefaults; |
6 | 11178 | jorpiell | import org.gvsig.gpe.GPEErrorHandler; |
7 | import org.gvsig.gpe.IGPEContentHandler; |
||
8 | import org.xml.sax.ErrorHandler; |
||
9 | |||
10 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
11 | *
|
||
12 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
13 | *
|
||
14 | * This program is free software; you can redistribute it and/or
|
||
15 | * modify it under the terms of the GNU General Public License
|
||
16 | * as published by the Free Software Foundation; either version 2
|
||
17 | * of the License, or (at your option) any later version.
|
||
18 | *
|
||
19 | * This program is distributed in the hope that it will be useful,
|
||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
22 | * GNU General Public License for more details.
|
||
23 | *
|
||
24 | * You should have received a copy of the GNU General Public License
|
||
25 | * along with this program; if not, write to the Free Software
|
||
26 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
27 | *
|
||
28 | * For more information, contact:
|
||
29 | *
|
||
30 | * Generalitat Valenciana
|
||
31 | * Conselleria d'Infraestructures i Transport
|
||
32 | * Av. Blasco Ib??ez, 50
|
||
33 | * 46010 VALENCIA
|
||
34 | * SPAIN
|
||
35 | *
|
||
36 | * +34 963862235
|
||
37 | * gvsig@gva.es
|
||
38 | * www.gvsig.gva.es
|
||
39 | *
|
||
40 | * or
|
||
41 | *
|
||
42 | * IVER T.I. S.A
|
||
43 | * Salamanca 50
|
||
44 | * 46005 Valencia
|
||
45 | * Spain
|
||
46 | *
|
||
47 | * +34 963163400
|
||
48 | * dac@iver.es
|
||
49 | */
|
||
50 | /* CVS MESSAGES:
|
||
51 | *
|
||
52 | * $Id$
|
||
53 | * $Log$
|
||
54 | 11247 | jorpiell | * Revision 1.4 2007-04-19 07:23:20 jorpiell
|
55 | * Add the add methods to teh contenhandler and change the register mode
|
||
56 | *
|
||
57 | * Revision 1.3 2007/04/14 16:06:13 jorpiell
|
||
58 | 11208 | jorpiell | * The writer handler has been updated
|
59 | *
|
||
60 | * Revision 1.2 2007/04/13 13:14:55 jorpiell
|
||
61 | 11203 | jorpiell | * Created the base tests and add some methods to the content handler
|
62 | *
|
||
63 | * Revision 1.1 2007/04/13 07:17:54 jorpiell
|
||
64 | 11178 | jorpiell | * Add the writting tests for the simple geometries
|
65 | *
|
||
66 | * Revision 1.2 2007/04/12 17:06:42 jorpiell
|
||
67 | * First GML writing tests
|
||
68 | *
|
||
69 | * Revision 1.1 2007/04/12 10:20:40 jorpiell
|
||
70 | * Add the writer
|
||
71 | *
|
||
72 | *
|
||
73 | */
|
||
74 | /**
|
||
75 | * @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
||
76 | */
|
||
77 | public abstract class GPEWriterHandler implements IGPEWriterHandler{ |
||
78 | private String format = null; |
||
79 | 11247 | jorpiell | private String version = null; |
80 | 11208 | jorpiell | private String fileName = null; |
81 | 11247 | jorpiell | private File outputFile = null; |
82 | 11178 | jorpiell | private GPEErrorHandler errorHandler = null; |
83 | 11208 | jorpiell | |
84 | 11247 | jorpiell | public GPEWriterHandler(){
|
85 | |||
86 | 11178 | jorpiell | } |
87 | 11208 | jorpiell | |
88 | 11178 | jorpiell | /**
|
89 | 11247 | jorpiell | * Gets the deafult writting version
|
90 | * @return
|
||
91 | */
|
||
92 | public abstract String getDefaultVersion(); |
||
93 | |||
94 | /**
|
||
95 | * Gets the deafult format
|
||
96 | * @return
|
||
97 | */
|
||
98 | public abstract String getDefaultFormat(); |
||
99 | |||
100 | /**
|
||
101 | * Creates the output file and
|
||
102 | * @return the file
|
||
103 | */
|
||
104 | public File getOutputFile() { |
||
105 | if (outputFile == null){ |
||
106 | if (fileName == null){ |
||
107 | fileName = GPEDefaults.getProperty(GPEDefaults.DEFAULT_FILE_NAME); |
||
108 | } |
||
109 | //TODO If the file ends with the format...
|
||
110 | outputFile = new File(fileName + "." + getFormat().toLowerCase()); |
||
111 | } |
||
112 | return outputFile;
|
||
113 | } |
||
114 | |||
115 | |||
116 | /**
|
||
117 | 11178 | jorpiell | * @return the errorHandler
|
118 | */
|
||
119 | public GPEErrorHandler getErrorHandler() {
|
||
120 | return errorHandler;
|
||
121 | } |
||
122 | |||
123 | 11247 | jorpiell | /**
|
124 | * @param errorHandler the errorHandler to set
|
||
125 | */
|
||
126 | public void setErrorHandler(GPEErrorHandler errorHandler) { |
||
127 | this.errorHandler = errorHandler;
|
||
128 | } |
||
129 | |||
130 | /**
|
||
131 | * @return the fileName
|
||
132 | */
|
||
133 | public String getFileName() { |
||
134 | return fileName;
|
||
135 | } |
||
136 | |||
137 | /**
|
||
138 | * @param fileName the fileName to set
|
||
139 | */
|
||
140 | public void setFileName(String fileName) { |
||
141 | this.fileName = fileName;
|
||
142 | } |
||
143 | |||
144 | /**
|
||
145 | * @return the format
|
||
146 | */
|
||
147 | public String getFormat() { |
||
148 | if (format == null){ |
||
149 | return getDefaultFormat();
|
||
150 | } |
||
151 | return format;
|
||
152 | } |
||
153 | |||
154 | /**
|
||
155 | * @param format the format to set
|
||
156 | */
|
||
157 | public void setFormat(String format) { |
||
158 | this.format = format;
|
||
159 | } |
||
160 | |||
161 | /**
|
||
162 | * @return the version
|
||
163 | */
|
||
164 | public String getVersion() { |
||
165 | if (version == null){ |
||
166 | return getDefaultVersion();
|
||
167 | } |
||
168 | return version;
|
||
169 | } |
||
170 | |||
171 | /**
|
||
172 | * @param version the version to set
|
||
173 | */
|
||
174 | public void setVersion(String version) { |
||
175 | this.version = version;
|
||
176 | } |
||
177 | |||
178 | 11178 | jorpiell | public void close() { |
179 | // TODO Auto-generated method stub
|
||
180 | |||
181 | } |
||
182 | |||
183 | public void endBbox() { |
||
184 | // TODO Auto-generated method stub
|
||
185 | |||
186 | } |
||
187 | |||
188 | public void endElement() { |
||
189 | // TODO Auto-generated method stub
|
||
190 | |||
191 | } |
||
192 | |||
193 | public void endInnerBoundary() { |
||
194 | // TODO Auto-generated method stub
|
||
195 | |||
196 | } |
||
197 | |||
198 | public void endLayer() { |
||
199 | // TODO Auto-generated method stub
|
||
200 | |||
201 | } |
||
202 | |||
203 | public void endLineString() { |
||
204 | // TODO Auto-generated method stub
|
||
205 | |||
206 | } |
||
207 | |||
208 | public void endLinearRing() { |
||
209 | // TODO Auto-generated method stub
|
||
210 | |||
211 | } |
||
212 | |||
213 | public void endPoint() { |
||
214 | // TODO Auto-generated method stub
|
||
215 | |||
216 | } |
||
217 | |||
218 | public void endPolygon() { |
||
219 | // TODO Auto-generated method stub
|
||
220 | |||
221 | } |
||
222 | |||
223 | public void initialize() { |
||
224 | // TODO Auto-generated method stub
|
||
225 | |||
226 | } |
||
227 | |||
228 | public void startBbox(String id, double[] x, double[] y, double[] z, String srs) { |
||
229 | // TODO Auto-generated method stub
|
||
230 | |||
231 | } |
||
232 | |||
233 | public void startElement(String name, Object value, Object type) { |
||
234 | // TODO Auto-generated method stub
|
||
235 | |||
236 | } |
||
237 | |||
238 | public void startInnerBoundary(String id, double[] x, double[] y, double[] z, String srs) { |
||
239 | // TODO Auto-generated method stub
|
||
240 | |||
241 | } |
||
242 | |||
243 | public void startLayer(String id, String name, String description, String srs) { |
||
244 | // TODO Auto-generated method stub
|
||
245 | |||
246 | } |
||
247 | |||
248 | public void startLineString(String id, double[] x, double[] y, double[] z, String srs) { |
||
249 | // TODO Auto-generated method stub
|
||
250 | |||
251 | } |
||
252 | |||
253 | public void startLinearRing(String id, double[] x, double[] y, double[] z, String srs) { |
||
254 | // TODO Auto-generated method stub
|
||
255 | |||
256 | 11203 | jorpiell | } |
257 | 11178 | jorpiell | |
258 | public void startPoint(String id, double x, double y, double z, String srs) { |
||
259 | // TODO Auto-generated method stub
|
||
260 | |||
261 | } |
||
262 | |||
263 | public void startPolygon(String id, double[] x, double[] y, double[] z, String srs) { |
||
264 | // TODO Auto-generated method stub
|
||
265 | |||
266 | } |
||
267 | |||
268 | public void endFeature() { |
||
269 | // TODO Auto-generated method stub
|
||
270 | |||
271 | } |
||
272 | |||
273 | public void startFeature(String name, String id) { |
||
274 | // TODO Auto-generated method stub
|
||
275 | |||
276 | } |
||
277 | |||
278 | |||
279 | 11203 | jorpiell | public void endMuliPoint() { |
280 | // TODO Auto-generated method stub
|
||
281 | |||
282 | } |
||
283 | |||
284 | public void endMultiLineString() { |
||
285 | // TODO Auto-generated method stub
|
||
286 | |||
287 | } |
||
288 | |||
289 | public void endMultiPolygon() { |
||
290 | // TODO Auto-generated method stub
|
||
291 | |||
292 | } |
||
293 | |||
294 | public void startMultiLineString(String id, String srs) { |
||
295 | // TODO Auto-generated method stub
|
||
296 | |||
297 | } |
||
298 | |||
299 | public void startMultiPoint(String id, String srs) { |
||
300 | // TODO Auto-generated method stub
|
||
301 | |||
302 | } |
||
303 | |||
304 | public void startMultiPolygon(String id, String srs) { |
||
305 | // TODO Auto-generated method stub
|
||
306 | |||
307 | 11208 | jorpiell | } |
308 | 11178 | jorpiell | } |