Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.MultiLineString


        }
        else if( geom instanceof MultiLineString ){
            // Shapefiles are determined to give us their contents as
            // a MultiLineString - forcing our hand in this case
            //
            MultiLineString lines = (MultiLineString) geom;
            if( lines.getNumGeometries() == 1){
                return (LineString) lines.getGeometryN(0);
            }
            throw new ClassCastException("MultiLineString does not contain a single LineString");
        }
        else if( geom instanceof GeometryCollection ){
            GeometryCollection geoms = (GeometryCollection) geom;
View Full Code Here


            throws CQLException {

        MultiLineStringBuilder builder = new MultiLineStringBuilder(
                getStatement(), getResultStack());

        MultiLineString ml = (MultiLineString) builder
                .build(linestringtextNode);

        return ml;

    }
View Full Code Here

        return gf.createMultiLineString((LineString[]) curves.toArray(new LineString[curves.size()]));
    }

    public Object getProperty(Object object, QName name) throws Exception {
        if ("curveMember".equals(name.getLocalPart())) {
            MultiLineString multiCurve = (MultiLineString) object;
            LineString[] members = new LineString[multiCurve.getNumGeometries()];

            for (int i = 0; i < members.length; i++) {
                members[i] = (LineString) multiCurve.getGeometryN(i);
            }

            GML3EncodingUtils.setChildIDs(multiCurve);

            return members;
View Full Code Here

public class MultiLineStringTypeBindingTest extends GML3TestSupport {
   
    public void test() throws Exception {
        GML3MockData.multiLineString(document, document);

        MultiLineString multiLineString = (MultiLineString) parse();
        assertNotNull(multiLineString);

        assertEquals(2, multiLineString.getNumGeometries());
    }
View Full Code Here

    }
   
    public void test3D() throws Exception {
        GML3MockData.multiLineString3D(document, document);

        MultiLineString multiLineString = (MultiLineString) parse();
        assertNotNull(multiLineString);

        assertEquals(2, multiLineString.getNumGeometries());
       
        LineString line = (LineString) multiLineString.getGeometryN(0);
        assertTrue(new Coordinate(1d, 2d, 10d).equals3D(line.getPointN(0).getCoordinate()));
        assertTrue(new Coordinate(3d, 4d, 20d).equals3D(line.getPointN(1).getCoordinate()));
    }
View Full Code Here

    }

    public Object getProperty(Object object, QName name)
        throws Exception {
        if (GML.lineStringMember.equals(name)) {
            MultiLineString multiLineString = (MultiLineString) object;
            LineString[] members = new LineString[multiLineString.getNumGeometries()];

            for (int i = 0; i < members.length; i++) {
                members[i] = (LineString) multiLineString.getGeometryN(i);
            }

            GML3EncodingUtils.setChildIDs(multiLineString);

            return members;
View Full Code Here

        assertEquals("geometry.2", getID(children.item(1)));
    }

    public void testParseWithCurveMember() throws Exception {
        GML3MockData.multiCurve(document, document);
        MultiLineString mline = (MultiLineString) parse();
       
        assertEquals(2, mline.getNumGeometries());
    }
View Full Code Here

        assertEquals(2, mline.getNumGeometries());
    }

    public void testParseWithCurveMembers() throws Exception {
        GML3MockData.multiCurve(document, document, false);
        MultiLineString mline = (MultiLineString) parse();
       
        assertEquals(2, mline.getNumGeometries());
    }
View Full Code Here

        // This property element contains a list of curves.
        // The order of the elements is significant and shall be preserved when processing the array.
        for (Node child : (List<Node>)node.getChildren()) {
            Object nodeValue = child.getValue();
            if (nodeValue instanceof MultiLineString) {
                MultiLineString curve = (MultiLineString)nodeValue;
                for (int i = 0; i < curve.getNumGeometries(); i++) {
                    LineString lineString = (LineString)curve.getGeometryN(i);
                    lineStrings.add(lineString);
                }
            } else if (nodeValue instanceof LineString) {
                LineString lineString = (LineString)nodeValue;
                lineStrings.add(lineString);
View Full Code Here

        CoordinateList clist = new CoordinateList();
        for (int i = 0; i < curveMembers.size(); i++) {
            List curves = ((Node) curveMembers.get(i))
                    .getChildren(MultiLineString.class);
            for (int j = 0; j < curves.size(); j++) {
                MultiLineString mls = (MultiLineString) ((Node) curves.get(j))
                        .getValue();
                clist.add(mls.getCoordinates(), false);
            }
        }
        return clist;
    }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.MultiLineString

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.