svn-gvsig-desktop / tags / v1_1_Build_1012 / libraries / libCq_CMS_praster / src / org / cresques / io / DxfFile.java @ 12987
History | View | Annotate | Download (67.8 KB)
1 | 8026 | nacho | /*
|
---|---|---|---|
2 | * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
|
||
3 | *
|
||
4 | * Copyright (C) 2004-5.
|
||
5 | *
|
||
6 | * This program is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 2
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program; if not, write to the Free Software
|
||
18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
19 | *
|
||
20 | * For more information, contact:
|
||
21 | *
|
||
22 | * cresques@gmail.com
|
||
23 | */
|
||
24 | package org.cresques.io; |
||
25 | |||
26 | import java.io.BufferedReader; |
||
27 | import java.io.FileNotFoundException; |
||
28 | import java.io.FileReader; |
||
29 | import java.io.FileWriter; |
||
30 | import java.io.IOException; |
||
31 | import java.io.InputStream; |
||
32 | import java.io.InputStreamReader; |
||
33 | import java.io.Reader; |
||
34 | import java.util.Date; |
||
35 | import java.util.Hashtable; |
||
36 | import java.util.Vector; |
||
37 | import org.cresques.cts.ICoordTrans; |
||
38 | import org.cresques.cts.IProjection; |
||
39 | import org.cresques.geo.Projected; |
||
40 | import org.cresques.px.Extent; |
||
41 | import org.cresques.px.IObjList; |
||
42 | import org.cresques.px.dxf.DxfEntityMaker; |
||
43 | import org.cresques.px.dxf.DxfHeaderManager; |
||
44 | import org.cresques.px.dxf.DxfHeaderVariables; |
||
45 | |||
46 | /**
|
||
47 | * Clase que representa un fichero en formato DXF. Contiene los interfaces y m?todos
|
||
48 | * necesarios para acceder a la informaci?n almacenada en su interior.
|
||
49 | *
|
||
50 | * @author jmorell
|
||
51 | */
|
||
52 | public class DxfFile extends GeoFile { |
||
53 | |||
54 | private boolean cadFlag = true; |
||
55 | |||
56 | long lineNr = 0; |
||
57 | |||
58 | String buf = null; |
||
59 | |||
60 | BufferedReader fi;
|
||
61 | long l = 0; |
||
62 | int count = 0; |
||
63 | DxfGroup grp = null;
|
||
64 | |||
65 | EntityFactory entityMaker = null;
|
||
66 | VarSettings headerManager; |
||
67 | private boolean dxf3DFlag; |
||
68 | |||
69 | /**
|
||
70 | * Crea los objetos en el Modelo correspondiente.
|
||
71 | * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
|
||
72 | */
|
||
73 | public interface EntityFactory extends Projected { |
||
74 | |||
75 | /**
|
||
76 | * Permite saber si se est?n a?adiendo elementos a un bloque
|
||
77 | * @param booleano que indica si se est?n a?adiendo elementos a un bloque
|
||
78 | */
|
||
79 | public void setAddingToBlock(boolean a); |
||
80 | |||
81 | /**
|
||
82 | * Crea una nueva capa partiendo de la informaci?n almacenada en el DXF
|
||
83 | * @param DxfGroupVector con informaci?n para la construcci?n de la nueva capa
|
||
84 | * @throws Exception
|
||
85 | */
|
||
86 | public void createLayer(DxfGroupVector v) throws Exception ; |
||
87 | |||
88 | /**
|
||
89 | * Crea una nueva polil?nea partiendo de la informaci?n almacenada en el DXF
|
||
90 | * @param DxfGroupVector con informaci?n para la construcci?n de la nueva polil?nea
|
||
91 | * @throws Exception
|
||
92 | */
|
||
93 | public void createPolyline(DxfGroupVector v) throws Exception ; |
||
94 | |||
95 | /**
|
||
96 | * A?ade un v?rtice a la polil?nea que se est? creando
|
||
97 | * @param DxfGroupVector con la informaci?n necesaria para la adici?n del v?rtice
|
||
98 | * @throws Exception
|
||
99 | */
|
||
100 | public void addVertex(DxfGroupVector v) throws Exception ; |
||
101 | |||
102 | /**
|
||
103 | * Fin de secuencia
|
||
104 | * @throws Exception
|
||
105 | */
|
||
106 | public void endSeq() throws Exception ; |
||
107 | |||
108 | /**
|
||
109 | * Crea una nueva LwPolyline partiendo de la informaci?n almacenada en el DXF
|
||
110 | * @param DxfGroupVector con informaci?n para la construcci?n de la nueva polil?nea
|
||
111 | * @throws Exception
|
||
112 | */
|
||
113 | public void createLwPolyline(DxfGroupVector v) throws Exception ; |
||
114 | |||
115 | /**
|
||
116 | * Crea una nueva l?nea partiendo de la informaci?n almacenada en el DXF
|
||
117 | * @param DxfGroupVector con informaci?n para la construcci?n de la nueva l?nea
|
||
118 | * @throws Exception
|
||
119 | */
|
||
120 | public void createLine(DxfGroupVector v) throws Exception ; |
||
121 | |||
122 | /**
|
||
123 | * Crea un nuevo texto partiendo de la informaci?n almacenada en el DXF
|
||
124 | * @param DxfGroupVector con informaci?n para la construcci?n del nuevo texto
|
||
125 | * @throws Exception
|
||
126 | */
|
||
127 | public void createText(DxfGroupVector v) throws Exception ; |
||
128 | |||
129 | /**
|
||
130 | * Crea un nuevo MText partiendo de la informaci?n almacenada en el DXF
|
||
131 | * @param DxfGroupVector con informaci?n para la construcci?n del nuevo MText
|
||
132 | * @throws Exception
|
||
133 | */
|
||
134 | public void createMText(DxfGroupVector v) throws Exception ; |
||
135 | |||
136 | /**
|
||
137 | * Crea un nuevo punto partiendo de la informaci?n almacenada en el DXF
|
||
138 | * @param DxfGroupVector con informaci?n para la construcci?n del nuevo punto
|
||
139 | * @throws Exception
|
||
140 | */
|
||
141 | public void createPoint(DxfGroupVector v) throws Exception ; |
||
142 | |||
143 | /**
|
||
144 | * Crea un nuevo c?rculo partiendo de la informaci?n almacenada en el DXF
|
||
145 | * @param DxfGroupVector con informaci?n para la construcci?n del nuevo c?rculo
|
||
146 | * @throws Exception
|
||
147 | */
|
||
148 | public void createCircle(DxfGroupVector v) throws Exception ; |
||
149 | |||
150 | /**
|
||
151 | * Crea una nueva elipse partiendo de la informaci?n almacenada en el DXF
|
||
152 | * @param DxfGroupVector con informaci?n para la construcci?n de la nueva elipse
|
||
153 | * @throws Exception
|
||
154 | */
|
||
155 | public void createEllipse(DxfGroupVector v) throws Exception ; |
||
156 | |||
157 | /**
|
||
158 | * Crea un nuevo arco partiendo de la informaci?n almacenada en el DXF
|
||
159 | * @param DxfGroupVector con informaci?n para la construcci?n del nuevo arco
|
||
160 | * @throws Exception
|
||
161 | */
|
||
162 | public void createArc(DxfGroupVector v) throws Exception ; |
||
163 | |||
164 | /**
|
||
165 | * Crea un nuevo punto de inserci?n partiendo de la informaci?n almacenada en el DXF
|
||
166 | * @param DxfGroupVector con informaci?n para la construcci?n del nuevo punto de inserci?n
|
||
167 | * @throws Exception
|
||
168 | */
|
||
169 | public void createInsert(DxfGroupVector v) throws Exception ; |
||
170 | |||
171 | /**
|
||
172 | * Crea un nuevo s?lido 2D partiendo de la informaci?n almacenada en el DXF
|
||
173 | * @param DxfGroupVector con informaci?n para la construcci?n del nuevo s?lido
|
||
174 | * @throws Exception
|
||
175 | */
|
||
176 | public void createSolid(DxfGroupVector v) throws Exception ; |
||
177 | |||
178 | /**
|
||
179 | * Crea un nuevo Spline partiendo de la informaci?n almacenada en el DXF
|
||
180 | * @param DxfGroupVector con informaci?n para la construcci?n del nuevo Spline
|
||
181 | * @throws Exception
|
||
182 | */
|
||
183 | public void createSpline(DxfGroupVector v) throws Exception ; |
||
184 | |||
185 | /**
|
||
186 | * Construye la definici?n de un nuevo atributo partiendo de la informaci?n almacenada en el DXF
|
||
187 | * @param DxfGroupVector con informaci?n para la construcci?n de la definici?n del nuevo atributo
|
||
188 | * @throws Exception
|
||
189 | */
|
||
190 | public void createAttdef(DxfGroupVector v) throws Exception ; |
||
191 | |||
192 | /**
|
||
193 | * Crea un nuevo atributo partiendo de la informaci?n almacenada en el DXF
|
||
194 | * @param DxfGroupVector con informaci?n para la creaci?n del nuevo atributo
|
||
195 | * @throws Exception
|
||
196 | */
|
||
197 | public void createAttrib(DxfGroupVector v) throws Exception ; |
||
198 | |||
199 | /**
|
||
200 | * Crea un bloque
|
||
201 | * @param DxfGroupVector con informaci?n para la creaci?n del nuevo elemento
|
||
202 | * @throws Exception
|
||
203 | */
|
||
204 | public void createBlock(DxfGroupVector v) throws Exception ; |
||
205 | |||
206 | /**
|
||
207 | * Fin de la definici?n de un bloqe
|
||
208 | * @param DxfGroupVector con informaci?n referente al final de un bloque
|
||
209 | * @throws Exception
|
||
210 | */
|
||
211 | public void endBlk(DxfGroupVector v) throws Exception ; |
||
212 | |||
213 | /**
|
||
214 | * Gestiona los bloques que no se han tratado en la primera vuelta
|
||
215 | */
|
||
216 | void testBlocks();
|
||
217 | |||
218 | /**
|
||
219 | * Devuelve el extent
|
||
220 | * @return el extent
|
||
221 | */
|
||
222 | public Extent getExtent();
|
||
223 | |||
224 | /**
|
||
225 | * Devuelve la lista de bloques
|
||
226 | * @return la lista de bloques
|
||
227 | */
|
||
228 | public Vector getBlkList(); |
||
229 | |||
230 | /**
|
||
231 | * Permite la gesti?n de los atributos almacenados en unn DXF
|
||
232 | * @return un Vector con la lista de atributos
|
||
233 | */
|
||
234 | public Vector getAttributes(); |
||
235 | |||
236 | /**
|
||
237 | * Borra los atributos repetidos
|
||
238 | */
|
||
239 | public void depureAttributes(); |
||
240 | |||
241 | /**
|
||
242 | * Devuelve los objetos almacenados en el DXF
|
||
243 | * @return IObjList con los objetos procedentes del DXF
|
||
244 | */
|
||
245 | public IObjList getObjects();
|
||
246 | |||
247 | /**
|
||
248 | * Permite saber si se trata de un fichero DXF en 2D o en 3D
|
||
249 | * @return booleano que indica si se trata de un fichero DXF 3D
|
||
250 | */
|
||
251 | public boolean isDxf3DFile(); |
||
252 | }; |
||
253 | |||
254 | /**
|
||
255 | * Establece el estado de las variables propias de un DXF que est?n definidas
|
||
256 | * en la secci?n HEADER. Por ejemplo, la versi?n del DXF.
|
||
257 | * @author jmorell (jose.morell@gmail.com)
|
||
258 | * @version 15-dic-2004
|
||
259 | */
|
||
260 | public interface VarSettings { |
||
261 | |||
262 | /**
|
||
263 | * Establece la versi?n de Autocad en la que fue generado el DXF.
|
||
264 | * @param informaci?n de base
|
||
265 | * @throws Exception
|
||
266 | */
|
||
267 | public void setAcadVersion(DxfGroupVector v) throws Exception ; |
||
268 | |||
269 | /**
|
||
270 | * Devuelve la versi?n de Autocad en la que fue generado el DXF.
|
||
271 | * @return
|
||
272 | */
|
||
273 | public String getAcadVersion(); |
||
274 | |||
275 | /**
|
||
276 | * Devuelve el estado de las variables propias de un DXF
|
||
277 | * @return
|
||
278 | */
|
||
279 | public DxfHeaderVariables getDxfHeaderVars();
|
||
280 | public boolean isWritedDxf3D(); |
||
281 | public void loadMinZFromHeader(double d); |
||
282 | public void loadMaxZFromHeader(double d); |
||
283 | }; |
||
284 | |||
285 | /**
|
||
286 | * Constructor de la clase
|
||
287 | * @param proj, la proyecci?n cartogr?fica
|
||
288 | * @param name, el path absoluto hasta el fichero DXF
|
||
289 | * @param maker, el interface que permite la construcci?n de las entidades procedentes del DXF
|
||
290 | */
|
||
291 | public DxfFile(IProjection proj, String name, EntityFactory maker) { |
||
292 | super(proj, name);
|
||
293 | entityMaker = maker; |
||
294 | headerManager = new DxfHeaderManager();
|
||
295 | } |
||
296 | |||
297 | /**
|
||
298 | * Constructor de la clase que adem?s incorpora la capacidad de leer una porci?n del HEADER
|
||
299 | * @param proj, la proyecci?n cartogr?fica
|
||
300 | * @param name, el path absoluto hasta el fichero DXF
|
||
301 | * @param maker, el interface que permite la construcci?n de las entidades procedentes del DXF
|
||
302 | * @param dxfVars, el interface que permite la lectura del HEADER de un DXF
|
||
303 | */
|
||
304 | public DxfFile(IProjection proj, String name, EntityFactory maker, VarSettings dxfVars) { |
||
305 | super(proj, name);
|
||
306 | entityMaker = maker; |
||
307 | headerManager = dxfVars; |
||
308 | } |
||
309 | |||
310 | /**
|
||
311 | * Carga un fichero en formato DXF
|
||
312 | */
|
||
313 | public GeoFile load() {
|
||
314 | System.out.println("Dxf: Cargando "+name+" ..."); |
||
315 | try {
|
||
316 | if (ZipFileFolder.isUrl(name)) {
|
||
317 | ZipFileFolder zFolder = new ZipFileFolder(name);
|
||
318 | InputStream is = zFolder.getInputStream(name);
|
||
319 | return load(new InputStreamReader(is)); |
||
320 | } else
|
||
321 | return load(new FileReader(name)); |
||
322 | } catch (FileNotFoundException fnfe) { |
||
323 | fnfe.printStackTrace(); |
||
324 | } catch (Exception e) { |
||
325 | System.err.println("Dxf: ERROR."+l+"lineas leidas"); |
||
326 | e.printStackTrace(); |
||
327 | } |
||
328 | return this; |
||
329 | } |
||
330 | |||
331 | /**
|
||
332 | * Carga un fichero en formato DXF tomando un Reader como par?metro
|
||
333 | * @param fr, Reader que se le pasa como par?metro
|
||
334 | * @return devuelve un objeto GeoFile, padre de DxfFile
|
||
335 | * @throws NumberFormatException
|
||
336 | * @throws Exception
|
||
337 | */
|
||
338 | public GeoFile load(Reader fr) throws NumberFormatException, Exception { |
||
339 | System.out.println("Dxf: Cargando '"+name+"' ..."); |
||
340 | fi = new BufferedReader(fr); |
||
341 | while ((grp = readGrp()) != null) { |
||
342 | l+=2;
|
||
343 | |||
344 | if (grp.equals(0, "EOF")) break; |
||
345 | if (grp.equals(0, "SECTION")) |
||
346 | readSection(); |
||
347 | } |
||
348 | fi.close(); |
||
349 | extent.add(entityMaker.getExtent()); |
||
350 | System.out.println("Dxf: '"+name+"' cargado. ("+l+" l?neas)."); |
||
351 | this.lineNr = l;
|
||
352 | return this; |
||
353 | } |
||
354 | |||
355 | /**
|
||
356 | * El fichero DXF se divide en grupos. Este m?todo permite leer cada grupo individualmente
|
||
357 | * @return devuelve la informaci?n del DXF en forma de objetos de la clase DxfGroup
|
||
358 | * @throws NumberFormatException
|
||
359 | * @throws IOException
|
||
360 | */
|
||
361 | private DxfGroup readGrp() throws NumberFormatException, IOException { |
||
362 | DxfGroup g = DxfGroup.read(fi); |
||
363 | if (g != null) l += 2; |
||
364 | /*if (g.code == 8)
|
||
365 | if (((String) g.data).length() < 1) {
|
||
366 | System.err.println("a que un layer no puede ser ''?");
|
||
367 | System.exit(1);
|
||
368 | }*/
|
||
369 | return g;
|
||
370 | } |
||
371 | |||
372 | /**
|
||
373 | * El fichero DXF se divide en varias secciones. Este m?todo se encarga de leer cada
|
||
374 | * una de ellas
|
||
375 | * @throws NumberFormatException
|
||
376 | * @throws Exception
|
||
377 | */
|
||
378 | private void readSection() throws NumberFormatException, Exception { |
||
379 | while (true) { |
||
380 | grp = readGrp(); System.out.print("-1:"+grp); |
||
381 | if (grp.code == 2) |
||
382 | if (((String) grp.data).compareTo("HEADER") == 0) |
||
383 | readHeader(); |
||
384 | else if (((String) grp.data).compareTo("CLASSES") == 0) |
||
385 | readAnySection(); |
||
386 | else if (((String) grp.data).compareTo("TABLES") == 0) |
||
387 | readTables(); |
||
388 | else if (((String) grp.data).compareTo("BLOCKS") == 0) |
||
389 | readBlocks(); |
||
390 | else if (((String) grp.data).compareTo("ENTITIES") == 0) |
||
391 | readEntities(); |
||
392 | else if (((String) grp.data).compareTo("OBJECTS") == 0) |
||
393 | readAnySection(); |
||
394 | else {
|
||
395 | System.out.println("DxfRead: Seccion "+grp.data); |
||
396 | readAnySection(); |
||
397 | } |
||
398 | else
|
||
399 | System.err.println("Dxf: Codigo/Seccion desconocidos" + grp); |
||
400 | if (grp.equals(0, "EOF")) break; |
||
401 | if (grp.equals(0, "ENDSEC")) break; |
||
402 | } |
||
403 | } |
||
404 | |||
405 | /**
|
||
406 | * Habilita la lectura de la secci?n de TABLES
|
||
407 | * @throws NumberFormatException
|
||
408 | * @throws Exception
|
||
409 | */
|
||
410 | private void readTables() throws NumberFormatException, Exception { |
||
411 | System.out.println("Dxf: Seccion TABLAS, linea "+ l+ "grp ="+ grp); |
||
412 | int layerCnt = 0; |
||
413 | String tableAct = "NONAME"; |
||
414 | |||
415 | Hashtable tables = new Hashtable(); |
||
416 | Vector table = new Vector(); |
||
417 | DxfGroupVector v = new DxfGroupVector();
|
||
418 | |||
419 | grp = readGrp();// System.out.print("0:"+grp);
|
||
420 | while (true) { |
||
421 | if (grp.code == 0) { |
||
422 | String data = (String) grp.getData(); |
||
423 | if (data.compareTo("ENDSEC") == 0 || data.compareTo("EOF") == 0) |
||
424 | break;
|
||
425 | else if (data.compareTo("ENDTAB") == 0) { |
||
426 | tables.put(tableAct, table); |
||
427 | table = new Vector(); |
||
428 | grp = readGrp();// System.out.print("1:"+grp);
|
||
429 | |||
430 | /**/if (tableAct.compareTo("LAYER") == 0 && v.size()>0) { |
||
431 | entityMaker.createLayer(v); |
||
432 | System.out.println("Dxf: Layer "+v.getDataAsString(2)); |
||
433 | layerCnt++; |
||
434 | v.clear(); |
||
435 | }/**/
|
||
436 | continue;
|
||
437 | } else {
|
||
438 | if (table.size()==1) { |
||
439 | tableAct = v.getDataAsString(2);
|
||
440 | System.out.println("Dxf: Tabla "+tableAct); |
||
441 | } else
|
||
442 | if (tableAct.compareTo("LAYER") == 0 && v.size()>0) { |
||
443 | entityMaker.createLayer(v); |
||
444 | System.out.println("Dxf: Layer "+v.getDataAsString(2)); |
||
445 | layerCnt++; |
||
446 | } |
||
447 | |||
448 | v.clear(); |
||
449 | v.add(grp); |
||
450 | } |
||
451 | while (true) { |
||
452 | grp = readGrp();// System.out.print("2:"+grp);
|
||
453 | if (grp.code == 0) break; |
||
454 | v.add(grp); |
||
455 | } |
||
456 | table.add(v); |
||
457 | } else {
|
||
458 | System.err.println("Dxf: Error de secuencia"); |
||
459 | grp = readGrp(); //System.out.print("3:"+grp);
|
||
460 | } |
||
461 | } |
||
462 | System.out.println("Dxf: Seccion TABLAS: " + layerCnt + " Capas. "); |
||
463 | } |
||
464 | |||
465 | /**
|
||
466 | * M?todo de lectura de secci?n por defecto. Se utiliza mientras se realiza la
|
||
467 | * implementaci?n correspondiente
|
||
468 | * @throws NumberFormatException
|
||
469 | * @throws IOException
|
||
470 | */
|
||
471 | private void readAnySection() throws NumberFormatException, IOException { |
||
472 | System.out.println("Dxf: Seccion '"+((String) grp.getData())+"', linea "+ l); |
||
473 | while (true) { |
||
474 | grp = readGrp(); |
||
475 | if (grp.equals(0, "ENDSEC")) break; |
||
476 | else if (grp.equals(0, "EOF")) break; |
||
477 | } |
||
478 | } |
||
479 | |||
480 | /**
|
||
481 | * Primera aproximaci?n a la implementaci?n de la lectura del HEADER. En principio
|
||
482 | * interesa que se lea la versi?n del DXF.
|
||
483 | * Para implementar esta parte del lector se ha optado por incluir el m?todo
|
||
484 | * setAcadVersion en el interface EntityFactory. A lo mejor conviene implementar
|
||
485 | * un nuevo interface VarSettings.
|
||
486 | * @throws NumberFormatException
|
||
487 | * @throws Exception
|
||
488 | */
|
||
489 | private void readHeader() throws NumberFormatException, Exception { |
||
490 | System.out.println("Dxf: Seccion HEADER, linea "+ l); |
||
491 | int variableCnt = 0; |
||
492 | int cntVeces = 0; |
||
493 | DxfGroupVector v = new DxfGroupVector();
|
||
494 | grp = readGrp(); |
||
495 | while (true) { |
||
496 | if (grp.equals(0, "EOF")) { |
||
497 | break;
|
||
498 | } |
||
499 | else if (grp.code==9 || grp.code==0) { |
||
500 | if (v.size() > 0) { |
||
501 | String lastVariable = (String) ((DxfGroup) v.get(0)).data; |
||
502 | //System.out.println(lastVariable);
|
||
503 | if (lastVariable.compareTo("$ACADVER") == 0) { |
||
504 | //System.out.println("Aqui llega.");
|
||
505 | headerManager.setAcadVersion(v); |
||
506 | } else if (lastVariable.compareTo("$EXTMIN") == 0) { |
||
507 | headerManager.loadMinZFromHeader(((Double)((DxfGroup) v.get(3)).data).doubleValue()); |
||
508 | } else if (lastVariable.compareTo("$EXTMAX") == 0) { |
||
509 | headerManager.loadMaxZFromHeader(((Double)((DxfGroup) v.get(3)).data).doubleValue()); |
||
510 | } else if (lastVariable.compareTo("ENDSEC") == 0) { |
||
511 | //System.out.println("Llega al ENDSEC.");
|
||
512 | break;
|
||
513 | } /*else
|
||
514 | System.err.println("Dxf: Variable "+lastVariable+" desconocida.");*/
|
||
515 | } |
||
516 | v.clear(); |
||
517 | v.add(grp); |
||
518 | while (true) { |
||
519 | grp = readGrp(); |
||
520 | if (grp.code == 9 || grp.code==0) break; |
||
521 | v.add(grp); |
||
522 | } |
||
523 | variableCnt++; |
||
524 | } |
||
525 | cntVeces++; |
||
526 | } |
||
527 | System.out.println("Dxf: Seccion HEADER, " + variableCnt + " variables, "+ cntVeces + " veces."); |
||
528 | //System.out.println("Seccion HEADER, linea "+ l+ " (SALGO)");
|
||
529 | System.out.println("readHeader: ACAD Version: " + headerManager.getDxfHeaderVars().getAcadVersion()); |
||
530 | } |
||
531 | |||
532 | /**
|
||
533 | * Permite leer la secci?n ENTITIES del DXF, donde se encuentran las entidades
|
||
534 | * geom?tricas del DXF que no aparecen dentro de ning?n bloque
|
||
535 | * @throws NumberFormatException
|
||
536 | * @throws Exception
|
||
537 | */
|
||
538 | private void readEntities() throws NumberFormatException, Exception { |
||
539 | System.out.println("Dxf: Seccion ENTITIES, linea "+ l); |
||
540 | int entityCnt = 0; |
||
541 | int cntVeces = 0; |
||
542 | DxfGroupVector v = new DxfGroupVector();
|
||
543 | grp = readGrp(); |
||
544 | while (true) { |
||
545 | if (grp.equals(0, "EOF")) break; |
||
546 | else if (grp.code == 0) { |
||
547 | if (v.size() > 0) { |
||
548 | String lastEntity = (String) ((DxfGroup) v.get(0)).data; |
||
549 | if (lastEntity.compareTo("POLYLINE") == 0) { |
||
550 | entityMaker.createPolyline(v); |
||
551 | } else if (lastEntity.compareTo("VERTEX") == 0) { |
||
552 | entityMaker.addVertex(v); |
||
553 | } else if (lastEntity.compareTo("SEQEND") == 0) { |
||
554 | entityMaker.endSeq(); |
||
555 | } else if (lastEntity.compareTo("LWPOLYLINE") == 0) { |
||
556 | entityMaker.createLwPolyline(v); |
||
557 | } else if (lastEntity.compareTo("LINE") == 0) { |
||
558 | entityMaker.createLine(v); |
||
559 | } else if (lastEntity.compareTo("TEXT") == 0) { |
||
560 | entityMaker.createText(v); |
||
561 | } else if (lastEntity.compareTo("MTEXT") == 0) { |
||
562 | entityMaker.createMText(v); |
||
563 | } else if (lastEntity.compareTo("POINT") == 0) { |
||
564 | entityMaker.createPoint(v); |
||
565 | } else if (lastEntity.compareTo("CIRCLE") == 0) { |
||
566 | entityMaker.createCircle(v); |
||
567 | } else if (lastEntity.compareTo("ELLIPSE") == 0) { |
||
568 | entityMaker.createEllipse(v); |
||
569 | } else if (lastEntity.compareTo("ARC") == 0) { |
||
570 | entityMaker.createArc(v); |
||
571 | } else if (lastEntity.compareTo("INSERT") == 0) { |
||
572 | entityMaker.createInsert(v); |
||
573 | } else if (lastEntity.compareTo("SOLID") == 0) { |
||
574 | entityMaker.createSolid(v); |
||
575 | } else if (lastEntity.compareTo("SPLINE") == 0) { |
||
576 | entityMaker.createSpline(v); |
||
577 | } else if (lastEntity.compareTo("ATTRIB") == 0) { |
||
578 | entityMaker.createAttrib(v); |
||
579 | } else if (lastEntity.compareTo("ENDSEC") == 0) { |
||
580 | break;
|
||
581 | } else
|
||
582 | System.err.println("Dxf: Entidad "+lastEntity+" desconocida."); |
||
583 | } |
||
584 | v.clear(); |
||
585 | v.add(grp); |
||
586 | while (true) { |
||
587 | grp = readGrp(); |
||
588 | if (grp.code == 0) break; |
||
589 | v.add(grp); |
||
590 | } |
||
591 | entityCnt++; |
||
592 | } |
||
593 | cntVeces++; |
||
594 | } |
||
595 | System.out.println("Dxf: Seccion ENTITIES, " + entityCnt + " entidades, "+ cntVeces + " veces."); |
||
596 | //System.out.println("Seccion ENTITIES, linea "+ l+ " (SALGO)");
|
||
597 | } |
||
598 | |||
599 | /**
|
||
600 | * Permite la secci?n BLOCKS del DXF, donde se encuentran las definiciones de los
|
||
601 | * bloques que componen el DXF
|
||
602 | * @throws NumberFormatException
|
||
603 | * @throws Exception
|
||
604 | */
|
||
605 | private void readBlocks() throws NumberFormatException, Exception { |
||
606 | System.out.println("Dxf: Seccion BLOCKS, linea "+ l); |
||
607 | int blkCnt = 0; |
||
608 | int cntVeces = 0; |
||
609 | DxfGroupVector v = new DxfGroupVector();
|
||
610 | grp = readGrp(); |
||
611 | while (true) { |
||
612 | if (grp.equals(0, "EOF")) break; |
||
613 | else if (grp.code == 0) { |
||
614 | if (v.size() > 0) { |
||
615 | String lastEntity = (String) ((DxfGroup) v.get(0)).data; |
||
616 | if (lastEntity.compareTo("BLOCK") == 0) { |
||
617 | //System.out.println("readBlocks(): Empezamos a leer un bloque");
|
||
618 | entityMaker.createBlock(v); |
||
619 | } else if (lastEntity.compareTo("POLYLINE") == 0) { |
||
620 | //System.out.println("readBlocks(): A?adimos una polilinea al bloque");
|
||
621 | entityMaker.createPolyline(v); |
||
622 | } else if (lastEntity.compareTo("VERTEX") == 0) { |
||
623 | //System.out.println("readBlocks(): A?adimos un vertice a la polilinea");
|
||
624 | entityMaker.addVertex(v); |
||
625 | } else if (lastEntity.compareTo("SEQEND") == 0) { |
||
626 | //System.out.println("readBlocks(): Cerramos una polilinea");
|
||
627 | entityMaker.endSeq(); |
||
628 | } else if (lastEntity.compareTo("LWPOLYLINE") == 0) { |
||
629 | //System.out.println("readBlocks(): A?adimos una lwpolilinea al bloque");
|
||
630 | entityMaker.createLwPolyline(v); |
||
631 | } else if (lastEntity.compareTo("LINE") == 0) { |
||
632 | //System.out.println("readBlocks(): A?adimos una linea al bloque");
|
||
633 | entityMaker.createLine(v); |
||
634 | } else if (lastEntity.compareTo("TEXT") == 0) { |
||
635 | //System.out.println("readBlocks(): A?adimos un texto al bloque");
|
||
636 | entityMaker.createText(v); |
||
637 | } else if (lastEntity.compareTo("MTEXT") == 0) { |
||
638 | //System.out.println("readBlocks(): A?adimos un m-texto al bloque");
|
||
639 | entityMaker.createMText(v); |
||
640 | } else if (lastEntity.compareTo("POINT") == 0) { |
||
641 | //System.out.println("readBlocks(): A?adimos un punto al bloque");
|
||
642 | entityMaker.createPoint(v); |
||
643 | } else if (lastEntity.compareTo("CIRCLE") == 0) { |
||
644 | //System.out.println("readBlocks(): A?adimos un circulo al bloque");
|
||
645 | entityMaker.createCircle(v); |
||
646 | } else if (lastEntity.compareTo("ARC") == 0) { |
||
647 | //System.out.println("readBlocks(): A?adimos un arco al bloque");
|
||
648 | entityMaker.createArc(v); |
||
649 | } else if (lastEntity.compareTo("INSERT") == 0) { |
||
650 | //System.out.println("readBlocks(): A?adimos un insert al bloque");
|
||
651 | entityMaker.createInsert(v); |
||
652 | } else if (lastEntity.compareTo("SOLID") == 0) { |
||
653 | //System.out.println("readBlocks(): A?adimos un solido al bloque");
|
||
654 | entityMaker.createSolid(v); |
||
655 | } else if (lastEntity.compareTo("SPLINE") == 0) { |
||
656 | entityMaker.createSpline(v); |
||
657 | } else if (lastEntity.compareTo("ATTDEF") == 0) { |
||
658 | entityMaker.createAttdef(v); |
||
659 | } else if (lastEntity.compareTo("ENDBLK") == 0) { |
||
660 | //System.out.println("readBlocks(): Cerramos un bloque"+v);
|
||
661 | entityMaker.endBlk(v); |
||
662 | } else if (lastEntity.compareTo("ENDSEC") == 0) { |
||
663 | break;
|
||
664 | } else
|
||
665 | System.err.println("Dxf: Entidad de bloque "+lastEntity+" desconocida."); |
||
666 | } |
||
667 | v.clear(); |
||
668 | v.add(grp); |
||
669 | while (true) { |
||
670 | grp = readGrp(); |
||
671 | if (grp.code == 0) break; |
||
672 | v.add(grp); |
||
673 | } |
||
674 | blkCnt++; |
||
675 | } |
||
676 | cntVeces++; |
||
677 | } |
||
678 | |||
679 | entityMaker.testBlocks(); |
||
680 | // Cuando termina de leer la secci?n de bloques se asegura de que todos los campos
|
||
681 | // son distintos.
|
||
682 | //System.out.println("readBlocks(): entityMaker.getAttributes().size() = " + entityMaker.getAttributes().size());
|
||
683 | entityMaker.depureAttributes(); |
||
684 | //System.out.println("readBlocks(): entityMaker.getAttributes().size() = " + entityMaker.getAttributes().size());
|
||
685 | System.out.println("Dxf: Seccion BLOCKS, " + blkCnt + " elementos de bloque. "+ cntVeces + " veces."); |
||
686 | } |
||
687 | |||
688 | /**
|
||
689 | * Devuelve los objetos geom?tricos obtenidos de un DXF
|
||
690 | */
|
||
691 | public IObjList getObjects() {
|
||
692 | return this.entityMaker.getObjects(); |
||
693 | } |
||
694 | |||
695 | /**
|
||
696 | * jmorell: M?todo que permite salvar capas al formato DXF2000.
|
||
697 | * Este m?todo ha sido actualizado en el proceso de implementaci?n del piloto
|
||
698 | * de CAD. En este piloto deb?a existir soporte para elipses, y este es uno de
|
||
699 | * los motivos que nos llevan a implementar ahora para DXF2000, puesto que el
|
||
700 | * DXF R12 no soporta elipses.
|
||
701 | * @param fName
|
||
702 | * @throws IOException
|
||
703 | */
|
||
704 | public void save(String fName) throws IOException { |
||
705 | System.out.println("save: fName = " + fName); |
||
706 | long t2, t1;
|
||
707 | t1 = getTime(); |
||
708 | fName = DataSource.normalize(fName);
|
||
709 | FileWriter fw = new FileWriter(fName); |
||
710 | // COMMENTAIRES DU TRADUCTEUR
|
||
711 | // fw.write(DxfGroup.toString(999, Integer.toString(features.size()) + " features"));
|
||
712 | fw.write(DxfGroup.toString(999, "TRANSLATION BY geo.cresques.io.DxfFile")); |
||
713 | fw.write(DxfGroup.toString(999, "DATE : " + (new Date()).toString())); |
||
714 | writeHeader(fw); |
||
715 | writeTables(fw); |
||
716 | writeBlocks(fw); |
||
717 | writeEntities(fw); |
||
718 | writeObjects(fw); |
||
719 | fw.write(DxfGroup.toString(0, "EOF")); |
||
720 | fw.flush(); |
||
721 | fw.close(); |
||
722 | t2 = getTime(); |
||
723 | System.out.println("DxfFile.save(): Tiempo salvando: " + (t2-t1)/1000 + " seg."); |
||
724 | } |
||
725 | |||
726 | /**
|
||
727 | * Escritor de la cabecera de un DXF.
|
||
728 | * jmorell: Actualizaci?n del escritor de DXF de R12 a 2000.
|
||
729 | * @param fw, un FileWriter para escribir ficheros
|
||
730 | * @throws IOException
|
||
731 | */
|
||
732 | public void writeHeader(FileWriter fw) throws IOException { |
||
733 | fw.write(DxfGroup.toString(0, "SECTION")); |
||
734 | fw.write(DxfGroup.toString(2, "HEADER")); |
||
735 | fw.write(DxfGroup.toString(9, "$ACADVER")); |
||
736 | //fw.write(DxfGroup.toString(1, "AC1009")); // DXF R12
|
||
737 | fw.write(DxfGroup.toString(1, "AC1015")); // DXF 2000 |
||
738 | fw.write(DxfGroup.toString(9, "$INSBASE")); |
||
739 | fw.write(DxfGroup.toString(10, 0.0, 1)); |
||
740 | fw.write(DxfGroup.toString(20, 0.0, 1)); |
||
741 | fw.write(DxfGroup.toString(30, 0.0, 1)); |
||
742 | fw.write(DxfGroup.toString(9, "$EXTMIN")); |
||
743 | fw.write(DxfGroup.toString(10, extent.minX(), 6)); |
||
744 | fw.write(DxfGroup.toString(20, extent.minY(), 6)); |
||
745 | if (dxf3DFlag) fw.write(DxfGroup.toString(30, extent.minX(), 6)); |
||
746 | else fw.write(DxfGroup.toString(30, 0.0, 6)); |
||
747 | fw.write(DxfGroup.toString(9, "$EXTMAX")); |
||
748 | fw.write(DxfGroup.toString(10, extent.maxX(), 6)); |
||
749 | fw.write(DxfGroup.toString(20, extent.maxY(), 6)); |
||
750 | if (dxf3DFlag) fw.write(DxfGroup.toString(30, extent.maxX(), 6)); |
||
751 | else fw.write(DxfGroup.toString(30, 0.0, 6)); |
||
752 | fw.write(DxfGroup.toString(9, "$LIMMIN")); |
||
753 | fw.write(DxfGroup.toString(10, extent.minX(), 6)); |
||
754 | fw.write(DxfGroup.toString(20, extent.minY(), 6)); |
||
755 | fw.write(DxfGroup.toString(9, "$LIMMAX")); |
||
756 | fw.write(DxfGroup.toString(10, extent.maxX(), 6)); |
||
757 | fw.write(DxfGroup.toString(20, extent.maxY(), 6)); |
||
758 | fw.write(DxfGroup.toString(9, "$ORTHOMODE")+DxfGroup.toString(70, 0)); |
||
759 | fw.write(DxfGroup.toString(9, "$REGENMODE")+DxfGroup.toString(70, 1)); |
||
760 | fw.write(DxfGroup.toString(9, "$FILLMODE")+ DxfGroup.toString(70, 1)); |
||
761 | fw.write(DxfGroup.toString(9, "$QTEXTMODE")+DxfGroup.toString(70, 0)); |
||
762 | fw.write(DxfGroup.toString(9, "$MIRRTEXT")+ DxfGroup.toString(70, 1)); |
||
763 | fw.write(DxfGroup.toString(9, "$DRAGMODE")+ DxfGroup.toString(70, 2)); |
||
764 | fw.write(DxfGroup.toString(9, "$LTSCALE")+ DxfGroup.toString(40, 1.0, 1)); |
||
765 | fw.write(DxfGroup.toString(9, "$OSMODE")+ DxfGroup.toString(70, 0)); |
||
766 | fw.write(DxfGroup.toString(9, "$ATTMODE")+ DxfGroup.toString(70, 1)); |
||
767 | fw.write(DxfGroup.toString(9, "$TEXTSIZE")+ DxfGroup.toString(40, 0.2, 1)); |
||
768 | fw.write(DxfGroup.toString(9, "$TRACEWID")+ DxfGroup.toString(40, 0.05, 2)); |
||
769 | fw.write(DxfGroup.toString(9, "$TEXTSTYLE")+ DxfGroup.toString(7, "STANDARD")); |
||
770 | fw.write(DxfGroup.toString(9, "$CLAYER")+ DxfGroup.toString(8, "0")); |
||
771 | fw.write(DxfGroup.toString(9, "$CELTYPE")+ DxfGroup.toString(6, "CONTINUOUS")); |
||
772 | fw.write(DxfGroup.toString(9, "$CECOLOR")+ DxfGroup.toString(62, 256)); |
||
773 | fw.write(DxfGroup.toString(9, "$DIMSCALE")+ DxfGroup.toString(40, 1.0, 1)); |
||
774 | fw.write(DxfGroup.toString(9, "$DIMASZ")+ DxfGroup.toString(40, 0.18, 2)); |
||
775 | fw.write(DxfGroup.toString(9, "$DIMEXO")+ DxfGroup.toString(40, 0.0625, 4)); |
||
776 | fw.write(DxfGroup.toString(9, "$DIMDLI")+ DxfGroup.toString(40, 0.38, 2)); |
||
777 | fw.write(DxfGroup.toString(9, "$DIMRND")+ DxfGroup.toString(40, 0.0, 1)); |
||
778 | fw.write(DxfGroup.toString(9, "$DIMDLE")+ DxfGroup.toString(40, 0.0, 1)); |
||
779 | fw.write(DxfGroup.toString(9, "$DIMEXE")+ DxfGroup.toString(40, 0.18, 2)); |
||
780 | fw.write(DxfGroup.toString(9, "$DIMTP")+ DxfGroup.toString(40, 0.0, 1)); |
||
781 | fw.write(DxfGroup.toString(9, "$DIMTM")+ DxfGroup.toString(40, 0.0, 1)); |
||
782 | fw.write(DxfGroup.toString(9, "$DIMTXT")+ DxfGroup.toString(40, 0.18, 2)); |
||
783 | fw.write(DxfGroup.toString(9, "$DIMCEN")+ DxfGroup.toString(40, 0.09, 2)); |
||
784 | fw.write(DxfGroup.toString(9, "$DIMTSZ")+ DxfGroup.toString(40, 0.0, 1)); |
||
785 | fw.write(DxfGroup.toString(9,"$DIMTOL")+ DxfGroup.toString(70,0)); |
||
786 | fw.write(DxfGroup.toString(9,"$DIMLIM")+ DxfGroup.toString(70,0)); |
||
787 | fw.write(DxfGroup.toString(9,"$DIMTIH")+ DxfGroup.toString(70,1)); |
||
788 | fw.write(DxfGroup.toString(9,"$DIMTOH")+ DxfGroup.toString(70,1)); |
||
789 | fw.write(DxfGroup.toString(9,"$DIMSE1")+ DxfGroup.toString(70,0)); |
||
790 | fw.write(DxfGroup.toString(9,"$DIMSE2")+ DxfGroup.toString(70,0)); |
||
791 | fw.write(DxfGroup.toString(9,"$DIMTAD")+ DxfGroup.toString(70,0)); |
||
792 | fw.write(DxfGroup.toString(9,"$DIMZIN")+ DxfGroup.toString(70,0)); |
||
793 | fw.write(DxfGroup.toString(9,"$DIMBLK")+ DxfGroup.toString(1,"")); |
||
794 | fw.write(DxfGroup.toString(9,"$DIMASO")+ DxfGroup.toString(70,1)); |
||
795 | fw.write(DxfGroup.toString(9,"$DIMSHO")+ DxfGroup.toString(70,1)); |
||
796 | fw.write(DxfGroup.toString(9,"$DIMPOST")+ DxfGroup.toString(1,"")); |
||
797 | fw.write(DxfGroup.toString(9,"$DIMAPOST")+ DxfGroup.toString(1,"")); |
||
798 | fw.write(DxfGroup.toString(9,"$DIMALT")+ DxfGroup.toString(70,0)); |
||
799 | fw.write(DxfGroup.toString(9,"$DIMALTD")+ DxfGroup.toString(70,2)); |
||
800 | fw.write(DxfGroup.toString(9,"$DIMALTF")+ DxfGroup.toString(40,25.4,1)); |
||
801 | fw.write(DxfGroup.toString(9,"$DIMLFAC")+ DxfGroup.toString(40,1.0,1)); |
||
802 | fw.write(DxfGroup.toString(9,"$DIMTOFL")+ DxfGroup.toString(70,0)); |
||
803 | fw.write(DxfGroup.toString(9,"$DIMTVP")+ DxfGroup.toString(40,0.0,1)); |
||
804 | fw.write(DxfGroup.toString(9,"$DIMTIX")+ DxfGroup.toString(70,0)); |
||
805 | fw.write(DxfGroup.toString(9,"$DIMSOXD")+ DxfGroup.toString(70,0)); |
||
806 | fw.write(DxfGroup.toString(9,"$DIMSAH")+ DxfGroup.toString(70,0)); |
||
807 | fw.write(DxfGroup.toString(9,"$DIMBLK1")+ DxfGroup.toString(1,"")); |
||
808 | fw.write(DxfGroup.toString(9,"$DIMBLK2")+ DxfGroup.toString(1,"")); |
||
809 | fw.write(DxfGroup.toString(9,"$DIMSTYLE")+ DxfGroup.toString(2,"STANDARD")); |
||
810 | fw.write(DxfGroup.toString(9,"$DIMCLRD")+ DxfGroup.toString(70,0)); |
||
811 | fw.write(DxfGroup.toString(9,"$DIMCLRE")+ DxfGroup.toString(70,0)); |
||
812 | fw.write(DxfGroup.toString(9,"$DIMCLRT")+ DxfGroup.toString(70,0)); |
||
813 | fw.write(DxfGroup.toString(9,"$DIMTFAC")+ DxfGroup.toString(40,1.0,1)); |
||
814 | fw.write(DxfGroup.toString(9,"$DIMGAP")+ DxfGroup.toString(40,0.09,2)); |
||
815 | fw.write(DxfGroup.toString(9,"$LUNITS")+ DxfGroup.toString(70,2)); |
||
816 | fw.write(DxfGroup.toString(9,"$LUPREC")+ DxfGroup.toString(70,4)); |
||
817 | fw.write(DxfGroup.toString(9,"$AXISMODE")+ DxfGroup.toString(70,0)); |
||
818 | fw.write(DxfGroup.toString(9,"$AXISUNIT")); |
||
819 | fw.write(DxfGroup.toString(10,0.0,1)); |
||
820 | fw.write(DxfGroup.toString(20,0.0,1)); |
||
821 | fw.write(DxfGroup.toString(9,"$SKETCHINC")+ DxfGroup.toString(40,0.1,1)); |
||
822 | fw.write(DxfGroup.toString(9,"$FILLETRAD")+ DxfGroup.toString(40,0.0,1)); |
||
823 | fw.write(DxfGroup.toString(9,"$AUNITS")+ DxfGroup.toString(70,0)); |
||
824 | fw.write(DxfGroup.toString(9,"$AUPREC")+ DxfGroup.toString(70,0)); |
||
825 | fw.write(DxfGroup.toString(9,"$MENU")+ DxfGroup.toString(1,"acad")); |
||
826 | fw.write(DxfGroup.toString(9,"$ELEVATION")+ DxfGroup.toString(40,0.0,1)); |
||
827 | fw.write(DxfGroup.toString(9,"$PELEVATION")+DxfGroup.toString(40,0.0,1)); |
||
828 | fw.write(DxfGroup.toString(9,"$THICKNESS")+ DxfGroup.toString(40,0.0,1)); |
||
829 | fw.write(DxfGroup.toString(9,"$LIMCHECK")+ DxfGroup.toString(70,0)); |
||
830 | fw.write(DxfGroup.toString(9,"$BLIPMODE")+ DxfGroup.toString(70,1)); |
||
831 | fw.write(DxfGroup.toString(9,"$CHAMFERA")+ DxfGroup.toString(40,0.0,1)); |
||
832 | fw.write(DxfGroup.toString(9,"$CHAMFERB")+ DxfGroup.toString(40,0.0,1)); |
||
833 | fw.write(DxfGroup.toString(9,"$SKPOLY")+ DxfGroup.toString(70,0)); |
||
834 | fw.write(DxfGroup.toString(9,"$TDCREATE")+ DxfGroup.toString(40,2453116.436828704,9)); |
||
835 | fw.write(DxfGroup.toString(9,"$TDUPDATE")+ DxfGroup.toString(40,2453116.436828704,9)); |
||
836 | fw.write(DxfGroup.toString(9,"$TDINDWG")+ DxfGroup.toString(40,0.0000000000,10)); |
||
837 | fw.write(DxfGroup.toString(9,"$TDUSRTIMER")+DxfGroup.toString(40,0.0000000000,10)); |
||
838 | fw.write(DxfGroup.toString(9,"$USRTIMER")+ DxfGroup.toString(70,1)); |
||
839 | fw.write(DxfGroup.toString(9,"$ANGBASE")+ DxfGroup.toString(50,0.0,1)); |
||
840 | fw.write(DxfGroup.toString(9,"$ANGDIR")+ DxfGroup.toString(70,0)); |
||
841 | fw.write(DxfGroup.toString(9,"$PDMODE")+ DxfGroup.toString(70,0)); |
||
842 | fw.write(DxfGroup.toString(9,"$PDSIZE")+ DxfGroup.toString(40,0.0,1)); |
||
843 | fw.write(DxfGroup.toString(9,"$PLINEWID")+ DxfGroup.toString(40,0.0,1)); |
||
844 | fw.write(DxfGroup.toString(9,"$COORDS")+ DxfGroup.toString(70,0)); |
||
845 | fw.write(DxfGroup.toString(9,"$SPLFRAME")+ DxfGroup.toString(70,0)); |
||
846 | fw.write(DxfGroup.toString(9,"$SPLINETYPE")+DxfGroup.toString(70,6)); |
||
847 | fw.write(DxfGroup.toString(9,"$SPLINESEGS")+DxfGroup.toString(70,10)); |
||
848 | fw.write(DxfGroup.toString(9,"$ATTDIA")+ DxfGroup.toString(70,0)); |
||
849 | fw.write(DxfGroup.toString(9,"$ATTREQ")+ DxfGroup.toString(70,1)); |
||
850 | fw.write(DxfGroup.toString(9,"$HANDLING")+ DxfGroup.toString(70,1)); |
||
851 | fw.write(DxfGroup.toString(9,"$HANDSEED")+ DxfGroup.toString(5,"394B")); |
||
852 | fw.write(DxfGroup.toString(9,"$SURFTAB1")+ DxfGroup.toString(70,6)); |
||
853 | fw.write(DxfGroup.toString(9,"$SURFTAB2")+ DxfGroup.toString(70,6)); |
||
854 | fw.write(DxfGroup.toString(9,"$SURFTYPE")+ DxfGroup.toString(70,6)); |
||
855 | fw.write(DxfGroup.toString(9,"$SURFU")+ DxfGroup.toString(70,6)); |
||
856 | fw.write(DxfGroup.toString(9,"$SURFV")+ DxfGroup.toString(70,6)); |
||
857 | fw.write(DxfGroup.toString(9,"$UCSNAME")+ DxfGroup.toString(2,"")); |
||
858 | fw.write(DxfGroup.toString(9,"$UCSORG")); |
||
859 | fw.write(DxfGroup.toString(10,0.0,1)); |
||
860 | fw.write(DxfGroup.toString(20,0.0,1)); |
||
861 | fw.write(DxfGroup.toString(30,0.0,1)); |
||
862 | fw.write(DxfGroup.toString(9,"$UCSXDIR")); |
||
863 | fw.write(DxfGroup.toString(10,1.0,1)); |
||
864 | fw.write(DxfGroup.toString(20,0.0,1)); |
||
865 | fw.write(DxfGroup.toString(30,0.0,1)); |
||
866 | fw.write(DxfGroup.toString(9,"$UCSYDIR")); |
||
867 | fw.write(DxfGroup.toString(10,0.0,1)); |
||
868 | fw.write(DxfGroup.toString(20,1.0,1)); |
||
869 | fw.write(DxfGroup.toString(30,0.0,1)); |
||
870 | fw.write(DxfGroup.toString(9,"$PUCSNAME")+ DxfGroup.toString(2,"")); |
||
871 | fw.write(DxfGroup.toString(9,"$PUCSORG")); |
||
872 | fw.write(DxfGroup.toString(10,0.0,1)); |
||
873 | fw.write(DxfGroup.toString(20,0.0,1)); |
||
874 | fw.write(DxfGroup.toString(30,0.0,1)); |
||
875 | fw.write(DxfGroup.toString(9,"$PUCSXDIR")); |
||
876 | fw.write(DxfGroup.toString(10,1.0,1)); |
||
877 | fw.write(DxfGroup.toString(20,0.0,1)); |
||
878 | fw.write(DxfGroup.toString(30,0.0,1)); |
||
879 | fw.write(DxfGroup.toString(9,"$PUCSYDIR")); |
||
880 | fw.write(DxfGroup.toString(10,0.0,1)); |
||
881 | fw.write(DxfGroup.toString(20,1.0,1)); |
||
882 | fw.write(DxfGroup.toString(30,0.0,1)); |
||
883 | fw.write(DxfGroup.toString(9,"$USERI1")+ DxfGroup.toString(70,0)); |
||
884 | fw.write(DxfGroup.toString(9,"$USERI2")+ DxfGroup.toString(70,0)); |
||
885 | fw.write(DxfGroup.toString(9,"$USERI3")+ DxfGroup.toString(70,0)); |
||
886 | fw.write(DxfGroup.toString(9,"$USERI4")+ DxfGroup.toString(70,0)); |
||
887 | fw.write(DxfGroup.toString(9,"$USERI5")+ DxfGroup.toString(70,0)); |
||
888 | fw.write(DxfGroup.toString(9,"$USERR1")+ DxfGroup.toString(40,0.0,1)); |
||
889 | fw.write(DxfGroup.toString(9,"$USERR2")+ DxfGroup.toString(40,0.0,1)); |
||
890 | fw.write(DxfGroup.toString(9,"$USERR3")+ DxfGroup.toString(40,0.0,1)); |
||
891 | fw.write(DxfGroup.toString(9,"$USERR4")+ DxfGroup.toString(40,0.0,1)); |
||
892 | fw.write(DxfGroup.toString(9,"$USERR5")+ DxfGroup.toString(40,0.0,1)); |
||
893 | fw.write(DxfGroup.toString(9,"$WORLDVIEW")+ DxfGroup.toString(70,1)); |
||
894 | fw.write(DxfGroup.toString(9,"$SHADEDGE")+ DxfGroup.toString(70,3)); |
||
895 | fw.write(DxfGroup.toString(9,"$SHADEDIF")+ DxfGroup.toString(70,70)); |
||
896 | fw.write(DxfGroup.toString(9,"$TILEMODE")+ DxfGroup.toString(70,1)); |
||
897 | fw.write(DxfGroup.toString(9,"$MAXACTVP")+ DxfGroup.toString(70,16)); |
||
898 | fw.write(DxfGroup.toString(9,"$PINSBASE")); |
||
899 | fw.write(DxfGroup.toString(10,0.0,1)); |
||
900 | fw.write(DxfGroup.toString(20,0.0,1)); |
||
901 | fw.write(DxfGroup.toString(30,0.0,1)); |
||
902 | fw.write(DxfGroup.toString(9,"$PLIMCHECK")+ DxfGroup.toString(70,0)); |
||
903 | fw.write(DxfGroup.toString(9,"$PEXTMIN")); |
||
904 | fw.write(DxfGroup.toString(10,"-1.000000E+20")); |
||
905 | fw.write(DxfGroup.toString(20,"-1.000000E+20")); |
||
906 | fw.write(DxfGroup.toString(30,"-1.000000E+20")); |
||
907 | fw.write(DxfGroup.toString(9,"$PEXTMAX")); |
||
908 | fw.write(DxfGroup.toString(10,"-1.000000E+20")); |
||
909 | fw.write(DxfGroup.toString(20,"-1.000000E+20")); |
||
910 | fw.write(DxfGroup.toString(30,"-1.000000E+20")); |
||
911 | fw.write(DxfGroup.toString(9,"$PLIMMIN")); |
||
912 | fw.write(DxfGroup.toString(10,0.0,1)); |
||
913 | fw.write(DxfGroup.toString(20,0.0,1)); |
||
914 | fw.write(DxfGroup.toString(9,"$PLIMMAX")); |
||
915 | fw.write(DxfGroup.toString(10,12.0,1)); |
||
916 | fw.write(DxfGroup.toString(20,9.0,1)); |
||
917 | fw.write(DxfGroup.toString(9,"$UNITMODE")+ DxfGroup.toString(70,0)); |
||
918 | fw.write(DxfGroup.toString(9,"$VISRETAIN")+ DxfGroup.toString(70,0)); |
||
919 | fw.write(DxfGroup.toString(9,"$PLINEGEN")+ DxfGroup.toString(70,1)); |
||
920 | fw.write(DxfGroup.toString(9,"$PSLTSCALE")+ DxfGroup.toString(70,0)); |
||
921 | fw.write(DxfGroup.toString(9,"$TREEDEPTH")+ DxfGroup.toString(70,3020)); |
||
922 | fw.write(DxfGroup.toString(9,"$DWGCODEPAGE")+DxfGroup.toString(3,"ansi_1252")); |
||
923 | /*
|
||
924 | fw.write(DxfGroup.toString(9, "$ELEVATION"));
|
||
925 | fw.write(DxfGroup.toString(40, 0.0, 3));
|
||
926 | fw.write(DxfGroup.toString(9, "$LIMCHECK"));
|
||
927 | fw.write(DxfGroup.toString(70, 1));
|
||
928 | fw.write(DxfGroup.toString(9, "$LUNITS"));
|
||
929 | fw.write(DxfGroup.toString(70, 2));
|
||
930 | fw.write(DxfGroup.toString(9, "$LUPREC"));
|
||
931 | fw.write(DxfGroup.toString(70, 2));*/
|
||
932 | fw.write(DxfGroup.toString(0, "ENDSEC")); |
||
933 | } |
||
934 | |||
935 | /**
|
||
936 | * Escritor de la secci?n TABLES de un DXF.
|
||
937 | * @param fw, FileWriter
|
||
938 | * @throws IOException
|
||
939 | */
|
||
940 | public void writeTables(FileWriter fw) throws IOException { |
||
941 | fw.write(DxfGroup.toString(0, "SECTION")); |
||
942 | fw.write(DxfGroup.toString(2, "TABLES")); |
||
943 | // esta tampoco.
|
||
944 | writeVPortTable(fw); |
||
945 | writeLTypeTable(fw); |
||
946 | writeLayerTable(fw); |
||
947 | writeStyleTable(fw); |
||
948 | // estas no son las provocan el pete.
|
||
949 | writeViewTable(fw); |
||
950 | writeUCSTable(fw); |
||
951 | // esta provoca el pete. Y si no se pone las tablas aparecen
|
||
952 | // incompletas y acad no abre el fichero ...
|
||
953 | writeAppidTable(fw); |
||
954 | writeDimStyleTable(fw); |
||
955 | // esta no provoca pete.
|
||
956 | writeBlockRecordTable(fw); |
||
957 | fw.write(DxfGroup.toString(0, "ENDSEC")); |
||
958 | } |
||
959 | |||
960 | /**
|
||
961 | * Escritor de la tabla VPORT.
|
||
962 | * @param fw
|
||
963 | * @throws IOException
|
||
964 | */
|
||
965 | public void writeVPortTable(FileWriter fw) throws IOException { |
||
966 | fw.write(DxfGroup.toString(0, "TABLE")); |
||
967 | fw.write(DxfGroup.toString(2, "VPORT")); |
||
968 | fw.write(DxfGroup.toString(5, 8)); |
||
969 | fw.write(DxfGroup.toString(100, "AcDbSymbolTable")); |
||
970 | fw.write(DxfGroup.toString(70, 0)); |
||
971 | /*fw.write(DxfGroup.toString(70, 1));
|
||
972 | fw.write(DxfGroup.toString(0, "VPORT"));
|
||
973 | fw.write(DxfGroup.toString(5, 30));
|
||
974 | fw.write(DxfGroup.toString(100, "AcDbSymbolTableRecord"));
|
||
975 | fw.write(DxfGroup.toString(100, "AcDbViewportTableRecord"));
|
||
976 | fw.write(DxfGroup.toString(2, "*Active"));
|
||
977 | fw.write(DxfGroup.toString(70, 0));
|
||
978 | fw.write(DxfGroup.toString(10, 0.0, 4));
|
||
979 | fw.write(DxfGroup.toString(20, 0.0, 4));
|
||
980 | fw.write(DxfGroup.toString(11, 1.0, 4));
|
||
981 | fw.write(DxfGroup.toString(21, 1.0, 4));
|
||
982 | fw.write(DxfGroup.toString(12, 286.30555555555549, 10));
|
||
983 | fw.write(DxfGroup.toString(22, 148.5, 4));
|
||
984 | fw.write(DxfGroup.toString(13, 0.0, 4));
|
||
985 | fw.write(DxfGroup.toString(23, 0.0, 4));
|
||
986 | fw.write(DxfGroup.toString(14, 10.0, 4));
|
||
987 | fw.write(DxfGroup.toString(24, 10.0, 4));
|
||
988 | fw.write(DxfGroup.toString(15, 10.0, 4));
|
||
989 | fw.write(DxfGroup.toString(25, 10.0, 4));
|
||
990 | fw.write(DxfGroup.toString(16, 0.0, 4));
|
||
991 | fw.write(DxfGroup.toString(26, 0.0, 4));
|
||
992 | fw.write(DxfGroup.toString(36, 1.0, 4));
|
||
993 | fw.write(DxfGroup.toString(17, 0.0, 4));
|
||
994 | fw.write(DxfGroup.toString(27, 0.0, 4));
|
||
995 | fw.write(DxfGroup.toString(37, 0.0, 4));
|
||
996 | fw.write(DxfGroup.toString(40, 297.0, 4));
|
||
997 | fw.write(DxfGroup.toString(41, 1.92798353909465, 10));
|
||
998 | fw.write(DxfGroup.toString(42, 50.0, 4));
|
||
999 | fw.write(DxfGroup.toString(43, 0.0, 4));
|
||
1000 | fw.write(DxfGroup.toString(44, 0.0, 4));
|
||
1001 | fw.write(DxfGroup.toString(50, 0.0, 4));
|
||
1002 | fw.write(DxfGroup.toString(51, 0.0, 4));
|
||
1003 | fw.write(DxfGroup.toString(71, 0));
|
||
1004 | fw.write(DxfGroup.toString(72, 100));
|
||
1005 | fw.write(DxfGroup.toString(73, 1));
|
||
1006 | fw.write(DxfGroup.toString(74, 3));
|
||
1007 | fw.write(DxfGroup.toString(75, 1));
|
||
1008 | fw.write(DxfGroup.toString(76, 1));
|
||
1009 | fw.write(DxfGroup.toString(77, 0));
|
||
1010 | fw.write(DxfGroup.toString(78, 0));
|
||
1011 | fw.write(DxfGroup.toString(281, 0));
|
||
1012 | fw.write(DxfGroup.toString(65, 1));
|
||
1013 | fw.write(DxfGroup.toString(110, 0.0, 4));
|
||
1014 | fw.write(DxfGroup.toString(120, 0.0, 4));
|
||
1015 | fw.write(DxfGroup.toString(130, 0.0, 4));
|
||
1016 | fw.write(DxfGroup.toString(111, 1.0, 4));
|
||
1017 | fw.write(DxfGroup.toString(121, 0.0, 4));
|
||
1018 | fw.write(DxfGroup.toString(131, 0.0, 4));
|
||
1019 | fw.write(DxfGroup.toString(112, 0.0, 4));
|
||
1020 | fw.write(DxfGroup.toString(122, 1.0, 4));
|
||
1021 | fw.write(DxfGroup.toString(132, 0.0, 4));
|
||
1022 | fw.write(DxfGroup.toString(79, 0));
|
||
1023 | fw.write(DxfGroup.toString(146, 0.0, 4));*/
|
||
1024 | fw.write(DxfGroup.toString(0, "ENDTAB")); |
||
1025 | } |
||
1026 | |||
1027 | /**
|
||
1028 | * Escritor de la tabla LTYPE.
|
||
1029 | * @param fw
|
||
1030 | * @throws IOException
|
||
1031 | */
|
||
1032 | public void writeLTypeTable(FileWriter fw) throws IOException { |
||
1033 | fw.write(DxfGroup.toString(0, "TABLE")); |
||
1034 | fw.write(DxfGroup.toString(2, "LTYPE")); |
||
1035 | fw.write(DxfGroup.toString(5, 5)); |
||
1036 | fw.write(DxfGroup.toString(100, "AcDbSymbolTable")); |
||
1037 | fw.write(DxfGroup.toString(70, 1)); |
||
1038 | // Aqui hay que crear un objeto DxfLType como el DxfLayer tambi?n basado en
|
||
1039 | // el lector de DXF de Mich.
|
||
1040 | /*DxfTABLE_LTYPE_ITEM ltype =
|
||
1041 | new DxfTABLE_LTYPE_ITEM("CONTINUE", 0, "", 65, 0f, new float[0]);
|
||
1042 | fw.write(ltype.toString());*/
|
||
1043 | fw.write(DxfGroup.toString(0, "LTYPE")); |
||
1044 | fw.write(DxfGroup.toString(5, 14)); |
||
1045 | fw.write(DxfGroup.toString(100, "AcDbSymbolTableRecord")); |
||
1046 | fw.write(DxfGroup.toString(100, "AcDbLinetypeTableRecord")); |
||
1047 | fw.write(DxfGroup.toString(2, "ByBlock")); |
||
1048 | fw.write(DxfGroup.toString(70, 0)); |
||
1049 | fw.write(DxfGroup.toString(3, "")); |
||
1050 | fw.write(DxfGroup.toString(72, 65)); |
||
1051 | fw.write(DxfGroup.toString(73, 0)); |
||
1052 | fw.write(DxfGroup.toString(40, 0.0, 4)); |
||
1053 | fw.write(DxfGroup.toString(0, "LTYPE")); |
||
1054 | fw.write(DxfGroup.toString(5, 15)); |
||
1055 | fw.write(DxfGroup.toString(100, "AcDbSymbolTableRecord")); |
||
1056 | fw.write(DxfGroup.toString(100, "AcDbLinetypeTableRecord")); |
||
1057 | fw.write(DxfGroup.toString(2, "ByLayer")); |
||
1058 | fw.write(DxfGroup.toString(70, 0)); |
||
1059 | fw.write(DxfGroup.toString(3, "")); |
||
1060 | fw.write(DxfGroup.toString(72, 65)); |
||
1061 | fw.write(DxfGroup.toString(73, 0)); |
||
1062 | fw.write(DxfGroup.toString(40, 0.0, 4)); |
||
1063 | fw.write(DxfGroup.toString(0, "ENDTAB")); |
||
1064 | } |
||
1065 | |||
1066 | /**
|
||
1067 | * Escritor de la tabla LAYER.
|
||
1068 | * @param fw
|
||
1069 | * @throws IOException
|
||
1070 | */
|
||
1071 | public void writeLayerTable(FileWriter fw) throws IOException { |
||
1072 | fw.write(DxfGroup.toString(0, "TABLE")); |
||
1073 | fw.write(DxfGroup.toString(2, "LAYER")); |
||
1074 | fw.write(DxfGroup.toString(5, 2)); |
||
1075 | fw.write(DxfGroup.toString(100, "AcDbSymbolTable")); |
||
1076 | fw.write(DxfGroup.toString(70, 1)); |
||
1077 | //layer = new DxfLayer(layerName, 0, 131, "CONTINUOUS");
|
||
1078 | //fw.write(layer.toString());
|
||
1079 | //fw.write(((DxfEntityMaker) entityMaker).getLayers().toDxfString());
|
||
1080 | fw.write(DxfGroup.toString(0, "LAYER")); |
||
1081 | fw.write(DxfGroup.toString(5, 10)); |
||
1082 | fw.write(DxfGroup.toString(100, "AcDbSymbolTableRecord")); |
||
1083 | fw.write(DxfGroup.toString(100, "AcDbLayerTableRecord")); |
||
1084 | fw.write(DxfGroup.toString(2, "0")); |
||
1085 | fw.write(DxfGroup.toString(70, 0)); |
||
1086 | fw.write(DxfGroup.toString(62, 7)); |
||
1087 | fw.write(DxfGroup.toString(6, "CONTINUOUS")); |
||
1088 | fw.write(DxfGroup.toString(390, "F")); |
||
1089 | fw.write(DxfGroup.toString(0, "ENDTAB")); |
||
1090 | } |
||
1091 | |||
1092 | /**
|
||
1093 | * Escritor de la tabla STYLE.
|
||
1094 | * @param fw
|
||
1095 | * @throws IOException
|
||
1096 | */
|
||
1097 | public void writeStyleTable(FileWriter fw) throws IOException { |
||
1098 | fw.write(DxfGroup.toString(0, "TABLE")); |
||
1099 | fw.write(DxfGroup.toString(2, "STYLE")); |
||
1100 | fw.write(DxfGroup.toString(5, 3)); |
||
1101 | fw.write(DxfGroup.toString(100, "AcDbSymbolTable")); |
||
1102 | fw.write(DxfGroup.toString(70, 0)); |
||
1103 | /*fw.write(DxfGroup.toString(70, 1));
|
||
1104 | DxfTABLE_STYLE_ITEM style =
|
||
1105 | new DxfTABLE_STYLE_ITEM("STANDARD", 0, 0f, 1f, 0f, 0, 1.0f, "xxx.txt", "yyy.txt");
|
||
1106 | fw.write(style.toString());*/
|
||
1107 | fw.write(DxfGroup.toString(0, "STYLE")); |
||
1108 | fw.write(DxfGroup.toString(5, 11)); |
||
1109 | fw.write(DxfGroup.toString(100, "AcDbSymbolTableRecord")); |
||
1110 | fw.write(DxfGroup.toString(100, "AcDbTextStyleTableRecord")); |
||
1111 | fw.write(DxfGroup.toString(2, "Standard")); |
||
1112 | fw.write(DxfGroup.toString(70, 0)); |
||
1113 | fw.write(DxfGroup.toString(71, 0)); |
||
1114 | fw.write(DxfGroup.toString(40, 0.0, 4)); |
||
1115 | fw.write(DxfGroup.toString(41, 1.0, 4)); |
||
1116 | fw.write(DxfGroup.toString(42, 2.5, 4)); |
||
1117 | fw.write(DxfGroup.toString(50, 0.0, 4)); |
||
1118 | fw.write(DxfGroup.toString(3, "txt")); |
||
1119 | fw.write(DxfGroup.toString(4, "")); |
||
1120 | fw.write(DxfGroup.toString(0, "ENDTAB")); |
||
1121 | } |
||
1122 | |||
1123 | /**
|
||
1124 | * Escritor de la tabla VIEW.
|
||
1125 | * @param fw
|
||
1126 | * @throws IOException
|
||
1127 | */
|
||
1128 | public void writeViewTable(FileWriter fw) throws IOException { |
||
1129 | fw.write(DxfGroup.toString(0, "TABLE")); |
||
1130 | fw.write(DxfGroup.toString(2, "VIEW")); |
||
1131 | fw.write(DxfGroup.toString(5, 6)); |
||
1132 | fw.write(DxfGroup.toString(100, "AcDbSymbolTable")); |
||
1133 | fw.write(DxfGroup.toString(70, 0)); |
||
1134 | fw.write(DxfGroup.toString(0, "ENDTAB")); |
||
1135 | } |
||
1136 | |||
1137 | /**
|
||
1138 | * Escritor de la tabla UCS.
|
||
1139 | * @param fw
|
||
1140 | * @throws IOException
|
||
1141 | */
|
||
1142 | public void writeUCSTable(FileWriter fw) throws IOException { |
||
1143 | fw.write(DxfGroup.toString(0, "TABLE")); |
||
1144 | fw.write(DxfGroup.toString(2, "UCS")); |
||
1145 | fw.write(DxfGroup.toString(5, 7)); |
||
1146 | fw.write(DxfGroup.toString(100, "AcDbSymbolTable")); |
||
1147 | fw.write(DxfGroup.toString(70, 0)); |
||
1148 | fw.write(DxfGroup.toString(0, "ENDTAB")); |
||
1149 | } |
||
1150 | |||
1151 | /**
|
||
1152 | * Escritor de la tabla APPID.
|
||
1153 | * @param fw
|
||
1154 | * @throws IOException
|
||
1155 | */
|
||
1156 | public void writeAppidTable(FileWriter fw) throws IOException { |
||
1157 | fw.write(DxfGroup.toString(0, "TABLE")); |
||
1158 | fw.write(DxfGroup.toString(2, "APPID")); |
||
1159 | fw.write(DxfGroup.toString(5, 9)); |
||
1160 | fw.write(DxfGroup.toString(100, "AcDbSymbolTable")); |
||
1161 | fw.write(DxfGroup.toString(70, 1)); |
||
1162 | fw.write(DxfGroup.toString(0, "APPID")); |
||
1163 | fw.write(DxfGroup.toString(5, 12)); |
||
1164 | fw.write(DxfGroup.toString(100, "AcDbSymbolTableRecord")); |
||
1165 | fw.write(DxfGroup.toString(100, "AcDbRegAppTableRecord")); |
||
1166 | fw.write(DxfGroup.toString(2, "ACAD")); |
||
1167 | fw.write(DxfGroup.toString(70, 1)); |
||
1168 | fw.write(DxfGroup.toString(0, "ENDTAB")); |
||
1169 | } |
||
1170 | |||
1171 | /**
|
||
1172 | * Escritor de la tabla DIMSTYLE.
|
||
1173 | * @param fw
|
||
1174 | * @throws IOException
|
||
1175 | */
|
||
1176 | public void writeDimStyleTable(FileWriter fw) throws IOException { |
||
1177 | fw.write(DxfGroup.toString(0, "TABLE")); |
||
1178 | fw.write(DxfGroup.toString(2, "DIMSTYLE")); |
||
1179 | fw.write(DxfGroup.toString(5, "A")); |
||
1180 | fw.write(DxfGroup.toString(100, "AcDbSymbolTable")); |
||
1181 | fw.write(DxfGroup.toString(70, 0)); |
||
1182 | fw.write(DxfGroup.toString(100, "AcDbDimStyleTable")); |
||
1183 | fw.write(DxfGroup.toString(0, "ENDTAB")); |
||
1184 | } |
||
1185 | |||
1186 | /**
|
||
1187 | * Escritor de la tabla BLOCK_RECORD.
|
||
1188 | * @param fw
|
||
1189 | * @throws IOException
|
||
1190 | */
|
||
1191 | public void writeBlockRecordTable(FileWriter fw) throws IOException { |
||
1192 | fw.write(DxfGroup.toString(0, "TABLE")); |
||
1193 | fw.write(DxfGroup.toString(2, "BLOCK_RECORD")); |
||
1194 | fw.write(DxfGroup.toString(5, 1)); |
||
1195 | fw.write(DxfGroup.toString(100, "AcDbSymbolTable")); |
||
1196 | fw.write(DxfGroup.toString(70, 1)); |
||
1197 | fw.write(DxfGroup.toString(0, "BLOCK_RECORD")); |
||
1198 | fw.write(DxfGroup.toString(5, "1F")); |
||
1199 | fw.write(DxfGroup.toString(100, "AcDbSymbolTableRecord")); |
||
1200 | fw.write(DxfGroup.toString(100, "AcDbBlockTableRecord")); |
||
1201 | fw.write(DxfGroup.toString(2, "*Model_Space")); |
||
1202 | fw.write(DxfGroup.toString(340, "22")); |
||
1203 | fw.write(DxfGroup.toString(0, "BLOCK_RECORD")); |
||
1204 | fw.write(DxfGroup.toString(5, "1B")); |
||
1205 | fw.write(DxfGroup.toString(100, "AcDbSymbolTableRecord")); |
||
1206 | fw.write(DxfGroup.toString(100, "AcDbBlockTableRecord")); |
||
1207 | fw.write(DxfGroup.toString(2, "*Paper_Space")); |
||
1208 | fw.write(DxfGroup.toString(340, "1E")); |
||
1209 | fw.write(DxfGroup.toString(0, "BLOCK_RECORD")); |
||
1210 | fw.write(DxfGroup.toString(5, "23")); |
||
1211 | fw.write(DxfGroup.toString(100, "AcDbSymbolTableRecord")); |
||
1212 | fw.write(DxfGroup.toString(100, "AcDbBlockTableRecord")); |
||
1213 | fw.write(DxfGroup.toString(2, "*Paper_Space0")); |
||
1214 | fw.write(DxfGroup.toString(340, "26")); |
||
1215 | fw.write(DxfGroup.toString(0, "ENDTAB")); |
||
1216 | } |
||
1217 | |||
1218 | /**
|
||
1219 | * Escritor de la secci?n de bloques por defecto de un DXF2000.
|
||
1220 | * @param fw
|
||
1221 | * @throws IOException
|
||
1222 | */
|
||
1223 | public void writeBlocks(FileWriter fw) throws IOException { |
||
1224 | fw.write(DxfGroup.toString(0, "SECTION")); |
||
1225 | fw.write(DxfGroup.toString(2, "BLOCKS")); |
||
1226 | fw.write(DxfGroup.toString(0, "BLOCK")); |
||
1227 | fw.write(DxfGroup.toString(5, "20")); |
||
1228 | fw.write(DxfGroup.toString(100, "AcDbEntity")); |
||
1229 | fw.write(DxfGroup.toString(8, "0")); |
||
1230 | fw.write(DxfGroup.toString(100, "AcDbBlockBegin")); |
||
1231 | fw.write(DxfGroup.toString(2, "*Model_Space")); |
||
1232 | fw.write(DxfGroup.toString(70, 0)); |
||
1233 | fw.write(DxfGroup.toString(10, 0.0, 4)); |
||
1234 | fw.write(DxfGroup.toString(20, 0.0, 4)); |
||
1235 | fw.write(DxfGroup.toString(30, 0.0, 4)); |
||
1236 | fw.write(DxfGroup.toString(3, "*Model_Space")); |
||
1237 | fw.write(DxfGroup.toString(1, "")); |
||
1238 | fw.write(DxfGroup.toString(0, "ENDBLK")); |
||
1239 | fw.write(DxfGroup.toString(5, "21")); |
||
1240 | fw.write(DxfGroup.toString(100, "AcDbEntity")); |
||
1241 | fw.write(DxfGroup.toString(8, "0")); |
||
1242 | fw.write(DxfGroup.toString(100, "AcDbBlockEnd")); |
||
1243 | fw.write(DxfGroup.toString(0, "BLOCK")); |
||
1244 | fw.write(DxfGroup.toString(5, "1C")); |
||
1245 | fw.write(DxfGroup.toString(100, "AcDbEntity")); |
||
1246 | fw.write(DxfGroup.toString(67, 1)); |
||
1247 | fw.write(DxfGroup.toString(8, "0")); |
||
1248 | fw.write(DxfGroup.toString(100, "AcDbBlockBegin")); |
||
1249 | fw.write(DxfGroup.toString(2, "*Paper_Space")); |
||
1250 | fw.write(DxfGroup.toString(70, 0)); |
||
1251 | fw.write(DxfGroup.toString(10, 0.0, 4)); |
||
1252 | fw.write(DxfGroup.toString(20, 0.0, 4)); |
||
1253 | fw.write(DxfGroup.toString(30, 0.0, 4)); |
||
1254 | fw.write(DxfGroup.toString(3, "*Paper_Space")); |
||
1255 | fw.write(DxfGroup.toString(1, "")); |
||
1256 | fw.write(DxfGroup.toString(0, "ENDBLK")); |
||
1257 | fw.write(DxfGroup.toString(5, "1D")); |
||
1258 | fw.write(DxfGroup.toString(100, "AcDbEntity")); |
||
1259 | fw.write(DxfGroup.toString(67, 1)); |
||
1260 | fw.write(DxfGroup.toString(8, "0")); |
||
1261 | fw.write(DxfGroup.toString(100, "AcDbBlockEnd")); |
||
1262 | fw.write(DxfGroup.toString(0, "BLOCK")); |
||
1263 | fw.write(DxfGroup.toString(5, "24")); |
||
1264 | fw.write(DxfGroup.toString(100, "AcDbEntity")); |
||
1265 | fw.write(DxfGroup.toString(8, "0")); |
||
1266 | fw.write(DxfGroup.toString(100, "AcDbBlockBegin")); |
||
1267 | fw.write(DxfGroup.toString(2, "*Paper_Space0")); |
||
1268 | fw.write(DxfGroup.toString(70, 0)); |
||
1269 | fw.write(DxfGroup.toString(10, 0.0, 4)); |
||
1270 | fw.write(DxfGroup.toString(20, 0.0, 4)); |
||
1271 | fw.write(DxfGroup.toString(30, 0.0, 4)); |
||
1272 | fw.write(DxfGroup.toString(3, "*Paper_Space0")); |
||
1273 | fw.write(DxfGroup.toString(1, "")); |
||
1274 | fw.write(DxfGroup.toString(0, "ENDBLK")); |
||
1275 | fw.write(DxfGroup.toString(5, "25")); |
||
1276 | fw.write(DxfGroup.toString(100, "AcDbEntity")); |
||
1277 | fw.write(DxfGroup.toString(8, "0")); |
||
1278 | fw.write(DxfGroup.toString(100, "AcDbBlockEnd")); |
||
1279 | fw.write(DxfGroup.toString(0, "ENDSEC")); |
||
1280 | } |
||
1281 | |||
1282 | /**
|
||
1283 | * Escritor de la secci?n ENTITIES de entidades.
|
||
1284 | * @param fw
|
||
1285 | * @throws IOException
|
||
1286 | */
|
||
1287 | public void writeEntities(FileWriter fw) throws IOException { |
||
1288 | // ECRITURE DES FEATURES
|
||
1289 | fw.write(DxfGroup.toString(0, "SECTION")); |
||
1290 | fw.write(DxfGroup.toString(2, "ENTITIES")); |
||
1291 | if (cadFlag) {
|
||
1292 | fw.write(((DxfEntityMaker) entityMaker).getEntities().toDxfString()); |
||
1293 | } else {
|
||
1294 | //fw.write(((DxfFeatureMaker) entityMaker).getObjects().toDxfString());
|
||
1295 | } |
||
1296 | fw.write(DxfGroup.toString(0, "ENDSEC")); |
||
1297 | } |
||
1298 | |||
1299 | /**
|
||
1300 | * 050224, jmorell: Escritura de la secci?n OBJECTS seg?n QCAD.
|
||
1301 | * Writes a objects section. This section is needed in VER_R13.
|
||
1302 | * Note that this method currently only writes a faked OBJECTS section
|
||
1303 | * to make the file readable by Aut*cad.
|
||
1304 | */
|
||
1305 | public void writeObjects(FileWriter fw) throws IOException { |
||
1306 | //int dicId, dicId2, dicId3, dicId4, dicId5;
|
||
1307 | //int dicId5;
|
||
1308 | |||
1309 | fw.write(DxfGroup.toString( 0, "SECTION")); |
||
1310 | fw.write(DxfGroup.toString( 2, "OBJECTS")); |
||
1311 | fw.write(DxfGroup.toString( 0, "DICTIONARY")); |
||
1312 | //fw.write(DxfGroup.toString(5, 0xC); // C
|
||
1313 | fw.write(DxfGroup.toString( 5, "C")); |
||
1314 | //fw.write(DxfGroup.toString(330, 0);
|
||
1315 | fw.write(DxfGroup.toString(100, "AcDbDictionary")); |
||
1316 | fw.write(DxfGroup.toString(280, 0)); |
||
1317 | fw.write(DxfGroup.toString(281, 1)); |
||
1318 | fw.write(DxfGroup.toString( 3, "ACAD_GROUP")); |
||
1319 | //fw.write(DxfGroup.toString(350, dw.getNextHandle()); // D
|
||
1320 | fw.write(DxfGroup.toString(350, "D")); // D |
||
1321 | fw.write(DxfGroup.toString( 3, "ACAD_LAYOUT")); |
||
1322 | fw.write(DxfGroup.toString(350, "1A")); |
||
1323 | //fw.write(DxfGroup.toString(350, dw.getNextHandle()+0); // 1A
|
||
1324 | fw.write(DxfGroup.toString( 3, "ACAD_MLINESTYLE")); |
||
1325 | fw.write(DxfGroup.toString(350, "17")); |
||
1326 | //fw.write(DxfGroup.toString(350, dw.getNextHandle()+1); // 17
|
||
1327 | fw.write(DxfGroup.toString( 3, "ACAD_PLOTSETTINGS")); |
||
1328 | fw.write(DxfGroup.toString(350, "19")); |
||
1329 | //fw.write(DxfGroup.toString(350, dw.getNextHandle()+2); // 19
|
||
1330 | fw.write(DxfGroup.toString( 3, "ACAD_PLOTSTYLENAME")); |
||
1331 | fw.write(DxfGroup.toString(350, "E")); |
||
1332 | //fw.write(DxfGroup.toString(350, dw.getNextHandle()+3); // E
|
||
1333 | fw.write(DxfGroup.toString( 3, "AcDbVariableDictionary")); |
||
1334 | //fw.write(DxfGroup.toString(350, dw.getNextHandle())); // 2C
|
||
1335 | fw.write(DxfGroup.toString(350, "2C")); // 2C |
||
1336 | fw.write(DxfGroup.toString( 0, "DICTIONARY")); |
||
1337 | fw.write(DxfGroup.toString(5, "D")); |
||
1338 | //dw.handle(); // D
|
||
1339 | //fw.write(DxfGroup.toString(330, 0xC);
|
||
1340 | fw.write(DxfGroup.toString(100, "AcDbDictionary")); |
||
1341 | fw.write(DxfGroup.toString(280, 0)); |
||
1342 | fw.write(DxfGroup.toString(281, 1)); |
||
1343 | fw.write(DxfGroup.toString( 0, "ACDBDICTIONARYWDFLT")); |
||
1344 | fw.write(DxfGroup.toString(5, "E")); |
||
1345 | //dicId4 = dw.handle(); // E
|
||
1346 | //fw.write(DxfGroup.toString(330, 0xC); // C
|
||
1347 | fw.write(DxfGroup.toString(100, "AcDbDictionary")); |
||
1348 | fw.write(DxfGroup.toString(281, 1)); |
||
1349 | fw.write(DxfGroup.toString( 3, "Normal")); |
||
1350 | fw.write(DxfGroup.toString(350, "F")); |
||
1351 | //fw.write(DxfGroup.toString(350, dw.getNextHandle()+5); // F
|
||
1352 | fw.write(DxfGroup.toString(100, "AcDbDictionaryWithDefault")); |
||
1353 | fw.write(DxfGroup.toString(340, "F")); |
||
1354 | //fw.write(DxfGroup.toString(340, dw.getNextHandle()+5); // F
|
||
1355 | fw.write(DxfGroup.toString( 0, "ACDBPLACEHOLDER")); |
||
1356 | fw.write(DxfGroup.toString(5, "F")); |
||
1357 | //dw.handle(); // F
|
||
1358 | //fw.write(DxfGroup.toString(330, dicId4); // E
|
||
1359 | fw.write(DxfGroup.toString( 0, "DICTIONARY")); |
||
1360 | //dicId3 = dw.handle(); // 17
|
||
1361 | fw.write(DxfGroup.toString(5, "17")); |
||
1362 | //fw.write(DxfGroup.toString(330, 0xC); // C
|
||
1363 | fw.write(DxfGroup.toString(100, "AcDbDictionary")); |
||
1364 | fw.write(DxfGroup.toString(280, 0)); |
||
1365 | fw.write(DxfGroup.toString(281, 1)); |
||
1366 | fw.write(DxfGroup.toString( 3, "Standard")); |
||
1367 | fw.write(DxfGroup.toString(350, "18")); |
||
1368 | //fw.write(DxfGroup.toString(350, dw.getNextHandle()+5); // 18
|
||
1369 | fw.write(DxfGroup.toString( 0, "MLINESTYLE")); |
||
1370 | fw.write(DxfGroup.toString(5, "18")); |
||
1371 | //dw.handle(); // 18
|
||
1372 | //fw.write(DxfGroup.toString(330, dicId3); // 17
|
||
1373 | fw.write(DxfGroup.toString(100, "AcDbMlineStyle")); |
||
1374 | fw.write(DxfGroup.toString( 2, "STANDARD")); |
||
1375 | fw.write(DxfGroup.toString( 70, 0)); |
||
1376 | fw.write(DxfGroup.toString( 3, "")); |
||
1377 | fw.write(DxfGroup.toString( 62, 256)); |
||
1378 | //dw.dxfReal( 51, 90.0);
|
||
1379 | fw.write(DxfGroup.toString( 51, 90.0, 4)); |
||
1380 | fw.write(DxfGroup.toString( 52, 90.0, 4)); |
||
1381 | fw.write(DxfGroup.toString( 71, 2)); |
||
1382 | fw.write(DxfGroup.toString( 49, 0.5, 4)); |
||
1383 | fw.write(DxfGroup.toString( 62, 256)); |
||
1384 | fw.write(DxfGroup.toString( 6, "BYLAYER")); |
||
1385 | fw.write(DxfGroup.toString( 49, -0.5, 4)); |
||
1386 | fw.write(DxfGroup.toString( 62, 256)); |
||
1387 | fw.write(DxfGroup.toString( 6, "BYLAYER")); |
||
1388 | fw.write(DxfGroup.toString( 0, "DICTIONARY")); |
||
1389 | fw.write(DxfGroup.toString(5, "19")); |
||
1390 | //dw.handle(); // 17
|
||
1391 | //fw.write(DxfGroup.toString(330, 0xC); // C
|
||
1392 | fw.write(DxfGroup.toString(100, "AcDbDictionary")); |
||
1393 | fw.write(DxfGroup.toString(280, 0)); |
||
1394 | fw.write(DxfGroup.toString(281, 1)); |
||
1395 | fw.write(DxfGroup.toString( 0, "DICTIONARY")); |
||
1396 | //dicId2 = dw.handle(); // 1A
|
||
1397 | fw.write(DxfGroup.toString(5, "1A")); |
||
1398 | //fw.write(DxfGroup.toString(330, 0xC);
|
||
1399 | fw.write(DxfGroup.toString(100, "AcDbDictionary")); |
||
1400 | fw.write(DxfGroup.toString(281, 1)); |
||
1401 | fw.write(DxfGroup.toString( 3, "Layout1")); |
||
1402 | fw.write(DxfGroup.toString(350, "1E")); |
||
1403 | //fw.write(DxfGroup.toString(350, dw.getNextHandle()+2); // 1E
|
||
1404 | fw.write(DxfGroup.toString( 3, "Layout2")); |
||
1405 | fw.write(DxfGroup.toString(350, "26")); |
||
1406 | //fw.write(DxfGroup.toString(350, dw.getNextHandle()+4); // 26
|
||
1407 | fw.write(DxfGroup.toString( 3, "Model")); |
||
1408 | fw.write(DxfGroup.toString(350, "22")); |
||
1409 | //fw.write(DxfGroup.toString(350, dw.getNextHandle()+5); // 22
|
||
1410 | |||
1411 | fw.write(DxfGroup.toString( 0, "LAYOUT")); |
||
1412 | fw.write(DxfGroup.toString(5, "1E")); |
||
1413 | //dw.handle(); // 1E
|
||
1414 | //fw.write(DxfGroup.toString(330, dicId2); // 1A
|
||
1415 | fw.write(DxfGroup.toString(100, "AcDbPlotSettings")); |
||
1416 | fw.write(DxfGroup.toString( 1, "")); |
||
1417 | fw.write(DxfGroup.toString( 2, "C:\\Program Files\\AutoCAD 2002\\plotters\\DWF ePlot (optimized for plotting).pc3")); |
||
1418 | fw.write(DxfGroup.toString( 4, "")); |
||
1419 | fw.write(DxfGroup.toString( 6, "")); |
||
1420 | fw.write(DxfGroup.toString( 40, 0.0, 4)); |
||
1421 | fw.write(DxfGroup.toString( 41, 0.0, 4)); |
||
1422 | fw.write(DxfGroup.toString( 42, 0.0, 4)); |
||
1423 | fw.write(DxfGroup.toString( 43, 0.0, 4)); |
||
1424 | fw.write(DxfGroup.toString( 44, 0.0, 4)); |
||
1425 | fw.write(DxfGroup.toString( 45, 0.0, 4)); |
||
1426 | fw.write(DxfGroup.toString( 46, 0.0, 4)); |
||
1427 | fw.write(DxfGroup.toString( 47, 0.0, 4)); |
||
1428 | fw.write(DxfGroup.toString( 48, 0.0, 4)); |
||
1429 | fw.write(DxfGroup.toString( 49, 0.0, 4)); |
||
1430 | fw.write(DxfGroup.toString(140, 0.0, 4)); |
||
1431 | fw.write(DxfGroup.toString(141, 0.0, 4)); |
||
1432 | fw.write(DxfGroup.toString(142, 1.0, 4)); |
||
1433 | fw.write(DxfGroup.toString(143, 1.0, 4)); |
||
1434 | fw.write(DxfGroup.toString( 70, 688)); |
||
1435 | fw.write(DxfGroup.toString( 72, 0)); |
||
1436 | fw.write(DxfGroup.toString( 73, 0)); |
||
1437 | fw.write(DxfGroup.toString( 74, 5)); |
||
1438 | fw.write(DxfGroup.toString( 7, "")); |
||
1439 | fw.write(DxfGroup.toString( 75, 16)); |
||
1440 | fw.write(DxfGroup.toString(147, 1.0, 4)); |
||
1441 | fw.write(DxfGroup.toString(148, 0.0, 4)); |
||
1442 | fw.write(DxfGroup.toString(149, 0.0, 4)); |
||
1443 | fw.write(DxfGroup.toString(100, "AcDbLayout")); |
||
1444 | fw.write(DxfGroup.toString( 1, "Layout1")); |
||
1445 | fw.write(DxfGroup.toString( 70, 1)); |
||
1446 | fw.write(DxfGroup.toString( 71, 1)); |
||
1447 | fw.write(DxfGroup.toString( 10, 0.0, 4)); |
||
1448 | fw.write(DxfGroup.toString( 20, 0.0, 4)); |
||
1449 | fw.write(DxfGroup.toString( 11, 420.0, 4)); |
||
1450 | fw.write(DxfGroup.toString( 21, 297.0, 4)); |
||
1451 | fw.write(DxfGroup.toString( 12, 0.0, 4)); |
||
1452 | fw.write(DxfGroup.toString( 22, 0.0, 4)); |
||
1453 | fw.write(DxfGroup.toString( 32, 0.0, 4)); |
||
1454 | fw.write(DxfGroup.toString( 14, 1.000000000000000E+20, 4)); |
||
1455 | fw.write(DxfGroup.toString( 24, 1.000000000000000E+20, 4)); |
||
1456 | fw.write(DxfGroup.toString( 34, 1.000000000000000E+20, 4)); |
||
1457 | fw.write(DxfGroup.toString( 15, -1.000000000000000E+20, 4)); |
||
1458 | fw.write(DxfGroup.toString( 25, -1.000000000000000E+20, 4)); |
||
1459 | fw.write(DxfGroup.toString( 35, -1.000000000000000E+20, 4)); |
||
1460 | fw.write(DxfGroup.toString(146, 0.0, 4)); |
||
1461 | fw.write(DxfGroup.toString( 13, 0.0, 4)); |
||
1462 | fw.write(DxfGroup.toString( 23, 0.0, 4)); |
||
1463 | fw.write(DxfGroup.toString( 33, 0.0, 4)); |
||
1464 | fw.write(DxfGroup.toString( 16, 1.0, 4)); |
||
1465 | fw.write(DxfGroup.toString( 26, 0.0, 4)); |
||
1466 | fw.write(DxfGroup.toString( 36, 0.0, 4)); |
||
1467 | fw.write(DxfGroup.toString( 17, 0.0, 4)); |
||
1468 | fw.write(DxfGroup.toString( 27, 1.0, 4)); |
||
1469 | fw.write(DxfGroup.toString( 37, 0.0, 4)); |
||
1470 | fw.write(DxfGroup.toString( 76, 0)); |
||
1471 | //fw.write(DxfGroup.toString(330, dw.getPaperSpaceHandle()); // 1B
|
||
1472 | fw.write(DxfGroup.toString(330, "1B")); |
||
1473 | fw.write(DxfGroup.toString( 0, "LAYOUT")); |
||
1474 | fw.write(DxfGroup.toString(5, "22")); |
||
1475 | //dw.handle(); // 22
|
||
1476 | //fw.write(DxfGroup.toString(330, dicId2); // 1A
|
||
1477 | fw.write(DxfGroup.toString(100, "AcDbPlotSettings")); |
||
1478 | fw.write(DxfGroup.toString( 1, "")); |
||
1479 | fw.write(DxfGroup.toString( 2, "C:\\Program Files\\AutoCAD 2002\\plotters\\DWF ePlot (optimized for plotting).pc3")); |
||
1480 | fw.write(DxfGroup.toString( 4, "")); |
||
1481 | fw.write(DxfGroup.toString( 6, "")); |
||
1482 | fw.write(DxfGroup.toString( 40, 0.0, 4)); |
||
1483 | fw.write(DxfGroup.toString( 41, 0.0, 4)); |
||
1484 | fw.write(DxfGroup.toString( 42, 0.0, 4)); |
||
1485 | fw.write(DxfGroup.toString( 43, 0.0, 4)); |
||
1486 | fw.write(DxfGroup.toString( 44, 0.0, 4)); |
||
1487 | fw.write(DxfGroup.toString( 45, 0.0, 4)); |
||
1488 | fw.write(DxfGroup.toString( 46, 0.0, 4)); |
||
1489 | fw.write(DxfGroup.toString( 47, 0.0, 4)); |
||
1490 | fw.write(DxfGroup.toString( 48, 0.0, 4)); |
||
1491 | fw.write(DxfGroup.toString( 49, 0.0, 4)); |
||
1492 | fw.write(DxfGroup.toString(140, 0.0, 4)); |
||
1493 | fw.write(DxfGroup.toString(141, 0.0, 4)); |
||
1494 | fw.write(DxfGroup.toString(142, 1.0, 4)); |
||
1495 | fw.write(DxfGroup.toString(143, 1.0, 4)); |
||
1496 | fw.write(DxfGroup.toString( 70, 1712)); |
||
1497 | fw.write(DxfGroup.toString( 72, 0)); |
||
1498 | fw.write(DxfGroup.toString( 73, 0)); |
||
1499 | fw.write(DxfGroup.toString( 74, 0)); |
||
1500 | fw.write(DxfGroup.toString( 7, "")); |
||
1501 | fw.write(DxfGroup.toString( 75, 0)); |
||
1502 | fw.write(DxfGroup.toString(147, 1.0, 4)); |
||
1503 | fw.write(DxfGroup.toString(148, 0.0, 4)); |
||
1504 | fw.write(DxfGroup.toString(149, 0.0, 4)); |
||
1505 | fw.write(DxfGroup.toString(100, "AcDbLayout")); |
||
1506 | fw.write(DxfGroup.toString( 1, "Model")); |
||
1507 | fw.write(DxfGroup.toString( 70, 1)); |
||
1508 | fw.write(DxfGroup.toString( 71, 0)); |
||
1509 | fw.write(DxfGroup.toString( 10, 0.0, 4)); |
||
1510 | fw.write(DxfGroup.toString( 20, 0.0, 4)); |
||
1511 | fw.write(DxfGroup.toString( 11, 12.0, 4)); |
||
1512 | fw.write(DxfGroup.toString( 21, 9.0, 4)); |
||
1513 | fw.write(DxfGroup.toString( 12, 0.0, 4)); |
||
1514 | fw.write(DxfGroup.toString( 22, 0.0, 4)); |
||
1515 | fw.write(DxfGroup.toString( 32, 0.0, 4)); |
||
1516 | fw.write(DxfGroup.toString( 14, 0.0, 4)); |
||
1517 | fw.write(DxfGroup.toString( 24, 0.0, 4)); |
||
1518 | fw.write(DxfGroup.toString( 34, 0.0, 4)); |
||
1519 | fw.write(DxfGroup.toString( 15, 0.0, 4)); |
||
1520 | fw.write(DxfGroup.toString( 25, 0.0, 4)); |
||
1521 | fw.write(DxfGroup.toString( 35, 0.0, 4)); |
||
1522 | fw.write(DxfGroup.toString(146, 0.0, 4)); |
||
1523 | fw.write(DxfGroup.toString( 13, 0.0, 4)); |
||
1524 | fw.write(DxfGroup.toString( 23, 0.0, 4)); |
||
1525 | fw.write(DxfGroup.toString( 33, 0.0, 4)); |
||
1526 | fw.write(DxfGroup.toString( 16, 1.0, 4)); |
||
1527 | fw.write(DxfGroup.toString( 26, 0.0, 4)); |
||
1528 | fw.write(DxfGroup.toString( 36, 0.0, 4)); |
||
1529 | fw.write(DxfGroup.toString( 17, 0.0, 4)); |
||
1530 | fw.write(DxfGroup.toString( 27, 1.0, 4)); |
||
1531 | fw.write(DxfGroup.toString( 37, 0.0, 4)); |
||
1532 | fw.write(DxfGroup.toString( 76, 0)); |
||
1533 | //fw.write(DxfGroup.toString(330, dw.getModelSpaceHandle()); // 1F
|
||
1534 | fw.write(DxfGroup.toString(330, "1F")); |
||
1535 | fw.write(DxfGroup.toString( 0, "LAYOUT")); |
||
1536 | //dw.handle(); // 26
|
||
1537 | fw.write(DxfGroup.toString(5, "26")); |
||
1538 | //fw.write(DxfGroup.toString(330, dicId2); // 1A
|
||
1539 | fw.write(DxfGroup.toString(100, "AcDbPlotSettings")); |
||
1540 | fw.write(DxfGroup.toString( 1, "")); |
||
1541 | fw.write(DxfGroup.toString( 2, "C:\\Program Files\\AutoCAD 2002\\plotters\\DWF ePlot (optimized for plotting).pc3")); |
||
1542 | fw.write(DxfGroup.toString( 4, "")); |
||
1543 | fw.write(DxfGroup.toString( 6, "")); |
||
1544 | fw.write(DxfGroup.toString( 40, 0.0, 4)); |
||
1545 | fw.write(DxfGroup.toString( 41, 0.0, 4)); |
||
1546 | fw.write(DxfGroup.toString( 42, 0.0, 4)); |
||
1547 | fw.write(DxfGroup.toString( 43, 0.0, 4)); |
||
1548 | fw.write(DxfGroup.toString( 44, 0.0, 4)); |
||
1549 | fw.write(DxfGroup.toString( 45, 0.0, 4)); |
||
1550 | fw.write(DxfGroup.toString( 46, 0.0, 4)); |
||
1551 | fw.write(DxfGroup.toString( 47, 0.0, 4)); |
||
1552 | fw.write(DxfGroup.toString( 48, 0.0, 4)); |
||
1553 | fw.write(DxfGroup.toString( 49, 0.0, 4)); |
||
1554 | fw.write(DxfGroup.toString(140, 0.0, 4)); |
||
1555 | fw.write(DxfGroup.toString(141, 0.0, 4)); |
||
1556 | fw.write(DxfGroup.toString(142, 1.0, 4)); |
||
1557 | fw.write(DxfGroup.toString(143, 1.0, 4)); |
||
1558 | fw.write(DxfGroup.toString( 70, 688)); |
||
1559 | fw.write(DxfGroup.toString( 72, 0)); |
||
1560 | fw.write(DxfGroup.toString( 73, 0)); |
||
1561 | fw.write(DxfGroup.toString( 74, 5)); |
||
1562 | fw.write(DxfGroup.toString( 7, "")); |
||
1563 | fw.write(DxfGroup.toString( 75, 16)); |
||
1564 | fw.write(DxfGroup.toString(147, 1.0, 4)); |
||
1565 | fw.write(DxfGroup.toString(148, 0.0, 4)); |
||
1566 | fw.write(DxfGroup.toString(149, 0.0, 4)); |
||
1567 | fw.write(DxfGroup.toString(100, "AcDbLayout")); |
||
1568 | fw.write(DxfGroup.toString( 1, "Layout2")); |
||
1569 | fw.write(DxfGroup.toString( 70, 1)); |
||
1570 | fw.write(DxfGroup.toString( 71, 2)); |
||
1571 | fw.write(DxfGroup.toString( 10, 0.0, 4)); |
||
1572 | fw.write(DxfGroup.toString( 20, 0.0, 4)); |
||
1573 | fw.write(DxfGroup.toString( 11, 12.0, 4)); |
||
1574 | fw.write(DxfGroup.toString( 21, 9.0, 4)); |
||
1575 | fw.write(DxfGroup.toString( 12, 0.0, 4)); |
||
1576 | fw.write(DxfGroup.toString( 22, 0.0, 4)); |
||
1577 | fw.write(DxfGroup.toString( 32, 0.0, 4)); |
||
1578 | fw.write(DxfGroup.toString( 14, 0.0, 4)); |
||
1579 | fw.write(DxfGroup.toString( 24, 0.0, 4)); |
||
1580 | fw.write(DxfGroup.toString( 34, 0.0, 4)); |
||
1581 | fw.write(DxfGroup.toString( 15, 0.0, 4)); |
||
1582 | fw.write(DxfGroup.toString( 25, 0.0, 4)); |
||
1583 | fw.write(DxfGroup.toString( 35, 0.0, 4)); |
||
1584 | fw.write(DxfGroup.toString(146, 0.0, 4)); |
||
1585 | fw.write(DxfGroup.toString( 13, 0.0, 4)); |
||
1586 | fw.write(DxfGroup.toString( 23, 0.0, 4)); |
||
1587 | fw.write(DxfGroup.toString( 33, 0.0, 4)); |
||
1588 | fw.write(DxfGroup.toString( 16, 1.0, 4)); |
||
1589 | fw.write(DxfGroup.toString( 26, 0.0, 4)); |
||
1590 | fw.write(DxfGroup.toString( 36, 0.0, 4)); |
||
1591 | fw.write(DxfGroup.toString( 17, 0.0, 4)); |
||
1592 | fw.write(DxfGroup.toString( 27, 1.0, 4)); |
||
1593 | fw.write(DxfGroup.toString( 37, 0.0, 4)); |
||
1594 | fw.write(DxfGroup.toString( 76, 0)); |
||
1595 | //fw.write(DxfGroup.toString(330, dw.getPaperSpace0Handle()); // 23
|
||
1596 | fw.write(DxfGroup.toString(330, "23")); |
||
1597 | fw.write(DxfGroup.toString( 0, "DICTIONARY")); |
||
1598 | fw.write(DxfGroup.toString(5, 0x2E)); |
||
1599 | //dicId5 =
|
||
1600 | //dw.handle(); // 2C
|
||
1601 | //fw.write(DxfGroup.toString(330, 0xC); // C
|
||
1602 | fw.write(DxfGroup.toString(100, "AcDbDictionary")); |
||
1603 | fw.write(DxfGroup.toString(281, 1)); |
||
1604 | fw.write(DxfGroup.toString( 3, "DIMASSOC")); |
||
1605 | //fw.write(DxfGroup.toString(350, 0x2F);
|
||
1606 | //fw.write(DxfGroup.toString(350, dw.getNextHandle()+1); // 2E
|
||
1607 | fw.write(DxfGroup.toString(350, 0x30)); // 2E |
||
1608 | fw.write(DxfGroup.toString( 3, "HIDETEXT")); |
||
1609 | //fw.write(DxfGroup.toString(350, 0x2E);
|
||
1610 | //fw.write(DxfGroup.toString(350, dw.getNextHandle()); // 2D
|
||
1611 | fw.write(DxfGroup.toString(350, 0x2F)); // 2D |
||
1612 | fw.write(DxfGroup.toString( 0, "DICTIONARYVAR")); |
||
1613 | fw.write(DxfGroup.toString(5, 0x2F)); |
||
1614 | //dw.handle(); // 2E
|
||
1615 | //fw.write(DxfGroup.toString(330, dicId5); // 2C
|
||
1616 | fw.write(DxfGroup.toString(100, "DictionaryVariables")); |
||
1617 | fw.write(DxfGroup.toString(280, 0)); |
||
1618 | fw.write(DxfGroup.toString( 1, 2)); |
||
1619 | fw.write(DxfGroup.toString( 0, "DICTIONARYVAR")); |
||
1620 | fw.write(DxfGroup.toString(5, 0x30)); |
||
1621 | //dw.handle(); // 2D
|
||
1622 | //fw.write(DxfGroup.toString(330, dicId5); // 2C
|
||
1623 | fw.write(DxfGroup.toString(100, "DictionaryVariables")); |
||
1624 | fw.write(DxfGroup.toString(280, 0)); |
||
1625 | fw.write(DxfGroup.toString( 1, 1)); |
||
1626 | fw.write(DxfGroup.toString(0, "ENDSEC")); |
||
1627 | } |
||
1628 | |||
1629 | /**
|
||
1630 | * Habilita la reproyecci?n cartogr?fica
|
||
1631 | */
|
||
1632 | public void reProject(ICoordTrans rp) { |
||
1633 | System.out.println("Dxf: reproyectando ..."); |
||
1634 | entityMaker.reProject(rp); |
||
1635 | } |
||
1636 | |||
1637 | /* (non-Javadoc)
|
||
1638 | * @see org.cresques.io.GeoFile#close()
|
||
1639 | */
|
||
1640 | public void close() { |
||
1641 | // TODO Auto-generated method stub
|
||
1642 | |||
1643 | } |
||
1644 | |||
1645 | /**
|
||
1646 | * Informa sobre si estamos trabajando con el modelo de datos GIS o con el de CAD
|
||
1647 | * @return Returns the cadFlag.
|
||
1648 | */
|
||
1649 | public boolean isCadFlag() { |
||
1650 | return cadFlag;
|
||
1651 | } |
||
1652 | |||
1653 | /**
|
||
1654 | * Establece si trabajamos con el modelo de datos GIS o con el de CAD
|
||
1655 | * @param cadFlag The cadFlag to set.
|
||
1656 | */
|
||
1657 | public void setCadFlag(boolean cadFlag) { |
||
1658 | this.cadFlag = cadFlag;
|
||
1659 | } |
||
1660 | |||
1661 | /**
|
||
1662 | * @return Returns the dxf3DFlag.
|
||
1663 | */
|
||
1664 | public boolean isDxf3DFlag() { |
||
1665 | return dxf3DFlag;
|
||
1666 | } |
||
1667 | |||
1668 | /**
|
||
1669 | * @param dxf3DFlag The dxf3DFlag to set.
|
||
1670 | */
|
||
1671 | public void setDxf3DFlag(boolean dxf3DFlag) { |
||
1672 | this.dxf3DFlag = dxf3DFlag;
|
||
1673 | } |
||
1674 | } |