Revision 10482 trunk/libraries/libDwg/src/com/iver/cit/jdwglib/dwg/DwgObjectFactory.java
DwgObjectFactory.java | ||
---|---|---|
45 | 45 |
* |
46 | 46 |
* $Id$ |
47 | 47 |
* $Log$ |
48 |
* Revision 1.13 2007-02-14 09:20:32 fdiaz |
|
48 |
* Revision 1.14 2007-02-22 20:45:51 azabala |
|
49 |
* changes to add dwg 12 entities creation |
|
50 |
* |
|
51 |
* Revision 1.13 2007/02/14 09:20:32 fdiaz |
|
49 | 52 |
* Eliminado un comentario y habilitado de nuevo el else del final del metodo create. |
50 | 53 |
* |
51 | 54 |
* Revision 1.12 2007/02/08 20:27:06 azabala |
... | ... | |
97 | 100 |
import com.iver.cit.jdwglib.dwg.objects.DwgCircle; |
98 | 101 |
import com.iver.cit.jdwglib.dwg.objects.DwgDictionary; |
99 | 102 |
import com.iver.cit.jdwglib.dwg.objects.DwgDictionaryVar; |
103 |
import com.iver.cit.jdwglib.dwg.objects.DwgDimOrd; |
|
100 | 104 |
import com.iver.cit.jdwglib.dwg.objects.DwgEllipse; |
101 | 105 |
import com.iver.cit.jdwglib.dwg.objects.DwgEndblk; |
106 |
import com.iver.cit.jdwglib.dwg.objects.DwgFace3D; |
|
102 | 107 |
import com.iver.cit.jdwglib.dwg.objects.DwgHatch; |
103 | 108 |
import com.iver.cit.jdwglib.dwg.objects.DwgIdBuffer; |
104 | 109 |
import com.iver.cit.jdwglib.dwg.objects.DwgImage; |
... | ... | |
128 | 133 |
import com.iver.cit.jdwglib.dwg.objects.DwgVertex3D; |
129 | 134 |
import com.iver.cit.jdwglib.dwg.objects.DwgXRecord; |
130 | 135 |
|
136 |
|
|
131 | 137 |
/** |
132 |
* Factory that creates dwg entities from its code. |
|
138 |
* Factory that creates dwg entities from its code (int value).
|
|
133 | 139 |
* |
140 |
* Some DWG entities dont have a fixed "type code". Instead, their type |
|
141 |
* is specified in the CLASSES section of the dwg file. |
|
142 |
* |
|
143 |
* |
|
144 |
* |
|
134 | 145 |
* It's a singleton |
135 | 146 |
* |
136 | 147 |
*/ |
... | ... | |
140 | 151 |
|
141 | 152 |
private DwgObjectFactory() { |
142 | 153 |
} |
154 |
|
|
155 |
/* |
|
156 |
* Constants to represent polyline2d, polyline3d, |
|
157 |
* vertex2d and vertex3d. |
|
158 |
* */ |
|
159 |
public static final byte POLYLINE2D = 40; |
|
160 |
public static final byte POLYLINE3D = 41; |
|
161 |
public static final byte VERTEX2D = 50; |
|
162 |
public static final byte VERTEX3D = 51; |
|
143 | 163 |
|
144 | 164 |
public static final DwgObjectFactory getInstance() { |
145 | 165 |
return _instance; |
146 | 166 |
} |
147 | 167 |
|
168 |
|
|
169 |
/** |
|
170 |
* Creates a Dwg object instance from its type. |
|
171 |
* |
|
172 |
* This method is used for DWG 13, 14 and 2000 files. |
|
173 |
* |
|
174 |
* */ |
|
148 | 175 |
public DwgObject create(int type, int index) { |
149 | 176 |
DwgObject obj = null; |
150 | 177 |
|
... | ... | |
277 | 304 |
* |
278 | 305 |
* This method is used to create entities without a fixed dwg code type |
279 | 306 |
* (entities whose type is > 500) |
307 |
* |
|
308 |
* This method is used for DWG 13, 14 and 2000 files. |
|
280 | 309 |
* |
281 | 310 |
*/ |
282 | 311 |
public DwgObject create(String dxfName, int index) { |
... | ... | |
317 | 346 |
return new DwgXRecord(index); |
318 | 347 |
return null; |
319 | 348 |
} |
349 |
|
|
350 |
/** |
|
351 |
* Creates a DWG object for DWG 12 files. |
|
352 |
* |
|
353 |
* */ |
|
354 |
//TODO REVISAR POLYLINE Y VERTEX |
|
355 |
public DwgObject create(byte kind, int index){ |
|
356 |
switch(kind){ |
|
357 |
case 1: |
|
358 |
return new DwgLine(index); |
|
359 |
case 2: |
|
360 |
return new DwgPoint(index); |
|
361 |
case 3: |
|
362 |
return new DwgCircle(index); |
|
363 |
// case 4://un dxf shape es un fichero externo que define una forma |
|
364 |
//(un tipo rudimentario de svg) |
|
365 |
// return new DwgShape() |
|
366 |
case 7: |
|
367 |
return new DwgText(index); |
|
368 |
case 8: |
|
369 |
return new DwgArc(index); |
|
370 |
// case 9: //It is a 3D quad |
|
371 |
// return new DwgTrace(index); |
|
372 |
|
|
373 |
case 12: |
|
374 |
return new DwgSolid(index); |
|
375 |
case 13: |
|
376 |
return new DwgBlock(index); |
|
377 |
case 14: |
|
378 |
return new DwgEndblk(index); |
|
379 |
case 15: |
|
380 |
return new DwgInsert(index); |
|
381 |
case 16: |
|
382 |
return new DwgAttdef(index); |
|
383 |
case 17: |
|
384 |
return new DwgAttrib(index); |
|
385 |
case 18://no estoy seguro de q esto sea SbEnd |
|
386 |
return new DwgSeqend(index); |
|
387 |
// case 20://la polilinea es un caso especial |
|
388 |
// return new DwgPolyline3D(index); |
|
389 |
// case 21://los vertices tb |
|
390 |
// return new DwgVertex3D(index); |
|
391 |
case 23: |
|
392 |
return new DwgFace3D(index); |
|
393 |
case 24: //esto es Dim ?? |
|
394 |
return new DwgDimOrd(index); |
|
395 |
// case 25://no implementado |
|
396 |
// return new DwgVPort(index); |
|
397 |
case POLYLINE2D: |
|
398 |
return new DwgPolyline2D(index); |
|
399 |
case POLYLINE3D: |
|
400 |
return new DwgPolyline3D(index); |
|
401 |
case VERTEX2D: |
|
402 |
return new DwgVertex2D(index); |
|
403 |
case VERTEX3D: |
|
404 |
return new DwgVertex3D(index); |
|
405 |
default: |
|
406 |
return null; |
|
407 |
} |
|
408 |
} |
|
320 | 409 |
} |
Also available in: Unified diff