root / trunk / libraries / libDwg / src / com / iver / cit / jdwglib / dwg / readers / objreaders / v1314 / DwgVertex2DReader1314.java @ 10858
History | View | Annotate | Download (2.39 KB)
1 |
/*
|
---|---|
2 |
* Created on 25-ene-2007 by azabala
|
3 |
*
|
4 |
*/
|
5 |
package com.iver.cit.jdwglib.dwg.readers.objreaders.v1314; |
6 |
|
7 |
import java.util.List; |
8 |
|
9 |
import com.iver.cit.jdwglib.dwg.CorruptedDwgEntityException; |
10 |
import com.iver.cit.jdwglib.dwg.DwgObject; |
11 |
import com.iver.cit.jdwglib.dwg.DwgUtil; |
12 |
import com.iver.cit.jdwglib.dwg.objects.DwgVertex2D; |
13 |
|
14 |
/**
|
15 |
* @author alzabord
|
16 |
|
17 |
*/
|
18 |
public class DwgVertex2DReader1314 extends AbstractDwg1314Reader{ |
19 |
|
20 |
/* (non-Javadoc)
|
21 |
* @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
|
22 |
*/
|
23 |
public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException { |
24 |
if(! (dwgObj instanceof DwgVertex2D)) |
25 |
throw new RuntimeException("ArcReader 14 solo puede leer DwgHatch"); |
26 |
DwgVertex2D v = (DwgVertex2D) dwgObj; |
27 |
|
28 |
int bitPos = offset;
|
29 |
bitPos = headTailReader.readObjectHeader(data, bitPos, v); |
30 |
|
31 |
List val = DwgUtil.getRawChar(data, bitPos);
|
32 |
bitPos = ((Integer) val.get(0)).intValue(); |
33 |
int flags = ((Integer) val.get(1)).intValue(); |
34 |
v.setFlags(flags); |
35 |
|
36 |
val = DwgUtil.getBitDouble(data, bitPos); |
37 |
bitPos = ((Integer) val.get(0)).intValue(); |
38 |
double x = ((Double) val.get(1)).doubleValue(); |
39 |
|
40 |
val = DwgUtil.getBitDouble(data, bitPos); |
41 |
bitPos = ((Integer) val.get(0)).intValue(); |
42 |
double y = ((Double) val.get(1)).doubleValue(); |
43 |
|
44 |
val = DwgUtil.getBitDouble(data, bitPos); |
45 |
bitPos = ((Integer) val.get(0)).intValue(); |
46 |
double z = ((Double) val.get(1)).doubleValue(); |
47 |
v.setPoint(new double[]{x, y, z}); |
48 |
|
49 |
val = DwgUtil.getBitDouble(data, bitPos); |
50 |
bitPos = ((Integer) val.get(0)).intValue(); |
51 |
double sw = ((Double) val.get(1)).doubleValue(); |
52 |
double ew = 0d; |
53 |
if(sw < 0d){ |
54 |
sw = Math.abs(sw);
|
55 |
ew = sw; |
56 |
}else{
|
57 |
val = DwgUtil.getBitDouble(data, bitPos); |
58 |
bitPos = ((Integer) val.get(0)).intValue(); |
59 |
ew = ((Double) val.get(1)).doubleValue(); |
60 |
} |
61 |
v.setInitWidth(sw); |
62 |
v.setEndWidth(ew); |
63 |
|
64 |
val = DwgUtil.getBitDouble(data, bitPos); |
65 |
bitPos = ((Integer) val.get(0)).intValue(); |
66 |
double bulge = ((Double) val.get(1)).doubleValue(); |
67 |
v.setBulge(bulge); |
68 |
|
69 |
val = DwgUtil.getBitDouble(data, bitPos); |
70 |
bitPos = ((Integer) val.get(0)).intValue(); |
71 |
double tangentDir = ((Double) val.get(1)).doubleValue(); |
72 |
v.setTangentDir(tangentDir); |
73 |
|
74 |
bitPos = headTailReader.readObjectTailer(data, bitPos, v); |
75 |
} |
76 |
} |