Examples of createLinearRing()


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

    request.setRatio(0.5f);
    request.setLayerIds(new String[] {LAYER_ID});

    // create a rectangle that overlaps 50 %
    GeometryFactory factory = new GeometryFactory();
    LinearRing half1 = factory.createLinearRing(new Coordinate[] {new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 0.5), new Coordinate(0, 0.5), new Coordinate(0, 0)});
    Polygon polygon = factory.createPolygon(half1, null);
    request.setLocation(converter.toDto(polygon));

    // execute
View Full Code Here

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

    request.setRatio(0.5f);
    request.setLayerIds(new String[] {LAYER_ID});

    // create a rectangle that overlaps 49 %
    GeometryFactory factory = new GeometryFactory();
    LinearRing half1 = factory.createLinearRing(new Coordinate[] {new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 0.49), new Coordinate(0, 0.49), new Coordinate(0, 0)});
    Polygon polygon = factory.createPolygon(half1, null);
    request.setLocation(converter.toDto(polygon));

    // execute
View Full Code Here

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

    String geometryType = geometry.getGeometryType();
    if (Geometry.POINT.equals(geometryType)) {
      jts = factory.createPoint(convertCoordinates(geometry)[0]);
    } else if (Geometry.LINEAR_RING.equals(geometryType)) {
      jts = factory.createLinearRing(convertCoordinates(geometry));
    } else if (Geometry.LINE_STRING.equals(geometryType)) {
      jts = factory.createLineString(convertCoordinates(geometry));
    } else if (Geometry.POLYGON.equals(geometryType)) {
      LinearRing exteriorRing = (LinearRing) toInternal(geometry.getGeometries()[0]);
      LinearRing[] interiorRings = new LinearRing[geometry.getGeometries().length - 1];
View Full Code Here

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

  private VectorLayer layer;

  @Before
  public void setupBeans() throws LayerException {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING), 4329);
    LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 1), new Coordinate(0, 1), new Coordinate(0, 0), });
    Polygon p = factory.createPolygon(shell, null);
    MultiPolygon expected = factory.createMultiPolygon(new Polygon[] { p });
    CustomBean cb = new CustomBean();
    cb.setId(1);
View Full Code Here

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

  }

  @Test
  public void readGeometry() throws LayerException {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326);
    LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 1), new Coordinate(0, 1), new Coordinate(0, 0), });
    Polygon p = factory.createPolygon(shell, null);
    MultiPolygon expected = factory.createMultiPolygon(new Polygon[] { p });
    Assert.assertTrue(((CustomBean) layer.read("1")).getGeometry().equalsExact(expected));
  }
View Full Code Here

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

  @Test
  public void readGeometry() throws LayerException {
    Object bean = layer.read("1");
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326);
    LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 1), new Coordinate(0, 1), new Coordinate(0, 0), });
    Polygon p = factory.createPolygon(shell, null);
    MultiPolygon expected =factory.createMultiPolygon(new Polygon[]{p});
    Geometry g = layer.getFeatureModel().getGeometry(bean);
    Assert.assertTrue(expected.equalsExact(g, 0.00001));
View Full Code Here

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

            v[0].getCoordinate(),
            v[1].getCoordinate(),
            v[2].getCoordinate(),
            v[0].getCoordinate()};
        GeometryFactory fact = new GeometryFactory();
        LinearRing ring = fact.createLinearRing(ringPts);
        Polygon tri = fact.createPolygon(ring, null);
        return tri;
    }

    public static Geometry toPolygon(QuadEdge[] e) {
View Full Code Here

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

            e[0].orig().getCoordinate(),
            e[1].orig().getCoordinate(),
            e[2].orig().getCoordinate(),
            e[0].orig().getCoordinate()};
        GeometryFactory fact = new GeometryFactory();
        LinearRing ring = fact.createLinearRing(ringPts);
        Polygon tri = fact.createPolygon(ring, null);
        return tri;
    }

    /**
 
View Full Code Here

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

      holesRing = holesList.toArray(new LinearRing[holesList.size()]);
    }

    // form a closed linearRing.
    shellClosed = GeometryUtil.closeGeometry(shellClosed);
    LinearRing shellRing = fc.createLinearRing(shellClosed);

    result = fc.createPolygon(shellRing, holesRing);

    return result;
  }
View Full Code Here

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

                new Coordinate(-128.6811, 59.0559), new Coordinate(-128.6817, 59.0538),
                new Coordinate(-128.683, 59.0526), new Coordinate(-128.6837, 59.052),
                new Coordinate(-128.685, 59.0512), new Coordinate(-128.6863, 59.0512),
                new Coordinate(-128.6889, 59.0493), new Coordinate(-128.6898, 59.0493)};
        GeometryFactory fac=new GeometryFactory();
        Polygon lake = fac.createPolygon(fac.createLinearRing(coords), new LinearRing[0]);
        Envelope env = lake.getEnvelopeInternal();
       
        ViewportModel model = ((ViewportModel) handler.getContext().getMap().getViewportModel());
        model.setBounds(env);
        model.setWidth(env.getWidth()*200);
 
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.