Package com.vividsolutions.jts.geom

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


  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

  }

  @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

  @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

      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

  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

  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

    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

      VectorXZ vertex = vertices.get(i);
      array[i] = vectorXZToJTSCoordinate(vertex);
    }
   
    return new Polygon(
        new LinearRing(new CoordinateArraySequence(array), GF),
        null, GF);
   
  }
View Full Code Here

            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;
    }
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.