Examples of Polygon


Examples of com.impetus.kundera.gis.geometry.Polygon

        LinearRing shell = new LinearRing(points, factory);
        LinearRing[] holes = new LinearRing[0];
        // holes[0] = shell;

        Polygon polygon = new Polygon(shell, holes, factory);
        List<Person> persons = dao.findWithinPolygon(polygon);
        Assert.assertNotNull(persons);
        Assert.assertFalse(persons.isEmpty());
        Assert.assertTrue(persons.size() == 11);
        dao.closeEntityManager();

        dao.createEntityManager();

        holes = new LinearRing[1];
        holes[0] = shell;
        polygon = new Polygon(shell, holes, factory);
        persons = dao.findWithinPolygon(polygon);
        Assert.assertNotNull(persons);
        Assert.assertFalse(persons.isEmpty());
        Assert.assertTrue(persons.size() == 8);
        dao.closeEntityManager();
View Full Code Here

Examples of com.jgraph.gaeawt.java.awt.Polygon

    }
    return internal_polygon;
  }

  private Polygon constructInternalPolygon() {
    internal_polygon = new Polygon();
    for (int i = 0; i < number_of_curves - 1; i++) {
      curve[i].addFinalPointsToPolygon(internal_polygon);
    }

    curve[number_of_curves - 1].addFinalPointsToPolygon(internal_polygon);
View Full Code Here

Examples of com.sromku.polygon.Polygon

  /**
   * Create simple polygon and check that the point is inside
   */
  public static void testSimplePolygon()
  {
    Polygon polygon = Polygon.Builder()
        .addVertex(new Point(1, 3))
        .addVertex(new Point(2, 8))
        .addVertex(new Point(5, 4))
        .addVertex(new Point(5, 9))
        .addVertex(new Point(7, 5))
View Full Code Here

Examples of com.sun.syndication.feed.module.georss.geometries.Polygon

          GeoPojo gp = new GeoPojo();
          gp.lat = latAvg;
          gp.lon = lonAvg;
          doc.setDocGeo(gp);
        }
        else if (ag.getClass().equals(new Polygon().getClass())) //<georss:polygon>
        {
          Polygon poly = ((Polygon)geoRSSModule.getGeometry());
          AbstractRing ar = poly.getExterior();
          LinearRing lr = (LinearRing)ar;

          double latAvg = 0.0;
          double lonAvg = 0.0;
          int length = lr.getPositionList().size();
View Full Code Here

Examples of com.vividsolutions.jts.geom.Polygon

    document.writeElement("vml:shape", asChild);
    document.writeAttribute("fill-rule", "evenodd");
    document.writeAttributeStart("path");
    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("vml:shape", asChild);
    document.writeAttribute("fill-rule", "evenodd");
    document.writeAttributeStart("path");
    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

  }

  @Test
  public void dtoPolygonToJts() throws GeomajasException {
    // Test DTO Polygon to JTS:
    Polygon polygon = (Polygon) converter.toInternal(createDtoPolygon());
    Assert.assertEquals(dtoC6.getX(), polygon.getInteriorRingN(0).getCoordinateN(1).x);
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Polygon

  @Test
  public void dtoMultiPolygonToJts() throws GeomajasException {
    // Test DTO MultiPolygon to JTS:
    MultiPolygon multiPolygon = (MultiPolygon) converter.toInternal(createDtoMultiPolygon());
    Polygon polygon = (Polygon) multiPolygon.getGeometryN(1);
    Assert.assertEquals(dtoC6.getX(), polygon.getInteriorRingN(0).getCoordinateN(1).x);
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Polygon

  private MultiPolygon createJtsMultiPolygon() {
    LinearRing shell = factory.createLinearRing(new com.vividsolutions.jts.geom.Coordinate[] { jtsC1, jtsC2, jtsC3,
        jtsC4, jtsC1 });
    LinearRing hole = factory.createLinearRing(new com.vividsolutions.jts.geom.Coordinate[] { jtsC5, jtsC6, jtsC7,
        jtsC8, jtsC5 });
    Polygon polygon1 = factory.createPolygon(shell, new LinearRing[] {});
    Polygon polygon2 = factory.createPolygon(shell, new LinearRing[] { hole });
    return factory.createMultiPolygon(new Polygon[] { polygon1, polygon2 });
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.Polygon

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

  @Test
  public void testContainsFilter() 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.createContainsFilter(poly1, "geometry");
    TestFeature f = new TestFeature();
    f.expectAndReturn("geometry", touching);
    Assert.assertFalse(filter.evaluate(f));
    f.clear();
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.