Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.LinearRing


  @Before
  public void setUp() throws Exception {
    GeometryFactory factory=new GeometryFactory();
   
    LinearRing ring1=factory.createLinearRing(new Coordinate[]{
        new Coordinate(0,0),
        new Coordinate(512,0),
        new Coordinate(512,256),
        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),
View Full Code Here


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

        LinearRing r1 = builder.safeCreateGeometry(LinearRing.class, new Coordinate[]{
            new Coordinate(0,0), new Coordinate(10,0), new Coordinate(10,10), new Coordinate(0,10), new Coordinate(0,0)
        });
        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});
View Full Code Here

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

        LinearRing r1 = builder.safeCreateGeometry(LinearRing.class, new Coordinate[]{
            new Coordinate(0,0), new Coordinate(10,0), new Coordinate(10,10), new Coordinate(0,10), new Coordinate(0,0)
        });
        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});
View Full Code Here

    @SuppressWarnings("deprecation")
    @Ignore
    @Test
    public void testPolygon2LineString() throws Exception {
        setTarget("target2", "LineString", builder.safeCreateGeometry(LineString.class, new Coordinate[]{new Coordinate(10,10)}));
        LinearRing r1 = builder.safeCreateGeometry(LinearRing.class, new Coordinate[]{
            new Coordinate(0,0), new Coordinate(10,0), new Coordinate(10,10), new Coordinate(0,10), new Coordinate(0,0)
        });
        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});
View Full Code Here

    @SuppressWarnings("deprecation")
    @Ignore
    @Test
    public void testPolygon2LinearRing() throws Exception {
        setTarget("target2", "com.vividsolutions.jts.geom.LinearRing", builder.safeCreateGeometry(LinearRing.class, new Coordinate[]{new Coordinate(10,10)}));
        LinearRing r1 = builder.safeCreateGeometry(LinearRing.class, new Coordinate[]{
            new Coordinate(0,0), new Coordinate(10,0), new Coordinate(10,10), new Coordinate(0,10), new Coordinate(0,0)
        });
        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});
View Full Code Here

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

        LinearRing r1 = builder.safeCreateGeometry(LinearRing.class, new Coordinate[]{
            new Coordinate(0,0), new Coordinate(10,0), new Coordinate(10,10), new Coordinate(0,10), new Coordinate(0,0)
        });
        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);
        FeatureIterator<SimpleFeature> iter = layer.getResource(FeatureSource.class, null).getFeatures(layer.getFilter()).features();
        SimpleFeature feature=iter.next();
        assertTrue( r1.equals(feature.getDefaultGeometry()) || r2.equals(feature.getDefaultGeometry()) );
        feature=iter.next();
        assertTrue( r1.equals(feature.getDefaultGeometry()) || r2.equals(feature.getDefaultGeometry()) );
        iter.close();
    }
View Full Code Here

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

        LinearRing r1 = builder.safeCreateGeometry(LinearRing.class, new Coordinate[]{
            new Coordinate(0,0), new Coordinate(10,0), new Coordinate(10,10), new Coordinate(0,10), new Coordinate(0,0)
        });
        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});
View Full Code Here

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

        LinearRing r1 = builder.safeCreateGeometry(LinearRing.class, new Coordinate[]{
            new Coordinate(0,0), new Coordinate(10,0), new Coordinate(10,10), new Coordinate(0,10), new Coordinate(0,0)
        });
        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);
       
        ILayer layer = targetMap.getMapLayers().get(0);
        FeatureIterator<SimpleFeature> iter = layer.getResource(FeatureSource.class, null).getFeatures(layer.getFilter()).features();
        SimpleFeature feature=iter.next();
        assertTrue( r1.equals(feature.getDefaultGeometry()) || r2.equals(feature.getDefaultGeometry()) );
        feature=iter.next();
        assertTrue( r1.equals(feature.getDefaultGeometry()) || r2.equals(feature.getDefaultGeometry()) );
        iter.close();
    }  
View Full Code Here

    // add the rings to the ringList.
    for (Polygon pol : polyCollection) {

      Coordinate[] polCoord = pol.getExteriorRing().getCoordinates();

      LinearRing polygonRing = line.getFactory().createLinearRing(polCoord);
      ringList.add(polygonRing);
    }
    //
    // for (Geometry ring : ringList) {
    //
View Full Code Here

      // for creating a linearRing, the geometry must form a closed
      // geometry.
      // close the geometry.
      Coordinate[] closedLine = closeGeometry(lineCoor);
      // try to create a linearRing.
      LinearRing ring;
      try {
        ring = factory.createLinearRing(closedLine);
        // Create the polygon geometry and add to the list.
        Geometry polygonGeometry = factory.createPolygon(ring, null);
        ringsList.add(polygonGeometry);
View Full Code Here

TOP

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

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.