| | |
| | | |
| | | public Geometry toGeometry(GeometryFactory factory) |
| | | { |
| | | ArrayList list = new ArrayList(); |
| | | ArrayList<Geometry> list = new ArrayList<Geometry>(); |
| | | |
| | | if (size() == 1) |
| | | { |
| | |
| | | |
| | | if (element instanceof LineStringElement) |
| | | { |
| | | if( ((LineStringElement) element).getVerticeSize() == 0 || ((LineStringElement) element).getVerticeSize() > 1) |
| | | { |
| | | return ((LineStringElement) element).toGeometry(factory); |
| | | } |
| | | if (((LineStringElement) element).getVerticeSize() == 0 || ((LineStringElement) element).getVerticeSize() > 1) |
| | | { |
| | | return ((LineStringElement) element).toGeometry(factory); |
| | | } |
| | | |
| | | } else if (element instanceof LineElement) |
| | | { |
| | | if( ((LineElement) element).getVertices().length == 0 || ((LineElement) element).getVertices().length > 1) |
| | | { |
| | | return ((LineElement) element).toGeometry(factory); |
| | | } |
| | | if (((LineElement) element).getVertices().length == 0 || ((LineElement) element).getVertices().length > 1) |
| | | { |
| | | return ((LineElement) element).toGeometry(factory); |
| | | } |
| | | |
| | | } else |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | for (ListIterator it = listIterator(); it.hasNext(); ) |
| | | for (ListIterator it = listIterator(); it.hasNext();) |
| | | { |
| | | Element element = (Element) it.next(); |
| | | |
| | | if (element instanceof LineStringElement) |
| | | { |
| | | if( ((LineStringElement) element).getVerticeSize() == 0 || ((LineStringElement) element).getVerticeSize() > 1) |
| | | { |
| | | list.add(((LineStringElement) element).toGeometry(factory)); |
| | | } |
| | | if (((LineStringElement) element).getVerticeSize() == 0 || ((LineStringElement) element).getVerticeSize() > 1) |
| | | { |
| | | list.add(((LineStringElement) element).toGeometry(factory)); |
| | | } |
| | | |
| | | } else if (element instanceof LineElement) |
| | | { |
| | | |
| | | if( ((LineElement) element).getVertices().length == 0 || ((LineElement) element).getVertices().length > 1) |
| | | { |
| | | list.add(((LineElement) element).toGeometry(factory)); |
| | | } |
| | | |
| | | if (((LineElement) element).getVertices().length == 0 || ((LineElement) element).getVertices().length > 1) |
| | | { |
| | | list.add(((LineElement) element).toGeometry(factory)); |
| | | } |
| | | } else if (element instanceof ArcElement) |
| | | { |
| | | list.add(((ArcElement) element).toGeometry(factory)); |
| | | } |
| | | } |
| | | |
| | | Geometry[] ga = (Geometry[]) list.toArray(new Geometry[list.size()]); |
| | | GeometryCollection geos = new GeometryCollection(ga, factory); |
| | | Geometry[] ga = list.toArray(new Geometry[list.size()]); |
| | | |
| | | return geos; |
| | | return new GeometryCollection(ga, factory); |
| | | } |
| | | |
| | | public double getElementSize() |