Statistics
| Revision:

svn-gvsig-desktop / branches / v10 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / drivers / dxf / DXFMemoryDriver.java @ 10717

History | View | Annotate | Download (31.8 KB)

1 758 jmorell
/*
2
 * @(#)DXFMemoryDriver    29-dic-2004
3 5389 caballero
 *
4 758 jmorell
 * @author jmorell (jose.morell@gmail.com)
5
 */
6 1100 fjp
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
7
 *
8
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
9
 *
10
 * This program is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU General Public License
12
 * as published by the Free Software Foundation; either version 2
13
 * of the License, or (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
23
 *
24
 * For more information, contact:
25
 *
26
 *  Generalitat Valenciana
27
 *   Conselleria d'Infraestructures i Transport
28
 *   Av. Blasco Ib??ez, 50
29
 *   46010 VALENCIA
30
 *   SPAIN
31
 *
32
 *      +34 963862235
33
 *   gvsig@gva.es
34
 *      www.gvsig.gva.es
35
 *
36
 *    or
37
 *
38
 *   IVER T.I. S.A
39
 *   Salamanca 50
40
 *   46005 Valencia
41
 *   Spain
42
 *
43
 *   +34 963163400
44
 *   dac@iver.es
45
 */
46 758 jmorell
package com.iver.cit.gvsig.fmap.drivers.dxf;
47
48 839 jmorell
import java.awt.Color;
49
import java.awt.Font;
50 758 jmorell
import java.awt.geom.Point2D;
51
import java.io.File;
52 4937 fjp
import java.io.FileInputStream;
53
import java.io.FileNotFoundException;
54
import java.io.FileOutputStream;
55 758 jmorell
import java.io.IOException;
56 4937 fjp
import java.nio.channels.FileChannel;
57 758 jmorell
import java.util.ArrayList;
58 4937 fjp
import java.util.Properties;
59 758 jmorell
60
import org.cresques.cts.IProjection;
61 2196 vcaballero
import org.cresques.geo.Point3D;
62 758 jmorell
import org.cresques.io.DxfFile;
63
import org.cresques.px.IObjList;
64
import org.cresques.px.dxf.AcadColor;
65
import org.cresques.px.dxf.DxfFeatureMaker;
66 3184 jmorell
import org.cresques.px.dxf.DxfHeaderManager;
67 758 jmorell
import org.cresques.px.gml.Feature;
68
import org.cresques.px.gml.LineString;
69 2196 vcaballero
import org.cresques.px.gml.LineString3D;
70 758 jmorell
import org.cresques.px.gml.Point;
71
import org.cresques.px.gml.Polygon;
72 2196 vcaballero
import org.cresques.px.gml.Polygon3D;
73 758 jmorell
74 4937 fjp
import com.hardcode.gdbms.driver.DriverUtilities;
75 1828 fernando
import com.hardcode.gdbms.engine.data.driver.DriverException;
76
import com.hardcode.gdbms.engine.data.driver.ObjectDriver;
77 2217 fernando
import com.hardcode.gdbms.engine.data.edition.DataWare;
78 758 jmorell
import com.hardcode.gdbms.engine.values.IntValue;
79
import com.hardcode.gdbms.engine.values.Value;
80
import com.hardcode.gdbms.engine.values.ValueFactory;
81 2196 vcaballero
import com.iver.cit.gvsig.fmap.core.FPoint2D;
82 758 jmorell
import com.iver.cit.gvsig.fmap.core.FPoint3D;
83
import com.iver.cit.gvsig.fmap.core.FPolygon2D;
84 2196 vcaballero
import com.iver.cit.gvsig.fmap.core.FPolygon3D;
85 758 jmorell
import com.iver.cit.gvsig.fmap.core.FPolyline2D;
86 2196 vcaballero
import com.iver.cit.gvsig.fmap.core.FPolyline3D;
87 758 jmorell
import com.iver.cit.gvsig.fmap.core.FShape;
88
import com.iver.cit.gvsig.fmap.core.GeneralPathX;
89 913 jmorell
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
90 758 jmorell
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
91 6164 luisw2
import com.iver.cit.gvsig.fmap.crs.CRSFactory;
92 8765 jjdelcerro
import com.iver.cit.gvsig.fmap.drivers.AbstractCadMemoryDriver;
93 1233 fjp
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes;
94 5558 fjp
import com.iver.cit.gvsig.fmap.drivers.ILayerDefinition;
95
import com.iver.cit.gvsig.fmap.drivers.ITableDefinition;
96 3271 fjp
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver;
97 758 jmorell
import com.iver.cit.gvsig.fmap.drivers.WithDefaultLegend;
98 4937 fjp
import com.iver.cit.gvsig.fmap.edition.EditionException;
99
import com.iver.cit.gvsig.fmap.edition.IRowEdited;
100
import com.iver.cit.gvsig.fmap.edition.ISpatialWriter;
101 5595 fjp
import com.iver.cit.gvsig.fmap.edition.IWriteable;
102
import com.iver.cit.gvsig.fmap.edition.IWriter;
103 4937 fjp
import com.iver.cit.gvsig.fmap.edition.writers.dxf.DxfFieldsMapping;
104
import com.iver.cit.gvsig.fmap.edition.writers.dxf.DxfWriter;
105 758 jmorell
import com.iver.cit.gvsig.fmap.rendering.Legend;
106
import com.iver.cit.gvsig.fmap.rendering.LegendFactory;
107
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend;
108
109
/**
110
 * @author jmorell (jose.morell@gmail.com)
111 8765 jjdelcerro
 * @author azabala
112 758 jmorell
 * @version 29-dic-2004
113
 */
114 8765 jjdelcerro
public class DXFMemoryDriver extends AbstractCadMemoryDriver implements
115 5595 fjp
                VectorialFileDriver, WithDefaultLegend, ISpatialWriter, IWriteable {
116 10717 caballero
117 4937 fjp
        private static String tempDirectoryPath = System
118
                        .getProperty("java.io.tmpdir");
119 758 jmorell
120 4937 fjp
121
        private DxfWriter dxfWriter = new DxfWriter();
122
123
        private File fTemp;
124
125 758 jmorell
        VectorialUniqueValueLegend defaultLegend;
126 4937 fjp
127 758 jmorell
        private String path;
128 4937 fjp
129 758 jmorell
        private File m_Fich;
130 4937 fjp
131 758 jmorell
        private DxfFile.EntityFactory featureMaker;
132 4937 fjp
133 758 jmorell
        private DxfFile dxfFeatureFile;
134 4937 fjp
135 758 jmorell
        private IObjList.vector features;
136 4937 fjp
137 1233 fjp
        private DriverAttributes attr = new DriverAttributes();
138 4937 fjp
139 758 jmorell
        /**
140
         * Habilita la utilizaci?n del lector del HEADER del DXF.
141
         */
142
        private DxfFile.VarSettings headerManager;
143
144 4937 fjp
        /*
145
         * (non-Javadoc)
146 5389 caballero
         *
147 758 jmorell
         * @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#open(java.io.File)
148
         */
149
        public void open(File f) throws IOException {
150 4937 fjp
                m_Fich = f;
151 758 jmorell
        }
152 4937 fjp
153 758 jmorell
        public void initialize() throws IOException {
154 913 jmorell
                float heightText = 10;
155 4937 fjp
156 1233 fjp
                attr.setLoadedInMemory(true);
157 4937 fjp
158 6164 luisw2
                IProjection proj = CRSFactory.getCRS("EPSG:23030");
159 758 jmorell
                featureMaker = new DxfFeatureMaker(proj);
160 4937 fjp
                headerManager = new DxfHeaderManager();
161
                dxfFeatureFile = new DxfFile(proj, m_Fich.getAbsolutePath(),
162
                                featureMaker, headerManager);
163 758 jmorell
                dxfFeatureFile.load();
164 4937 fjp
                features = (IObjList.vector) ((DxfFeatureMaker) featureMaker)
165
                                .getObjects();
166
                String acadVersion = (String) ((DxfHeaderManager) headerManager)
167
                                .getAcadVersion();
168
                System.out.println("initialize(): acadVersion = " + acadVersion);
169
                if (!featureMaker.isDxf3DFile() && !headerManager.isWritedDxf3D()) { // y no
170
                                                                                                                                                                // est?n
171
                                                                                                                                                                // todos
172
                                                                                                                                                                // a
173
                                                                                                                                                                // 9999
174
                        Feature[] features2D = new Feature[features.size()];
175
                        for (int i = 0; i < features.size(); i++) {
176
                                Feature fea = (Feature) features.get(i);
177 2196 vcaballero
                                if (fea.getGeometry() instanceof org.cresques.px.gml.Point3D) {
178 4937 fjp
                                        Point point = (Point) fea.getGeometry();
179 2196 vcaballero
                                        Point point2 = new Point();
180 4937 fjp
                                        for (int j = 0; j < point.pointNr(); j++) {
181
                                                point2.add(point.get(j));
182 2196 vcaballero
                                        }
183
                                        point2.setTextPoint(point.isTextPoint());
184
                                        fea.setGeometry(point2);
185
                                        features2D[i] = fea;
186 4937 fjp
                                        // } else if (fea.getGeometry() instanceof InsPoint3D) {
187
                                        // InsPoint insPoint = (InsPoint)fea.getGeometry();
188
                                        // InsPoint insPoint2 = new InsPoint();
189
                                        // for (int j=0;j<insPoint.pointNr();j++) {
190
                                        // insPoint2.add(insPoint.get(j));
191
                                        // }
192
                                        // fea.setGeometry(insPoint2);
193
                                        // features2D[i] = fea;
194 2196 vcaballero
                                } else if (fea.getGeometry() instanceof LineString3D) {
195 4937 fjp
                                        LineString lineString = (LineString) fea.getGeometry();
196 2196 vcaballero
                                        LineString lineString2 = new LineString();
197 4937 fjp
                                        for (int j = 0; j < lineString.pointNr(); j++) {
198
                                                lineString2.add(lineString.get(j));
199 2196 vcaballero
                                        }
200
                                        fea.setGeometry(lineString2);
201
                                        features2D[i] = fea;
202
                                } else if (fea.getGeometry() instanceof Polygon3D) {
203 4937 fjp
                                        Polygon polygon = (Polygon) fea.getGeometry();
204 2196 vcaballero
                                        Polygon polygon2 = new Polygon();
205 4937 fjp
                                        for (int j = 0; j < polygon.pointNr(); j++) {
206
                                                polygon2.add(polygon.get(j));
207 2196 vcaballero
                                        }
208
                                        fea.setGeometry(polygon2);
209
                                        features2D[i] = fea;
210
                                }
211
                        }
212 4937 fjp
                        features.clear();
213
                        for (int i = 0; i < features2D.length; i++) {
214
                                features.add(features2D[i]);
215 2196 vcaballero
                        }
216
                }
217 4937 fjp
                // String acadVersion =
218
                // (String)((DxfHeaderManager)headerManager).getAcadVersion();
219
                // System.out.println("initialize(): acadVersion = " + acadVersion);
220
221 758 jmorell
                int nAtt = featureMaker.getAttributes().size();
222 4937 fjp
223 758 jmorell
                // Campos de las MemoryLayer:
224 4937 fjp
                Value[] auxRow = new Value[10 + nAtt];
225 913 jmorell
                ArrayList arrayFields = new ArrayList();
226
                arrayFields.add("ID");
227 2196 vcaballero
                arrayFields.add("FShape");
228 913 jmorell
                arrayFields.add("Entity");
229
                arrayFields.add("Layer");
230
                arrayFields.add("Color");
231
                arrayFields.add("Elevation");
232
                arrayFields.add("Thickness");
233
                arrayFields.add("Text");
234
                arrayFields.add("HeightText");
235
                arrayFields.add("RotationText");
236 4937 fjp
                for (int i = 0; i < nAtt; i++) {
237 758 jmorell
                        String att[] = new String[2];
238 4937 fjp
                        att = (String[]) featureMaker.getAttributes().get(i);
239 913 jmorell
                        arrayFields.add(att[0]);
240 758 jmorell
                }
241 4937 fjp
242
                getTableModel().setColumnIdentifiers(arrayFields.toArray());
243
244
                for (int i = 0; i < features.size(); i++) {
245
246
                        auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory.createValue(0.0);
247
                        auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory.createValue(0.0);
248
                        auxRow[ID_FIELD_TEXT] = ValueFactory.createNullValue();
249
250
                        Feature fea = (Feature) features.get(i);
251
                        if (fea.getGeometry() instanceof Point
252
                                        && !(fea.getGeometry() instanceof org.cresques.px.gml.Point3D)) {
253
                                Point point = (Point) fea.getGeometry();
254 758 jmorell
                                Point2D pto = new Point2D.Double();
255 4937 fjp
                                pto = (Point2D) point.get(0);
256 758 jmorell
                                FShape nuevoShp;
257 4937 fjp
                                if (point.isTextPoint()) {
258 913 jmorell
                                        auxRow[ID_FIELD_ID] = ValueFactory.createValue(i);
259 4937 fjp
                                        auxRow[ID_FIELD_FSHAPE] = ValueFactory
260
                                                        .createValue(new String("FPoint2D"));
261
                                        auxRow[ID_FIELD_ENTITY] = ValueFactory
262
                                                        .createValue(new String(fea.getProp("dxfEntity")));
263
                                        auxRow[ID_FIELD_LAYER] = ValueFactory
264
                                                        .createValue(new String(fea.getProp("layer")));
265
                                        int auxInt = Integer.parseInt(fea.getProp("color"));
266
                                        auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt);
267
                                        auxRow[ID_FIELD_TEXT] = ValueFactory
268
                                                        .createValue(new String(fea.getProp("text")));
269
                                        heightText = Float.parseFloat(fea.getProp("textHeight"));
270
                                        auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory
271
                                                        .createValue(heightText);
272
                                        double auxR = Double.parseDouble(fea
273
                                                        .getProp("textRotation"));
274
                                        auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory
275
                                                        .createValue(auxR);
276
                                        double auxE = Double.parseDouble(fea.getProp("elevation"));
277
                                        auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE);
278
                                        double auxT = Double.parseDouble(fea.getProp("thickness"));
279
                                        auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT);
280
                                        // Attributes
281
                                        for (int j = 0; j < nAtt; j++) {
282
                                                String[] attributes = new String[2];
283
                                                attributes = (String[]) featureMaker.getAttributes()
284
                                                                .get(j);
285
                                                auxRow[10 + j] = ValueFactory.createValue(new String(
286
                                                                (String) attributes[1]));
287
                                                if (!fea.getProp(attributes[0]).equals(attributes[1])) {
288
                                                        auxRow[10 + j] = ValueFactory
289
                                                                        .createValue(new String(fea
290
                                                                                        .getProp(attributes[0])));
291
                                                }
292
                                        }
293
                                        nuevoShp = new FPoint2D(pto.getX(), pto.getY());
294 913 jmorell
                                        addShape(nuevoShp, auxRow);
295 4937 fjp
                                } else {
296
                                        auxRow[ID_FIELD_ID] = ValueFactory.createValue(i);
297
                                        auxRow[ID_FIELD_FSHAPE] = ValueFactory
298
                                                        .createValue(new String("FPoint2D"));
299
                                        auxRow[ID_FIELD_ENTITY] = ValueFactory
300
                                                        .createValue(new String(fea.getProp("dxfEntity")));
301
                                        auxRow[ID_FIELD_LAYER] = ValueFactory
302
                                                        .createValue(new String(fea.getProp("layer")));
303
                                        int auxInt = Integer.parseInt(fea.getProp("color"));
304
                                        auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt);
305
                                        double auxE = Double.parseDouble(fea.getProp("elevation"));
306
                                        auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE);
307
                                        double auxT = Double.parseDouble(fea.getProp("thickness"));
308
                                        auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT);
309
                                        // Attributes
310
                                        for (int j = 0; j < nAtt; j++) {
311
                                                String[] attributes = new String[2];
312
                                                attributes = (String[]) featureMaker.getAttributes()
313
                                                                .get(j);
314
                                                auxRow[10 + j] = ValueFactory.createValue(new String(
315
                                                                (String) attributes[1]));
316
                                                if (!fea.getProp(attributes[0]).equals(attributes[1])) {
317
                                                        auxRow[10 + j] = ValueFactory
318
                                                                        .createValue(new String(fea
319
                                                                                        .getProp(attributes[0])));
320
                                                }
321
                                        }
322
                                        nuevoShp = new FPoint2D(pto.getX(), pto.getY());
323 758 jmorell
                                        addShape(nuevoShp, auxRow);
324 4937 fjp
                                }
325 2196 vcaballero
                        } else if (fea.getGeometry() instanceof org.cresques.px.gml.Point3D) {
326 4937 fjp
                                org.cresques.px.gml.Point3D point = (org.cresques.px.gml.Point3D) fea
327
                                                .getGeometry();
328 2196 vcaballero
                                Point3D pto = new Point3D();
329 4937 fjp
                                pto = (Point3D) point.getPoint3D(0);
330 2196 vcaballero
                                FShape nuevoShp;
331 4937 fjp
                                if (point.isTextPoint()) {
332 2196 vcaballero
                                        auxRow[ID_FIELD_ID] = ValueFactory.createValue(i);
333 4937 fjp
                                        auxRow[ID_FIELD_FSHAPE] = ValueFactory
334
                                                        .createValue(new String("FPoint3D"));
335
                                        auxRow[ID_FIELD_ENTITY] = ValueFactory
336
                                                        .createValue(new String(fea.getProp("dxfEntity")));
337
                                        auxRow[ID_FIELD_LAYER] = ValueFactory
338
                                                        .createValue(new String(fea.getProp("layer")));
339
                                        int auxInt = Integer.parseInt(fea.getProp("color"));
340
                                        auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt);
341
                                        auxRow[ID_FIELD_TEXT] = ValueFactory
342
                                                        .createValue(new String(fea.getProp("text")));
343
                                        heightText = Float.parseFloat(fea.getProp("textHeight"));
344
                                        auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory
345
                                                        .createValue(heightText);
346
                                        double auxR = Double.parseDouble(fea
347
                                                        .getProp("textRotation"));
348
                                        auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory
349
                                                        .createValue(auxR);
350
                                        double auxE = Double.parseDouble(fea.getProp("elevation"));
351
                                        auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE);
352
                                        double auxT = Double.parseDouble(fea.getProp("thickness"));
353
                                        auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT);
354
                                        // Attributes
355
                                        for (int j = 0; j < nAtt; j++) {
356
                                                String[] attributes = new String[2];
357
                                                attributes = (String[]) featureMaker.getAttributes()
358
                                                                .get(j);
359
                                                auxRow[10 + j] = ValueFactory.createValue(new String(
360
                                                                (String) attributes[1]));
361
                                                if (!fea.getProp(attributes[0]).equals(attributes[1])) {
362
                                                        auxRow[10 + j] = ValueFactory
363
                                                                        .createValue(new String(fea
364
                                                                                        .getProp(attributes[0])));
365
                                                }
366
                                        }
367
                                        nuevoShp = new FPoint3D(pto.getX(), pto.getY(), pto.getZ());
368 2196 vcaballero
                                        addShape(nuevoShp, auxRow);
369 4937 fjp
                                } else {
370
                                        auxRow[ID_FIELD_ID] = ValueFactory.createValue(i);
371
                                        auxRow[ID_FIELD_FSHAPE] = ValueFactory
372
                                                        .createValue(new String("FPoint3D"));
373
                                        auxRow[ID_FIELD_ENTITY] = ValueFactory
374
                                                        .createValue(new String(fea.getProp("dxfEntity")));
375
                                        auxRow[ID_FIELD_LAYER] = ValueFactory
376
                                                        .createValue(new String(fea.getProp("layer")));
377
                                        int auxInt = Integer.parseInt(fea.getProp("color"));
378
                                        auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt);
379
                                        double auxE = Double.parseDouble(fea.getProp("elevation"));
380
                                        auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE);
381
                                        double auxT = Double.parseDouble(fea.getProp("thickness"));
382
                                        auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT);
383
                                        // Attributes
384
                                        for (int j = 0; j < nAtt; j++) {
385
                                                String[] attributes = new String[2];
386
                                                attributes = (String[]) featureMaker.getAttributes()
387
                                                                .get(j);
388
                                                auxRow[10 + j] = ValueFactory.createValue(new String(
389
                                                                (String) attributes[1]));
390
                                                if (!fea.getProp(attributes[0]).equals(attributes[1])) {
391
                                                        auxRow[10 + j] = ValueFactory
392
                                                                        .createValue(new String(fea
393
                                                                                        .getProp(attributes[0])));
394
                                                }
395
                                        }
396
                                        nuevoShp = new FPoint3D(pto.getX(), pto.getY(), pto.getZ());
397 2196 vcaballero
                                        addShape(nuevoShp, auxRow);
398 4937 fjp
                                }
399
                                /*
400
                                 * } else if (fea.getGeometry() instanceof InsPoint &&
401
                                 * !(fea.getGeometry() instanceof InsPoint3D)) { InsPoint
402
                                 * insPoint = (InsPoint)fea.getGeometry(); Point2D pto = new
403
                                 * Point2D.Double(); pto = (Point2D)insPoint.get(0);
404
                                 * auxRow[ID_FIELD_ID] = ValueFactory.createValue(i);
405
                                 * auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new
406
                                 * String("PointZ")); auxRow[ID_FIELD_ENTITY] =
407
                                 * ValueFactory.createValue(new
408
                                 * String(fea.getProp("dxfEntity"))); auxRow[ID_FIELD_LAYER] =
409
                                 * ValueFactory.createValue(new String(fea.getProp("layer")));
410
                                 * int auxInt = Integer.parseInt(fea.getProp("color"));
411
                                 * auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt);
412
                                 * double auxE = Double.parseDouble(fea.getProp("elevation"));
413
                                 * auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); //
414
                                 * Attributes for (int j=0;j<nAtt;j++) { String[] attributes =
415
                                 * new String[2]; attributes =
416
                                 * (String[])featureMaker.getAttributes().get(j); auxRow[9+j] =
417
                                 * ValueFactory.createValue(new String((String)attributes[1]));
418
                                 * if (!fea.getProp(attributes[0]).equals(attributes[1])) {
419
                                 * auxRow[9+j] = ValueFactory.createValue(new
420
                                 * String(fea.getProp(attributes[0]))); } } FShape nuevoShp =
421
                                 * new FPoint2D(pto.getX(),pto.getY()); addShape(nuevoShp,
422
                                 * auxRow); } else if (fea.getGeometry() instanceof InsPoint3D) {
423
                                 * InsPoint3D insPoint = (InsPoint3D)fea.getGeometry(); Point3D
424
                                 * pto = new Point3D(); pto = (Point3D)insPoint.getPoint3D(0);
425
                                 * auxRow[ID_FIELD_ID] = ValueFactory.createValue(i);
426
                                 * auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new
427
                                 * String("PointZ")); auxRow[ID_FIELD_ENTITY] =
428
                                 * ValueFactory.createValue(new
429
                                 * String(fea.getProp("dxfEntity"))); auxRow[ID_FIELD_LAYER] =
430
                                 * ValueFactory.createValue(new String(fea.getProp("layer")));
431
                                 * int auxInt = Integer.parseInt(fea.getProp("color"));
432
                                 * auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt);
433
                                 * double auxE = Double.parseDouble(fea.getProp("elevation"));
434
                                 * auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); //
435
                                 * Attributes for (int j=0;j<nAtt;j++) { String[] attributes =
436
                                 * new String[2]; attributes =
437
                                 * (String[])featureMaker.getAttributes().get(j); auxRow[9+j] =
438
                                 * ValueFactory.createValue(new String((String)attributes[1]));
439
                                 * if (!fea.getProp(attributes[0]).equals(attributes[1])) {
440
                                 * auxRow[9+j] = ValueFactory.createValue(new
441
                                 * String(fea.getProp(attributes[0]))); } } FShape nuevoShp =
442
                                 * new FPoint3D(pto.getX(),pto.getY(),pto.getZ());
443
                                 * addShape(nuevoShp, auxRow);
444
                                 */
445
                        } else if (fea.getGeometry() instanceof LineString
446
                                        && !(fea.getGeometry() instanceof LineString3D)) {
447 758 jmorell
                                GeneralPathX genPathX = new GeneralPathX();
448
                                Point2D[] pts = new Point2D[fea.getGeometry().pointNr()];
449 4937 fjp
                                for (int j = 0; j < fea.getGeometry().pointNr(); j++) {
450
                                        pts[j] = (Point2D) fea.getGeometry().get(j);
451 758 jmorell
                                }
452
                                genPathX.moveTo(pts[0].getX(), pts[0].getY());
453 4937 fjp
                                for (int j = 1; j < pts.length; j++) {
454 758 jmorell
                                        genPathX.lineTo(pts[j].getX(), pts[j].getY());
455
                                }
456 4937 fjp
                                // double[] elevations = new double[pts.length];
457
                                // for (int j=0;j<pts.length;j++) {
458
                                // elevations[j]=pts[j].getZ();
459
                                // }
460
                                auxRow[ID_FIELD_ID] = ValueFactory.createValue(i);
461
                                auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String(
462
                                                "FPolyline2D"));
463
                                auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(
464
                                                fea.getProp("dxfEntity")));
465
                                auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(
466
                                                fea.getProp("layer")));
467
                                int auxInt = Integer.parseInt(fea.getProp("color"));
468
                                auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt);
469
                                double auxE = Double.parseDouble(fea.getProp("elevation"));
470
                                auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE);
471
                                double auxT = Double.parseDouble(fea.getProp("thickness"));
472
                                auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT);
473
                                // Attributes
474
                                for (int j = 0; j < nAtt; j++) {
475
                                        String[] attributes = new String[2];
476
                                        attributes = (String[]) featureMaker.getAttributes().get(j);
477
                                        auxRow[10 + j] = ValueFactory.createValue(new String(
478
                                                        (String) attributes[1]));
479
                                        if (!fea.getProp(attributes[0]).equals(attributes[1])) {
480
                                                auxRow[10 + j] = ValueFactory.createValue(new String(
481
                                                                fea.getProp(attributes[0])));
482
                                        }
483
                                }
484 758 jmorell
                                FShape nuevoShp = new FPolyline2D(genPathX);
485
                                addShape(nuevoShp, auxRow);
486 2196 vcaballero
                        } else if (fea.getGeometry() instanceof LineString3D) {
487 758 jmorell
                                GeneralPathX genPathX = new GeneralPathX();
488 2196 vcaballero
                                Point3D[] pts = new Point3D[fea.getGeometry().pointNr()];
489 4937 fjp
                                for (int j = 0; j < fea.getGeometry().pointNr(); j++) {
490
                                        pts[j] = ((LineString3D) fea.getGeometry()).getPoint3D(j);
491 2196 vcaballero
                                }
492
                                genPathX.moveTo(pts[0].getX(), pts[0].getY());
493 4937 fjp
                                for (int j = 1; j < pts.length; j++) {
494 2196 vcaballero
                                        genPathX.lineTo(pts[j].getX(), pts[j].getY());
495
                                }
496 4937 fjp
                                double[] elevations = new double[pts.length];
497
                                for (int j = 0; j < pts.length; j++) {
498
                                        elevations[j] = pts[j].getZ();
499
                                }
500
                                auxRow[ID_FIELD_ID] = ValueFactory.createValue(i);
501
                                auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String(
502
                                                "FPolyline3D"));
503
                                auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(
504
                                                fea.getProp("dxfEntity")));
505
                                auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(
506
                                                fea.getProp("layer")));
507
                                int auxInt = Integer.parseInt(fea.getProp("color"));
508
                                auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt);
509
                                if (fea.getProp("elevation") != null) {
510
                                        double auxE = Double.parseDouble(fea.getProp("elevation"));
511
                                        auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE);
512
                                }
513
                                double auxT = Double.parseDouble(fea.getProp("thickness"));
514
                                auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT);
515
                                // Attributes
516
                                for (int j = 0; j < nAtt; j++) {
517
                                        String[] attributes = new String[2];
518
                                        attributes = (String[]) featureMaker.getAttributes().get(j);
519
                                        auxRow[10 + j] = ValueFactory.createValue(new String(
520
                                                        (String) attributes[1]));
521
                                        if (!fea.getProp(attributes[0]).equals(attributes[1])) {
522
                                                auxRow[10 + j] = ValueFactory.createValue(new String(
523
                                                                fea.getProp(attributes[0])));
524
                                        }
525
                                }
526 2196 vcaballero
                                FShape nuevoShp = new FPolyline3D(genPathX, elevations);
527
                                addShape(nuevoShp, auxRow);
528 4937 fjp
                        } else if (fea.getGeometry() instanceof Polygon
529
                                        && !(fea.getGeometry() instanceof Polygon3D)) {
530 2196 vcaballero
                                GeneralPathX genPathX = new GeneralPathX();
531 4937 fjp
                                // 050112: A?ado una posici?n m?s para el punto que cierra y
532
                                // creo el objeto firstPt.
533 936 jmorell
                                Point2D firstPt = new Point2D.Double();
534 4937 fjp
                                firstPt = (Point2D) fea.getGeometry().get(0);
535
                                Point2D[] pts = new Point2D[fea.getGeometry().pointNr() + 1];
536
                                for (int j = 0; j < fea.getGeometry().pointNr(); j++) {
537
                                        pts[j] = (Point2D) fea.getGeometry().get(j);
538 758 jmorell
                                }
539 4937 fjp
                                // 050112: A?ado el primer punto al final para cerrar los
540
                                // pol?gonos.
541 936 jmorell
                                pts[fea.getGeometry().pointNr()] = firstPt;
542 758 jmorell
                                genPathX.moveTo(pts[0].getX(), pts[0].getY());
543 4937 fjp
                                for (int j = 1; j < pts.length; j++) {
544 758 jmorell
                                        genPathX.lineTo(pts[j].getX(), pts[j].getY());
545
                                }
546 4937 fjp
                                // double[] elevations = new double[pts.length];
547
                                // for (int j=0;j<pts.length;j++) {
548
                                // elevations[j]=pts[j].getZ();
549
                                // }
550
                                auxRow[ID_FIELD_ID] = ValueFactory.createValue(i);
551
                                auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String(
552
                                                "FPolygon2D"));
553
                                auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(
554
                                                fea.getProp("dxfEntity")));
555
                                auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(
556
                                                fea.getProp("layer")));
557
                                int auxInt = Integer.parseInt(fea.getProp("color"));
558
                                auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt);
559
                                double auxE = Double.parseDouble(fea.getProp("elevation"));
560
                                auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE);
561
                                double auxT = Double.parseDouble(fea.getProp("thickness"));
562
                                auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT);
563
                                // Attributes
564
                                for (int j = 0; j < nAtt; j++) {
565
                                        String[] attributes = new String[2];
566
                                        attributes = (String[]) featureMaker.getAttributes().get(j);
567
                                        auxRow[10 + j] = ValueFactory.createValue(new String(
568
                                                        (String) attributes[1]));
569
                                        if (!fea.getProp(attributes[0]).equals(attributes[1])) {
570
                                                auxRow[10 + j] = ValueFactory.createValue(new String(
571
                                                                fea.getProp(attributes[0])));
572
                                        }
573
                                }
574 758 jmorell
                                FShape nuevoShp = new FPolygon2D(genPathX);
575
                                addShape(nuevoShp, auxRow);
576 2196 vcaballero
                        } else if (fea.getGeometry() instanceof Polygon3D) {
577
                                GeneralPathX genPathX = new GeneralPathX();
578 4937 fjp
                                // 050112: A?ado una posici?n m?s para el punto que cierra y
579
                                // creo el objeto firstPt.
580 2196 vcaballero
                                Point3D firstPt = new Point3D();
581 4937 fjp
                                firstPt = (Point3D) ((Polygon3D) fea.getGeometry())
582
                                                .getPoint3D(0);
583
                                Point3D[] pts = new Point3D[fea.getGeometry().pointNr() + 1];
584
                                for (int j = 0; j < fea.getGeometry().pointNr(); j++) {
585
                                        pts[j] = (Point3D) ((Polygon3D) fea.getGeometry())
586
                                                        .getPoint3D(j);
587 2196 vcaballero
                                }
588 4937 fjp
                                // 050112: A?ado el primer punto al final para cerrar los
589
                                // pol?gonos.
590 2196 vcaballero
                                pts[fea.getGeometry().pointNr()] = firstPt;
591
                                genPathX.moveTo(pts[0].getX(), pts[0].getY());
592 4937 fjp
                                for (int j = 1; j < pts.length; j++) {
593 2196 vcaballero
                                        genPathX.lineTo(pts[j].getX(), pts[j].getY());
594
                                }
595 4937 fjp
                                double[] elevations = new double[pts.length];
596
                                for (int j = 0; j < pts.length; j++) {
597
                                        elevations[j] = pts[j].getZ();
598
                                }
599
                                auxRow[ID_FIELD_ID] = ValueFactory.createValue(i);
600
                                auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String(
601
                                                "FPolygon3D"));
602
                                auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(
603
                                                fea.getProp("dxfEntity")));
604
                                auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(
605
                                                fea.getProp("layer")));
606
                                int auxInt = Integer.parseInt(fea.getProp("color"));
607
                                auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt);
608
                                if (fea.getProp("elevation") != null) {
609
                                        double auxE = Double.parseDouble(fea.getProp("elevation"));
610
                                        auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE);
611
                                }
612
                                double auxT = Double.parseDouble(fea.getProp("thickness"));
613
                                auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT);
614
                                // Attributes
615
                                for (int j = 0; j < nAtt; j++) {
616
                                        String[] attributes = new String[2];
617
                                        attributes = (String[]) featureMaker.getAttributes().get(j);
618
                                        auxRow[10 + j] = ValueFactory.createValue(new String(
619
                                                        (String) attributes[1]));
620
                                        if (!fea.getProp(attributes[0]).equals(attributes[1])) {
621
                                                auxRow[10 + j] = ValueFactory.createValue(new String(
622
                                                                fea.getProp(attributes[0])));
623
                                        }
624
                                }
625 2196 vcaballero
                                FShape nuevoShp = new FPolygon3D(genPathX, elevations);
626
                                addShape(nuevoShp, auxRow);
627 758 jmorell
                        } else {
628 4937 fjp
                                // System.out.println("Detectado feature desconocido");
629 758 jmorell
                        }
630
                }
631 4937 fjp
632
                defaultLegend = LegendFactory
633
                                .createVectorialUniqueValueLegend(getShapeType());
634 758 jmorell
                defaultLegend.setFieldName("Color");
635 936 jmorell
                defaultLegend.setLabelField("Text");
636 10717 caballero
637
                FSymbol myDefaultSymbol = new FSymbol(getShapeType());
638
                myDefaultSymbol.setShapeVisible(true);
639 8765 jjdelcerro
                myDefaultSymbol.setFontSizeInPixels(false);
640
                myDefaultSymbol.setFont(new Font("SansSerif",Font.PLAIN, 9));
641
                myDefaultSymbol.setFontColor(Color.BLACK);
642
                myDefaultSymbol.setFontSize(heightText);
643
                myDefaultSymbol.setStyle(FConstant.SYMBOL_STYLE_DGNSPECIAL);
644
                myDefaultSymbol.setSize(3);
645
                myDefaultSymbol.setSizeInPixels(true);
646 10717 caballero
647 8765 jjdelcerro
                defaultLegend.setDefaultSymbol(myDefaultSymbol);
648 4937 fjp
649 839 jmorell
                defaultLegend.setLabelHeightField("HeightText");
650
                defaultLegend.setLabelRotationField("RotationText");
651 4937 fjp
652 1828 fernando
                ObjectDriver rs = this;
653 758 jmorell
                IntValue clave;
654
                FSymbol theSymbol = null;
655 4937 fjp
656 758 jmorell
                try {
657 4937 fjp
                        // TODO: Provisional hasta que cambiemos los s?mbolos.
658
                        /*
659
                         * BufferedImage bi= new BufferedImage(5, 5,
660
                         * BufferedImage.TYPE_INT_ARGB); Graphics2D big =
661
                         * bi.createGraphics(); Color color=new Color(0,0,0,0);
662
                         * big.setBackground(color); big.clearRect(0, 0, 5, 5); Paint
663
                         * fillProv = null; Rectangle2D rProv = new Rectangle();
664
                         * rProv.setFrame(0, 0,5,5); fillProv = new TexturePaint(bi,rProv);
665
                         */
666
667
                        for (long j = 0; j < rs.getRowCount(); j++) {
668
                                clave = (IntValue) rs.getFieldValue(j, ID_FIELD_COLOR);
669
                                if (defaultLegend.getSymbolByValue(clave) == null) {
670 936 jmorell
                                        theSymbol = new FSymbol(getShapeType());
671 758 jmorell
                                        theSymbol.setDescription(clave.toString());
672
                                        theSymbol.setColor(AcadColor.getColor(clave.getValue()));
673 1402 fjp
                                        // theSymbol.setFill(fillProv);
674 4937 fjp
                                        // 050202, jmorell: Asigna los colores de Autocad a los
675
                                        // bordes
676
                                        // de los pol?gonos.
677
                                        theSymbol.setOutlineColor(AcadColor.getColor(clave
678
                                                        .getValue()));
679
680 1402 fjp
                                        theSymbol.setStyle(FConstant.SYMBOL_STYLE_DGNSPECIAL);
681 1461 jmorell
                                        theSymbol.setSize(3);
682 1402 fjp
                                        theSymbol.setSizeInPixels(true);
683 4937 fjp
684 758 jmorell
                                        defaultLegend.addSymbol(clave, theSymbol);
685
                                }
686
                        } // for
687
                } catch (DriverException e) {
688
                        e.printStackTrace();
689 4937 fjp
                        throw new IOException(
690
                                        "Error al poner la leyenda por defecto en el DXF");
691 758 jmorell
                }
692
        }
693
694 4937 fjp
        /*
695
         * (non-Javadoc)
696 5389 caballero
         *
697 758 jmorell
         * @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#accept(java.io.File)
698
         */
699
        public boolean accept(File f) {
700
                return f.getName().toUpperCase().endsWith("DXF");
701
        }
702
703 4937 fjp
        /*
704
         * (non-Javadoc)
705 5389 caballero
         *
706 758 jmorell
         * @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#getShapeType()
707
         */
708
        public int getShapeType() {
709 839 jmorell
                return FShape.MULTI;
710 758 jmorell
        }
711
712 4937 fjp
        /*
713
         * (non-Javadoc)
714 5389 caballero
         *
715 758 jmorell
         * @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#getName()
716
         */
717
        public String getName() {
718
                return "gvSIG DXF Memory Driver";
719
        }
720
721 4937 fjp
        /*
722
         * (non-Javadoc)
723 5389 caballero
         *
724 758 jmorell
         * @see com.iver.cit.gvsig.fmap.drivers.WithDefaultLegend#getDefaultLegend()
725
         */
726
        public Legend getDefaultLegend() {
727
                return defaultLegend;
728
        }
729
730 4937 fjp
        /*
731
         * (non-Javadoc)
732 5389 caballero
         *
733 4937 fjp
         * @see com.iver.cit.gvsig.fmap.drivers.VectorialDriver#getDriverAttributes()
734
         */
735
        public DriverAttributes getDriverAttributes() {
736
                return attr;
737
        }
738 2183 fernando
739 4937 fjp
        /**
740
         * @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#getPrimaryKeys()
741
         */
742
        public int[] getPrimaryKeys() throws DriverException {
743
                return null;
744
        }
745 2217 fernando
746 4937 fjp
        /**
747
         * @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#write(com.hardcode.gdbms.engine.data.edition.DataWare)
748
         */
749
        public void write(DataWare arg0) throws DriverException {
750
                // TODO Auto-generated method stub
751 2880 fernando
752 4937 fjp
        }
753
754
        /*
755
         * (non-Javadoc)
756 5389 caballero
         *
757 4937 fjp
         * @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#close()
758
         */
759
        public void close() throws IOException {
760
                // TODO Auto-generated method stub
761
762
        }
763
764 3720 fjp
        public File getFile() {
765
                return m_Fich;
766
        }
767 3271 fjp
768 4937 fjp
        public boolean canWriteGeometry(int gvSIGgeometryType) {
769
                return dxfWriter.canWriteGeometry(gvSIGgeometryType);
770
        }
771 3720 fjp
772 5558 fjp
        public void initialize(ITableDefinition layerDef) throws EditionException {
773 4937 fjp
                int aux = (int) (Math.random() * 1000);
774
                fTemp = new File(tempDirectoryPath + "/tmpDxf" + aux + ".dxf");
775
                dxfWriter.setFile(fTemp);
776
777 5558 fjp
                dxfWriter.initialize(layerDef);
778 4937 fjp
                /*
779
                 * arrayFields.add("ID"); arrayFields.add("FShape");
780
                 * arrayFields.add("Entity"); arrayFields.add("Layer");
781
                 * arrayFields.add("Color"); arrayFields.add("Elevation");
782
                 * arrayFields.add("Thickness"); arrayFields.add("Text");
783
                 * arrayFields.add("HeightText"); arrayFields.add("RotationText");
784
                 */
785
786
                DxfFieldsMapping fieldsMapping = new DxfFieldsMapping();
787
                fieldsMapping.setLayerField("Layer");
788
                fieldsMapping.setColorField("Color");
789
                fieldsMapping.setElevationField("Elevation");
790
                fieldsMapping.setThicknessField("Thickness");
791
                fieldsMapping.setTextField("Text");
792
                fieldsMapping.setHeightText("HeightText");
793
                fieldsMapping.setRotationText("Layer");
794
                dxfWriter.setFieldMapping(fieldsMapping);
795 5558 fjp
                dxfWriter.setProjection(((ILayerDefinition)layerDef).getProjection());
796 4937 fjp
        }
797
798
        public void preProcess() throws EditionException {
799
                dxfWriter.preProcess();
800
        }
801
802
        public void process(IRowEdited row) throws EditionException {
803
                dxfWriter.process(row);
804
        }
805
806
        public void postProcess() throws EditionException {
807
                dxfWriter.postProcess();
808
                try {
809
810
                        // close();
811
812
                        // Dxf
813
                        FileChannel fcinDxf = new FileInputStream(fTemp).getChannel();
814
                        FileChannel fcoutDxf = new FileOutputStream(m_Fich).getChannel();
815
                        DriverUtilities.copy(fcinDxf, fcoutDxf);
816
817
                        // Borramos los temporales
818
                        fTemp.delete();
819 6323 fjp
                        reload();
820 4937 fjp
821
                } catch (FileNotFoundException e) {
822
                        e.printStackTrace();
823
                        throw new EditionException(e);
824
                } catch (IOException e) {
825
                        e.printStackTrace();
826
                        throw new EditionException(e);
827 6323 fjp
                } catch (DriverException e) {
828
                        e.printStackTrace();
829 6714 caballero
                        throw new EditionException(e);
830 4937 fjp
                }
831
832
        }
833
834
        public String getCapability(String capability) {
835
                return dxfWriter.getCapability(capability);
836
        }
837
838
        public void setCapabilities(Properties capabilities) {
839
                dxfWriter.setCapabilities(capabilities);
840
841
        }
842
843
        public boolean canWriteAttribute(int sqlType) {
844
                return dxfWriter.canWriteAttribute(sqlType);
845
        }
846 6714 caballero
847 4937 fjp
        /*
848
         * (non-Javadoc)
849 5389 caballero
         *
850 4937 fjp
         * @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#reLoad()
851
         */
852 6323 fjp
        public void reload() throws IOException, DriverException {
853
                super.reload();
854 4937 fjp
                try {
855
                        initialize();
856
                } catch (IOException e) {
857
                        e.printStackTrace();
858
                        throw new IOException("DXF: Error reloading " + path + " file.");
859
                }
860
        }
861
862 6714 caballero
//        public void setFlatness(double flatness) {
863
//                // TODO Auto-generated method stub
864
//
865
//        }
866 5389 caballero
867 5521 caballero
        public boolean isWritable() {
868
                return m_Fich.canWrite();
869
        }
870
871 5595 fjp
        public IWriter getWriter() {
872
                return this;
873
        }
874
875 6259 fjp
        public ITableDefinition getTableDefinition() {
876
                return dxfWriter.getTableDefinition();
877
        }
878
879 6356 fjp
        public boolean canAlterTable() {
880
                return false;
881
        }
882
883 6856 fjp
        public boolean canSaveEdits() {
884
                return dxfWriter.canSaveEdits();
885
        }
886
887 8913 fjp
        public boolean isWriteAll() {
888
                return true;
889
        }
890
891 758 jmorell
}