Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / drivers / dgn / DGNDriver.java @ 1828

History | View | Annotate | Download (19.3 KB)

1 1100 fjp
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41 307 vcaballero
package com.iver.cit.gvsig.fmap.drivers.dgn;
42
43 1005 vcaballero
import java.awt.geom.AffineTransform;
44
import java.awt.geom.Arc2D;
45
import java.awt.geom.Rectangle2D;
46
import java.io.File;
47
import java.io.IOException;
48
import java.util.ArrayList;
49
50 1828 fernando
import com.hardcode.gdbms.engine.data.driver.DriverException;
51
import com.hardcode.gdbms.engine.data.driver.FileDriver;
52
import com.hardcode.gdbms.engine.values.Value;
53
import com.iver.cit.gvsig.fmap.core.GeneralPathX;
54
import com.iver.cit.gvsig.fmap.core.IGeometry;
55
import com.iver.cit.gvsig.fmap.core.ShapeFactory;
56
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes;
57
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver;
58 1005 vcaballero
59 1828 fernando
60 307 vcaballero
/**
61 1005 vcaballero
 * Driver DGN.
62 307 vcaballero
 *
63
 * @author Vicente Caballero Navarro
64
 */
65 559 fjp
public class DGNDriver implements VectorialFileDriver, FileDriver {
66 378 fjp
        DGNReader m_DgnReader;
67 1005 vcaballero
        private final int ID_FIELD_ID = 0;
68
        private final int ID_FIELD_ENTITY = 1;
69
        private final int ID_FIELD_LAYER = 2;
70
        private final int ID_FIELD_COLOR = 3;
71
        private final int ID_FIELD_HEIGHTTEXT = 4;
72
        private final int ID_FIELD_ROTATIONTEXT = 5;
73
        private final int ID_FIELD_TEXT = 6;
74 378 fjp
        private String path;
75 559 fjp
        private File m_Fich;
76 378 fjp
77 695 fjp
        // Campos del registro en cache:
78 1005 vcaballero
        Object[] auxRow = new Object[7];
79
        Object[] cellRow = new Object[7];
80
        Object[] complexRow = new Object[7];
81
82 695 fjp
        /**
83 1005 vcaballero
         * Traduce las posiciones de comienzo de las entidades del DGN a nuestras
84
         * entidades FShape. (Una FShape puede corresponder a varias entidades de
85
         * un DGN).
86 695 fjp
         */
87
        private int[] m_posShapes;
88
89 1005 vcaballero
        /**
90
         * @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#open(java.io.File)
91
         */
92
        public void open(File f) throws IOException {
93
                m_Fich = f;
94
        }
95 307 vcaballero
96 1005 vcaballero
        /**
97
         * @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#close()
98
         */
99
        public void close() throws IOException {
100
        }
101 307 vcaballero
102 1005 vcaballero
        /**
103
         * @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#getShape(int)
104
         */
105
        public IGeometry getShape(int index) throws IOException {
106
                boolean bElementoCompuesto = false;
107
                boolean bEsPoligono = false;
108 378 fjp
                boolean bInsideCell = false;
109
                boolean bFirstHoleEntity = false;
110
                boolean bConnect = false; // Se usa para que los pol?gonos cierren bien cuando son formas compuestas
111 1005 vcaballero
112 378 fjp
                // int contadorSubElementos =0, numSubElementos = 0;
113 1005 vcaballero
                int complex_index_fill_color = -1;
114 378 fjp
                int nClass; // Para filtrar los elementos de construcci?n, etc.
115 1005 vcaballero
116 378 fjp
                ArrayList arrayFields = new ArrayList();
117
                arrayFields.add("ID");
118
                arrayFields.add("Entity");
119
                arrayFields.add("Layer");
120
                arrayFields.add("Color");
121 695 fjp
                arrayFields.add("HeightText");
122
                arrayFields.add("RotationText");
123
                arrayFields.add("Text");
124 1005 vcaballero
125 378 fjp
                IGeometry aux;
126
                GeneralPathX elementoCompuesto = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD);
127 1005 vcaballero
128 378 fjp
                m_DgnReader.DGNGotoElement(index);
129 1005 vcaballero
130
                DGNElemCore elemento = m_DgnReader.DGNReadElement();
131
                nClass = 0;
132
133
                if (elemento.properties != 0) {
134
                        nClass = elemento.properties & DGNFileHeader.DGNPF_CLASS;
135
                }
136
137
                if ((elemento != null) && (elemento.deleted == 0) && (nClass == 0)) //Leer un elemento
138
                 {
139
                        aux = null;
140
141
                        // if ((elemento.element_id > 3800) && (elemento.element_id < 3850))
142
                        //         m_DgnReader.DGNDumpElement(m_DgnReader.getInfo(),elemento,"");
143
                        if ((elemento.stype == DGNFileHeader.DGNST_MULTIPOINT) ||
144
                                        (elemento.stype == DGNFileHeader.DGNST_ARC) ||
145
                                        (elemento.stype == DGNFileHeader.DGNST_CELL_HEADER) ||
146
                                        (elemento.stype == DGNFileHeader.DGNST_SHARED_CELL_DEFN) ||
147
                                        (elemento.stype == DGNFileHeader.DGNST_COMPLEX_HEADER)) {
148
                                if (elemento.complex != 0) {
149
                                        bElementoCompuesto = true;
150
                                } else {
151
                                        if (bElementoCompuesto) {
152
                                                if (bInsideCell) {
153
                                                        auxRow[ID_FIELD_ENTITY] = cellRow[ID_FIELD_ENTITY];
154
                                                } else {
155
                                                        auxRow = complexRow;
156
                                                }
157
158
                                                // System.err.println("Entidad compuesta. bInsideCell = " + bInsideCell + " auxRow = " + auxRow[ID_FIELD_ENTITY]);
159
                                                // TODO: CREACION DE LINEA lyrLines.addShape(new FShape(FConstant.SHAPE_TYPE_POLYLINE, elementoCompuesto), auxRow);
160
                                                if (bEsPoligono) {
161
                                                        if (complex_index_fill_color != -1) {
162 378 fjp
                                                                auxRow[ID_FIELD_COLOR] = new Integer(complex_index_fill_color);
163 1005 vcaballero
                                                        }
164 378 fjp
165 1005 vcaballero
                                                        // TODO: CREAR POLIGONO lyrPolygons.addShape(new FShape(FConstant.SHAPE_TYPE_POLYGON, elementoCompuesto), auxRow);
166
                                                }
167
168
                                                elementoCompuesto = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD);
169
                                        }
170
171
                                        // System.err.println("Entidad simple");
172
                                        bElementoCompuesto = false;
173
                                        bEsPoligono = false;
174
                                        bConnect = false;
175
176
                                        // elementoCompuesto = new GeneralPathX();
177
                                        bInsideCell = false;
178
                                }
179
                        }
180
181
                        switch (elemento.stype) {
182 378 fjp
                                case DGNFileHeader.DGNST_SHARED_CELL_DEFN:
183
                                        bInsideCell = true;
184
                                        cellRow[ID_FIELD_ID] = new Integer(elemento.element_id);
185 1005 vcaballero
                                        cellRow[ID_FIELD_LAYER] = new Integer(elemento.level);
186
                                        cellRow[ID_FIELD_COLOR] = new Integer(elemento.color);
187
                                        cellRow[ID_FIELD_ENTITY] = new String("Shared Cell");
188
189 378 fjp
                                        break;
190 1005 vcaballero
191 378 fjp
                                case DGNFileHeader.DGNST_CELL_HEADER:
192
                                        bInsideCell = true;
193 1005 vcaballero
194 378 fjp
                                        DGNElemCellHeader psCellHeader = (DGNElemCellHeader) elemento;
195
                                        cellRow[ID_FIELD_ID] = new Integer(elemento.element_id);
196 1005 vcaballero
                                        cellRow[ID_FIELD_LAYER] = new Integer(elemento.level);
197
                                        cellRow[ID_FIELD_COLOR] = new Integer(elemento.color);
198
                                        cellRow[ID_FIELD_ENTITY] = new String("Cell");
199
                                        complex_index_fill_color = m_DgnReader.DGNGetShapeFillInfo(elemento);
200
201
                                        // System.err.println("Cell Header " + complex_index_fill_color);
202 378 fjp
                                        break;
203
204
                                case DGNFileHeader.DGNST_COMPLEX_HEADER:
205 1005 vcaballero
206 378 fjp
                                        // bElementoCompuesto = true;
207
                                        // System.err.println("Complex Header");
208
                                        // contadorSubElementos = 0;
209
                                        DGNElemComplexHeader psComplexHeader = (DGNElemComplexHeader) elemento;
210 1005 vcaballero
211 378 fjp
                                        // numSubElementos = psComplexHeader.numelems;
212
                                        complexRow[ID_FIELD_ID] = new Integer(elemento.element_id);
213 1005 vcaballero
                                        complexRow[ID_FIELD_LAYER] = new Integer(elemento.level);
214
                                        complexRow[ID_FIELD_COLOR] = new Integer(elemento.color);
215
                                        complexRow[ID_FIELD_ENTITY] = new String("Complex");
216
217
                                        if (psComplexHeader.type == DGNFileHeader.DGNT_COMPLEX_SHAPE_HEADER) {
218 378 fjp
                                                bEsPoligono = true;
219 1005 vcaballero
220 378 fjp
                                                // Si es un agujero, no conectamos con el anterior
221 1005 vcaballero
                                                if ((psComplexHeader.properties & 0x8000) != 0) {
222 378 fjp
                                                        bFirstHoleEntity = true;
223 1005 vcaballero
                                                } else {
224 378 fjp
                                                        // Miramos si tiene color de relleno
225
                                                        // complex_index_fill_color = -1;
226
                                                        // if (elemento.attr_bytes > 0) {
227 1005 vcaballero
                                                        complex_index_fill_color = m_DgnReader.DGNGetShapeFillInfo(elemento);
228
229
                                                        // System.err.println("complex shape fill color = " + elemento.color);
230 378 fjp
                                                        // }
231
                                                }
232 1005 vcaballero
233 378 fjp
                                                bConnect = true;
234 1005 vcaballero
                                        } else {
235 378 fjp
                                                bEsPoligono = false;
236
                                                bConnect = false;
237
                                        }
238 1005 vcaballero
239 378 fjp
                                        break;
240 1005 vcaballero
241 378 fjp
                                case DGNFileHeader.DGNST_MULTIPOINT:
242 1005 vcaballero
243 378 fjp
                                        // OJO: Si lo que viene en este multipoint es un elemento con type=11 (curve), se trata de una "parametric
244
                                        // spline curve". La vamos a tratar como si no fuera curva, pero seg?n la documentaci?n, los 2 primeros puntos
245
                                        // y los 2 ?ltimos puntos definen "endpoint derivatives" y NO se muestran.
246
                                        // TODAV?A HAY UN PEQUE?O FALLO CON EL FICHERO dgn-sample.dgn, pero lo dejo por ahora.
247
                                        // Es posible que tenga que ver con lo de los arcos (arco distorsionado), que
248
                                        // todav?a no est? metido.
249 1005 vcaballero
                                        DGNElemMultiPoint psLine = (DGNElemMultiPoint) elemento;
250
                                        auxRow[ID_FIELD_LAYER] = new Integer(elemento.level);
251
                                        auxRow[ID_FIELD_COLOR] = new Integer(elemento.color);
252
253
                                        if ((psLine.num_vertices == 2) &&
254
                                                        (psLine.vertices[0].x == psLine.vertices[1].x) &&
255
                                                        (psLine.vertices[0].y == psLine.vertices[1].y)) {
256
                                                auxRow[ID_FIELD_ENTITY] = new String("Point");
257
258
                                                // TODO: CREAR PUNTO lyrPoints.addShape(new FShape(new FPoint(psLine.vertices[0].x,
259
                                                //                 psLine.vertices[0].y,psLine.vertices[0].z),FConstant.SHAPE_TYPE_POINT), auxRow);
260
                                                return ShapeFactory.createPoint3D(psLine.vertices[0].x,
261
                                                        psLine.vertices[0].y, psLine.vertices[0].z);
262
                                        } else {
263
                                                GeneralPathX elShape = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD);
264
265
                                                if (psLine.type == DGNFileHeader.DGNT_CURVE) {
266
                                                        psLine.num_vertices = psLine.num_vertices - 4;
267
268
                                                        for (int aux_n = 0; aux_n < psLine.num_vertices;
269
                                                                        aux_n++) {
270
                                                                psLine.vertices[aux_n] = psLine.vertices[aux_n +
271
                                                                        2];
272
                                                        }
273
                                                }
274
275
                                                if ((psLine.type == DGNFileHeader.DGNT_SHAPE) &&
276
                                                                ((psLine.properties & 0x8000) != 0)) {
277
                                                        // Invertimos el orden porque es un agujero
278
                                                        elShape.moveTo(psLine.vertices[psLine.num_vertices -
279
                                                                1].x, psLine.vertices[psLine.num_vertices - 1].y);
280
281
                                                        for (int i = psLine.num_vertices - 2; i >= 0;
282
                                                                        i--)
283
                                                                elShape.lineTo(psLine.vertices[i].x,
284
                                                                        psLine.vertices[i].y);
285
                                                } else {
286
                                                        elShape.moveTo(psLine.vertices[0].x,
287
                                                                psLine.vertices[0].y);
288
289
                                                        for (int i = 1; i < psLine.num_vertices; i++)
290
                                                                elShape.lineTo(psLine.vertices[i].x,
291
                                                                        psLine.vertices[i].y);
292
                                                }
293
294
                                                auxRow[ID_FIELD_ID] = new Integer(elemento.element_id);
295
                                                auxRow[ID_FIELD_ENTITY] = new String("Multipoint");
296
297
                                                if ((psLine.vertices[0].x == psLine.vertices[psLine.num_vertices -
298
                                                                1].x) &&
299
                                                                (psLine.vertices[0].y == psLine.vertices[psLine.num_vertices -
300
                                                                1].y)) {
301
                                                        // Lo a?adimos tambi?n como pol?gono
302
                                                        bEsPoligono = true;
303
304 378 fjp
                                                        // Miramos si tiene color de relleno
305
                                                        if (elemento.attr_bytes > 0) {
306
                                                                elemento.color = m_DgnReader.DGNGetShapeFillInfo(elemento);
307 1005 vcaballero
308 378 fjp
                                                                // System.err.println("fill color = " + elemento.color);
309 1005 vcaballero
                                                                if (elemento.color != -1) {
310 378 fjp
                                                                        auxRow[ID_FIELD_COLOR] = new Integer(elemento.color);
311 1005 vcaballero
                                                                }
312 378 fjp
                                                        }
313
314 1005 vcaballero
                                                        if (elemento.complex == 0) {
315
                                                                // TODO: A?adir POLIGONO lyrPolygons.addShape(new FShape(FConstant.SHAPE_TYPE_POLYGON, elShape), auxRow);
316
                                                                return ShapeFactory.createPolygon2D(elShape);
317
                                                        }
318
                                                }
319 378 fjp
320 1005 vcaballero
                                                if (elemento.complex != 0) {
321
                                                        // Si es un agujero o
322
                                                        // es la primera entidad del agujero, lo a?adimos sin unir al anterior
323
                                                        if (bFirstHoleEntity ||
324
                                                                        ((psLine.type == DGNFileHeader.DGNT_SHAPE) &&
325
                                                                        ((psLine.properties & 0x8000) != 0))) {
326
                                                                elementoCompuesto.append(elShape, false);
327
                                                                bFirstHoleEntity = false;
328
                                                        } else {
329
                                                                elementoCompuesto.append(elShape, bConnect);
330
                                                        }
331
                                                } else {
332
                                                        // TODO: A?adir LINEA lyrLines.addShape(new FShape(FConstant.SHAPE_TYPE_POLYLINE, elShape), auxRow);
333
                                                        return ShapeFactory.createPolyline2D(elShape);
334
                                                }
335
                                        }
336 378 fjp
337 1005 vcaballero
                                        break;
338
339
                                case DGNFileHeader.DGNST_ARC:
340
341
                                        // m_DgnReader.DGNDumpElement(m_DgnReader.getInfo(), elemento,"");
342
                                        DGNElemArc psArc = (DGNElemArc) elemento;
343
344
                                        // La definici?n de arco de MicroStation es distinta a la de Java.
345
                                        // En el dgn el origin se entiende que es el centro del arco,
346
                                        // y a la hora de crear un Arc2D las 2 primeras coordenadas son
347
                                        // la esquina inferior izquierda del rect?ngulo que rodea al arco.
348
                                        // 1.- Creamos la elipse sin rotaci?n.
349
                                        // 2.- Creamos el arco
350
                                        // 3.- Rotamos el resultado
351
352
                                        /* System.out.println("Arco con primari axis: " + psArc.primary_axis +
353
                                           " start angle: " + psArc.startang + " sweepang = " + psArc.sweepang);
354
                                           System.out.println("secondaria axis: " + psArc.secondary_axis +
355
                                                                            " rotation = " + psArc.rotation); */
356
                                        AffineTransform mT = AffineTransform.getRotateInstance(Math.toRadians(
357
                                                                psArc.rotation), psArc.origin.x, psArc.origin.y);
358
359
                                        // mT.preConcatenate(AffineTransform.getScaleInstance(100.0,100.0));
360
                                        Arc2D.Double elArco = new Arc2D.Double(psArc.origin.x -
361
                                                        psArc.primary_axis,
362
                                                        psArc.origin.y - psArc.secondary_axis,
363
                                                        2.0 * psArc.primary_axis,
364
                                                        2.0 * psArc.secondary_axis, -psArc.startang,
365
                                                        -psArc.sweepang, Arc2D.OPEN);
366
367
                                        // Ellipse2D.Double elArco = new Ellipse2D.Double(psArc.origin.x - psArc.primary_axis,
368
                                        //                 psArc.origin.y - psArc.secondary_axis,2.0 * psArc.primary_axis, 2.0 * psArc.secondary_axis);
369
                                        GeneralPathX elShapeArc = new GeneralPathX(elArco);
370
371
                                        // Transformamos el GeneralPahtX porque si transformamos elArco nos lo convierte
372
                                        // a GeneralPath y nos guarda las coordenadas en float, con la correspondiente p?rdida de precisi?n
373
                                        elShapeArc.transform(mT);
374
375
                                        if (m_DgnReader.getInfo().dimension == 3) {
376
                                                //Aqu? podr?amos hacer cosas con la coordenada Z
377
                                        }
378
379
                                        auxRow[ID_FIELD_ID] = new Integer(elemento.element_id);
380
                                        auxRow[ID_FIELD_ENTITY] = new String("Arc");
381
                                        auxRow[ID_FIELD_LAYER] = new Integer(elemento.level);
382
                                        auxRow[ID_FIELD_COLOR] = new Integer(elemento.color);
383
384
                                        /* Line2D.Double ejeMayor = new Line2D.Double(psArc.origin.x - psArc.primary_axis, psArc.origin.y,
385
                                           psArc.origin.x + psArc.primary_axis, psArc.origin.y);
386

387
                                           lyrLines.addShape(new FShape(FConstant.SHAPE_TYPE_POLYLINE, new GeneralPathX(ejeMayor)), auxRow); */
388
389
                                        // lyrLines.addShape(new FShape(FConstant.SHAPE_TYPE_POLYLINE, elShapeArc), auxRow);
390
                                        if (elemento.complex != 0) {
391
                                                // Esto es una posible fuente de fallos si detr?s de una
392
                                                // elipse vienen m?s cosas pegadas. Deber?amos volver
393
                                                // a conectar una vez pasada la elipse.
394
                                                if (elemento.type == DGNFileHeader.DGNT_ELLIPSE) {
395
                                                        bConnect = false;
396
                                                }
397
398
                                                // SI LA ELIPSE ES UN AGUJERO, SE A?ADE SIN PEGAR
399
                                                // Y EL ELEMENTO ES UN POLIGONO
400
                                                if (bFirstHoleEntity ||
401
                                                                ((elemento.type == DGNFileHeader.DGNT_SHAPE) &&
402
                                                                ((elemento.properties & 0x8000) != 0))) {
403
                                                        elementoCompuesto.append(elShapeArc, false);
404
                                                        bFirstHoleEntity = false;
405
                                                } else {
406
                                                        elementoCompuesto.append(elShapeArc, bConnect);
407
                                                }
408
                                        } else {
409
                                                // TODO: A?ADIR LINEA lyrLines.addShape(new FShape(FConstant.SHAPE_TYPE_POLYLINE, elShapeArc), auxRow);
410
                                                if (psArc.type == DGNFileHeader.DGNT_ELLIPSE) {
411
                                                        // TODO: A?adir POLIGONO lyrPolygons.addShape(new FShape(FConstant.SHAPE_TYPE_POLYGON, elShapeArc), auxRow);
412
                                                }
413
                                        }
414
415
                                        // System.err.println("Entra un Arco");
416
                                        break;
417
418
                                case DGNFileHeader.DGNST_TEXT:
419
420
                                        DGNElemText psText = (DGNElemText) elemento;
421
422
                                        // TODO: DEVOLVER UN TEXTO??
423
424
                                        /* FPoint2D elShapeTxt = new FPoint2D(
425
                                           psText.origin.x, psText.origin.y,psText.origin.z);
426

427
                                           auxRow[ID_FIELD_ID] = new Integer(elemento.element_id);
428
                                           auxRowTxt[ID_FIELD_ENTITY] = new String("Text");
429
                                           auxRowTxt[ID_FIELD_LAYER] = new Integer(elemento.level);
430
                                           auxRowTxt[ID_FIELD_COLOR] = new Integer(elemento.color);
431
                                           heightText = (float) psText.height_mult;
432
                                           auxRowTxt[ID_FIELD_HEIGHTTEXT] = new Double(heightText);
433
                                           auxRowTxt[ID_FIELD_ROTATIONTEXT] = new Double(psText.rotation);
434
                                           auxRowTxt[ID_FIELD_TEXT] = psText.string; // .trim();
435
                                           lyrTexts.addShape(new FShape(elShapeTxt,FConstant.SHAPE_TYPE_POINT),
436
                                                           auxRowTxt);
437
                                         */
438
                                        break;
439
440
                                /* default:
441
                                   m_DgnReader.DGNDumpElement(m_DgnReader.getInfo(), elemento, "");
442
                                 */
443
                        } // switch
444
                } // if
445
446
                // } // for
447
                if (bElementoCompuesto) {
448
                        if (bInsideCell) {
449
                                auxRow = cellRow;
450
                        } else {
451
                                auxRow = complexRow;
452
                        }
453
454
                        // System.err.println("Entidad compuesta. bInsideCell = " + bInsideCell + " auxRow = " + auxRow[ID_FIELD_ENTITY]);
455
                        // TODO: LINEA lyrLines.addShape(new FShape(FConstant.SHAPE_TYPE_POLYLINE, elementoCompuesto), auxRow);
456
                        if (bEsPoligono) {
457
                                if (complex_index_fill_color != -1) {
458
                                        auxRow[ID_FIELD_COLOR] = new Integer(complex_index_fill_color);
459
                                }
460
461
                                // TODO: POLIGONO lyrPolygons.addShape(new FShape(FConstant.SHAPE_TYPE_POLYGON, elementoCompuesto), auxRow);
462
                        }
463 378 fjp
                }
464
465 1005 vcaballero
                return null;
466 378 fjp
        }
467 307 vcaballero
468 1005 vcaballero
        /**
469
         * @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#getShapeCount()
470
         */
471
        public int getShapeCount() throws IOException {
472
                return m_DgnReader.getNumEntities();
473
        }
474 307 vcaballero
475 1005 vcaballero
        /**
476
         * @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#getFullExtent()
477
         */
478
        public Rectangle2D getFullExtent() throws IOException {
479
                return m_DgnReader.getBoundingBox();
480
        }
481 307 vcaballero
482 1005 vcaballero
        /**
483
         * @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#initialize()
484
         */
485
        public void initialize() throws IOException {
486
                m_DgnReader = new DGNReader(m_Fich.getAbsolutePath());
487
        }
488 307 vcaballero
489 1005 vcaballero
        /**
490
         * @see com.iver.cit.gvsig.fmap.drivers.VectorialDriver#getShapeType()
491
         */
492
        public int getShapeType() {
493
                return 15;
494
        }
495 307 vcaballero
496 1005 vcaballero
        /**
497 408 fernando
         * @see com.hardcode.driverManager.Driver#getType()
498
         */
499
        public String getName() {
500
                return "gvSIG DGN Driver";
501
        }
502
503
        /**
504
         * @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#accept(java.io.File)
505
         */
506
        public boolean accept(File f) {
507
                return f.getName().toUpperCase().endsWith("DGN");
508
        }
509
510
        /**
511
         * @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#getDataDriverName()
512
         */
513
        public String getDataDriverName() {
514
                //TODO implementar bien
515
                return null;
516
        }
517
518
        /**
519
         * @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#getDataFile(java.io.File)
520
         */
521
        public File getDataFile(File f) {
522
                //TODO implementar bien
523
                return null;
524
        }
525 559 fjp
526
        /* (non-Javadoc)
527
         * @see com.hardcode.gdbms.engine.data.FileDriver#fileAccepted(java.io.File)
528
         */
529
        public boolean fileAccepted(File f) {
530
                return f.getName().toUpperCase().endsWith("DGN");
531
        }
532
533
        /* (non-Javadoc)
534
         * @see com.hardcode.gdbms.engine.data.ReadDriver#getFieldValue(long, int)
535
         */
536 1005 vcaballero
        public Value getFieldValue(long rowIndex, int fieldId)
537
                throws DriverException {
538 559 fjp
                // TODO Auto-generated method stub
539
                return null;
540
        }
541
542
        /* (non-Javadoc)
543
         * @see com.hardcode.gdbms.engine.data.ReadDriver#getFieldCount()
544
         */
545
        public int getFieldCount() throws DriverException {
546
                // TODO Auto-generated method stub
547
                return 0;
548
        }
549
550
        /* (non-Javadoc)
551
         * @see com.hardcode.gdbms.engine.data.ReadDriver#getFieldName(int)
552
         */
553
        public String getFieldName(int fieldId) throws DriverException {
554
                // TODO Auto-generated method stub
555
                return null;
556
        }
557
558
        /* (non-Javadoc)
559
         * @see com.hardcode.gdbms.engine.data.ReadDriver#getRowCount()
560
         */
561
        public long getRowCount() throws DriverException {
562
                try {
563
                        return getShapeCount();
564
                } catch (IOException e) {
565
                        e.printStackTrace();
566
                }
567 1005 vcaballero
568 559 fjp
                return -1;
569
        }
570 1233 fjp
571
    /* (non-Javadoc)
572
     * @see com.iver.cit.gvsig.fmap.drivers.VectorialDriver#getDriverAttributes()
573
     */
574
    public DriverAttributes getDriverAttributes() {
575
        // TODO Auto-generated method stub
576
        return null;
577
    }
578 1658 fjp
579
    /* (non-Javadoc)
580
     * @see com.hardcode.gdbms.engine.data.ReadDriver#getFieldType(int)
581
     */
582 1773 fernando
    public int getFieldType(int arg0) throws DriverException {
583
        throw new RuntimeException("por implementar");
584 1658 fjp
    }
585 307 vcaballero
}