Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.GeometryFactory.createPolygon()


        // to detect this other than this crazy DE-9IM stuff

        List<Polygon> polygonHoles = new ArrayList<Polygon>();
        for (Ring ring : holes) {
            LinearRing linearRing = factory.createLinearRing(toCoordinates(ring.geometry));
            Polygon polygon = factory.createPolygon(linearRing, new LinearRing[0]);
            for (Iterator<Polygon> it = polygonHoles.iterator(); it.hasNext();) {
                Polygon otherHole = it.next();
                if (otherHole.relate(polygon, "F***1****")) {
                    polygon = (Polygon) polygon.union(otherHole);
                    it.remove();
View Full Code Here


                LinearRing ring = factory.createLinearRing(line.getCoordinates());
                lrholelist.add(ring);
            }
        }
        LinearRing[] lrholes = lrholelist.toArray(new LinearRing[lrholelist.size()]);
        jtsPolygon = factory.createPolygon(shell, lrholes);
        return jtsPolygon;
    }

    private Coordinate[] toCoordinates(VLPolygon geometry) {
        Coordinate[] coords = new Coordinate[geometry.n() + 1];
View Full Code Here

                } else {
                    innerLR[innerIndex++] = (LinearRing) value[i].getValue();
                }
            }

            Polygon p = gf.createPolygon(outerLR, innerLR);

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

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

            if ((hole != null) && !hole.isEmpty()) {
                holes.add(hole);
            }
        }

        return gf.createPolygon((LinearRing) shell, holes.toArray(new LinearRing[holes.size()]));
    }

    /**
     * Removes collinear vertices from the provided {@link Geometry}.
     *
 
View Full Code Here

        if (removeHoles) {
            for (int i = 0; i < result.size(); i++) {
                Polygon item = result.get(i);
                if (item.getNumInteriorRing() > 0) {
                    GeometryFactory factory = item.getFactory();
                    Polygon noHoles = factory.createPolygon((LinearRing) item.getExteriorRing(),
                            null);
                    result.set(i, noHoles);
                }
            }
        }
View Full Code Here

* @source $URL$
*/
public class SurfacePropertyTypeBindingTest extends GML3TestSupport {
    public void testEncode() throws Exception {
        GeometryFactory gf = new GeometryFactory();
        Polygon polygon = gf.createPolygon(gf.createLinearRing(
                    new Coordinate[] {
                        new Coordinate(0, 0), new Coordinate(1, 1), new Coordinate(2, 2),
                        new Coordinate(0, 0)
                    }), null);

View Full Code Here

        assertEquals( 2, ml.getNumGeometries() );
    }
   
    public void testEncodeMultiPolygon() throws Exception {
        GeometryFactory gf = new GeometryFactory();
        Polygon p = gf.createPolygon(
            gf.createLinearRing( new Coordinate[] {
                new Coordinate(0,0), new Coordinate(1,1), new Coordinate(2,2),
                new Coordinate(0,0)
            }), null
        );
View Full Code Here

        GeometryFactory gf = new GeometryFactory();
        GeometryCollection gc = gf.createGeometryCollection(
            new Geometry[]{
                gf.createPoint( new Coordinate(0,0)),
                gf.createLineString( new Coordinate[]{new Coordinate(0,0), new Coordinate(1,1)}),
                gf.createPolygon(
                    gf.createLinearRing( new Coordinate[] {
                        new Coordinate(0,0), new Coordinate(1,1), new Coordinate(2,2),
                        new Coordinate(0,0)
                    }), null
                )   
View Full Code Here

        GeometryFactory gc = new GeometryFactory();
        LinearRing ring = gc.createLinearRing(new Coordinate[] {
                new Coordinate(0, 0), new Coordinate(10, 0),
                new Coordinate(10, 10), new Coordinate(0, 10),
                new Coordinate(0, 0) });
        Polygon polygon = gc.createPolygon(ring, null);

        ReferencedEnvelope bounds = new ReferencedEnvelope(polygon
                .getEnvelopeInternal(), null);
        Filter gf = ff.bbox(ff.property("the_geom"), bounds);
View Full Code Here

            ring = gfac.createLinearRing(coords);
        } catch (TopologyException tex) {
            throw new IllegalFilterException(tex.toString());
        }

        Polygon polygon = gfac.createPolygon(ring, null);
        if (envelope instanceof ReferencedEnvelope) {
            ReferencedEnvelope refEnv = (ReferencedEnvelope) envelope;
            polygon.setUserData(refEnv.getCoordinateReferenceSystem());
        }
       
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.