Examples of Polygon


Examples of com.vividsolutions.jts.geom.Polygon

    Assert.assertTrue(fid.evaluate(f));
  }

  @Test
  public void testGeometryTypeFilter() throws GeomajasException, ParseException {
    Polygon poly = (Polygon) wkt.read("POLYGON((0 0,1 0,1 1,0 1,0 0))");
    Filter fid = filterService.createGeometryTypeFilter("geometry", "Polygon");
    TestFeature f = new TestFeature();
    f.expectAndReturn("geometry", poly);
    Assert.assertTrue(fid.evaluate(f));
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Polygon

    Assert.assertTrue(fid.evaluate(f));
  }

  @Test
  public void testIntersectsFilter() throws GeomajasException, ParseException {
    Polygon poly1 = (Polygon) wkt.read("POLYGON((0 0,1 0,1 1,0 1,0 0))");
    Polygon touching = (Polygon) wkt.read("POLYGON((1 1,2 1,2 2,1 2,1 1))");
    Polygon disjoint = (Polygon) wkt.read("POLYGON((2 2,3 2,3 3,2 3,2 2))");
    Polygon overlapping = (Polygon) wkt.read("POLYGON((0.5 0.5,1.5 0.5,1.5 1.5,0.5 1.5,0.5 0.5))");
    Polygon within = (Polygon) wkt.read("POLYGON((0.1 0.1,0.9 0.1,0.9 0.9,0.1 0.9,0.1 0.1))");
    Polygon contains = (Polygon) wkt.read("POLYGON((-0.1 -0.1,1.1 -0.1,1.1 1.1,-0.1 1.1,-0.1 -0.1))");
    Filter filter = filterService.createIntersectsFilter(poly1, "geometry");
    TestFeature f = new TestFeature();
    f.expectAndReturn("geometry", touching);
    Assert.assertTrue(filter.evaluate(f));
    f.clear();
View Full Code Here

Examples of com.vividsolutions.jts.geom.Polygon

    Assert.assertTrue(filter.evaluate(f));
  }

  @Test
  public void testOverlapsFilter() throws GeomajasException, ParseException {
    Polygon poly1 = (Polygon) wkt.read("POLYGON((0 0,1 0,1 1,0 1,0 0))");
    Polygon touching = (Polygon) wkt.read("POLYGON((1 1,2 1,2 2,1 2,1 1))");
    Polygon disjoint = (Polygon) wkt.read("POLYGON((2 2,3 2,3 3,2 3,2 2))");
    Polygon overlapping = (Polygon) wkt.read("POLYGON((0.5 0.5,1.5 0.5,1.5 1.5,0.5 1.5,0.5 0.5))");
    Polygon within = (Polygon) wkt.read("POLYGON((0.1 0.1,0.9 0.1,0.9 0.9,0.1 0.9,0.1 0.1))");
    Polygon contains = (Polygon) wkt.read("POLYGON((-0.1 -0.1,1.1 -0.1,1.1 1.1,-0.1 1.1,-0.1 -0.1))");
    Filter filter = filterService.createOverlapsFilter(poly1, "geometry");
    TestFeature f = new TestFeature();
    f.expectAndReturn("geometry", touching);
    Assert.assertFalse(filter.evaluate(f));
    f.clear();
View Full Code Here

Examples of com.vividsolutions.jts.geom.Polygon

    Assert.assertFalse(filter.evaluate(f));
  }

  @Test
  public void testTouchesFilter() throws GeomajasException, ParseException {
    Polygon poly1 = (Polygon) wkt.read("POLYGON((0 0,1 0,1 1,0 1,0 0))");
    Polygon touching = (Polygon) wkt.read("POLYGON((1 1,2 1,2 2,1 2,1 1))");
    Polygon disjoint = (Polygon) wkt.read("POLYGON((2 2,3 2,3 3,2 3,2 2))");
    Polygon overlapping = (Polygon) wkt.read("POLYGON((0.5 0.5,1.5 0.5,1.5 1.5,0.5 1.5,0.5 0.5))");
    Polygon within = (Polygon) wkt.read("POLYGON((0.1 0.1,0.9 0.1,0.9 0.9,0.1 0.9,0.1 0.1))");
    Polygon contains = (Polygon) wkt.read("POLYGON((-0.1 -0.1,1.1 -0.1,1.1 1.1,-0.1 1.1,-0.1 -0.1))");
    Filter filter = filterService.createTouchesFilter(poly1, "geometry");
    TestFeature f = new TestFeature();
    f.expectAndReturn("geometry", touching);
    Assert.assertTrue(filter.evaluate(f));
    f.clear();
View Full Code Here

Examples of com.vividsolutions.jts.geom.Polygon

    Assert.assertFalse(filter.evaluate(f));
  }

  @Test
  public void testWithinFilter() throws GeomajasException, ParseException {
    Polygon poly1 = (Polygon) wkt.read("POLYGON((0 0,1 0,1 1,0 1,0 0))");
    Polygon touching = (Polygon) wkt.read("POLYGON((1 1,2 1,2 2,1 2,1 1))");
    Polygon disjoint = (Polygon) wkt.read("POLYGON((2 2,3 2,3 3,2 3,2 2))");
    Polygon overlapping = (Polygon) wkt.read("POLYGON((0.5 0.5,1.5 0.5,1.5 1.5,0.5 1.5,0.5 0.5))");
    Polygon within = (Polygon) wkt.read("POLYGON((0.1 0.1,0.9 0.1,0.9 0.9,0.1 0.9,0.1 0.1))");
    Polygon contains = (Polygon) wkt.read("POLYGON((-0.1 -0.1,1.1 -0.1,1.1 1.1,-0.1 1.1,-0.1 -0.1))");
    Filter filter = filterService.createWithinFilter(poly1, "geometry");
    TestFeature f = new TestFeature();
    f.expectAndReturn("geometry", touching);
    Assert.assertFalse(filter.evaluate(f));
    f.clear();
View Full Code Here

Examples of com.vividsolutions.jts.geom.Polygon

    document.writeElement("path", asChild);
    document.writeAttribute("fill-rule", "evenodd");
    document.writeAttributeStart("d");
    MultiPolygon mpoly = (MultiPolygon) o;
    for (int i = 0; i < mpoly.getNumGeometries(); i++) {
      Polygon poly = (Polygon) mpoly.getGeometryN(i);
      LineString shell = poly.getExteriorRing();
      int nHoles = poly.getNumInteriorRing();
      document.writeClosedPathContent(shell.getCoordinates());

      for (int j = 0; j < nHoles; j++) {
        document.writeClosedPathContent(poly.getInteriorRingN(j).getCoordinates());
      }
    }
    document.writeAttributeEnd();
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Polygon

  public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
    document.writeElement("path", asChild);
    document.writeAttribute("fill-rule", "evenodd");
    document.writeAttributeStart("d");
    Polygon poly = (Polygon) o;
    LineString shell = poly.getExteriorRing();
    int nHoles = poly.getNumInteriorRing();
    document.writeClosedPathContent(shell.getCoordinates());
    for (int j = 0; j < nHoles; j++) {
      document.writeClosedPathContent(poly.getInteriorRingN(j).getCoordinates());
    }
    document.writeAttributeEnd();
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Polygon

    LineString lineString = (LineString) reader.read("LINESTRING (0 1,1 1)");
    geometry = geoService.transform(lineString, new ThrowingTransform());
    Assert.assertEquals(LineString.class, geometry.getClass());
    Assert.assertTrue(geometry.isEmpty());
   
    Polygon polygon = (Polygon) reader.read("POLYGON ((0 0,1 1,0 1,0 0))");
    geometry = geoService.transform(polygon, new ThrowingTransform());
    Assert.assertEquals(Polygon.class, geometry.getClass());
    Assert.assertTrue(geometry.isEmpty());

    MultiPoint multipoint = (MultiPoint) reader.read("MULTIPOINT ((1 1),(2 1))");
View Full Code Here

Examples of com.vividsolutions.jts.geom.Polygon

    GeometryFactory factory = new GeometryFactory(new PrecisionModel(100.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);
    JSONObject jo = (JSONObject) ser.marshall(null, p);
    assertEquals("Polygon", jo.get("type").toString());
    assertEquals("[]", jo.get("holes").toString());
    assertEquals("31300", jo.get("srid").toString());
    assertEquals("2", jo.get("precision").toString());
View Full Code Here

Examples of com.vividsolutions.jts.geom.Polygon

    GeometryFactory factory = new GeometryFactory(new PrecisionModel(100.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);
    JSONObject jo = (JSONObject) ser.marshall(null, m);
    assertEquals("MultiPolygon", jo.get("type").toString());
    assertEquals("31300", jo.get("srid").toString());
    assertEquals("2", jo.get("precision").toString());
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.