Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.MultiLineString


        SimpleFeatureCollection result = cp.execute(features, new WKTReader().read("POLYGON((-10 -10, -10 10, 5000 10, 5000 -10, -10 -10))"), true);
        assertEquals(1, result.size());
        SimpleFeatureIterator fi = result.features();
        // check the first polygon
        SimpleFeature f = fi.next();
        MultiLineString ml = (MultiLineString) f.getDefaultGeometry();
        assertEquals(1, ml.getNumGeometries());
        LineString ls = (LineString) ml.getGeometryN(0);
        CoordinateSequence cs = ls.getCoordinateSequence();
        assertEquals(2, cs.size());
        assertOrdinates(0, 0, 0, cs, 0);
        assertOrdinates(5000, 0, 0.5, cs, 1);
        fi.close();
View Full Code Here


        SimpleFeatureCollection result = cp.execute(features, new WKTReader().read("POLYGON((-10 -10, -10 10, 5000 10, 5000 -10, -10 -10))"), true);
        assertEquals(1, result.size());
        SimpleFeatureIterator fi = result.features();
        // check the first polygon
        SimpleFeature f = fi.next();
        MultiLineString ml = (MultiLineString) f.getDefaultGeometry();
        assertEquals(1, ml.getNumGeometries());
        LineString ls = (LineString) ml.getGeometryN(0);
        CoordinateSequence cs = ls.getCoordinateSequence();
        assertEquals(4, cs.size());
        assertOrdinates(0, 0, 0, cs, 0);
        assertOrdinates(1000, 0, 0.1, cs, 1);
        assertOrdinates(4000, 0, 0.4, cs, 2);
View Full Code Here

        SimpleFeatureCollection result = cp.execute(features, new WKTReader().read("POLYGON((9000 5000, 9000 10000, 11000 10000, 11000 5000, 9000 5000))"), true);
        assertEquals(1, result.size());
        SimpleFeatureIterator fi = result.features();
        // check the first polygon
        SimpleFeature f = fi.next();
        MultiLineString ml = (MultiLineString) f.getDefaultGeometry();
        assertEquals(1, ml.getNumGeometries());
        LineString ls = (LineString) ml.getGeometryN(0);
        CoordinateSequence cs = ls.getCoordinateSequence();
        assertEquals(2, cs.size());
        assertOrdinates(10000, 5000, 1.5, cs, 0);
        assertOrdinates(10000, 10000, 2, cs, 1);
        fi.close();
View Full Code Here

        SimpleFeatureCollection result = cp.execute(features, new WKTReader().read("POLYGON((5000 -10, 5000 5000, 11000 5000, 11000 -10, 5000 -10))"), true);
        assertEquals(1, result.size());
        SimpleFeatureIterator fi = result.features();
        // check the first polygon
        SimpleFeature f = fi.next();
        MultiLineString ml = (MultiLineString) f.getDefaultGeometry();
        assertEquals(1, ml.getNumGeometries());
        LineString ls = (LineString) ml.getGeometryN(0);
        CoordinateSequence cs = ls.getCoordinateSequence();
        assertEquals(3, cs.size());
        assertOrdinates(5000, 0, 0.5, cs, 0);
        assertOrdinates(10000, 0, 1, cs, 1);
        assertOrdinates(10000, 5000, 1.5, cs, 2);
View Full Code Here

        assertEquals(1, result.size());
        SimpleFeatureIterator fi = result.features();
        // check the first polygon
        SimpleFeature f = fi.next();
        fi.close();
        MultiLineString ml = (MultiLineString) f.getDefaultGeometry();
        assertEquals(2, ml.getNumGeometries());
        LineString ls = (LineString) ml.getGeometryN(0);
        CoordinateSequence cs = ls.getCoordinateSequence();
        assertEquals(2, cs.size());
        assertOrdinates(1000, 0, 0.1, cs, 0);
        assertOrdinates(2000, 0, 0.2, cs, 1);
        ls = (LineString) ml.getGeometryN(1);
        cs = ls.getCoordinateSequence();
        assertEquals(2, cs.size());
        assertOrdinates(8000, 0, 0.8, cs, 0);
        assertOrdinates(9000, 0, 0.9, cs, 1);
View Full Code Here

        assertEquals(1, result.size());
        SimpleFeatureIterator fi = result.features();
        // check the first polygon
        SimpleFeature f = fi.next();
        fi.close();
        MultiLineString ml = (MultiLineString) f.getDefaultGeometry();
        assertEquals(2, ml.getNumGeometries());
        LineString ls = (LineString) ml.getGeometryN(0);
        CoordinateSequence cs = ls.getCoordinateSequence();
        assertEquals(2, cs.size());
        assertOrdinates(1000, 0, 0.1, cs, 0);
        assertOrdinates(2000, 0, 0.2, cs, 1);
        ls = (LineString) ml.getGeometryN(1);
        cs = ls.getCoordinateSequence();
        assertEquals(2, cs.size());
        assertOrdinates(10000, 4000, 1.4, cs, 0);
        assertOrdinates(10000, 5000, 1.5, cs, 1);
View Full Code Here

        assertEquals(1, result.size());
        SimpleFeatureIterator fi = result.features();
        // check the first polygon
        SimpleFeature f = fi.next();
        fi.close();
        MultiLineString ml = (MultiLineString) f.getDefaultGeometry();
        assertEquals(2, ml.getNumGeometries());
        LineString ls = (LineString) ml.getGeometryN(0);
        CoordinateSequence cs = ls.getCoordinateSequence();
        assertEquals(4, cs.size());
        assertOrdinates(1000, 900, 0.9, cs, 0);
        assertOrdinates(1000, 1000, 1.0, cs, 1);
        assertOrdinates(2000, 1000, 2.0, cs, 2);
        assertOrdinates(2000, 900, 2.1, cs, 3);
        ls = (LineString) ml.getGeometryN(1);
        cs = ls.getCoordinateSequence();
        assertEquals(4, cs.size());
        assertOrdinates(1000, 2100, 0.9, cs, 0);
        assertOrdinates(1000, 2000, 1.0, cs, 1);
        assertOrdinates(2000, 2000, 2.0, cs, 2);
View Full Code Here

                @Override
                public <T> T convert(Object source, Class<T> target) throws Exception {
                    Geometry result = null;
                    Geometry sourceGeometry = (Geometry) source;
                    if (MultiCurvedGeometry.class.isAssignableFrom(target)) {
                        MultiLineString multiLineString = Converters.convert(source,
                                MultiLineString.class);
                        if (multiLineString == null) {
                            return null;
                        } else {
                            List<LineString> components = new ArrayList<>();
                            double tolerance = Double.MAX_VALUE;

                            for (int i = 0; i < multiLineString.getNumGeometries(); i++) {
                                LineString geom = (LineString) multiLineString.getGeometryN(0);
                                if (geom instanceof CurvedGeometry) {
                                    tolerance = Math.min(tolerance,
                                            ((CurvedGeometry) geom).getTolerance());
                                }
                                components.add(geom);
View Full Code Here

     * @throws NoSuchAuthorityCodeException
     */
    private MultiLineString parseMultiLineString(int dimension, CoordinateReferenceSystem crs)
            throws XmlPullParserException, IOException, NoSuchAuthorityCodeException,
            FactoryException {
        MultiLineString geom;

        parser.require(XmlPullParser.START_TAG, GML.NAMESPACE, GML.MultiLineString.getLocalPart());

        List<LineString> lines = new ArrayList<LineString>(2);

View Full Code Here

            return multiPoint;
        } else if (internalType.equals("LineString")) {
            LineString[] lineStringArray = geometryFactory
                    .toLineStringArray(geometries);
            MultiLineString multiLineString = geometryFactory.createMultiLineString(lineStringArray);
            multiLineString.setUserData( getSRS() );
            multiLineString.setSRID( getSRID() );
            LOGGER.fine("created " + multiLineString);

            return multiLineString;
        } else if (internalType.equals("Polygon")) {
            Polygon[] polygonArray = geometryFactory.toPolygonArray(geometries);
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.