Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Polygon


   * interior.
   */
  @Test
  public void twoCoordinateLineOverlapsBoundaryPart() 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, 30 25)");

    assertTrue(splitee.isValid());

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

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


     */
    public List<Geometry> split(Geometry geomToSplit) {
   
          assert geomToSplit instanceof Polygon;
   
          final Polygon polygon = (Polygon) geomToSplit;
          final List<Geometry> splitPolygon;
          LineString splitLine = getSplitLine().getOriginalSplitLine();
          if (SplitUtil.isClosedLine(splitLine)) {
   
            splitPolygon = splitPolygonClosedLines(polygon);
View Full Code Here

      List<Geometry> polygons = new ArrayList<Geometry>(allRings.size());

      for (LinkedHashSet<SplitEdge> edgeList : allRings) {

    // boolean polyIsHole = false;
    Polygon poly = buildPolygon(edgeList);
    Geometry result = poly;

    for (LinearRing holeRing : nonSplitHoles) {

        // if it contain a ring, make the difference for creating a
View Full Code Here

    shellCoords = new Coordinate[ring[0].getCoordinates().length];
    shellCoords = ring[0].getCoordinates();

      } while (hasSelfIntersection(shellCoords));

      Polygon poly;
      if (holeList.isEmpty()) {
    poly = this.geometryFactory.createPolygon(ring[0],
      (LinearRing[]) null);
      } else {
    LinearRing[] holes = holeList.toArray(new LinearRing[holeList
View Full Code Here

     *
     * @throws Exception
     */
    @Test
    public void testcatalog_38a() throws Exception {
  Polygon polygon = (Polygon) SplitTestUtil
    .read("POLYGON ((120 300, 120 220, 200 220, 200 300, 120 300))"); //$NON-NLS-1$
  Polygon polygon2 = (Polygon) SplitTestUtil
    .read("POLYGON  ((200 300, 280 300, 280 220, 200 220, 200 300))"); //$NON-NLS-1$
  Polygon polygon3 = (Polygon) SplitTestUtil
    .read("POLYGON ((120 220, 120 140, 200 140, 200 220, 120 220))"); //$NON-NLS-1$
  Polygon polygon4 = (Polygon) SplitTestUtil
    .read("POLYGON  ((200 140, 280 140, 280 220, 200 220, 200 140))"); //$NON-NLS-1$

  LineString splitLine = (LineString) SplitTestUtil
    .read("LINESTRING (150 250, 150 160, 260 180, 240 270, 150 250)"); //$NON-NLS-1$
  assertTrue(SplitUtil.isClosedLine(splitLine));
View Full Code Here

     *
     * @throws Exception
     */
    @Test
    public void testcatalog_39() throws Exception {
  Polygon polygon1 = (Polygon) SplitTestUtil
    .read("POLYGON ((120 280, 210 280, 210 230, 160 230, 160 200, 120 200, 120 280))"); //$NON-NLS-1$
  Polygon polygon2 = (Polygon) SplitTestUtil
    .read("POLYGON  ((210 230, 210 280, 330 280, 330 180, 260 180, 260 230, 210 230))"); //$NON-NLS-1$
  Polygon polygon3 = (Polygon) SplitTestUtil
    .read("POLYGON ((180 160, 180 120, 120 120, 120 200, 160 200, 160 160, 180 160))"); //$NON-NLS-1$
  Polygon polygon4 = (Polygon) SplitTestUtil
    .read("POLYGON  ((180 160, 260 160, 260 180, 330 180, 330 120, 180 120, 180 160))"); //$NON-NLS-1$

  LineString splitLine = (LineString) SplitTestUtil
    .read("LINESTRING (140 240, 300 260, 280 150, 160 130, 140 240)"); //$NON-NLS-1$
  assertTrue(SplitUtil.isClosedLine(splitLine));
View Full Code Here

     * @throws Exception
     */
    @Test
    public void testcatalog_39a() throws Exception {

  Polygon geomToSplit1 = (Polygon) SplitTestUtil
    .read("POLYGON ((120 280, 210 280, 210 230, 160 230, 160 200, 120 200, 120 280))"); //$NON-NLS-1$
  Polygon geomToSplit2 = (Polygon) SplitTestUtil
    .read("POLYGON  ((210 230, 210 280, 330 280, 330 180, 260 180, 260 230, 210 230))"); //$NON-NLS-1$
  Polygon geomToSplit3 = (Polygon) SplitTestUtil
    .read("POLYGON ((180 160, 180 120, 120 120, 120 200, 160 200, 160 160, 180 160))"); //$NON-NLS-1$
  Polygon geomToSplit4 = (Polygon) SplitTestUtil
    .read("POLYGON  ((180 160, 260 160, 260 180, 330 180, 330 120, 180 120, 180 160))"); //$NON-NLS-1$

  LineString splitLine = (LineString) SplitTestUtil
    .read("LINESTRING (140 240, 160 130, 280 150, 300 260, 140 240)"); //$NON-NLS-1$

View Full Code Here

  final LineString splitLine = (LineString) SplitTestUtil
    .read("LINESTRING (3307.555 344812.916, 3311.023 344814.879, 3311.481 344814.486, 3308.013 344812.458, 3308.602 344811.804, 3311.416 344813.374, 3312.201 344812.392, 3309.03 344810.887 )"); //$NON-NLS-1$

  // execute the first split
  final Polygon geomToSplit1 = (Polygon) SplitTestUtil
    .read("POLYGON ((3317.50270000007 344814.0458, 3314.5 344818.619999999, 3312.52773082279 344817.352559328, 3309.34229529964 344815.30550075, 3307.75040000025 344814.282500001, 3312.25389999989 344810.6798, 3317.50270000007 344814.0458))"); //$NON-NLS-1$

  // The First split
  // Expected fragments for the first polygon
  List<Geometry> expectedParts1 = new ArrayList<Geometry>();
View Full Code Here

  final LineString splitLine = (LineString) SplitTestUtil
    .read("LINESTRING (3307.555 344812.916, 3311.023 344814.879, 3311.481 344814.486, 3308.013 344812.458, 3308.602 344811.804, 3311.416 344813.374, 3312.201 344812.392, 3309.03 344810.887 )"); //$NON-NLS-1$

  // execute the second split
  final Polygon geomToSplit = (Polygon) SplitTestUtil
    .read("POLYGON ((3312.25389999989 344810.6798, 3307.75040000025 344814.282500001, 3304.94159999955 344812.477499999, 3308.42009999976 344808.2213, 3312.25389999989 344810.6798))"); //$NON-NLS-1$

  // Expected fragments for the second polygon
  List<Geometry> expectedParts = new ArrayList<Geometry>();
  expectedParts
View Full Code Here

  final LineString splitLine = (LineString) SplitTestUtil
    .read("LINESTRING (3339.24000000022 344749.039999999, 3338.524 344749.15, 3337.926 344749.968, 3337.335 344749.527)"); //$NON-NLS-1$

  // executes the *first* split
  final Polygon geomToSplit1 = (Polygon) SplitTestUtil
    .read("POLYGON ((3337.65769828104 344749.628001634, 3337.68906744777 344749.582152394, 3337.69439355432 344749.574367745, 3337.71329062782 344749.546747742, 3337.88559999969 344749.2949, 3338.69020000007 344749.889699999, 3338.13999999966 344750.74, 3337.86251098821 344750.558368478, 3337.69275969313 344750.447257101, 3337.28139999975 344750.177999999, 3337.65769828104 344749.628001634))"); //$NON-NLS-1$

  // Expected fragments for the first polygon
  List<Geometry> expectedParts1 = new ArrayList<Geometry>();
  expectedParts1
    .add(SplitTestUtil
      .read("POLYGON ((3338.2312638305843 344749.55043175013, 3337.926 344749.968, 3337.5943801154913 344749.72054759884, 3337.65769828104 344749.628001634, 3337.68906744777 344749.582152394, 3337.69439355432 344749.574367745, 3337.71329062782 344749.546747742, 3337.88559999969 344749.2949, 3338.2312638305843 344749.55043175013))")); //$NON-NLS-1$

  expectedParts1
    .add(SplitTestUtil
      .read("POLYGON ((3337.28139999975 344750.177999999, 3337.69275969313 344750.447257101, 3337.86251098821 344750.558368478, 3338.13999999966 344750.74, 3338.69020000007 344749.889699999, 3338.2312638305843 344749.55043175013, 3337.926 344749.968, 3337.5943801154913 344749.72054759884, 3337.28139999975 344750.177999999))")); //$NON-NLS-1$

  SplitTestUtil
    .testSplitStrategy(geomToSplit1, splitLine, expectedParts1);

  // execute the *second* split
  final Polygon geomToSplit2 = (Polygon) SplitTestUtil
    .read("POLYGON ((3339.24000000022 344749.039999999, 3338.69020000007 344749.889699999, 3337.88559999969 344749.2949, 3338.15221109267 344748.905211093, 3338.42650000006 344748.5043, 3339.24000000022 344749.039999999))"); //$NON-NLS-1$

  // Expected fragments for the second polygon
  List<Geometry> expectedParts2 = new ArrayList<Geometry>();
  expectedParts2
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.