forked from geodmms/xdgnjobs

?? ?
2008-05-15 c25905d7c4d0547e798e19454815a6ec7a736fcb
xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ComplexChainElement.java
@@ -1,7 +1,5 @@
package com.ximple.io.dgn7;
//~--- JDK imports ------------------------------------------------------------
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
@@ -10,8 +8,8 @@
import org.apache.log4j.Logger;
import com.vividsolutions.jts.geom.CoordinateList;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryCollection;
import com.vividsolutions.jts.geom.GeometryFactory;
/**
@@ -25,7 +23,7 @@
{
    private static final Logger logger = Logger.getLogger(ComplexChainElement.class);
    protected ArrayList list = new ArrayList();
    protected ArrayList<Element> list = new ArrayList<Element>();
    public ComplexChainElement(byte[] raw)
    {
@@ -60,7 +58,7 @@
    public boolean add(Object o)
    {
        return list.add(o);
        return list.add((Element) o);
    }
    public boolean remove(Object o)
@@ -90,12 +88,12 @@
    public Object set(int index, Object element)
    {
        return list.set(index, element);
        return list.set(index, (Element) element);
    }
    public void add(int index, Object element)
    {
        list.add(index, element);
        list.add(index, (Element) element);
    }
    public Object remove(int index)
@@ -150,8 +148,6 @@
    public Geometry toGeometry(GeometryFactory factory)
    {
        ArrayList<Geometry> list = new ArrayList<Geometry>();
        if (size() == 1)
        {
            Element element = (Element) get(0);
@@ -181,6 +177,7 @@
            }
        }
        CoordinateList pts = new CoordinateList();
        for (ListIterator it = listIterator(); it.hasNext();)
        {
            Element element = (Element) it.next();
@@ -189,7 +186,7 @@
            {
                if (((LineStringElement) element).getVerticeSize() == 0 || ((LineStringElement) element).getVerticeSize() > 1)
                {
                    list.add(((LineStringElement) element).toGeometry(factory));
                    pts.add(((LineStringElement) element).toGeometry(factory).getCoordinates(), true);
                }
            } else if (element instanceof LineElement)
@@ -197,19 +194,15 @@
                if (((LineElement) element).getVertices().length == 0 || ((LineElement) element).getVertices().length > 1)
                {
                    list.add(((LineElement) element).toGeometry(factory));
                    pts.add(((LineElement) element).toGeometry(factory).getCoordinates(), true);
                }
            /*
            } else if (element instanceof ArcElement)
            {
                list.add(((ArcElement) element).toGeometry(factory));
            */
                pts.add(((ArcElement) element).toGeometry(factory).getCoordinates(), true);
            }
        }
        Geometry[] ga = list.toArray(new Geometry[list.size()]);
        return new GeometryCollection(ga, factory);
        return factory.createLineString(pts.toCoordinateArray());
    }
    public double getElementSize()