forked from geodmms/xdgnjobs

?? ?
2008-05-05 286dd94a39c2ffba32bbe9feac39c80f75efc19c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package com.ximple.io.dgn7;
 
/**
 * TcbElement
 *
 * @author Ulysses
 * @version 0.1
 * @since 2006/5/18 下午 05:03:46
 */
public class TcbElement extends Element
{
    public TcbElement(short[] raw)
    {
        super(raw);
    }
 
    public boolean is2D()
    {
        int dimension = (int) (raw[607] & 0x00000004);
 
        if (dimension == 0)
        {
            return true;
        } else
        {
            return false;
        }
    }
 
    public String getMasterUnitName()
    {
        byte[] master = new byte[1];
 
        master[0] = (byte) (raw[560] & 0x00ff);
        java.nio.charset.Charset.forName("US-ASCII");
 
        // ASCIIEncoding encode = new ASCIIEncoding();
        StringBuffer sb = new StringBuffer();
 
        sb.append((char) master[0]);
 
        // return encode.GetString(master);
        return sb.toString();
    }
 
    public String getSubUnitName()
    {
        byte[] sub = new byte[2];
 
        sub[0] = (byte) (raw[561] & 0x00ff);
        sub[1] = (byte) (raw[561] >> 8 & 0x00ff);
 
        StringBuffer sb = new StringBuffer();
 
        sb.append((char) sub[0]);
        sb.append((char) sub[0]);
 
        return sb.toString();
    }
 
    public int getGraphicGroup()
    {
        return (int) (raw[594] & 0x0000ffff);
    }
 
    public static class ElementHandler extends Element.ElementHandler
    {
        private static ElementHandler instance = null;
 
        public ElementHandler()
        {
            super(ElementType.TCB);
        }
 
        public static IElementHandler getInstance()
        {
            if (instance == null)
            {
                instance = new ElementHandler();
            }
 
            return instance;
        }
 
        protected Element createElement(short[] raw)
        {
            return new TcbElement(raw);
        }
    }
}