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(byte[] 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(byte[] raw)
|
{
|
return new TcbElement(raw);
|
}
|
}
|
}
|