Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.MultiPolygon


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

            MultiPolygon g = (MultiPolygon) value;

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


        if (g instanceof LineString) {
            return removeCollinearVertices((LineString) g);
        } else if (g instanceof Polygon) {
            return removeCollinearVertices((Polygon) g);
        } else if (g instanceof MultiPolygon) {
            MultiPolygon mp = (MultiPolygon) g;
            Polygon[] parts = new Polygon[mp.getNumGeometries()];
            for (int i = 0; i < mp.getNumGeometries(); i++) {
                Polygon part = (Polygon) mp.getGeometryN(i);
                part = removeCollinearVertices(part);
                parts[i] = part;
            }

            return g.getFactory().createMultiPolygon(parts);
View Full Code Here

        if (geometry instanceof LineString) {
            return removeCollinearVertices((LineString) geometry);
        } else if (geometry instanceof Polygon) {
            return removeCollinearVertices((Polygon) geometry);
        } else if (geometry instanceof MultiPolygon) {
            MultiPolygon mp = (MultiPolygon) geometry;
            Polygon[] parts = new Polygon[mp.getNumGeometries()];
            for (int i = 0; i < mp.getNumGeometries(); i++) {
                Polygon part = (Polygon) mp.getGeometryN(i);
                part = removeCollinearVertices(part);
                parts[i] = part;
            }

            return geometry.getFactory().createMultiPolygon(parts);
View Full Code Here

                } catch (Exception ex) {
                    throw new DataSourceException(ex.getMessage(), ex);
                }
            }

            MultiPolygon multiPoly = geometryFactory.createMultiPolygon(polys);

            return multiPoly;
        }
View Full Code Here

*/
public class SurfaceTypeBindingTest extends GML3TestSupport {

    public void testParse() throws Exception {
        GML3MockData.surface(document, document);
        MultiPolygon surface = (MultiPolygon) parse();
        assertNotNull(surface);
       
        assertEquals( 1, surface.getNumGeometries() );
        Polygon p = (Polygon) surface.getGeometryN( 0 );
       
        assertEquals( 1, p.getNumInteriorRing() );
    }
View Full Code Here

     * @param g
     * @param shape
     */
    void fillLiteShape(Graphics2D g, LiteShape2 shape) {
        if(shape.getGeometry() instanceof MultiPolygon && shape.getGeometry().getNumGeometries() > 1) {
            MultiPolygon mp = (MultiPolygon) shape.getGeometry();
            for (int i = 0; i < mp.getNumGeometries(); i++) {
                Polygon p = (Polygon) mp.getGeometryN(i);
                try {
                    g.fill(new LiteShape2(p, null, null, false, false));
                } catch(Exception e) {
                    // should not really happen, but anyways
                    throw new RuntimeException("Unexpected error occurred while rendering a multipolygon", e);
View Full Code Here

            "<outerBoundaryIs><LinearRing><coordinates>0,0 1,1 2,2 0,0</coordinates></LinearRing></outerBoundaryIs></Polygon>" +
            "</MultiGeometry>";

        buildDocument(xml);

        MultiPolygon ml = (MultiPolygon) parse();
        assertEquals( 2, ml.getNumGeometries() );
    }
View Full Code Here

                new Coordinate(0,0), new Coordinate(1,1), new Coordinate(2,2),
                new Coordinate(0,0)
            }), null
        );
       
        MultiPolygon mp = gf.createMultiPolygon(new Polygon[]{p,p});
       
        Document dom = encode( mp, KML.MultiGeometry );
        assertEquals( 2, getElementsByQName(dom, KML.Polygon ).getLength() );
    }
View Full Code Here

     * </pre></code>
     */
    protected MultiPolygon createMultiPolygon() {
        Polygon poly1 = gf.createPolygon(ring(new double[] { 2, 3, 7, 3, 7, 9, 2, 9, 2, 3 }), null);
        Polygon poly2 = gf.createPolygon(ring(new double[] { 9, 5, 13, 5, 11, 8, 9, 5 }), null);
        MultiPolygon multiPolygon = gf.createMultiPolygon(new Polygon[] { poly1, poly2 });
        return multiPolygon;
    }
View Full Code Here

     */
    protected MultiPolygon createMultiPolygonWithHole() {
        Polygon poly1 = gf.createPolygon(ring(new double[] { 2, 3, 7, 3, 7, 9, 2, 9, 2, 3 }),
                new LinearRing[] { ring(new double[] { 3, 4, 6, 8, 3, 8, 3, 4 }), });
        Polygon poly2 = gf.createPolygon(ring(new double[] { 9, 5, 11, 8, 13, 5, 9, 5 }), null);
        MultiPolygon multiPolygon = gf.createMultiPolygon(new Polygon[] { poly1, poly2 });
        return multiPolygon;
    }
View Full Code Here

TOP

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

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.