Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.MultiPoint


      obj.put("rings", arrayTemp2);
    }

    // MultiPoint
    else if (geometry.getClass().equals(MultiPoint.class)) {
      MultiPoint mpt = (MultiPoint) geometry;
      arrayTemp = new JSONArray();
      for (int i = 0, count = mpt.getNumGeometries(); i < count; i++) {
        Geometry geo = mpt.getGeometryN(i);
        if (geo.getClass().equals(Point.class)) {
          Point pt = (Point) geo;
          arrayTemp2 = new JSONArray();
          arrayTemp2.put(pt.getX());
          arrayTemp2.put(pt.getY());
View Full Code Here


    MultiGenerator pg = new MultiGenerator(pgc);
    pg.setBoundingBox(new Envelope(0,10,0,10));
    pg.setNumberGeometries(3);
    pg.setGeometryFactory(geometryFactory);
   
    MultiPoint pt = (MultiPoint) pg.create();
    checkRoundTrip(pt);
  }
View Full Code Here

    }

    private static GeometryFactory gf = new GeometryFactory();
    public Geometry getConvexHull() {
        if (newVertexAdded) {
            MultiPoint mp = gf.createMultiPoint(vertexCoords.toArray(new Coordinate[0]));
            newVertexAdded = false;
            mp.convexHull();
        }
        return convexHullAsGeom;
    }
View Full Code Here

        init(factory);
       
        if (g instanceof Point) {
            transformed = transformPoint((Point) g, factory);
        } else if (g instanceof MultiPoint) {
            MultiPoint mp = (MultiPoint) g;
            Point[] points = new Point[mp.getNumGeometries()];

            for (int i = 0; i < points.length; i++) {
                points[i] = transformPoint((Point) mp.getGeometryN(i), factory);
            }

            transformed = factory.createMultiPoint(points);
        } else if (g instanceof LineString) {
            transformed = transformLineString((LineString) g, factory);
        } else if (g instanceof MultiLineString) {
            MultiLineString mls = (MultiLineString) g;
            LineString[] lines = new LineString[mls.getNumGeometries()];

            for (int i = 0; i < lines.length; i++) {
                lines[i] = transformLineString((LineString) mls.getGeometryN(i), factory);
            }

            transformed = factory.createMultiLineString(lines);
        } else if (g instanceof Polygon) {
            transformed = transformPolygon((Polygon) g, factory);
        } else if (g instanceof MultiPolygon) {
            MultiPolygon mp = (MultiPolygon) g;
            Polygon[] polygons = new Polygon[mp.getNumGeometries()];

            for (int i = 0; i < polygons.length; i++) {
                polygons[i] = transformPolygon((Polygon) mp.getGeometryN(i), factory);
            }

            transformed = factory.createMultiPolygon(polygons);
        } else if (g instanceof GeometryCollection) {
            GeometryCollection gc = (GeometryCollection) g;
View Full Code Here

            for (int i = 0; i < value.length; i++) {
                geoms[i] = (Point) value[i].getValue();
            }

            MultiPoint mp = gf.createMultiPoint(geoms);

            ElementValue[] ev = new ElementValue[1];
            ev[0] = new DefaultElementValue(element, mp);

            return AbstractGeometryType.getInstance().getValue(element, ev,
View Full Code Here

            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

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

        buildDocument(xml);

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

        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

     *   (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

        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

TOP

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

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.