forked from geodmms/xdgnjobs

?? ?
2008-05-14 fe4bda7d456c106e1061afaa29d452e5553e9d96
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextElement.java
@@ -18,52 +18,52 @@
{
    public static final int ED_CENTERJUSTIFICATION = 0;
//  Enter data field center justification
    //  Enter data field center justification
    public static final int ED_LEFTJUSTIFICATION = 0;
//  Enter data field left justification
    //  Enter data field left justification
    public static final int ED_RIGHTJUSTIFICATION = 0;
//  Enter data field right justification
    //  Enter data field right justification
    public static final int TXTJUST_CB = 0;
//  Center/bottom text justification.
    //  Center/bottom text justification.
    public static final int TXTJUST_CC = 0;
//  Center/center text justification.
    //  Center/center text justification.
    public static final int TXTJUST_CT = 0;
//  Center/top text justification.
    //  Center/top text justification.
    public static final int TXTJUST_LB = 0;
//  Left/bottom text justification.
    //  Left/bottom text justification.
    public static final int TXTJUST_LC = 0;
//  Left/center text justification.
    //  Left/center text justification.
    public static final int TXTJUST_LT = 0;
//  Left/top text justification.
    //  Left/top text justification.
    public static final int TXTJUST_RB = 0;
//  Right/bottom text justification.
    //  Right/bottom text justification.
    public static final int TXTJUST_RC = 0;
//  Right/center text justification.
    //  Right/center text justification.
    public static final int TXTJUST_RT = 0;
    public TextElement(short[] raw)
    public TextElement(byte[] raw)
    {
        super(raw);
    }
    public Coordinate getOrigin()
    {
        int x = (int) (raw[25] << 16 & 0xffff0000);
        int x = (raw[25] << 16 & 0xffff0000);
        x += raw[26] & 0x0000ffff;
        double dx = Utility.converUnitToCoord(x);
        int    y  = (int) (raw[27] << 16 & 0xffff0000);
        int y = (raw[27] << 16 & 0xffff0000);
        y += raw[28] & 0x0000ffff;
@@ -75,10 +75,10 @@
    public Coordinate getUserOrigin()
    {
        Coordinate origin = getOrigin();
        double     x      = origin.x;
        double     weight = getUserSetWeight();
        double     height = getUserSetHeight();
        double     angle  = Utility.converRotationToRadian(getRotationAngle());
        double x = origin.x;
        double weight = getUserSetWeight();
        double height = getUserSetHeight();
        double angle = Utility.converRotationToRadian(getRotationAngle());
        x += weight * Math.cos(angle) - height * Math.sin(angle);
@@ -91,29 +91,29 @@
    private double getUserSetWeight()
    {
        int      just   = getJustification();
        Envelope range  = getRange();
        double   weight = (range.getWidth());
        int just = getJustification();
        Envelope range = getRange();
        double weight = (range.getWidth());
        switch (just)
        {
        case 0 :
        case 1 :
        case 2 :
        case 0:
        case 1:
        case 2:
            weight = 0;
            break;
        case 6 :
        case 7 :
        case 8 :
        case 6:
        case 7:
        case 8:
            weight = weight / 2;
            break;
        case 12 :
        case 13 :
        case 14 :
        case 12:
        case 13:
        case 14:
            break;
        }
@@ -122,28 +122,28 @@
    private double getUserSetHeight()
    {
        int    just   = getJustification();
        int just = getJustification();
        double height = getTextHeight();
        switch (just)
        {
        case 2 :
        case 8 :
        case 14 :    // bottom
        case 2:
        case 8:
        case 14:    // bottom
            height = 0;
            break;
        case 1 :
        case 7 :
        case 13 :    // center
        case 1:
        case 7:
        case 13:    // center
            height = height / 2;
            break;
        case 0 :
        case 6 :
        case 12 :    // height
        case 0:
        case 6:
        case 12:    // height
            break;
        }
@@ -182,7 +182,7 @@
    public double getTextHeight()
    {
        int height = (int) ((raw[21] << 16) & 0xffff0000);
        int height = ((raw[21] << 16) & 0xffff0000);
        height += raw[22] & 0x0000ffff;
@@ -191,7 +191,7 @@
    public double getTextWidth()
    {
        int length = (int) (raw[19] << 16 & 0xffff0000);
        int length = (raw[19] << 16 & 0xffff0000);
        length += raw[20] & 0x0000ffff;
@@ -200,12 +200,12 @@
    public int getJustification()
    {
        return (int) ((raw[18] >>> 8) & 0x00000000ff);
        return ((raw[18] >>> 8) & 0x00000000ff);
    }
    public double getRotationAngle()
    {
        int totation = (int) ((raw[23] << 16) & 0xffff0000);
        int totation = ((raw[23] << 16) & 0xffff0000);
        totation += raw[24] & 0x0000ffff;
@@ -216,13 +216,7 @@
    {
        int isChinese = raw[30] & 0x0000ffff;
        if (isChinese == 0xfdff)
        {
            return true;
        } else
        {
            return false;
        }
        return (isChinese == 0xfdff);
    }
    public int getTextLength()
@@ -240,8 +234,8 @@
    public String getText()
    {
        StringBuffer val = new StringBuffer();
        char[]       temp;
        int          num = getTextLength();
        char[] temp;
        int num = getTextLength();
        if (!isChinese())
        {
@@ -288,7 +282,7 @@
            return instance;
        }
        protected Element createElement(short[] raw)
        protected Element createElement(byte[] raw)
        {
            return new TextElement(raw);
        }