forked from geodmms/xdgnjobs

?? ?
2008-06-25 1939acb5eeca2792e93a0e236ed2f4a60b4d4008
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextNodeElement.java
@@ -184,9 +184,24 @@
        // return factory.createMultiPoint(coords.toCoordinateArray());
    }
    public int getTotalWords()
    {
        return (raw[18] & 0x0000ffff);
    }
    public void setTotalWords(int value)
    {
        raw[18] = (short) (value & 0x0000ffff);
    }
    public int getNumString()
    {
        return (raw[19] & 0x0000ffff);
    }
    public void setNumString(int value)
    {
        raw[19] = (short) (value & 0x0000ffff);
    }
    public int getNodeNumber()
@@ -194,9 +209,19 @@
        return (raw[20] & 0x0000ffff);
    }
    public void setNodeNumber(int value)
    {
        raw[20] = (short) (value & 0x0000ffff);
    }
    public int getMaxLength()
    {
        return (raw[21] & 0x00ff);
    }
    public void setMaxLength(int value)
    {
        raw[21] = (short) ((value & 0x00ff) | (raw[21] & 0xff00));
    }
    public int getMaxUsed()
@@ -204,14 +229,29 @@
        return ((raw[21] >> 8) & 0x00ff);
    }
    public void setMaxUsed(int value)
    {
        raw[21] = (short) (((value << 8) & 0xff00) | (raw[21] & 0x00ff));
    }
    public int getJustification()
    {
        return ((raw[22] >> 8) & 0x00ff);
    }
    public void setJustification(int value)
    {
        raw[22] = (short) (((value << 8) & 0xff00) | (raw[22] & 0x00ff));
    }
    public int getFontIndex()
    {
        return (raw[22] & 0x00ff);
    }
    public void setFontIndex(int value)
    {
        raw[22] = (short) ((value & 0x00ff) | (raw[22] & 0xff00));
    }
    public double getLineSpacing()
@@ -220,6 +260,13 @@
        lineSpace = ((raw[23] & 0x0000ffff) << 16) | (raw[24] & 0x0000ffff);
        return lineSpace;
    }
    public void setLineSpacing(double value)
    {
        int temp = (int) (value*1000.0);
        raw[23] = (short) ((temp >> 16) & 0x0000ffff);
        raw[24] = (short) (temp & 0x0000ffff);
    }
    public double getTextNodeLength()
@@ -232,6 +279,13 @@
        return DgnUtility.converIntToDouble(lengthMult);
    }
    public void setTextNodeLength(double value)
    {
        int temp = DgnUtility.converDoubleToInt(value);
        raw[25] = (short) ((temp >> 16) & 0x0000ffff);
        raw[26] = (short) (temp & 0x0000ffff);
    }
    public double getTextNodeHeight()
    {
        int heightMult;
@@ -242,12 +296,26 @@
        return DgnUtility.converIntToDouble(heightMult);
    }
    public void setTextNodeHeight(double value)
    {
        int temp = DgnUtility.converDoubleToInt(value);
        raw[27] = (short) ((temp >> 16) & 0x0000ffff);
        raw[28] = (short) (temp & 0x0000ffff);
    }
    public double getRotationAngle()
    {
        int rotation = (raw[29] << 16 & 0xffff0000);
        rotation += raw[30];
        return DgnUtility.converIntToRotation(rotation);
    }
    public void setRotationAngle(double value)
    {
        int temp = DgnUtility.converRotatioToInt(value);
        raw[29] = (short) (temp >> 16 & 0x0000ffff);
        raw[30] = (short) (temp & 0x0000ffff);
    }
    public Coordinate getOrigin()
@@ -262,6 +330,36 @@
        return new Coordinate(dx, dy);
    }
    public void setOrigin(Coordinate value)
    {
        int x = DgnUtility.converCoordToUnit(value.x);
        raw[31] = (short) (x >> 16 & 0x0000ffff);
        raw[32] = (short) (x & 0x0000ffff);
        int y = DgnUtility.converCoordToUnit(value.y);
        raw[33] = (short) (y >> 16 & 0x0000ffff);
        raw[34] = (short) (y & 0x0000ffff);
    }
    public Object clone() throws CloneNotSupportedException
    {
        int pos = this.rawBuffer.position();
        this.rawBuffer.position(0);
        byte[] rawBytes = this.rawBuffer.array();
        byte[] otherRaw = new byte[rawBytes.length];
        System.arraycopy(rawBytes, 0, otherRaw, 0, rawBytes.length);
        this.rawBuffer.position(pos);
        TextNodeElement other = new TextNodeElement(otherRaw);
        for (Object o : this)
        {
            TextElement textElm = (TextElement) o;
            other.add(textElm.clone());
        }
        return other;
    }
    public static class ElementHandler extends Element.ElementHandler
    {
        private static ElementHandler instance = null;