Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Polygon


        new Coordinate(0,256),
        new Coordinate(0,0),
       
    });
   
    Polygon poly1=factory.createPolygon( ring1, new LinearRing[]{});
   
    LinearRing ring2=factory.createLinearRing(new Coordinate[]{
        new Coordinate(0,256),
        new Coordinate(512,256),
        new Coordinate(512,512),
        new Coordinate(0,512),
        new Coordinate(0,256),
       
    });
   
    Polygon poly2=factory.createPolygon( ring2, new LinearRing[]{});
   
    SimpleFeature[] features=UDIGTestUtil.createTestFeatures("testType", new Geometry[]{poly1, poly2},new String[]{}//$NON-NLS-1$
        DefaultEngineeringCRS.CARTESIAN_2D);
    map=MapTests.createNonDynamicMapAndRenderer(MapTests.createGeoResource(features, true), new Dimension(w,h));
    StyleBuilder sb=new StyleBuilder();
View Full Code Here


        LinearRing r2 = builder.safeCreateGeometry(LinearRing.class, new Coordinate[]{
            new Coordinate(2,2), new Coordinate(8,2), new Coordinate(8,8), new Coordinate(2,2),
        });
       
        GeometryFactory fac=new GeometryFactory();
        Polygon poly = fac.createPolygon(r1, new LinearRing[]{r2});
        setSource("Polygon", poly);
       
        copyFeatures(MultiPolygon.class, 1);
    }
View Full Code Here

        LinearRing r2 = builder.safeCreateGeometry(LinearRing.class, new Coordinate[]{
            new Coordinate(2,2), new Coordinate(8,2), new Coordinate(8,8), new Coordinate(2,2),
        });
       
        GeometryFactory fac=new GeometryFactory();
        Polygon poly = fac.createPolygon(r1, new LinearRing[]{r2});
        setSource("Polygon", poly);
       
        copyFeatures(MultiLineString.class, 1);
       
        ILayer layer = targetMap.getMapLayers().get(0);
View Full Code Here

        LinearRing r2 = builder.safeCreateGeometry(LinearRing.class, new Coordinate[]{
            new Coordinate(2,2), new Coordinate(8,2), new Coordinate(8,8), new Coordinate(2,2),
        });
       
        GeometryFactory fac=new GeometryFactory();
        Polygon poly = fac.createPolygon(r1, new LinearRing[]{r2});
        setSource("Polygon", poly);
       
        copyFeatures(LineString.class, 2);

    }
View Full Code Here

        LinearRing r2 = builder.safeCreateGeometry(LinearRing.class, new Coordinate[]{
            new Coordinate(2,2), new Coordinate(8,2), new Coordinate(8,8), new Coordinate(2,2),
        });
       
        GeometryFactory fac=new GeometryFactory();
        Polygon poly = fac.createPolygon(r1, new LinearRing[]{r2});
        setSource("Polygon", poly);
       
        copyFeatures(LinearRing.class, 2);
    }
View Full Code Here

    @Ignore
    @Test
    public void testPolygon2Point() throws Exception {
        setTarget("name2", "Point", builder.safeCreateGeometry(Point.class, new Coordinate[]{new Coordinate(10,10)}));

        Polygon poly = builder.safeCreateGeometry(Polygon.class, new Coordinate[]{
                    new Coordinate(0,0), new Coordinate(10,0), new Coordinate(10,10), new Coordinate(0,0),
                });
        setSource("Polygon", poly);
       
        copyFeatures(Point.class, 1);
        ILayer layer = targetMap.getMapLayers().get(0);
        FeatureIterator<SimpleFeature> iter = layer.getResource(FeatureSource.class, null).getFeatures(layer.getFilter()).features();
        SimpleFeature feature=iter.next();
        iter.close();
        assertEquals( poly.getCentroid().getCoordinate(), ((Geometry)feature.getDefaultGeometry()).getCoordinate() );
    }
View Full Code Here

    @Ignore
    @Test
    public void testMultiPolygon2Point() throws Exception {
        setTarget("name2", "Point", builder.safeCreateGeometry(Point.class, new Coordinate[]{new Coordinate(10,10)}));

        Polygon poly = builder.safeCreateGeometry(Polygon.class, new Coordinate[]{
            new Coordinate(0,0), new Coordinate(10,0), new Coordinate(10,10), new Coordinate(0,0),
        });
        Polygon poly2 = builder.safeCreateGeometry(Polygon.class, new Coordinate[]{
            new Coordinate(10,10), new Coordinate(20,10), new Coordinate(20,20), new Coordinate(10,10),
        });
        GeometryFactory fac=new GeometryFactory();
        setSource("MultiPolygon", fac.createMultiPolygon(new Polygon[]{poly,poly2}));
       
        copyFeatures(Point.class, 2);
        ILayer layer = targetMap.getMapLayers().get(0);
        FeatureIterator<SimpleFeature> iter = layer.getResource(FeatureSource.class, null).getFeatures(layer.getFilter()).features();
        SimpleFeature feature=iter.next();
        assertTrue( poly.getCentroid().getCoordinate().equals(((Geometry)feature.getDefaultGeometry()).getCoordinate()) ||
                poly2.getCentroid().getCoordinate().equals(((Geometry)feature.getDefaultGeometry()).getCoordinate()) );
        feature=iter.next();
        assertTrue( poly.getCentroid().getCoordinate().equals(((Geometry)feature.getDefaultGeometry()).getCoordinate()) ||
                poly2.getCentroid().getCoordinate().equals(((Geometry)feature.getDefaultGeometry()).getCoordinate()) );
        iter.close();
    }
View Full Code Here

    @Ignore
    @Test
    public void testMultiPolygon2MultiPoint() throws Exception {
        setTarget("name2", "MultiPoint", builder.safeCreateGeometry(MultiPoint.class, new Coordinate[]{new Coordinate(10,10)}));

        Polygon poly = builder.safeCreateGeometry(Polygon.class, new Coordinate[]{
            new Coordinate(0,0), new Coordinate(10,0), new Coordinate(10,10), new Coordinate(0,0),
        });
        Polygon poly2 = builder.safeCreateGeometry(Polygon.class, new Coordinate[]{
            new Coordinate(10,10), new Coordinate(20,10), new Coordinate(20,20), new Coordinate(10,10),
        });
        GeometryFactory fac=new GeometryFactory();
        setSource("MultiPolygon", fac.createMultiPolygon(new Polygon[]{poly,poly2}));
       
View Full Code Here

    @Ignore
    @Test
    public void testMultiPolygon2LineString() throws Exception {
        setTarget("name2", "LineString", builder.safeCreateGeometry(LineString.class, new Coordinate[]{new Coordinate(10,10)}));

        Polygon poly = builder.safeCreateGeometry(Polygon.class, new Coordinate[]{
            new Coordinate(0,0), new Coordinate(10,0), new Coordinate(10,10), new Coordinate(0,0),
        });
        Polygon poly2 = builder.safeCreateGeometry(Polygon.class, new Coordinate[]{
            new Coordinate(10,10), new Coordinate(20,10), new Coordinate(20,20), new Coordinate(10,10),
        });
        GeometryFactory fac=new GeometryFactory();
        setSource("MultiPolygon", fac.createMultiPolygon(new Polygon[]{poly,poly2}));
       
View Full Code Here

        LinearRing r2 = builder.safeCreateGeometry(LinearRing.class, new Coordinate[]{
            new Coordinate(2,2), new Coordinate(8,2), new Coordinate(8,8), new Coordinate(2,2),
        });
       
        GeometryFactory fac=new GeometryFactory();
        Polygon poly = fac.createPolygon(r1, new LinearRing[]{r2});
        setSource("MultiPolygon", fac.createMultiPolygon(new Polygon[]{poly}));
       
        copyFeatures(LineString.class, 2);
       
        ILayer layer = targetMap.getMapLayers().get(0);
View Full Code Here

TOP

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

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.