svn-gvsig-desktop / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / drivers / dgn / DGNDriver.java @ 695
History | View | Annotate | Download (20.3 KB)
1 |
package com.iver.cit.gvsig.fmap.drivers.dgn; |
---|---|
2 |
|
3 |
import java.awt.geom.AffineTransform; |
4 |
import java.awt.geom.Arc2D; |
5 |
import java.awt.geom.Rectangle2D; |
6 |
import java.io.File; |
7 |
import java.io.IOException; |
8 |
import java.util.ArrayList; |
9 |
|
10 |
import com.hardcode.gdbms.engine.data.DriverException; |
11 |
import com.hardcode.gdbms.engine.data.FileDriver; |
12 |
import com.hardcode.gdbms.engine.values.Value; |
13 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
14 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
15 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
16 |
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver; |
17 |
|
18 |
|
19 |
/**
|
20 |
* DOCUMENT ME!
|
21 |
*
|
22 |
* @author Vicente Caballero Navarro
|
23 |
*/
|
24 |
public class DGNDriver implements VectorialFileDriver, FileDriver { |
25 |
|
26 |
DGNReader m_DgnReader; |
27 |
|
28 |
private final int ID_FIELD_ID=0; |
29 |
private final int ID_FIELD_ENTITY=1; |
30 |
private final int ID_FIELD_LAYER=2; |
31 |
private final int ID_FIELD_COLOR=3; |
32 |
private final int ID_FIELD_HEIGHTTEXT=4; |
33 |
private final int ID_FIELD_ROTATIONTEXT=5; |
34 |
private final int ID_FIELD_TEXT=6; |
35 |
|
36 |
private String path; |
37 |
private File m_Fich; |
38 |
|
39 |
// Campos del registro en cache:
|
40 |
Object [] auxRow = new Object[7]; |
41 |
Object [] cellRow = new Object[7]; |
42 |
Object [] complexRow = new Object[7]; |
43 |
|
44 |
/**
|
45 |
* Traduce las posiciones de comienzo de las entidades del DGN
|
46 |
* a nuestras entidades FShape. (Una FShape puede corresponder
|
47 |
* a varias entidades de un DGN).
|
48 |
*/
|
49 |
private int[] m_posShapes; |
50 |
|
51 |
|
52 |
/**
|
53 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#open(java.io.File)
|
54 |
*/
|
55 |
public void open(File f) throws IOException { |
56 |
m_Fich = f; |
57 |
} |
58 |
|
59 |
/**
|
60 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#close()
|
61 |
*/
|
62 |
public void close() throws IOException { |
63 |
} |
64 |
|
65 |
/**
|
66 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#getShape(int)
|
67 |
*/
|
68 |
public IGeometry getShape(int index) throws IOException { |
69 |
boolean bElementoCompuesto = false, bEsPoligono = false; |
70 |
boolean bInsideCell = false; |
71 |
boolean bFirstHoleEntity = false; |
72 |
boolean bConnect = false; // Se usa para que los pol?gonos cierren bien cuando son formas compuestas |
73 |
// int contadorSubElementos =0, numSubElementos = 0;
|
74 |
int complex_index_fill_color= -1; |
75 |
int nClass; // Para filtrar los elementos de construcci?n, etc. |
76 |
|
77 |
|
78 |
ArrayList arrayFields = new ArrayList(); |
79 |
arrayFields.add("ID");
|
80 |
arrayFields.add("Entity");
|
81 |
arrayFields.add("Layer");
|
82 |
arrayFields.add("Color");
|
83 |
arrayFields.add("HeightText");
|
84 |
arrayFields.add("RotationText");
|
85 |
arrayFields.add("Text");
|
86 |
|
87 |
IGeometry aux; |
88 |
GeneralPathX elementoCompuesto = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD);
|
89 |
|
90 |
m_DgnReader.DGNGotoElement(index); |
91 |
|
92 |
DGNElemCore elemento = m_DgnReader.DGNReadElement(); |
93 |
nClass= 0;
|
94 |
if (elemento.properties != 0) |
95 |
nClass = elemento.properties & DGNFileHeader.DGNPF_CLASS; |
96 |
if ((elemento != null) && (elemento.deleted == 0) && (nClass == 0)) //Leer un elemento |
97 |
{ |
98 |
aux = null;
|
99 |
// if ((elemento.element_id > 3800) && (elemento.element_id < 3850))
|
100 |
// m_DgnReader.DGNDumpElement(m_DgnReader.getInfo(),elemento,"");
|
101 |
|
102 |
if ((elemento.stype == DGNFileHeader.DGNST_MULTIPOINT) || (elemento.stype == DGNFileHeader.DGNST_ARC)
|
103 |
|| (elemento.stype == DGNFileHeader.DGNST_CELL_HEADER) |
104 |
|| (elemento.stype == DGNFileHeader.DGNST_SHARED_CELL_DEFN) |
105 |
|| (elemento.stype == DGNFileHeader.DGNST_COMPLEX_HEADER)) |
106 |
{ |
107 |
if (elemento.complex != 0) |
108 |
{ |
109 |
bElementoCompuesto = true;
|
110 |
} |
111 |
else
|
112 |
{ |
113 |
if (bElementoCompuesto)
|
114 |
{ |
115 |
if (bInsideCell)
|
116 |
{ |
117 |
auxRow[ID_FIELD_ENTITY] = cellRow[ID_FIELD_ENTITY]; |
118 |
} |
119 |
else
|
120 |
{ |
121 |
auxRow = complexRow; |
122 |
} |
123 |
// System.err.println("Entidad compuesta. bInsideCell = " + bInsideCell + " auxRow = " + auxRow[ID_FIELD_ENTITY]);
|
124 |
// TODO: CREACION DE LINEA lyrLines.addShape(new FShape(FConstant.SHAPE_TYPE_POLYLINE, elementoCompuesto), auxRow);
|
125 |
if (bEsPoligono)
|
126 |
{ |
127 |
if (complex_index_fill_color != -1) |
128 |
auxRow[ID_FIELD_COLOR] = new Integer(complex_index_fill_color); |
129 |
|
130 |
// TODO: CREAR POLIGONO lyrPolygons.addShape(new FShape(FConstant.SHAPE_TYPE_POLYGON, elementoCompuesto), auxRow);
|
131 |
} |
132 |
elementoCompuesto = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD);
|
133 |
} |
134 |
// System.err.println("Entidad simple");
|
135 |
bElementoCompuesto = false;
|
136 |
bEsPoligono = false;
|
137 |
bConnect = false;
|
138 |
// elementoCompuesto = new GeneralPathX();
|
139 |
bInsideCell = false;
|
140 |
} |
141 |
} |
142 |
switch (elemento.stype)
|
143 |
{ |
144 |
case DGNFileHeader.DGNST_SHARED_CELL_DEFN:
|
145 |
bInsideCell = true;
|
146 |
cellRow[ID_FIELD_ID] = new Integer(elemento.element_id); |
147 |
cellRow[ID_FIELD_LAYER] = new Integer(elemento.level); |
148 |
cellRow[ID_FIELD_COLOR] = new Integer(elemento.color); |
149 |
cellRow[ID_FIELD_ENTITY] = new String("Shared Cell"); |
150 |
break;
|
151 |
case DGNFileHeader.DGNST_CELL_HEADER:
|
152 |
bInsideCell = true;
|
153 |
DGNElemCellHeader psCellHeader = (DGNElemCellHeader) elemento; |
154 |
cellRow[ID_FIELD_ID] = new Integer(elemento.element_id); |
155 |
cellRow[ID_FIELD_LAYER] = new Integer(elemento.level); |
156 |
cellRow[ID_FIELD_COLOR] = new Integer(elemento.color); |
157 |
cellRow[ID_FIELD_ENTITY] = new String("Cell"); |
158 |
complex_index_fill_color = m_DgnReader.DGNGetShapeFillInfo(elemento); |
159 |
// System.err.println("Cell Header " + complex_index_fill_color);
|
160 |
break;
|
161 |
|
162 |
case DGNFileHeader.DGNST_COMPLEX_HEADER:
|
163 |
// bElementoCompuesto = true;
|
164 |
// System.err.println("Complex Header");
|
165 |
// contadorSubElementos = 0;
|
166 |
DGNElemComplexHeader psComplexHeader = (DGNElemComplexHeader) elemento; |
167 |
// numSubElementos = psComplexHeader.numelems;
|
168 |
complexRow[ID_FIELD_ID] = new Integer(elemento.element_id); |
169 |
complexRow[ID_FIELD_LAYER] = new Integer(elemento.level); |
170 |
complexRow[ID_FIELD_COLOR] = new Integer(elemento.color); |
171 |
complexRow[ID_FIELD_ENTITY] = new String("Complex"); |
172 |
|
173 |
|
174 |
if (psComplexHeader.type == DGNFileHeader.DGNT_COMPLEX_SHAPE_HEADER)
|
175 |
{ |
176 |
bEsPoligono = true;
|
177 |
// Si es un agujero, no conectamos con el anterior
|
178 |
if ((psComplexHeader.properties & 0x8000) != 0) |
179 |
bFirstHoleEntity = true;
|
180 |
else
|
181 |
{ |
182 |
// Miramos si tiene color de relleno
|
183 |
// complex_index_fill_color = -1;
|
184 |
// if (elemento.attr_bytes > 0) {
|
185 |
complex_index_fill_color = m_DgnReader.DGNGetShapeFillInfo(elemento); |
186 |
// System.err.println("complex shape fill color = " + elemento.color);
|
187 |
// }
|
188 |
|
189 |
} |
190 |
bConnect = true;
|
191 |
} |
192 |
else
|
193 |
{ |
194 |
bEsPoligono = false;
|
195 |
bConnect = false;
|
196 |
} |
197 |
break;
|
198 |
case DGNFileHeader.DGNST_MULTIPOINT:
|
199 |
// OJO: Si lo que viene en este multipoint es un elemento con type=11 (curve), se trata de una "parametric
|
200 |
// spline curve". La vamos a tratar como si no fuera curva, pero seg?n la documentaci?n, los 2 primeros puntos
|
201 |
// y los 2 ?ltimos puntos definen "endpoint derivatives" y NO se muestran.
|
202 |
// TODAV?A HAY UN PEQUE?O FALLO CON EL FICHERO dgn-sample.dgn, pero lo dejo por ahora.
|
203 |
// Es posible que tenga que ver con lo de los arcos (arco distorsionado), que
|
204 |
// todav?a no est? metido.
|
205 |
DGNElemMultiPoint psLine = (DGNElemMultiPoint) elemento; |
206 |
|
207 |
auxRow[ID_FIELD_LAYER] = new Integer(elemento.level); |
208 |
auxRow[ID_FIELD_COLOR] = new Integer(elemento.color); |
209 |
|
210 |
if ((psLine.num_vertices == 2) && (psLine.vertices[0].x == psLine.vertices[1].x) |
211 |
&& (psLine.vertices[0].y == psLine.vertices[1].y)) |
212 |
{ |
213 |
auxRow[ID_FIELD_ENTITY] = new String("Point"); |
214 |
// TODO: CREAR PUNTO lyrPoints.addShape(new FShape(new FPoint(psLine.vertices[0].x,
|
215 |
// psLine.vertices[0].y,psLine.vertices[0].z),FConstant.SHAPE_TYPE_POINT), auxRow);
|
216 |
return ShapeFactory.createPoint3D(psLine.vertices[0].x, psLine.vertices[0].y,psLine.vertices[0].z); |
217 |
} |
218 |
else
|
219 |
{ |
220 |
GeneralPathX elShape = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD);
|
221 |
if (psLine.type == DGNFileHeader.DGNT_CURVE)
|
222 |
{ |
223 |
psLine.num_vertices = psLine.num_vertices - 4;
|
224 |
for (int aux_n = 0; aux_n < psLine.num_vertices; aux_n++) |
225 |
{ |
226 |
psLine.vertices[aux_n] = psLine.vertices[aux_n+2];
|
227 |
} |
228 |
} |
229 |
if ((psLine.type == DGNFileHeader.DGNT_SHAPE)
|
230 |
&& ((psLine.properties & 0x8000) != 0)) |
231 |
{ |
232 |
// Invertimos el orden porque es un agujero
|
233 |
elShape.moveTo(psLine.vertices[psLine.num_vertices-1].x,
|
234 |
psLine.vertices[psLine.num_vertices-1].y);
|
235 |
for (int i = psLine.num_vertices-2; i >= 0; i--) |
236 |
elShape.lineTo( psLine.vertices[i].x, |
237 |
psLine.vertices[i].y); |
238 |
} |
239 |
else
|
240 |
{ |
241 |
elShape.moveTo(psLine.vertices[0].x, psLine.vertices[0].y); |
242 |
for (int i = 1; i < psLine.num_vertices; i++) |
243 |
elShape.lineTo( psLine.vertices[i].x, |
244 |
psLine.vertices[i].y); |
245 |
} |
246 |
|
247 |
auxRow[ID_FIELD_ID] = new Integer(elemento.element_id); |
248 |
auxRow[ID_FIELD_ENTITY] = new String("Multipoint"); |
249 |
|
250 |
|
251 |
if ((psLine.vertices[0].x == psLine.vertices[psLine.num_vertices-1].x) |
252 |
&& (psLine.vertices[0].y == psLine.vertices[psLine.num_vertices-1].y)) |
253 |
{ |
254 |
// Lo a?adimos tambi?n como pol?gono
|
255 |
bEsPoligono = true;
|
256 |
// Miramos si tiene color de relleno
|
257 |
if (elemento.attr_bytes > 0) { |
258 |
elemento.color = m_DgnReader.DGNGetShapeFillInfo(elemento); |
259 |
// System.err.println("fill color = " + elemento.color);
|
260 |
if (elemento.color != -1) |
261 |
auxRow[ID_FIELD_COLOR] = new Integer(elemento.color); |
262 |
} |
263 |
|
264 |
if (elemento.complex == 0) |
265 |
{ |
266 |
// TODO: A?adir POLIGONO lyrPolygons.addShape(new FShape(FConstant.SHAPE_TYPE_POLYGON, elShape), auxRow);
|
267 |
return ShapeFactory.createPolygon2D(elShape);
|
268 |
} |
269 |
} |
270 |
if (elemento.complex != 0) |
271 |
// Si es un agujero o
|
272 |
// es la primera entidad del agujero, lo a?adimos sin unir al anterior
|
273 |
if (bFirstHoleEntity || ((psLine.type == DGNFileHeader.DGNT_SHAPE) && ((psLine.properties & 0x8000) != 0))) |
274 |
{ |
275 |
elementoCompuesto.append(elShape, false);
|
276 |
bFirstHoleEntity = false;
|
277 |
} |
278 |
else
|
279 |
elementoCompuesto.append(elShape, bConnect); |
280 |
else
|
281 |
{ |
282 |
// TODO: A?adir LINEA lyrLines.addShape(new FShape(FConstant.SHAPE_TYPE_POLYLINE, elShape), auxRow);
|
283 |
return ShapeFactory.createPolyline2D(elShape);
|
284 |
} |
285 |
} |
286 |
|
287 |
break;
|
288 |
case DGNFileHeader.DGNST_ARC:
|
289 |
// m_DgnReader.DGNDumpElement(m_DgnReader.getInfo(), elemento,"");
|
290 |
DGNElemArc psArc = (DGNElemArc) elemento; |
291 |
// La definici?n de arco de MicroStation es distinta a la de Java.
|
292 |
// En el dgn el origin se entiende que es el centro del arco,
|
293 |
// y a la hora de crear un Arc2D las 2 primeras coordenadas son
|
294 |
// la esquina inferior izquierda del rect?ngulo que rodea al arco.
|
295 |
|
296 |
// 1.- Creamos la elipse sin rotaci?n.
|
297 |
// 2.- Creamos el arco
|
298 |
// 3.- Rotamos el resultado
|
299 |
/* System.out.println("Arco con primari axis: " + psArc.primary_axis +
|
300 |
" start angle: " + psArc.startang + " sweepang = " + psArc.sweepang);
|
301 |
System.out.println("secondaria axis: " + psArc.secondary_axis +
|
302 |
" rotation = " + psArc.rotation); */
|
303 |
|
304 |
AffineTransform mT = AffineTransform.getRotateInstance( |
305 |
Math.toRadians(psArc.rotation), psArc.origin.x, psArc.origin.y);
|
306 |
// mT.preConcatenate(AffineTransform.getScaleInstance(100.0,100.0));
|
307 |
Arc2D.Double elArco = new Arc2D.Double( |
308 |
psArc.origin.x - psArc.primary_axis, psArc.origin.y - psArc.secondary_axis, |
309 |
2.0 * psArc.primary_axis, 2.0 * psArc.secondary_axis, |
310 |
-psArc.startang, -psArc.sweepang, Arc2D.OPEN);
|
311 |
// Ellipse2D.Double elArco = new Ellipse2D.Double(psArc.origin.x - psArc.primary_axis,
|
312 |
// psArc.origin.y - psArc.secondary_axis,2.0 * psArc.primary_axis, 2.0 * psArc.secondary_axis);
|
313 |
GeneralPathX elShapeArc = new GeneralPathX(elArco);
|
314 |
// Transformamos el GeneralPahtX porque si transformamos elArco nos lo convierte
|
315 |
// a GeneralPath y nos guarda las coordenadas en float, con la correspondiente p?rdida de precisi?n
|
316 |
elShapeArc.transform(mT); |
317 |
if (m_DgnReader.getInfo().dimension == 3) { |
318 |
//Aqu? podr?amos hacer cosas con la coordenada Z
|
319 |
} |
320 |
|
321 |
auxRow[ID_FIELD_ID] = new Integer(elemento.element_id); |
322 |
auxRow[ID_FIELD_ENTITY] = new String("Arc"); |
323 |
auxRow[ID_FIELD_LAYER] = new Integer(elemento.level); |
324 |
auxRow[ID_FIELD_COLOR] = new Integer(elemento.color); |
325 |
|
326 |
/* Line2D.Double ejeMayor = new Line2D.Double(psArc.origin.x - psArc.primary_axis, psArc.origin.y,
|
327 |
psArc.origin.x + psArc.primary_axis, psArc.origin.y);
|
328 |
|
329 |
lyrLines.addShape(new FShape(FConstant.SHAPE_TYPE_POLYLINE, new GeneralPathX(ejeMayor)), auxRow); */
|
330 |
// lyrLines.addShape(new FShape(FConstant.SHAPE_TYPE_POLYLINE, elShapeArc), auxRow);
|
331 |
if (elemento.complex != 0) |
332 |
{ |
333 |
// Esto es una posible fuente de fallos si detr?s de una
|
334 |
// elipse vienen m?s cosas pegadas. Deber?amos volver
|
335 |
// a conectar una vez pasada la elipse.
|
336 |
if (elemento.type == DGNFileHeader.DGNT_ELLIPSE)
|
337 |
bConnect = false;
|
338 |
|
339 |
// SI LA ELIPSE ES UN AGUJERO, SE A?ADE SIN PEGAR
|
340 |
// Y EL ELEMENTO ES UN POLIGONO
|
341 |
if (bFirstHoleEntity || ((elemento.type == DGNFileHeader.DGNT_SHAPE)
|
342 |
&& ((elemento.properties & 0x8000) != 0))) |
343 |
{ |
344 |
elementoCompuesto.append(elShapeArc, false);
|
345 |
bFirstHoleEntity = false;
|
346 |
} |
347 |
else
|
348 |
elementoCompuesto.append(elShapeArc, bConnect); |
349 |
} |
350 |
else
|
351 |
{ |
352 |
// TODO: A?ADIR LINEA lyrLines.addShape(new FShape(FConstant.SHAPE_TYPE_POLYLINE, elShapeArc), auxRow);
|
353 |
if (psArc.type == DGNFileHeader.DGNT_ELLIPSE)
|
354 |
{ |
355 |
// TODO: A?adir POLIGONO lyrPolygons.addShape(new FShape(FConstant.SHAPE_TYPE_POLYGON, elShapeArc), auxRow);
|
356 |
} |
357 |
} |
358 |
|
359 |
// System.err.println("Entra un Arco");
|
360 |
break;
|
361 |
|
362 |
case DGNFileHeader.DGNST_TEXT:
|
363 |
DGNElemText psText = (DGNElemText) elemento; |
364 |
// TODO: DEVOLVER UN TEXTO??
|
365 |
/* FPoint2D elShapeTxt = new FPoint2D(
|
366 |
psText.origin.x, psText.origin.y,psText.origin.z);
|
367 |
|
368 |
auxRow[ID_FIELD_ID] = new Integer(elemento.element_id);
|
369 |
auxRowTxt[ID_FIELD_ENTITY] = new String("Text");
|
370 |
auxRowTxt[ID_FIELD_LAYER] = new Integer(elemento.level);
|
371 |
auxRowTxt[ID_FIELD_COLOR] = new Integer(elemento.color);
|
372 |
heightText = (float) psText.height_mult;
|
373 |
auxRowTxt[ID_FIELD_HEIGHTTEXT] = new Double(heightText);
|
374 |
auxRowTxt[ID_FIELD_ROTATIONTEXT] = new Double(psText.rotation);
|
375 |
auxRowTxt[ID_FIELD_TEXT] = psText.string; // .trim();
|
376 |
lyrTexts.addShape(new FShape(elShapeTxt,FConstant.SHAPE_TYPE_POINT),
|
377 |
auxRowTxt);
|
378 |
*/
|
379 |
break;
|
380 |
/* default:
|
381 |
m_DgnReader.DGNDumpElement(m_DgnReader.getInfo(), elemento, "");
|
382 |
*/
|
383 |
|
384 |
} // switch
|
385 |
|
386 |
|
387 |
} // if
|
388 |
|
389 |
// } // for
|
390 |
|
391 |
if (bElementoCompuesto)
|
392 |
{ |
393 |
if (bInsideCell)
|
394 |
{ |
395 |
auxRow = cellRow; |
396 |
} |
397 |
else
|
398 |
{ |
399 |
auxRow = complexRow; |
400 |
} |
401 |
// System.err.println("Entidad compuesta. bInsideCell = " + bInsideCell + " auxRow = " + auxRow[ID_FIELD_ENTITY]);
|
402 |
// TODO: LINEA lyrLines.addShape(new FShape(FConstant.SHAPE_TYPE_POLYLINE, elementoCompuesto), auxRow);
|
403 |
if (bEsPoligono)
|
404 |
{ |
405 |
if (complex_index_fill_color != -1) |
406 |
auxRow[ID_FIELD_COLOR] = new Integer(complex_index_fill_color); |
407 |
|
408 |
// TODO: POLIGONO lyrPolygons.addShape(new FShape(FConstant.SHAPE_TYPE_POLYGON, elementoCompuesto), auxRow);
|
409 |
} |
410 |
} |
411 |
return null; |
412 |
} |
413 |
|
414 |
/**
|
415 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#getShapeCount()
|
416 |
*/
|
417 |
public int getShapeCount() throws IOException { |
418 |
return m_DgnReader.getNumEntities();
|
419 |
} |
420 |
|
421 |
/**
|
422 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#getFullExtent()
|
423 |
*/
|
424 |
public Rectangle2D getFullExtent() throws IOException { |
425 |
return m_DgnReader.getBoundingBox();
|
426 |
} |
427 |
|
428 |
/**
|
429 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#initialize()
|
430 |
*/
|
431 |
public void initialize() throws IOException { |
432 |
m_DgnReader = new DGNReader(m_Fich.getAbsolutePath());
|
433 |
} |
434 |
|
435 |
/**
|
436 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialDriver#getShapeType()
|
437 |
*/
|
438 |
public int getShapeType() { |
439 |
return 15; |
440 |
} |
441 |
|
442 |
/**
|
443 |
* @see com.hardcode.driverManager.Driver#getType()
|
444 |
*/
|
445 |
public String getName() { |
446 |
return "gvSIG DGN Driver"; |
447 |
} |
448 |
|
449 |
/**
|
450 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#accept(java.io.File)
|
451 |
*/
|
452 |
public boolean accept(File f) { |
453 |
return f.getName().toUpperCase().endsWith("DGN"); |
454 |
} |
455 |
|
456 |
/**
|
457 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#getDataDriverName()
|
458 |
*/
|
459 |
public String getDataDriverName() { |
460 |
//TODO implementar bien
|
461 |
return null; |
462 |
} |
463 |
|
464 |
/**
|
465 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#getDataFile(java.io.File)
|
466 |
*/
|
467 |
public File getDataFile(File f) { |
468 |
//TODO implementar bien
|
469 |
return null; |
470 |
} |
471 |
|
472 |
/* (non-Javadoc)
|
473 |
* @see com.hardcode.gdbms.engine.data.FileDriver#fileAccepted(java.io.File)
|
474 |
*/
|
475 |
public boolean fileAccepted(File f) { |
476 |
return f.getName().toUpperCase().endsWith("DGN"); |
477 |
} |
478 |
|
479 |
/* (non-Javadoc)
|
480 |
* @see com.hardcode.gdbms.engine.data.ReadDriver#getFieldValue(long, int)
|
481 |
*/
|
482 |
public Value getFieldValue(long rowIndex, int fieldId) throws DriverException { |
483 |
// TODO Auto-generated method stub
|
484 |
return null; |
485 |
} |
486 |
|
487 |
/* (non-Javadoc)
|
488 |
* @see com.hardcode.gdbms.engine.data.ReadDriver#getFieldCount()
|
489 |
*/
|
490 |
public int getFieldCount() throws DriverException { |
491 |
// TODO Auto-generated method stub
|
492 |
return 0; |
493 |
} |
494 |
|
495 |
/* (non-Javadoc)
|
496 |
* @see com.hardcode.gdbms.engine.data.ReadDriver#getFieldName(int)
|
497 |
*/
|
498 |
public String getFieldName(int fieldId) throws DriverException { |
499 |
// TODO Auto-generated method stub
|
500 |
return null; |
501 |
} |
502 |
|
503 |
/* (non-Javadoc)
|
504 |
* @see com.hardcode.gdbms.engine.data.ReadDriver#getRowCount()
|
505 |
*/
|
506 |
public long getRowCount() throws DriverException { |
507 |
try {
|
508 |
return getShapeCount();
|
509 |
} catch (IOException e) { |
510 |
e.printStackTrace(); |
511 |
} |
512 |
return -1; |
513 |
} |
514 |
} |