root / trunk / org.gvsig.dwg / org.gvsig.dwg.lib / src / main / java / org / gvsig / dwg / lib / readers / v1314 / DwgLayerReader1314.java @ 5
History | View | Annotate | Download (3.27 KB)
1 |
/*
|
---|---|
2 |
* Created on 25-ene-2007 by azabala
|
3 |
*
|
4 |
*/
|
5 |
package org.gvsig.dwg.lib.readers.v1314; |
6 |
|
7 |
import java.util.List; |
8 |
|
9 |
import org.gvsig.dwg.lib.CorruptedDwgEntityException; |
10 |
import org.gvsig.dwg.lib.DwgHandleReference; |
11 |
import org.gvsig.dwg.lib.DwgObject; |
12 |
import org.gvsig.dwg.lib.DwgUtil; |
13 |
import org.gvsig.dwg.lib.objects.DwgLayer; |
14 |
|
15 |
|
16 |
/**
|
17 |
* @author alzabord
|
18 |
*/
|
19 |
public class DwgLayerReader1314 extends AbstractDwg1314Reader{ |
20 |
|
21 |
/* (non-Javadoc)
|
22 |
* @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
|
23 |
*/
|
24 |
public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException { |
25 |
if(! (dwgObj instanceof DwgLayer)) |
26 |
throw new RuntimeException("ArcReader 14 solo puede leer DwgLayer"); |
27 |
DwgLayer lyr = (DwgLayer) dwgObj; |
28 |
int bitPos = offset;
|
29 |
|
30 |
List val = DwgUtil.getBitLong(data, bitPos);
|
31 |
bitPos = ((Integer) val.get(0)).intValue(); |
32 |
int numReactors = ((Integer) val.get(1)).intValue(); |
33 |
lyr.setNumReactors(numReactors); |
34 |
|
35 |
val = DwgUtil.getTextString(data, bitPos); |
36 |
bitPos = ((Integer) val.get(0)).intValue(); |
37 |
String name = (String) val.get(1); |
38 |
lyr.setName(name); |
39 |
|
40 |
val = DwgUtil.testBit(data, bitPos); |
41 |
bitPos = ((Integer) val.get(0)).intValue(); |
42 |
boolean flag64 = ((Boolean) val.get(1)).booleanValue(); |
43 |
lyr.setFlag64(flag64); |
44 |
|
45 |
//TODO Las layers tb pueden ser referencia externa??
|
46 |
val = DwgUtil.getBitShort(data, bitPos); |
47 |
bitPos = ((Integer) val.get(0)).intValue(); |
48 |
int xRefPlus = ((Integer) val.get(1)).intValue(); |
49 |
lyr.setXRefPlus(xRefPlus); |
50 |
|
51 |
val = DwgUtil.testBit(data, bitPos); |
52 |
bitPos = ((Integer) val.get(0)).intValue(); |
53 |
boolean xdep = ((Boolean) val.get(1)).booleanValue(); |
54 |
lyr.setXdep(xdep); |
55 |
|
56 |
val = DwgUtil.testBit(data, bitPos); |
57 |
bitPos = ((Integer) val.get(0)).intValue(); |
58 |
boolean frozen = ((Boolean) val.get(1)).booleanValue(); |
59 |
lyr.setFrozen(frozen); |
60 |
|
61 |
val = DwgUtil.testBit(data, bitPos); |
62 |
bitPos = ((Integer) val.get(0)).intValue(); |
63 |
boolean on = ((Boolean) val.get(1)).booleanValue(); |
64 |
lyr.setOn(on); |
65 |
|
66 |
val = DwgUtil.testBit(data, bitPos); |
67 |
bitPos = ((Integer) val.get(0)).intValue(); |
68 |
boolean frozenInNew = ((Boolean) val.get(1)).booleanValue(); |
69 |
lyr.setFrozenInNew(frozenInNew); |
70 |
|
71 |
val = DwgUtil.testBit(data, bitPos); |
72 |
bitPos = ((Integer) val.get(0)).intValue(); |
73 |
boolean locked = ((Boolean) val.get(1)).booleanValue(); |
74 |
lyr.setLocked(locked); |
75 |
|
76 |
val = DwgUtil.getBitShort(data, bitPos); |
77 |
bitPos = ((Integer) val.get(0)).intValue(); |
78 |
int color = ((Integer) val.get(1)).intValue(); |
79 |
lyr.setColor(color); |
80 |
|
81 |
DwgHandleReference handle = new DwgHandleReference();
|
82 |
bitPos = handle.read(data, bitPos); |
83 |
lyr.setLayerControlHandle(handle); |
84 |
|
85 |
for(int i = 0; i < numReactors; i++){ |
86 |
handle = new DwgHandleReference();
|
87 |
bitPos = handle.read(data, bitPos); |
88 |
lyr.addReactorHandle(handle); |
89 |
} |
90 |
|
91 |
handle = new DwgHandleReference();
|
92 |
bitPos = handle.read(data, bitPos); |
93 |
lyr.setXDicObjHandle(handle); |
94 |
|
95 |
handle = new DwgHandleReference();
|
96 |
bitPos = handle.read(data, bitPos); |
97 |
lyr.setNullHandle(handle); |
98 |
|
99 |
handle = new DwgHandleReference();
|
100 |
bitPos = handle.read(data, bitPos); |
101 |
lyr.setLineTypeHandle(handle); |
102 |
} |
103 |
|
104 |
} |