Examples of MultiPoint


Examples of com.vividsolutions.jts.geom.MultiPoint

            Map hints) throws IOException, OperationNotSupportedException {
            if (!canEncode(element, value, hints)) {
                throw new OperationNotSupportedException("Cannot encode");
            }

            MultiPoint g = (MultiPoint) value;

            GMLComplexTypes.encode(element, g, output);
        }
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPoint

            "<Point><coordinates>1,1</coordinates></Point>" +
            "</MultiGeometry>";

        buildDocument(xml);

        MultiPoint mp = (MultiPoint) parse();
        assertEquals( 2, mp.getNumPoints() );
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPoint

        assertEquals( 2, mp.getNumPoints() );
    }
   
    public void testEncodeMultiPoint() throws Exception {
        GeometryFactory gf = new GeometryFactory();
        MultiPoint mp = gf.createMultiPoint(
            new Coordinate[]{ new Coordinate( 0, 0 ), new Coordinate(1,1) }
        );
        Document dom = encode( mp, KML.MultiGeometry );
        assertEquals( 2, getElementsByQName(dom, KML.Point ).getLength() );
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPoint

     *   (1,1, 2,2, 3,3, 5,5)
     * )
     * </pre></code>
     */
    protected MultiPoint createMultiPoint() {
        MultiPoint multiPoint = gf
                .createMultiPoint(coords(new double[] { 1, 1, 2, 2, 3, 3, 5, 5 }));
        return multiPoint;
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPoint

        final int LEN = D(GTYPE);

        int start = (STARTING_OFFSET - 1) / LEN;
        int end = start + INTERPRETATION;

        MultiPoint points = gf.createMultiPoint(subList(
                    gf.getCoordinateSequenceFactory(), coords, start, end));
        points.setSRID(SRID);

        return points;
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPoint

    }

    public void testParse() throws Exception {
        GML2MockData.multiPoint(document, document);

        MultiPoint mp = (MultiPoint) parse();
        assertEquals(2, mp.getNumGeometries());
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPoint

        GMLGeometryCollectionTypeBinding s1 = (GMLGeometryCollectionTypeBinding) container
            .getComponentInstanceOfType(GMLGeometryCollectionTypeBinding.class);
        GMLMultiPointTypeBinding s2 = (GMLMultiPointTypeBinding) container
            .getComponentInstanceOfType(GMLMultiPointTypeBinding.class);

        MultiPoint mpoint = (MultiPoint) s2.parse(mp, node, s1.parse(mp, node, null));

        assertNotNull(mpoint);
        assertEquals(mpoint.getNumGeometries(), 2);

        assertEquals(((Point) mpoint.getGeometryN(0)).getX(), 0d, 0d);
        assertEquals(((Point) mpoint.getGeometryN(0)).getY(), 0d, 0d);
        assertEquals(((Point) mpoint.getGeometryN(1)).getX(), 1d, 0d);
        assertEquals(((Point) mpoint.getGeometryN(1)).getY(), 1d, 0d);
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPoint

    }

    public void testParse() throws Exception {
        GML2MockData.multiPointProperty(document, document);

        MultiPoint mp = (MultiPoint) parse();
        assertNotNull(mp);
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPoint

     *
     * @return int The length of the record that this shapepoint will take up in
     *         a shapefile
     */
    public int getLength(Object geometry) {
        MultiPoint mp = (MultiPoint) geometry;

        int length;

        if (shapeType == ShapeType.MULTIPOINT) {
            // two doubles per coord (16 * numgeoms) + 40 for header
            length = (mp.getNumGeometries() * 16) + 40;
        } else if (shapeType == ShapeType.MULTIPOINTM) {
            // add the additional MMin, MMax for 16, then 8 per measure
            length = (mp.getNumGeometries() * 16) + 40 + 16
                    + (8 * mp.getNumGeometries());
        } else if (shapeType == ShapeType.MULTIPOINTZ) {
            // add the additional ZMin,ZMax, plus 8 per Z
            length = (mp.getNumGeometries() * 16) + 40 + 16
                    + (8 * mp.getNumGeometries()) + 16
                    + (8 * mp.getNumGeometries());
        } else {
            throw new IllegalStateException("Expected ShapeType of Arc, got "
                    + shapeType);
        }

View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPoint

        return geometryFactory.createMultiPoint(cs);
    }

    public void write(ByteBuffer buffer, Object geometry) {
        MultiPoint mp = (MultiPoint) geometry;

        Envelope box = mp.getEnvelopeInternal();
        buffer.putDouble(box.getMinX());
        buffer.putDouble(box.getMinY());
        buffer.putDouble(box.getMaxX());
        buffer.putDouble(box.getMaxY());

        buffer.putInt(mp.getNumGeometries());

        for (int t = 0, tt = mp.getNumGeometries(); t < tt; t++) {
            Coordinate c = (mp.getGeometryN(t)).getCoordinate();
            buffer.putDouble(c.x);
            buffer.putDouble(c.y);
        }

        if (shapeType == ShapeType.MULTIPOINTZ) {
            double[] zExtreame = JTSUtilities.zMinMax(mp.getCoordinates());

            if (Double.isNaN(zExtreame[0])) {
                buffer.putDouble(0.0);
                buffer.putDouble(0.0);
            } else {
                buffer.putDouble(zExtreame[0]);
                buffer.putDouble(zExtreame[1]);
            }

            for (int t = 0; t < mp.getNumGeometries(); t++) {
                Coordinate c = (mp.getGeometryN(t)).getCoordinate();
                double z = c.z;

                if (Double.isNaN(z)) {
                    buffer.putDouble(0.0);
                } else {
                    buffer.putDouble(z);
                }
            }
        }

        if (shapeType == ShapeType.MULTIPOINTM
                || shapeType == ShapeType.MULTIPOINTZ) {
            buffer.putDouble(-10E40);
            buffer.putDouble(-10E40);

            for (int t = 0; t < mp.getNumGeometries(); t++) {
                buffer.putDouble(-10E40);
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.