Statistics
| Revision:

svn-gvsig-desktop / branches / v10 / libraries / libDwg / src / com / iver / cit / jdwglib / dwg / readers / objreaders / v1314 / DwgArcReader1314.java @ 10539

History | View | Annotate | Download (2.7 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.DwgArc;
13

    
14
/**
15
 * @author alzabord
16
 *
17
 * TODO To change the template for this generated type comment go to
18
 * Window - Preferences - Java - Code Style - Code Templates
19
 */
20
public class DwgArcReader1314 extends AbstractDwg1314Reader{
21

    
22
        /* (non-Javadoc)
23
         * @see com.iver.cit.jdwglib.dwg.readers.IDwgObjectReader#readSpecificObj(int[], int, com.iver.cit.jdwglib.dwg.DwgObject)
24
         */
25
        public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
26
                if(! (dwgObj instanceof DwgArc))
27
                    throw new RuntimeException("ArcReader 14 solo puede leer DwgArc");
28
                DwgArc arc = (DwgArc) dwgObj;
29
                int bitPos = offset;
30
                bitPos = headTailReader.readObjectHeader(data, bitPos, arc);
31
                
32
                List val = DwgUtil.getBitDouble(data, bitPos);
33
                bitPos = ((Integer) val.get(0)).intValue();
34
                double x = ((Double) val.get(1)).doubleValue();
35
                
36
                val = DwgUtil.getBitDouble(data, bitPos);
37
                bitPos = ((Integer) val.get(0)).intValue();
38
                double y = ((Double) val.get(1)).doubleValue();
39
                
40
                val = DwgUtil.getBitDouble(data, bitPos);
41
                bitPos = ((Integer) val.get(0)).intValue();
42
                double z = ((Double) val.get(1)).doubleValue();
43
                arc.setCenter(new double[]{x, y, z});
44
                
45
                val = DwgUtil.getBitDouble(data, bitPos);
46
                bitPos = ((Integer) val.get(0)).intValue();
47
                double radius = ((Double) val.get(1)).doubleValue();
48
                arc.setRadius(radius);
49
                
50
                val = DwgUtil.getBitDouble(data, bitPos);
51
                bitPos = ((Integer) val.get(0)).intValue();
52
                double thickness = ((Double) val.get(1)).doubleValue();
53
                arc.setThickness(thickness);
54
                
55
                val = DwgUtil.getBitDouble(data, bitPos);
56
                bitPos = ((Integer) val.get(0)).intValue();
57
                x = ((Double) val.get(1)).doubleValue();
58
                
59
                val = DwgUtil.getBitDouble(data, bitPos);
60
                bitPos = ((Integer) val.get(0)).intValue();
61
                y = ((Double) val.get(1)).doubleValue();
62
                
63
                val = DwgUtil.getBitDouble(data, bitPos);
64
                bitPos = ((Integer) val.get(0)).intValue();
65
                z = ((Double) val.get(1)).doubleValue();
66
                arc.setExtrusion(new double[]{x, y, z});
67
                
68
                val = DwgUtil.getBitDouble(data, bitPos);
69
                bitPos = ((Integer) val.get(0)).intValue();
70
                double startAngle = ((Double) val.get(1)).doubleValue();
71
                arc.setInitAngle(startAngle);
72
                
73
                val = DwgUtil.getBitDouble(data, bitPos);
74
                bitPos = ((Integer) val.get(0)).intValue();
75
                double endAngle = ((Double) val.get(1)).doubleValue();
76
                arc.setEndAngle(endAngle);
77
                
78
                bitPos = headTailReader.readObjectTailer(data, bitPos, arc);
79
        }
80
}