forked from geodmms/xdgnjobs

?? ?
2008-05-14 2631b9ee4a3625df1dc66926e8610f93c1ecd81f
update for  EOFM-83
12 files modified
1 files added
291 ■■■■ changed files
.gitattributes 1 ●●●● patch | view | raw | blame | history
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ArcElement.java 42 ●●●● patch | view | raw | blame | history
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7Exception.java 24 ●●●●● patch | view | raw | blame | history
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7OracleReader.java 21 ●●●●● patch | view | raw | blame | history
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileException.java 9 ●●●● patch | view | raw | blame | history
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileReader.java 24 ●●●● patch | view | raw | blame | history
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Element.java 12 ●●●● patch | view | raw | blame | history
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/EllipseElement.java 26 ●●●● patch | view | raw | blame | history
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineElement.java 8 ●●●● patch | view | raw | blame | history
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineStringElement.java 8 ●●●● patch | view | raw | blame | history
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextElement.java 12 ●●●● patch | view | raw | blame | history
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextNodeElement.java 12 ●●●● patch | view | raw | blame | history
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Utility.java 92 ●●●●● patch | view | raw | blame | history
.gitattributes
@@ -5,6 +5,7 @@
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ComplexChainElement.java svneol=native#text/plain
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ComplexElement.java svneol=native#text/plain
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ComplexShapeElement.java svneol=native#text/plain
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7Exception.java -text
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7OracleReader.java svneol=native#text/plain
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileException.java svneol=native#text/plain
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileHeader.java svneol=native#text/plain
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ArcElement.java
@@ -24,14 +24,14 @@
    {
        int angle = (raw[18] << 16 & 0xffff0000);
        angle += raw[19] & 0x0000ffff;
        angle |= raw[19] & 0x0000ffff;
        return Utility.ConverIntToRotation(angle);
        return Utility.converIntToRotation(angle);
    }
    public void setStartAngle(double value)
    {
        int angle = Utility.ConverRotatioToInt(value);
        int angle = Utility.converRotatioToInt(value);
        raw[18] = (short) (angle >>> 16 & 0x0000ffff);
        raw[19] = (short) (angle & 0x0000ffff);
@@ -41,14 +41,14 @@
    {
        int angle = (raw[20] << 16 & 0xffff0000);
        angle += raw[21] & 0x0000ffff;
        angle |= raw[21] & 0x0000ffff;
        return Utility.ConverIntToRotation(angle);
        return Utility.converIntToRotation(angle);
    }
    public void setSweepAngle(double value)
    {
        int angle = Utility.ConverRotatioToInt(value);
        int angle = Utility.converRotatioToInt(value);
        raw[20] = (short) (angle >> 16 & 0x0000ffff);
        raw[21] = (short) (angle & 0x0000ffff);
@@ -60,13 +60,13 @@
        System.arraycopy(raw, 22, primary, 0, 4);
        return Utility.DGNToIEEEDouble(primary) / 1000.0;
        return Utility.convertDGNToIEEEDouble(primary) / 1000.0;
    }
    public void setPrimary(double value)
    {
        double  temp    = value * 1000.0;
        short[] primary = Utility.IEEEDoubleToDGN(temp);
        short[] primary = Utility.convertIEEEDoubleToDGN(temp);
        System.arraycopy(primary, 0, raw, 22, 4);
    }
@@ -77,13 +77,13 @@
        System.arraycopy(raw, 26, secondary, 0, 4);
        return Utility.DGNToIEEEDouble(secondary) / 1000.0;
        return Utility.convertDGNToIEEEDouble(secondary) / 1000.0;
    }
    public void setSecondary(double value)
    {
        double  temp      = value * 1000.0;
        short[] secondary = Utility.IEEEDoubleToDGN(temp);
        short[] secondary = Utility.convertIEEEDoubleToDGN(temp);
        System.arraycopy(secondary, 0, raw, 26, 4);
    }
@@ -92,14 +92,14 @@
    {
        int rotation = (raw[30] << 16 & 0xffff0000);
        rotation += raw[31] & 0x0000ffff;
        rotation |= raw[31] & 0x0000ffff;
        return Utility.ConverIntToRotation(rotation);
        return Utility.converIntToRotation(rotation);
    }
    public void setRotationAngle(double value)
    {
        int angle = Utility.ConverRotatioToInt(value);
        int angle = Utility.converRotatioToInt(value);
        raw[30] = (short) (angle >> 16 & 0x0000ffff);
        raw[31] = (short) (angle & 0x0000ffff);
@@ -111,25 +111,25 @@
        System.arraycopy(raw, 32, x, 0, 4);
        double  dx = Utility.ConverUnitToCoord((int) Utility.DGNToIEEEDouble(x));
        double  dx = Utility.converUnitToCoord((int) Utility.convertDGNToIEEEDouble(x));
        short[] y  = new short[4];
        System.arraycopy(raw, 36, y, 0, 4);
        double dy = Utility.ConverUnitToCoord((int) Utility.DGNToIEEEDouble(y));
        double dy = Utility.converUnitToCoord((int) Utility.convertDGNToIEEEDouble(y));
        return new Coordinate(dx, dy);
    }
    public void setOrigin(Coordinate value)
    {
        double  temp = Utility.ConverCoordToUnit(value.x);
        short[] x    = Utility.IEEEDoubleToDGN(temp);
        double  temp = Utility.converCoordToUnit(value.x);
        short[] x    = Utility.convertIEEEDoubleToDGN(temp);
        System.arraycopy(x, 0, raw, 32, 4);
        temp = Utility.ConverCoordToUnit(value.y);
        temp = Utility.converCoordToUnit(value.y);
        short[] y = Utility.IEEEDoubleToDGN(temp);
        short[] y = Utility.convertIEEEDoubleToDGN(temp);
        System.arraycopy(y, 0, raw, 36, 4);
    }
@@ -145,7 +145,7 @@
    private Coordinate[] convertToLineString(int pts)
    {
        Coordinate[] result = new Coordinate[pts];
        double beta = -getRotationAngle() / 180 * Math.PI;
        double beta = Utility.converRotationToRadian(-getRotationAngle());
        double sinbeta = Math.sin(beta);
        double cosbeta = Math.cos(beta);
        double startAngle = getStartAngle();
@@ -157,7 +157,7 @@
            if (i < pts)
            {
                Coordinate pt = new Coordinate();
                double alpha = current / 180 * Math.PI;
                double alpha = Utility.converRotationToRadian(current);
                double sinalpha = Math.sin(alpha);
                double cosalpha = Math.cos(alpha);
                pt.x = getOrigin().x + (getPrimary() * cosalpha * cosbeta -
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7Exception.java
New file
@@ -0,0 +1,24 @@
package com.ximple.io.dgn7;
public class Dgn7Exception extends Exception
{
    public Dgn7Exception()
    {
    }
    public Dgn7Exception(String s)
    {
        super(s);
    }
    public Dgn7Exception(String s, Throwable throwable)
    {
        super(s, throwable);
    }
    public Dgn7Exception(Throwable throwable)
    {
        super(throwable);
    }
}
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7OracleReader.java
@@ -69,16 +69,12 @@
            } catch (SQLException e)
            {
                throw new RuntimeException("initialize oralce error.", e);
            } catch (Dgn7fileException e)
            } catch (Dgn7Exception e)
            {
                throw new RuntimeException("initialize oralce error.", e);
            }
        }
        if (_element == null)
        {
            return false;
        }
        return true;
        return _element != null;
    }
    public Element next()
@@ -91,7 +87,7 @@
        } catch (SQLException e)
        {
            throw new RuntimeException("Error:" + e.getMessage(), e);
        } catch (Dgn7fileException e)
        } catch (Dgn7Exception e)
        {
            throw new RuntimeException("Error:" + e.getMessage(), e);
        }
@@ -104,7 +100,7 @@
        throw new RuntimeException("Not Support this method.");
    }
    private boolean initializeReader() throws SQLException, Dgn7fileException
    private boolean initializeReader() throws SQLException, Dgn7Exception
    {
        if (_resultSet != null) return true;
        Statement stmtSrc = _connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
@@ -117,7 +113,7 @@
        return true;
    }
    private boolean fetchElement() throws SQLException, Dgn7fileException
    private boolean fetchElement() throws SQLException, Dgn7Exception
    {
        if (_resultSet.next())
        {
@@ -133,7 +129,7 @@
                    raw = getBytesFromBLOB(blob);
                } catch (IOException e)
                {
                    throw new SQLException("IOError", e);
                    throw new Dgn7Exception("IOError", e);
                }
                blob.close();
            } else if (value instanceof byte[])
@@ -208,14 +204,14 @@
    protected static byte[] getBytesFromBLOB(BLOB blob) throws SQLException, IOException
    {
        byte[] raw = null;
        byte[] raw;
        // BLOB        blob        = (BLOB) rs.getBlob(1);
        int optimalSize = blob.getChunkSize();
        byte[] chunk = new byte[optimalSize];
        InputStream is = blob.getBinaryStream(0);
        ByteBuffer buffer = null;    // ByteBuffer.allocate(optimalSize);
        int len = 0;
        int len;
        try
        {
@@ -233,6 +229,7 @@
            }
            is.close();
            assert buffer != null;
            buffer.position(0);
            raw = buffer.array();
        } catch (IOException e)
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileException.java
@@ -1,13 +1,6 @@
package com.ximple.io.dgn7;
/**
 * Created by IntelliJ IDEA.
 * User: Ulysses
 * Date: 2007/9/13
 * Time: ¤W¤È 11:19:08
 * To change this template use File | Settings | File Templates.
 */
public class Dgn7fileException extends Exception
public class Dgn7fileException extends Dgn7Exception
{
    public Dgn7fileException()
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileReader.java
@@ -252,33 +252,33 @@
        {
            int lowCoorX = buffer.getInt();
            lowCoorX    = Utility.ConvertFromDGN(lowCoorX);
            record.minX = Utility.ConverUnitToCoord(lowCoorX);
            lowCoorX    = Utility.convertFromDGN(lowCoorX);
            record.minX = Utility.converUnitToCoord(lowCoorX);
            int lowCoorY = buffer.getInt();
            lowCoorY    = Utility.ConvertFromDGN(lowCoorY);
            record.minY = Utility.ConverUnitToCoord(lowCoorY);
            lowCoorY    = Utility.convertFromDGN(lowCoorY);
            record.minY = Utility.converUnitToCoord(lowCoorY);
            int lowCoorZ = buffer.getInt();
            lowCoorZ    = Utility.ConvertFromDGN(lowCoorZ);
            record.minZ = Utility.ConverUnitToCoord(lowCoorZ);
            lowCoorZ    = Utility.convertFromDGN(lowCoorZ);
            record.minZ = Utility.converUnitToCoord(lowCoorZ);
            int highCoorX = buffer.getInt();
            highCoorX   = Utility.ConvertFromDGN(highCoorX);
            record.maxX = Utility.ConverUnitToCoord(highCoorX);
            highCoorX   = Utility.convertFromDGN(highCoorX);
            record.maxX = Utility.converUnitToCoord(highCoorX);
            int highCoorY = buffer.getInt();
            highCoorY   = Utility.ConvertFromDGN(highCoorY);
            record.maxY = Utility.ConverUnitToCoord(highCoorY);
            highCoorY   = Utility.convertFromDGN(highCoorY);
            record.maxY = Utility.converUnitToCoord(highCoorY);
            int highCoorZ = buffer.getInt();
            highCoorZ   = Utility.ConvertFromDGN(highCoorZ);
            record.maxZ = Utility.ConverUnitToCoord(highCoorZ);
            highCoorZ   = Utility.convertFromDGN(highCoorZ);
            record.maxZ = Utility.converUnitToCoord(highCoorZ);
        }
        buffer.reset();
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Element.java
@@ -50,22 +50,22 @@
    {
        int lowCoorX = (int) ((raw[3] << 16) & 0xffff0000) + (raw[2] & 0x0000ffff);
        lowCoorX = Utility.ConvertFromDGN(lowCoorX);
        lowCoorX = Utility.convertFromDGN(lowCoorX);
        int lowCoorY = (int) ((raw[5] << 16) & 0xffff0000) + (raw[4] & 0x0000ffff);
        lowCoorY = Utility.ConvertFromDGN(lowCoorY);
        lowCoorY = Utility.convertFromDGN(lowCoorY);
        int highCoorX = (int) ((raw[9] << 16) & 0xffff0000) + (raw[8] & 0x0000ffff);
        highCoorX = Utility.ConvertFromDGN(highCoorX);
        highCoorX = Utility.convertFromDGN(highCoorX);
        int highCoorY = (int) ((raw[11] << 16) & 0xffff0000) + (raw[10] & 0x0000ffff);
        highCoorY = Utility.ConvertFromDGN(highCoorY);
        highCoorY = Utility.convertFromDGN(highCoorY);
        return new Envelope(Utility.ConverUnitToCoord(lowCoorX), Utility.ConverUnitToCoord(highCoorX),
                            Utility.ConverUnitToCoord(lowCoorY), Utility.ConverUnitToCoord(highCoorY));
        return new Envelope(Utility.converUnitToCoord(lowCoorX), Utility.converUnitToCoord(highCoorX),
                            Utility.converUnitToCoord(lowCoorY), Utility.converUnitToCoord(highCoorY));
    }
    public boolean isComponentElement()
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/EllipseElement.java
@@ -35,13 +35,13 @@
        System.arraycopy(raw, 18, primary, 0, 4);
        return Utility.DGNToIEEEDouble(primary) / 1000.0;
        return Utility.convertDGNToIEEEDouble(primary) / 1000.0;
    }
    public void setPrimary(double value)
    {
        double temp = value * 1000.0;
        short[] primary = Utility.IEEEDoubleToDGN(temp);
        short[] primary = Utility.convertIEEEDoubleToDGN(temp);
        System.arraycopy(primary, 0, raw, 18, 4);
    }
@@ -52,13 +52,13 @@
        System.arraycopy(raw, 22, secondary, 0, 4);
        return Utility.DGNToIEEEDouble(secondary) / 1000.0;
        return Utility.convertDGNToIEEEDouble(secondary) / 1000.0;
    }
    public void setSecondary(double value)
    {
        double temp = value * 1000.0;
        short[] secondary = Utility.IEEEDoubleToDGN(temp);
        short[] secondary = Utility.convertIEEEDoubleToDGN(temp);
        System.arraycopy(secondary, 0, raw, 22, 4);
    }
@@ -67,14 +67,14 @@
    {
        int rotation = (raw[26] << 16 & 0xffff0000);
        rotation += raw[27] & 0x0000ffff;
        rotation |= raw[27] & 0x0000ffff;
        return Utility.ConverIntToRotation(rotation);
        return Utility.converIntToRotation(rotation);
    }
    public void setRotationAngle(double value)
    {
        int angle = Utility.ConverRotatioToInt(value);
        int angle = Utility.converRotatioToInt(value);
        raw[26] = (short) (angle >> 16 & 0x0000ffff);
        raw[27] = (short) (angle & 0x0000ffff);
@@ -86,25 +86,25 @@
        System.arraycopy(raw, 28, x, 0, 4);
        double dx = Utility.ConverUnitToCoord((int) Utility.DGNToIEEEDouble(x));
        double dx = Utility.converUnitToCoord((int) Utility.convertDGNToIEEEDouble(x));
        short[] y = new short[4];
        System.arraycopy(raw, 32, y, 0, 4);
        double dy = Utility.ConverUnitToCoord((int) Utility.DGNToIEEEDouble(y));
        double dy = Utility.converUnitToCoord((int) Utility.convertDGNToIEEEDouble(y));
        return new Coordinate(dx, dy);
    }
    public void setOrigin(Coordinate value)
    {
        double temp = Utility.ConverCoordToUnit(value.x);
        short[] x = Utility.IEEEDoubleToDGN(temp);
        double temp = Utility.converCoordToUnit(value.x);
        short[] x = Utility.convertIEEEDoubleToDGN(temp);
        System.arraycopy(x, 0, raw, 28, 4);
        temp = Utility.ConverCoordToUnit(value.y);
        temp = Utility.converCoordToUnit(value.y);
        short[] y = Utility.IEEEDoubleToDGN(temp);
        short[] y = Utility.convertIEEEDoubleToDGN(temp);
        System.arraycopy(y, 0, raw, 32, 4);
    }
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineElement.java
@@ -31,12 +31,12 @@
        endX = endX + (raw[23] & 0x0000ffff);
        double x    = Utility.ConverUnitToCoord(endX);
        double x    = Utility.converUnitToCoord(endX);
        int    endY = (int) ((raw[24] << 16) & 0xffff0000);
        endY = endY + (raw[25] & 0x0000ffff);
        double y = Utility.ConverUnitToCoord(endY);
        double y = Utility.converUnitToCoord(endY);
        return new Coordinate(x, y);
    }
@@ -57,12 +57,12 @@
        startX = startX + (raw[19] & 0x0000ffff);
        double x      = Utility.ConverUnitToCoord(startX);
        double x      = Utility.converUnitToCoord(startX);
        int    startY = (int) ((raw[20] << 16) & 0xffff0000);
        startY = startY + (raw[21] & 0x0000ffff);
        double y = Utility.ConverUnitToCoord(startY);
        double y = Utility.converUnitToCoord(startY);
        return new Coordinate(x, y);
    }
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineStringElement.java
@@ -106,12 +106,12 @@
        x += (int) (raw[20 + (4 * index)] & 0x0000ffff);
        return Utility.ConverUnitToCoord(x);
        return Utility.converUnitToCoord(x);
    }
    protected void setX(int index, double dx)
    {
        int newVal = Utility.ConverCoordToUnit(dx);
        int newVal = Utility.converCoordToUnit(dx);
        raw[19 + (4 * index)] = (short) (newVal >> 16 & 0x0000ffff);
        raw[20 + (4 * index)] = (short) (newVal & 0x0000ffff);
@@ -128,12 +128,12 @@
        y = y + (int) (raw[22 + (4 * index)] & 0x0000ffff);
        return Utility.ConverUnitToCoord(y);
        return Utility.converUnitToCoord(y);
    }
    protected void setY(int index, double dy)
    {
        int newVal = Utility.ConverCoordToUnit(dy);
        int newVal = Utility.converCoordToUnit(dy);
        raw[21 + (4 * index)] = (short) ((newVal >> 16) & 0x0000ffff);
        raw[22 + (4 * index)] = (short) (newVal & 0x0000ffff);
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextElement.java
@@ -62,12 +62,12 @@
        x += raw[26] & 0x0000ffff;
        double dx = Utility.ConverUnitToCoord(x);
        double dx = Utility.converUnitToCoord(x);
        int    y  = (int) (raw[27] << 16 & 0xffff0000);
        y += raw[28] & 0x0000ffff;
        double dy = Utility.ConverUnitToCoord(y);
        double dy = Utility.converUnitToCoord(y);
        return new Coordinate(dx, dy);
    }
@@ -78,7 +78,7 @@
        double     x      = origin.x;
        double     weight = getUserSetWeight();
        double     height = getUserSetHeight();
        double     angle  = Utility.ConverRotationToRadian(getRotationAngle());
        double     angle  = Utility.converRotationToRadian(getRotationAngle());
        x += weight * Math.cos(angle) - height * Math.sin(angle);
@@ -186,7 +186,7 @@
        height += raw[22] & 0x0000ffff;
        return Utility.ConverIntToDouble(height);
        return Utility.converIntToDouble(height);
    }
    public double getTextWidth()
@@ -195,7 +195,7 @@
        length += raw[20] & 0x0000ffff;
        return Utility.ConverIntToDouble(length);
        return Utility.converIntToDouble(length);
    }
    public int getJustification()
@@ -209,7 +209,7 @@
        totation += raw[24] & 0x0000ffff;
        return Utility.ConverIntToRotation(totation);
        return Utility.converIntToRotation(totation);
    }
    public boolean isChinese()
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextNodeElement.java
@@ -225,7 +225,7 @@
        lengthMult = (int) ((raw[25] << 16) & 0xffff0000);
        lengthMult += (raw[26] & 0x0000ffff);
        return Utility.ConverIntToDouble(lengthMult);
        return Utility.converIntToDouble(lengthMult);
    }
    public double getTextNodeHeight()
@@ -235,7 +235,7 @@
        heightMult = (int) ((raw[27] << 16) & 0xffff0000);
        heightMult += (raw[28] & 0x0000ffff);
        return Utility.ConverIntToDouble(heightMult);
        return Utility.converIntToDouble(heightMult);
    }
    public double getRotationAngle()
@@ -244,7 +244,7 @@
        rotation += raw[30];
        return Utility.ConverIntToRotation(rotation);
        return Utility.converIntToRotation(rotation);
    }
    public Coordinate getOrigin()
@@ -253,13 +253,13 @@
        x += raw[32] & 0x0000ffff;
        // return Utility.ConvertFromDGN(x);
        double dx = Utility.ConverUnitToCoord(x);
        // return Utility.convertFromDGN(x);
        double dx = Utility.converUnitToCoord(x);
        int    y  = (int) ((raw[33] << 16) & 0xffff0000);
        y += (raw[34] & 0x0000ffff);
        double dy = Utility.ConverUnitToCoord(y);
        double dy = Utility.converUnitToCoord(y);
        return new Coordinate(dx, dy);
    }
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Utility.java
@@ -1,7 +1,5 @@
package com.ximple.io.dgn7;
//~--- non-JDK imports --------------------------------------------------------
import com.vividsolutions.jts.geom.Envelope;
/**
@@ -13,72 +11,59 @@
 */
public final class Utility
{
    public static double ConverIntToDouble(int src)
    public static double converIntToDouble(int src)
    {
        double newVal = (double) ((long) ((src * 6) / 1000.0 + 0.5)) / 1000.0;    // ?[0.5?O?¢X?F?|¡Ó????J
        return newVal;
        return (double) ((long) ((src * 6) / 1000.0 + 0.5)) / 1000.0;
    }
    public static int ConverDoubleToInt(double src)
    public static int converDoubleToInt(double src)
    {
        int newVal = (int) (src / 6 * 1000000.0);
        return newVal;
        return (int) (src / 6 * 1000000.0);
    }
    public static int ConvertFromDGN(int aValue)
    public static int convertFromDGN(int aValue)
    {
        int newVal = 0;
        int newVal;
        newVal = (((aValue ^ 0x00008000) << 16) & 0xffff0000);
        newVal += (aValue >>> 16) & 0x0000ffff;
        newVal |= (aValue >>> 16) & 0x0000ffff;
        return newVal;
    }
    public static int ConverToDGN(int aValue)
    public static int converToDGN(int aValue)
    {
        int newVal = 0;
        int newVal;
        newVal = (aValue << 16 & 0xffff0000);
        newVal += (((aValue ^ 0x80000000) >>> 16) & 0x0000ffff);
        newVal |= (((aValue ^ 0x80000000) >>> 16) & 0x0000ffff);
        return newVal;
    }
    public static double ConverIntToRotation(int aValue)
    public static double converIntToRotation(int aValue)
    {
        double newVal = aValue / 360000.0;
        if (newVal > 0)
        {
            newVal = (int) (newVal + 0.5);
        } else
        {
            newVal = (int) (newVal - 0.5);
        }
        return newVal;
        return aValue / 360000.0;
    }
    public static int ConverRotatioToInt(double aValue)
    public static int converRotatioToInt(double aValue)
    {
        int newVal = (int) (aValue * 360000.0);
        return newVal;
        return (int) (aValue * 360000.0);
    }
    public static double ConverRotationToRadian(double aValue)
    public static double converRotationToRadian(double aValue)
    {
        double newVal = aValue * Math.PI / 180;
        return newVal;
        return aValue * Math.PI / 180;
    }
    public static double ConverUnitToCoord(int aValue)
    public static double converUnitToCoord(int aValue)
    {
        double newVal = 0;
        double newVal;
        newVal = aValue / 1000.0;
        newVal += 2147483.648;    // 2147483.648 = 2 ^ 31
@@ -86,7 +71,7 @@
        return newVal;
    }
    public static int ConverCoordToUnit(double aValue)
    public static int converCoordToUnit(double aValue)
    {
        double newVal = aValue;
@@ -96,36 +81,32 @@
        return (int) newVal;
    }
    public static Envelope ConverUnitToCoord(Envelope range)
    public static Envelope converUnitToCoord(Envelope range)
    {
        if (range == null)
        {
            return null;
        }
        Envelope newRange = new Envelope(ConverUnitToCoord((int) range.getMinX()), ConverUnitToCoord((int) range.getMaxX()),
                                         ConverUnitToCoord((int) range.getMinY()), ConverUnitToCoord((int) range.getMaxY()));
        return newRange;
        return new Envelope(converUnitToCoord((int) range.getMinX()), converUnitToCoord((int) range.getMaxX()),
                                         converUnitToCoord((int) range.getMinY()), converUnitToCoord((int) range.getMaxY()));
    }
    public static Envelope ConverCoordToUnit(Envelope range)
    public static Envelope converCoordToUnit(Envelope range)
    {
        if (range == null)
        {
            return null;
        }
        Envelope newRange = new Envelope(ConverCoordToUnit(range.getMinX()), ConverCoordToUnit(range.getMaxX()),
                                         ConverCoordToUnit(range.getMinY()), ConverCoordToUnit(range.getMaxY()));
        return newRange;
        return new Envelope(converCoordToUnit(range.getMinX()), converCoordToUnit(range.getMaxX()),
                                         converCoordToUnit(range.getMinY()), converCoordToUnit(range.getMaxY()));
    }
    public static double DGNToIEEEDouble(short[] src)
    public static double convertDGNToIEEEDouble(short[] src)
    {
        int[] tmp = new int[2];
        long  des = 0;
        long  des;
        int   sign;
        int   exponent;
        int   rndbits;
@@ -135,9 +116,9 @@
            throw new RuntimeException("Source short array is null");
        }
        tmp[0]   = (int) ((src[0] << 16) & 0xffff0000) | (src[1] & 0x0000ffff);    // ¢X?????
        tmp[1]   = (int) ((src[2] << 16) & 0xffff0000) | (src[3] & 0x0000ffff);    // ¡±C????
        sign     = (int) (tmp[0] & 0x80000000);
        tmp[0]   = ((src[0] << 16) & 0xffff0000) | (src[1] & 0x0000ffff);
        tmp[1]   = ((src[2] << 16) & 0xffff0000) | (src[3] & 0x0000ffff);
        sign     = (tmp[0] & 0x80000000);
        exponent = (tmp[0] >>> 23) & 0x000000ff;
        if (exponent != 0)
@@ -157,12 +138,12 @@
        tmp[0] = (tmp[0] >>> 3) & 0x000fffff;
        tmp[0] = tmp[0] | (exponent << 20) | sign;
        des    = (((long) tmp[0] << 32));
        des    = des | (long) tmp[1] & 0x00000000ffffffff;
        des    = des | (long) tmp[1];
        return Double.longBitsToDouble(des);
    }
    public static short[] IEEEDoubleToDGN(double src)
    public static short[] convertIEEEDoubleToDGN(double src)
    {
        long newVal = Double.doubleToLongBits(src);
@@ -173,11 +154,11 @@
        int     sign;
        int     exponent;
        tmp[0] = (int) ((newVal >>> 32) & 0x0ffffffff);
        tmp[1] = (int) (newVal & 0x0ffffffff);
        tmp[0] = (int) ((newVal >>> 32));
        tmp[1] = (int) (newVal);
        // sign = ( int ) ( ( uint ) tmp[ 0 ] & 0x80000000 );
        sign     = (int) tmp[0] & 0x80000000;
        sign     = tmp[0] & 0x80000000;
        exponent = (tmp[0] >>> 20) & 0x07ff;
        if (exponent != 0)
@@ -231,8 +212,7 @@
    {
        double dx     = x1 - x2;
        double dy     = y1 - y2;
        double length = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
        return length;
        return Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
    }
}