Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.LineString


  }

  @Test
  public void testEndLineFinishOnEdge() throws Exception {

    LineString line = (LineString) SplitTestUtil
          .read("LINESTRING (260 280, 260 140, 130 140, 130 220, 90 220, 90 190, 180 190, 180 280, 240 280, 240 220, 150 220, 150 160, 240 160, 240 190, 180 190)");

    Geometry partA = SplitTestUtil.read("LINESTRING (260 280, 260 140, 130 140, 130 190, 150 190)");

    Geometry partB = SplitTestUtil.read("LINESTRING (90 220, 130 220, 130 190, 90 190, 90 220)");
View Full Code Here


  }

  @Test
  public void testEndLineFinishOnEdge2Rings() throws Exception {

    LineString line = (LineString) SplitTestUtil
          .read("LINESTRING (180 160, 180 70, 240 70, 240 110, 130 110, 130 70, 180 70)");

    Geometry partA = SplitTestUtil.read("LINESTRING (180 160, 180 110)");

    Geometry partB = SplitTestUtil.read("LINESTRING (180 110, 240 110, 240 70, 180 70, 180 110)");
View Full Code Here

    // SplitTestUtil.read("LINESTRING (110 260, 280 260, 280 150, 110 150, 110 260)");
    //
    // LineString line = (LineString)
    // SplitTestUtil.read("LINESTRING (150 260, 270 260, 270 180, 160 180, 160 270)");
    //
    LineString line = (LineString) SplitTestUtil
          .read("LINESTRING (260 280, 260 140, 130 140, 130 220, 90 220, 90 190, 180 190, 180 280, 240 280, 240 220, 150 220, 150 160, 240 160, 240 190, 180 190)");

    List<LinearRing> ringList = new ArrayList<LinearRing>();

    Geometry multiLines = line.union();

    Polygonizer polygonizer = new Polygonizer();
    polygonizer.add(multiLines);
    Collection<Polygon> polyCollection = polygonizer.getPolygons();

    // add the rings to the ringList.
    for (Polygon pol : polyCollection) {

      Coordinate[] polCoord = pol.getExteriorRing().getCoordinates();

      LinearRing polygonRing = line.getFactory().createLinearRing(polCoord);
      ringList.add(polygonRing);
    }
    //
    // for (Geometry ring : ringList) {
    //
View Full Code Here

  }

  @Test
  public void testLineOverLine() throws Exception {

    LineString line = (LineString) SplitTestUtil
          .read("LINESTRING (110 330, 110 210, 260 210, 260 280, 110 280, 110 80, 240 80)");

    Geometry partA = SplitTestUtil.read("LINESTRING (110 280, 260 280, 260 210, 110 210, 110 280)");

    Geometry partB = SplitTestUtil.read("LINESTRING (110 330, 110 280, 110 210, 110 80, 240 80)");
View Full Code Here

   * @throws Exception
   */
  @Test
  public void testSzenario_A_inputChanged_1() throws Exception {
    MultiPolygon splitee = (MultiPolygon) SplitTestUtil.read("MULTIPOLYGON (((0 0, 5 0, 5 10, 0 10, 0 8, 3 8, 3 6, 0 6, 0 0)))"); //$NON-NLS-1$
    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING(6 1, 3 6, 3 8, 6 9)"); //$NON-NLS-1$

    assertTrue(splitee.isValid());

    Geometry partA = SplitTestUtil.read("POLYGON ((5 2.6666666666666665, 3 6, 0 6, 0 0, 5 0, 5 2.6666666666666665))"); // A //$NON-NLS-1$
    Geometry partB = SplitTestUtil.read("POLYGON ((5 8.666666666666666, 3 8, 3 6, 5 2.6666666666666665, 5 8.666666666666666))"); //$NON-NLS-1$
View Full Code Here

   * @throws Exception
   */
  @Test
  public void testSzenario_A_inputChanged_2() throws Exception {
    MultiPolygon splitee = (MultiPolygon) SplitTestUtil.read("MULTIPOLYGON (((0 6, 3 6, 3 8, 0 8, 0 6)))"); //$NON-NLS-1$
    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING(6 1, 3 6, 3 8, 6 9)"); // same //$NON-NLS-1$
    // split
    // line

    assertTrue(splitee.isValid());

View Full Code Here

   */
  @Test
  public void testSzenario_002_withValidData_1() throws Exception {
    MultiPolygon splitee = (MultiPolygon) SplitTestUtil.read("MULTIPOLYGON(((1 1, 1 8, 10 8, 10 1, 1 1),(2 3, 8 3, 8 6, 2 6, 2 3)))"); //$NON-NLS-1$

    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING(5 5, 5 2, 2 2, 2 3)"); //$NON-NLS-1$

    assertTrue(splitee.isValid());

    Geometry partA = SplitTestUtil.read("POLYGON ((1 1, 1 8, 10 8, 10 1, 1 1), (5 3, 8 3, 8 6, 2 6, 2 3, 2 2, 5 2, 5 3))"); //$NON-NLS-1$

View Full Code Here

   */
  @Test
  public void testSzenario_002_withValidData_2() throws Exception {
    MultiPolygon splitee = (MultiPolygon) SplitTestUtil.read("MULTIPOLYGON (((2 3, 8 3, 8 6, 2 6, 2 3)))"); //$NON-NLS-1$

    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING(5 5, 5 2, 2 2, 2 3)"); //$NON-NLS-1$

    assertTrue(splitee.isValid());

    // there isn't any split

View Full Code Here

   */
  @Test
  public void testSzenario_003() throws Exception {
    MultiPolygon splitee = (MultiPolygon) SplitTestUtil.read("MULTIPOLYGON(((1 1, 1 8, 10 8, 10 1, 1 1),(2 3, 8 3, 8 6, 2 6, 2 3)))"); //$NON-NLS-1$

    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING(2 3, 2 2, 5 2, 5 5)"); //$NON-NLS-1$

    assertTrue(splitee.isValid());

    Geometry partA = SplitTestUtil.read("POLYGON ((1 1, 1 8, 10 8, 10 1, 1 1), (5 3, 8 3, 8 6, 2 6, 2 3, 2 2, 5 2, 5 3))"); //$NON-NLS-1$

View Full Code Here

   */
  @Test
  public void testSzenario_003_withValidData_1() throws Exception {
    MultiPolygon splitee = (MultiPolygon) SplitTestUtil.read("MULTIPOLYGON(((1 1, 1 8, 10 8, 10 1, 1 1),(2 3, 8 3, 8 6, 2 6, 2 3)))"); //$NON-NLS-1$

    LineString splitter = (LineString) SplitTestUtil.read("LINESTRING(2 3, 2 2, 5 2, 5 5)"); //$NON-NLS-1$

    assertTrue(splitee.isValid());

    Geometry partA = SplitTestUtil.read("POLYGON ((1 1, 1 8, 10 8, 10 1, 1 1), (5 3, 8 3, 8 6, 2 6, 2 3, 2 2, 5 2, 5 3))"); //$NON-NLS-1$

View Full Code Here

TOP

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

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.