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