forked from geodmms/xdgnjobs

Dennis Kao
2014-01-15 94ae08701bbd7585a0b7e5a92d1975965a503c03
xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7fileReaderTest.java
@@ -14,11 +14,10 @@
 * Dgn7fileReaderTest
 * User: Ulysses
 * Date: 2007/10/24
 * Time: ¤W¤È 01:43:41
 * Time: �W�� 01:43:41
 * To change this template use File | Settings | File Templates.
 */
public class Dgn7fileReaderTest
{
public class Dgn7fileReaderTest {
    private final static Logger logger = Logger.getLogger(Dgn7fileReaderTest.class);
    // private final static String testFilePath = "test-data\\testHV.dgn";
@@ -26,11 +25,9 @@
    private FileInputStream _fs;
    @BeforeTest
    public void setUp() throws IOException
    {
    public void setUp() throws IOException {
        File dataFile = TestData.file(this, testFilePath);
        if (!dataFile.exists())
        {
        if (!dataFile.exists()) {
            return;
        }
@@ -38,72 +35,56 @@
    }
    @Test
    public void testRead() throws Dgn7fileException, IOException
    {
    public void testRead() throws Dgn7fileException, IOException {
        if (_fs == null) return;
        FileChannel fc = _fs.getChannel();
        Dgn7fileReader reader = new Dgn7fileReader(fc, new Lock());
        int count = 0;
        Element lastComplex = null;
        while (reader.hasNext())
        {
            Dgn7fileReader.Record record = reader.nextElement();
            if (record.element() != null)
            {
        while (reader.hasNext()) {
            Element.FileRecord record = reader.nextElement();
            if (record.element() != null) {
                Element element = (Element) record.element();
                ElementType type = element.getElementType();
                if ((!type.isComplexElement()) && (!element.isComponentElement()))
                {
                    if (lastComplex != null)
                    {
                if ((!type.isComplexElement()) && (!element.isComponentElement())) {
                    if (lastComplex != null) {
                        // @todo add process in here
                        lastComplex = null;
                    }
                    // @todo add process in here
                } else if (element.isComponentElement())
                {
                    if (lastComplex != null)
                    {
                } else if (element.isComponentElement()) {
                    if (lastComplex != null) {
                        ((ComplexElement) lastComplex).add(element);
                    }
                } else if (type.isComplexElement())
                {
                    if (lastComplex == null)
                    {
                } else if (type.isComplexElement()) {
                    if (lastComplex == null) {
                        lastComplex = element;
                    } else
                    {
                    } else {
                        // @todo add process in here
                        lastComplex = element;
                    }
                }
                if (element.getElementType().isComplexElement())
                {
                    if (element instanceof ComplexChainElement)
                    {
                if (element.getElementType().isComplexElement()) {
                    if (element instanceof ComplexChainElement) {
                        ComplexChainElement complexChain = (ComplexChainElement) element;
                        int size = complexChain.size();
                        for (Object aComplexChain : complexChain)
                        {
                        for (Object aComplexChain : complexChain) {
                            Element subElement = (Element) aComplexChain;
                            subElement.getType();
                        }
                    }
                    if (element instanceof ComplexShapeElement)
                    {
                    if (element instanceof ComplexShapeElement) {
                        ComplexShapeElement complexShape = (ComplexShapeElement) element;
                    }
                    if (element instanceof TextNodeElement)
                    {
                    if (element instanceof TextNodeElement) {
                        TextNodeElement textNode = (TextNodeElement) element;
                        int size = textNode.size();
                        for (int i = 0; i < size; i++)
                        {
                        for (int i = 0; i < size; i++) {
                            Element subElement = (Element) textNode.get(i);
                            subElement.getElementType();
                        }
@@ -113,6 +94,6 @@
            count++;
        }
        logger.info("ElementRecord Count=" + count);
        logger.info("FileRecord Count=" + count);
    }
}