Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Polygon


        LinearRing r2 = builder.safeCreateGeometry(LinearRing.class, new Coordinate[]{
            new Coordinate(2,2), new Coordinate(8,2), new Coordinate(8,8), new Coordinate(2,2),
        });
       
        GeometryFactory fac=new GeometryFactory();
        Polygon poly = fac.createPolygon(r1, new LinearRing[]{r2});
        setSource("MultiPolygon", fac.createMultiPolygon(new Polygon[]{poly, fac.createPolygon(r2, new LinearRing[0])}));
       
        copyFeatures(Polygon.class, 2);
    }
View Full Code Here


        LinearRing r2 = builder.safeCreateGeometry(LinearRing.class, new Coordinate[]{
            new Coordinate(2,2), new Coordinate(8,2), new Coordinate(8,8), new Coordinate(2,2),
        });
       
        GeometryFactory fac=new GeometryFactory();
        Polygon poly = fac.createPolygon(r1, new LinearRing[]{r2});
        setSource("Polygon", poly);
       
        copyFeatures(LineString.class, 2);
       
        ILayer layer = targetMap.getMapLayers().get(0);
View Full Code Here

   * @throws Exception
   */
  @Test
  public void testSplitPolygon_SplitPolygonOnce() throws Exception {
    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING(30 0, 30 60)");
    Polygon splitee = (Polygon) SplitTestUtil.read("POLYGON((20 20, 40 20, 40 40, 20 40, 20 20))");
    Geometry expectedLeft = SplitTestUtil.read("POLYGON ((30 20, 20 20, 20 40, 30 40, 30 20))");
    Geometry expectedRight = SplitTestUtil.read("POLYGON ((30 40, 40 40, 40 20, 30 20, 30 40))");

    testSplitResults(splitee, splitter, new Geometry[] { expectedLeft, expectedRight });
  }
View Full Code Here

   * @throws Exception
   */
  @Test
  public void testSplitPolygon_CutoutBlock() throws Exception {
    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING(20 0, 20 30, 30 30, 30 0)");
    Polygon splitee = (Polygon) SplitTestUtil.read("POLYGON((10 10, 40 10, 40 40, 10 40, 10 10))");
    final Geometry expectedLeft = SplitTestUtil
          .read("POLYGON ((20 10, 10 10, 10 40, 40 40, 40 10, 30 10, 30 30, 30 30, 20 30, 20 30, 20 10))");
    final Geometry expectedRight = SplitTestUtil.read("POLYGON ((30 10, 20 10, 20 30, 30 30, 30 10))");
    testSplitResults(splitee, splitter, new Geometry[] { expectedLeft, expectedRight });
  }
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testSplitPolygon_SplitGeomWithHole() throws Exception {
    Polygon splitee = (Polygon) SplitTestUtil
          .read("POLYGON((10 10, 40 10, 40 40, 10 40, 10 10), (15 15, 15 30, 30 30, 30 15, 15 15))");
    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING(20 0, 20 22, 20 60)");
    Geometry expectedLeft = SplitTestUtil
          .read("POLYGON ((20 10, 10 10, 10 40, 20 40, 20 30, 15 30, 15 15, 20 15, 20 10))");
    Geometry expectedRight = SplitTestUtil
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testSplitPolygon_SplitGeomWithHoleNoHoleBisection() throws Exception {
    Polygon splitee = (Polygon) SplitTestUtil
          .read("POLYGON((10 10, 40 10, 40 40, 10 40, 10 10), (20 20, 20 30, 30 30, 30 20, 20 20))");
    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING(15 0, 15 60)");
    Geometry expectedLeft = SplitTestUtil.read("POLYGON ((15 10, 10 10, 10 40, 15 40, 15 10))");
    Geometry expectedRight = SplitTestUtil
          .read("POLYGON ((15 40, 40 40, 40 10, 15 10, 15 40), (20 20, 30 20, 30 30, 20 30, 20 20))");
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testSplitPolygon2() throws Exception {
    Polygon splitee = (Polygon) SplitTestUtil
          .read("POLYGON ((10 10, 40 10, 40 40, 10 40, 10 30, 20 30, 10 20, 10 10))");
    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING (15 30, 15 40)");

    Geometry expectedLeft = SplitTestUtil
          .read("POLYGON ((10 10, 40 10, 40 40, 15 40, 15 30, 20 30, 10 20, 10 10))");
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testSplitPolygon_DoubleIntersection() throws Exception {
    Polygon splitee = (Polygon) SplitTestUtil
          .read("POLYGON((10 10, 40 10, 40 40, 10 40, 10 30, 20 30, 10 20, 10 10))");
    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING(15 0, 15 60)");

    Geometry expectedLeft = SplitTestUtil.read("POLYGON ((15 10, 10 10, 10 20, 15 25, 15 10))");
    Geometry expectedMiddle = SplitTestUtil
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testSplitPolygon_DoubleIntersectionReversedCut() throws Exception {
    Polygon splitee = (Polygon) SplitTestUtil
          .read("POLYGON((10 10, 40 10, 40 40, 10 40, 10 30, 20 30, 20 20, 10 20, 10 10))");
    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING(15 60, 15 0)");

    Geometry expectedLeft = SplitTestUtil.read("POLYGON ((15 10, 10 10, 10 20, 15 20, 15 10))");
    Geometry expectedMiddle = SplitTestUtil
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testSplitPolygon_LineRidesShapeLine() throws Exception {
    Polygon splitee = (Polygon) SplitTestUtil.read("POLYGON((10.5 10, 20 10, 20 20, 10.5 20, 10.5 10))");

    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING(10 0, 10 30)");

    Geometry expected = SplitTestUtil.read("POLYGON((10.5 10, 20 10, 20 20, 10.5 20, 10.5 10))");

    assertTrue(splitee.equals(expected));

    Geometry[] expectedParts = new Geometry[] {};
    testSplitResults(splitee, splitter, expectedParts);
  }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.Polygon

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.