Revision 12 trunk/libraries/libCq CMS for java.old/src/org/cresques/io/DxfFile.java

View differences:

DxfFile.java
9 9
import java.io.BufferedReader;
10 10
import java.io.FileNotFoundException;
11 11
import java.io.FileReader;
12
import java.io.FileWriter;
12 13
import java.io.IOException;
13 14
import java.io.InputStream;
14 15
import java.io.InputStreamReader;
15 16
import java.io.Reader;
17
import java.util.Date;
16 18
import java.util.Hashtable;
17 19
import java.util.Vector;
18 20

  
......
53 55
		public void createLine(DxfGroupVector v) throws Exception ;
54 56
		public void createText(DxfGroupVector v) throws Exception ;
55 57
		public void createSolid(DxfGroupVector v) throws Exception ;
56
		public Ent getEnt
57 58
		public void reProject(ReProjection rp);
58 59
	};
59 60
	
......
235 236
		//System.out.println("Seccion ENTITIES, linea "+ l+ " (SALGO)");
236 237
	}
237 238
	
238
	public void save(String fName) {
239
	public void save(String fName) throws IOException {
240
		fName = DataSource.normalize(fName);
241
		FileWriter fw = new FileWriter(fName);
242
		writeHeader(fw);
243
		writeSections(fw);
244
		writeEntities(fw);
245
		fw.close();
239 246
	}
240 247
	
248
	public void writeHeader(FileWriter fw) throws IOException {
249
			// COMMENTAIRES DU TRADUCTEUR
250
//			fw.write(DxfGroup.toString(999, Integer.toString(features.size()) + " features")); 
251
			fw.write(DxfGroup.toString(999, "TRANSLATION BY geo.cresques.io.DxfFile"));
252
			fw.write(DxfGroup.toString(999, "DATE : " + (new Date()).toString()));
253
			// ECRITURE DU HEADER
254
			fw.write(DxfGroup.toString(0, "SECTION"));
255
			fw.write(DxfGroup.toString(2, "HEADER"));
256
			fw.write(DxfGroup.toString(9, "$ACADVER"));
257
				fw.write(DxfGroup.toString(1, "AC1009"));
258
			fw.write(DxfGroup.toString(9, "$CECOLOR"));
259
				fw.write(DxfGroup.toString(62, 256));
260
			fw.write(DxfGroup.toString(9, "$CELTYPE"));
261
				fw.write(DxfGroup.toString(6, "DUPLAN"));
262
			fw.write(DxfGroup.toString(9, "$CLAYER"));
263
				fw.write(DxfGroup.toString(8, 0));
264
			fw.write(DxfGroup.toString(9, "$ELEVATION"));
265
				fw.write(DxfGroup.toString(40, 0.0, 3));
266
			fw.write(DxfGroup.toString(9, "$EXTMAX"));
267
				fw.write(DxfGroup.toString(10, extent.maxX(), 6));
268
				fw.write(DxfGroup.toString(20, extent.maxX(), 6));
269
				//fw.write(DxfGroup.toString(30, envelope.getMaxX(), 6));
270
			fw.write(DxfGroup.toString(9, "$EXTMIN"));
271
				fw.write(DxfGroup.toString(10, extent.minX(), 6));
272
				fw.write(DxfGroup.toString(20, extent.minX(), 6));
273
				//fw.write(DxfGroup.toString(30, envelope.getMaxX(), 6));
274
			fw.write(DxfGroup.toString(9, "$INSBASE"));
275
				fw.write(DxfGroup.toString(10, 0.0, 1));
276
				fw.write(DxfGroup.toString(20, 0.0, 1));
277
				fw.write(DxfGroup.toString(30, 0.0, 1));
278
			fw.write(DxfGroup.toString(9, "$LIMCHECK"));
279
				fw.write(DxfGroup.toString(70, 1));
280
			fw.write(DxfGroup.toString(9, "$LIMMAX"));
281
				fw.write(DxfGroup.toString(10, extent.maxX(), 6));
282
				fw.write(DxfGroup.toString(20, extent.maxX(), 6));
283
			fw.write(DxfGroup.toString(9, "$LIMMIN"));
284
				fw.write(DxfGroup.toString(10, extent.minX(), 6));
285
				fw.write(DxfGroup.toString(20, extent.minX(), 6));
286
			fw.write(DxfGroup.toString(9, "$LUNITS"));
287
				fw.write(DxfGroup.toString(70, 2));
288
			fw.write(DxfGroup.toString(9, "$LUPREC"));
289
				fw.write(DxfGroup.toString(70, 2));
290
			fw.write(DxfGroup.toString(0, "ENDSEC"));
291

  
292
	}
293
	
294
	public void writeSections(FileWriter fw) throws IOException {
295
		writeTables(fw);
296
	}
297
	
298
	public void writeTables(FileWriter fw) throws IOException {
299
	}
300

  
301
	public void writeEntities(FileWriter fw) throws IOException {
302
	}
303
	
241 304
	public void reProject(ReProjection rp) {
242 305
		System.out.println("Dxf: reproyectando ...");
243 306
		entityMaker.reProject(rp);

Also available in: Unified diff