Statistics
| Revision:

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

History | View | Annotate | Download (2.88 KB)

1
/*
2
 * Created on 25-ene-2007 by azabala
3
 *
4
 */
5
package com.iver.cit.jdwglib.dwg.readers.objreaders.v15;
6

    
7
import java.util.ArrayList;
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.DwgEllipse;
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 DwgEllipseReader15 extends AbstractDwg15Reader{
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 DwgEllipse))
27
                        throw new RuntimeException("ArcReader 15 solo puede leer DwgEllipse");
28
                DwgEllipse ell = (DwgEllipse) dwgObj;
29
                int bitPos = offset;
30
                bitPos = headTailReader.readObjectHeader(data, bitPos, ell);
31
                ArrayList v = DwgUtil.getBitDouble(data, bitPos);
32
                bitPos = ((Integer)v.get(0)).intValue();
33
                double x = ((Double)v.get(1)).doubleValue();
34
                v = DwgUtil.getBitDouble(data, bitPos);
35
                bitPos = ((Integer)v.get(0)).intValue();
36
                double y = ((Double)v.get(1)).doubleValue();
37
                v = DwgUtil.getBitDouble(data, bitPos);
38
                bitPos = ((Integer)v.get(0)).intValue();
39
                double z = ((Double)v.get(1)).doubleValue();
40
                double[] coord = new double[]{x, y, z};
41
                ell.setCenter(coord);
42
                v = DwgUtil.getBitDouble(data, bitPos);
43
                bitPos = ((Integer)v.get(0)).intValue();
44
                x = ((Double)v.get(1)).doubleValue();
45
                v = DwgUtil.getBitDouble(data, bitPos);
46
                bitPos = ((Integer)v.get(0)).intValue();
47
                y = ((Double)v.get(1)).doubleValue();
48
                v = DwgUtil.getBitDouble(data, bitPos);
49
                bitPos = ((Integer)v.get(0)).intValue();
50
                z = ((Double)v.get(1)).doubleValue();
51
                coord = new double[]{x, y, z};
52
                ell.setMajorAxisVector(coord);
53
                v = DwgUtil.getBitDouble(data, bitPos);
54
                bitPos = ((Integer)v.get(0)).intValue();
55
                x = ((Double)v.get(1)).doubleValue();
56
                v = DwgUtil.getBitDouble(data, bitPos);
57
                bitPos = ((Integer)v.get(0)).intValue();
58
                y = ((Double)v.get(1)).doubleValue();
59
                v = DwgUtil.getBitDouble(data, bitPos);
60
                bitPos = ((Integer)v.get(0)).intValue();
61
                z = ((Double)v.get(1)).doubleValue();
62
                coord = new double[]{x, y, z};
63
                ell.setExtrusion(coord);
64
                v = DwgUtil.getBitDouble(data, bitPos);
65
                bitPos = ((Integer)v.get(0)).intValue();
66
                double val = ((Double)v.get(1)).doubleValue();
67
                ell.setAxisRatio(val);
68
                v = DwgUtil.getBitDouble(data, bitPos);
69
                bitPos = ((Integer)v.get(0)).intValue();
70
                val = ((Double)v.get(1)).doubleValue();
71
                ell.setInitAngle(val);
72
                v = DwgUtil.getBitDouble(data, bitPos);
73
                bitPos = ((Integer)v.get(0)).intValue();
74
                val = ((Double)v.get(1)).doubleValue();
75
                ell.setEndAngle(val);
76
                bitPos = headTailReader.readObjectTailer(data, bitPos, ell);
77
        }
78
}