Revision 10054 trunk/libraries/libDwg/src/com/iver/cit/jdwglib/dwg/readers/DwgFileV15Reader.java
DwgFileV15Reader.java | ||
---|---|---|
38 | 38 |
import java.nio.ByteBuffer; |
39 | 39 |
import java.nio.ByteOrder; |
40 | 40 |
import java.util.ArrayList; |
41 |
import java.util.logging.Logger; |
|
42 |
|
|
41 | 43 |
import com.iver.cit.gvsig.fmap.drivers.dgn.ByteUtils; |
44 |
import com.iver.cit.jdwglib.dwg.CorruptedDwgEntityException; |
|
42 | 45 |
import com.iver.cit.jdwglib.dwg.DwgFile; |
43 | 46 |
import com.iver.cit.jdwglib.dwg.DwgHandleReference; |
44 | 47 |
import com.iver.cit.jdwglib.dwg.DwgObject; |
... | ... | |
233 | 236 |
* @param offset |
234 | 237 |
* The current bit offset where the value begins |
235 | 238 |
* @return int New offset |
236 |
* @throws Exception |
|
237 |
* If an unexpected bit value is found in the DWG file. Occurs |
|
238 |
* when we are looking for LwPolylines. |
|
239 | 239 |
*/ |
240 |
public int readObjectHeader(int[] data, int offset, DwgObject dwgObject) |
|
241 |
throws Exception { |
|
240 |
public int readObjectHeader(int[] data, int offset, DwgObject dwgObject) { |
|
242 | 241 |
int bitPos = offset; |
243 | 242 |
Integer mode = (Integer) DwgUtil.getBits(data, 2, bitPos); |
244 | 243 |
bitPos = bitPos + 2; |
... | ... | |
288 | 287 |
* @param offset |
289 | 288 |
* Offset for this array of bytes |
290 | 289 |
* @return int New offset |
291 |
* @throws Exception |
|
292 |
* If an unexpected bit value is found in the DWG file. Occurs |
|
293 |
* when we are looking for LwPolylines. |
|
290 |
* @throws CorruptedDwgEntityException |
|
291 |
* @throws RuntimeException |
|
294 | 292 |
*/ |
295 |
public int readObjectTailer(int[] data, int offset, DwgObject dwgObject) |
|
296 |
throws Exception { |
|
293 |
public int readObjectTailer(int[] data, int offset, DwgObject dwgObject) throws RuntimeException, CorruptedDwgEntityException { |
|
297 | 294 |
int bitPos = offset; |
298 | 295 |
/* |
299 | 296 |
* Subentity ref handle. Esto se aplica sobre VERTEX, ATTRIB, SEQEND |
... | ... | |
305 | 302 |
} |
306 | 303 |
|
307 | 304 |
/* |
308 |
* Reactors handles |
|
305 |
* Reactors handles TODO No se est?n usando para setear nada en
|
|
309 | 306 |
* DwgObject |
310 | 307 |
*/ |
311 | 308 |
DwgHandleReference reactorHandle; |
... | ... | |
326 | 323 |
* Layer Handle code |
327 | 324 |
*/ |
328 | 325 |
|
329 |
DwgHandleReference layerHandle = new DwgHandleReference(); |
|
330 |
bitPos = layerHandle.read(data, bitPos); |
|
331 |
dwgObject.setLayerHandle(layerHandle); |
|
326 |
DwgHandleReference handle = new DwgHandleReference(); |
|
327 |
bitPos = handle.read(data, bitPos); |
|
328 |
dwgObject.setLayerHandle(handle); |
|
329 |
|
|
330 |
// System.out.println(cadena + " ==> " + handle); |
|
332 | 331 |
|
333 | 332 |
if (!dwgObject.isNoLinks()) { |
334 | 333 |
|
... | ... | |
401 | 400 |
int type = ((Integer) v.get(1)).intValue(); |
402 | 401 |
|
403 | 402 |
obj = DwgObjectFactory.getInstance().create(type, index); |
404 |
|
|
405 |
System.out.println("CREANDO UN " + obj.getClass().getName()); |
|
406 | 403 |
|
404 |
// System.out.println("CREANDO UN " + obj.getClass().getName()); |
|
405 |
|
|
407 | 406 |
v = DwgUtil.getRawLong(data, bitPos); |
408 | 407 |
bitPos = ((Integer) v.get(0)).intValue(); |
409 | 408 |
int objBSize = ((Integer) v.get(1)).intValue(); |
... | ... | |
441 | 440 |
readSpecificObject(obj, data, bitPos); |
442 | 441 |
// else |
443 | 442 |
// System.out.println("Dwg Object desconocido:"+obj.getType()); |
444 |
} catch (Exception e) { |
|
443 |
} catch (RuntimeException e) {
|
|
445 | 444 |
e.printStackTrace(); |
445 |
} catch (CorruptedDwgEntityException e) { |
|
446 |
// TODO Auto-generated catch block |
|
447 |
e.printStackTrace(); |
|
448 |
return null; |
|
449 |
|
|
446 | 450 |
} |
447 | 451 |
return obj; |
448 | 452 |
} |
... | ... | |
453 | 457 |
* |
454 | 458 |
*/ |
455 | 459 |
protected void readSpecificObject(DwgObject obj, int[] data, int bitPos) |
456 |
throws Exception { |
|
460 |
throws RuntimeException, CorruptedDwgEntityException {
|
|
457 | 461 |
DwgObjectReaderPool pool = DwgObjectReaderPool.getInstance(); |
458 | 462 |
IDwgObjectReader reader = pool.get(obj, "15"); |
459 | 463 |
if(reader != null){ |
Also available in: Unified diff