Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Polygon


   * @throws Exception
   */
  @SuppressWarnings("nls")
    @Test
  public void testSplitPolygon_IntersectsVertexAndEdge() throws Exception {
    Polygon splitee = (Polygon) SplitTestUtil
          .read("POLYGON((10 10, 15.5 10, 15.7 10, 15.8 10, 20 10, 20 20, 15.5 20, 15.5 30, 10 30, 10 10))");
    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING(15.5 0, 15.5 40)");

    // with the next input it fails.
    // LineString splitter = (LineString)
View Full Code Here


    testSplitResults(splitee, splitter, expectedParts);
  }

  @Test
  public void testSplitPolygon() throws Exception {
    Polygon splitee = (Polygon) SplitTestUtil
          .read("POLYGON ((484931.33221207117 4823429.360774391, 576441.460505905 4823429.360773954, 576441.4605056487 4770404.800438415, 484931.3322121216 4770404.800438844, 484931.33221207117 4823429.360774391))");
    LineString splitter = (LineString) SplitTestUtil
          .read("LINESTRING (518738.74733960454 4831558.988908185, 519056.4924999358 4763720.397139888, 526682.3763498047 4760066.327794093)");

    testSplitResults(splitee, splitter, 2);
View Full Code Here

    testSplitResults(splitee, splitter, 2);
  }

  @Test
  public void testSplitPolygon3() throws Exception {
    Polygon splitee = (Polygon) SplitTestUtil
          .read("POLYGON ((-2.05630239088747 43.383785592776206, -2.060964497966142 43.08091005152631,-2.4598370614233303 43.08348812503837, -2.5916373277716898 43.08403436779535, -3.1851208791748506 43.08461326221585,-3.1857959859927067 43.30753769431183, -3.185956334129664 43.36011198917018, -3.1860512944056665 43.39118019719231,-3.1860873520587085 43.402964186987994, -2.5261988548074474 43.561229494969545, -2.0535830120584198 43.55829389231849,-2.05630239088747 43.383785592776206))");
    LineString splitter = (LineString) SplitTestUtil
          .read("LINESTRING(-2.3129794071592786 43.629039402056485, -2.9465587625515224 42.99163177261353)");

    testSplitResults(splitee, splitter, 2);
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testCreatingAPolygonWithHoleInBoundary() throws Exception {
    Polygon splitee = (Polygon) SplitTestUtil
          .read("POLYGON ((20 25, 10 15, 10 5, 20 -5, 30 5, 30 15, 20 25), (15 15, 25 15, 25 5, 15 5, 15 15))");

    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING (17 10, 15 15, 20 25, 25 15, 23 10)");

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

   *
   * @throws Exception
   */
  @Test
  public void testCreatingAPolygonWithHoleInBoundary2() throws Exception {
    Polygon splitee = (Polygon) SplitTestUtil
          .read("POLYGON ((20 25, 10 15, 10 5, 20 -5, 30 5, 30 15, 20 25), (15 15, 25 15, 25 5, 15 5, 15 15))");

    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING (15 15, 20 25, 25 15, 15 15, 12 11)");

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

   *
   * @throws Exception
   */
  @Test
  public void testIntersectionEdgeSharedWithHullEdge() throws Exception {
    Polygon splitee = (Polygon) SplitTestUtil
          .read("POLYGON ((35 35, 60 35, 60 5, 35 5, 35 15, 45 15, 45 25, 35 25, 35 35))");

    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING (65 30, 45 25, 45 15, 65 10, 65 10, 65 10)");

    Geometry partA = SplitTestUtil.read("POLYGON ((60 28.75, 45 25, 45 15, 60 11.25, 60 28.75)) ");
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testFromInsideBorderHoleToHoleArea() throws Exception {
    Polygon splitee = (Polygon) SplitTestUtil
          .read("POLYGON ((30 50, 30 10, 100 10, 100 50, 30 50),  (40 40, 90 40, 90 20, 40 20, 40 40))");

    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING (40 20, 40 15, 50 15, 50 30, 50 30)");

    Geometry partA = SplitTestUtil.read("POLYGON ((40 20, 40 15, 50 15, 50 20, 40 20))");
View Full Code Here

   *
   * The expected result is the polygon divided into 2 fragments.
   */
  @Test
  public void twoCoordinateLineBothCoordinateInBoundary() throws Exception {
    Polygon splitee = (Polygon) SplitTestUtil.read("POLYGON ((15 35, 40 35, 40 10, 15 10, 15 35))");

    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING (25 35, 25 10)");

    assertTrue(splitee.isValid());

    Geometry partA = SplitTestUtil.read(" POLYGON ((15 10, 15 35, 25 35, 25 10, 15 10))");

    Geometry partB = SplitTestUtil.read("POLYGON ((25 35, 25 10, 40 10, 40 35, 25 35))");

View Full Code Here

   *
   * Expected result is no polygon.
   */
  @Test
  public void twoCoordinateLineBothCoordinateInBoundary2() throws Exception {
    Polygon splitee = (Polygon) SplitTestUtil
          .read("POLYGON ((10 35, 40 35, 40 25, 30 25, 30 15, 40 15, 40 10, 10 10, 10 35))");

    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING (35 25, 35 15)");

    assertTrue(splitee.isValid());

    List<Geometry> expectedParts = new ArrayList<Geometry>();

    SplitTestUtil.testSplitStrategy(splitee, splitter, expectedParts);
  }
View Full Code Here

   * it doesn't intersects with the interior.
   */
  @Test
  public void threeCoordinateLineBothCoordinateInBoundary3() throws Exception {

    Polygon splitee = (Polygon) SplitTestUtil.read("POLYGON ((10 30, 30 30, 30 10, 10 10, 10 30))");

    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING (30 15, 35 20, 30 25, 30 25, 30 25)");

    assertTrue(splitee.isValid());

    List<Geometry> expectedParts = new ArrayList<Geometry>();

    SplitTestUtil.testSplitStrategy(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.