Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.MultiPolygon


   *
   * @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$
    Geometry partC = SplitTestUtil.read("POLYGON ((3 8, 0 8, 0 10, 5 10, 5 8.666666666666666, 3 8))"); //$NON-NLS-1$
    // wrong polygon
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());

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

    SplitTestUtil.testSplitStrategy(splitee, splitter, expectedParts);

View Full Code Here

   *
   * @throws Exception
   */
  @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$

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

View Full Code Here

   *
   * @throws Exception
   */
  @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

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

View Full Code Here

   *
   * @throws Exception
   */
  @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$

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

View Full Code Here

   *
   * @throws Exception
   */
  @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$

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

View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testSzenario_003_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(2 3, 2 2, 5 2, 5 5)"); //$NON-NLS-1$
    assertTrue(splitee.isValid());

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

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

    @Override
    protected GeometryCollection buildFromParts(GeometryFactory gf, List<?> parts) {

      Polygon[] polygons = parts.toArray(new Polygon[parts.size()]);
      MultiPolygon result = gf.createMultiPolygon(polygons);
      return result;
    }
View Full Code Here

         * @param geom DOCUMENT ME!
         *
         * @throws IOException DOCUMENT ME!
         */
        protected void writeGeometry(Geometry geom) throws IOException {
            MultiPolygon mpoly = (MultiPolygon) geom;

            for (int i = 0; i < mpoly.getNumGeometries(); i++) {
                super.writeGeometry(mpoly.getGeometryN(i));
            }
        }
View Full Code Here

                            if (type.isAssignableFrom(Polygon.class)) {
                                Polygon polygon = polygon(bounds);
                                boundedByNode.setValue(polygon);
                            } else if (type.isAssignableFrom(MultiPolygon.class)) {
                                MultiPolygon multiPolygon = geometryFactory.createMultiPolygon(new Polygon[] {
                                        polygon(bounds)
                                });
                                boundedByNode.setValue(multiPolygon);
                            }
                        }
View Full Code Here

TOP

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

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.