Examples of LinearRing


Examples of com.vividsolutions.jts.geom.LinearRing

    } 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];
      for (int i = 0; i < interiorRings.length; i++) {
        interiorRings[i] = (LinearRing) toInternal(geometry.getGeometries()[i + 1]);
      }
      jts = factory.createPolygon(exteriorRing, interiorRings);
View Full Code Here

Examples of com.vividsolutions.jts.geom.LinearRing

          coords.add(new Coordinate(0, 0));
          coords.add(new Coordinate(w, 0));
          coords.add(new Coordinate(w, h));
          coords.add(new Coordinate(0, h));
          coords.add(new Coordinate(0, 0));
          LinearRing ring = geometryFactory.createLinearRing(coords.toArray(new Coordinate[coords.size()]));
          Polygon p = geometryFactory.createPolygon(ring, null);
          polygon = new LiteShape2(p, null, null, false);
        }
        return polygon;
      } else if (symbolizer instanceof PointSymbolizer) {
View Full Code Here

Examples of com.vividsolutions.jts.geom.LinearRing

  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.LinearRing

  }

  @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.LinearRing

  @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.LinearRing

      double dy = Math.sin(angle) * radius;
      coords[i] = new Coordinate(x + dx, y + dy);
    }
    coords[nrPoints] = coords[0];

    LinearRing ring = point.getFactory().createLinearRing(coords);
    return point.getFactory().createPolygon(ring, null);
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.LinearRing

  public void testPolygon() throws MarshallException, GeomajasException {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(10000.0), 31300);
    CoordinateArraySequence coords = new CoordinateArraySequence(new Coordinate[] { new Coordinate(12.0, 34.23),
        new Coordinate(12.000, 54.555), new Coordinate(7, 8), new Coordinate(12.0, 34.23) });
    LinearRing ring = new LinearRing(coords, factory);
    Polygon p = new Polygon(ring, null, factory);
    Geometry dto = converter.toDto(p);

    JSONObject jtsJson = (JSONObject) jtsSerializer.marshall(null, p);
    JSONObject dtoJson = (JSONObject) dtoSerializer.marshall(null, dto);
View Full Code Here

Examples of com.vividsolutions.jts.geom.LinearRing

  public void testMultiPolygon() throws MarshallException, GeomajasException {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(10000.0), 31300);
    CoordinateArraySequence coords = new CoordinateArraySequence(new Coordinate[] { new Coordinate(12.0, 34.23),
        new Coordinate(12.000, 54.555), new Coordinate(7, 8), new Coordinate(12.0, 34.23) });
    LinearRing ring = new LinearRing(coords, factory);
    Polygon p = new Polygon(ring, new LinearRing[] {}, factory);
    MultiPolygon m = new MultiPolygon(new Polygon[] { p }, factory);
    Geometry dto = converter.toDto(m);

    JSONObject jtsJson = (JSONObject) jtsSerializer.marshall(null, m);
View Full Code Here

Examples of com.vividsolutions.jts.geom.LinearRing

    return geometry;
  }

  private Polygon createPolygon(GeometryFactory factory, JSONObject jso) throws UnmarshallException {
    JSONObject jsoShell = jso.getJSONObject("shell");
    LinearRing shell = createLinearRing(factory, jsoShell);

    JSONArray holeArray = jso.getJSONArray("holes");
    LinearRing[] holes = new LinearRing[holeArray.length()];
    for (int i = 0; i < holeArray.length(); i++) {
      JSONObject jsoHole = holeArray.getJSONObject(i);
View Full Code Here

Examples of de.micromata.opengis.kml.v_2_2_0.LinearRing

      kmlPolygon.setAltitudeMode(AltitudeMode.CLAMP_TO_GROUND);

      final Boundary outerboundary = new Boundary();
      kmlPolygon.setOuterBoundaryIs(outerboundary);

      final LinearRing outerlinearring = new LinearRing();
      outerboundary.setLinearRing(outerlinearring);

      List<Coordinate> outercoord = new ArrayList<Coordinate>();
      outerlinearring.setCoordinates(outercoord);
      for (int i=0;i<polygon.getExteriorRing().getNumPoints();i++) {
        outercoord.add(new Coordinate(polygon.getExteriorRing().getPointN(i).getX(),polygon.getExteriorRing().getPointN(i).getY()));
      }
     
      int numOfInnerBoundaries = polygon.getNumInteriorRing();
      for(int i=0;i<numOfInnerBoundaries;i++)
      {
        final Boundary innerboundary = new Boundary();
        kmlPolygon.getInnerBoundaryIs().add(innerboundary);
 
        final LinearRing innerlinearring = new LinearRing();
        innerboundary.setLinearRing(innerlinearring);
 
        List<Coordinate> innercoord = new ArrayList<Coordinate>();
        innerlinearring.setCoordinates(innercoord);
        int numOfPoints = polygon.getInteriorRingN(i).getNumPoints();
        for(int j=0;j<numOfPoints;j++)
          innercoord.add(new Coordinate(polygon.getInteriorRingN(i).getPointN(j).getX(),polygon.getInteriorRingN(i).getPointN(j).getY()));
       
      }
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.