Package org.geomajas.gwt.client.spatial.geometry

Examples of org.geomajas.gwt.client.spatial.geometry.LinearRing


  }

  @Test
  public void testLinearRingMiddleIndex() {
    GeometryOperation op = new SetCoordinateOperation(1, new Coordinate(0, 0));
    LinearRing result = (LinearRing) op.execute(linearRing);
    Assert.assertEquals(10.0, result.getCoordinateN(0).getX(), DELTA);
    Assert.assertEquals(0.0, result.getCoordinateN(1).getX(), DELTA);
    Assert.assertEquals(20.0, result.getCoordinateN(2).getX(), DELTA);
    Assert.assertEquals(result.getNumPoints(), linearRing.getNumPoints());
    Assert.assertTrue(result.isClosed());
  }
View Full Code Here


  }

  @Test
  public void testLinearRingZeroIndex() {
    TranslateCoordinateOperation op = new TranslateCoordinateOperation(0, 10, -10);
    LinearRing result = (LinearRing) op.execute(linearRing);
    Assert.assertEquals(20.0, result.getCoordinateN(0).getX(), DELTA);
    Assert.assertEquals(20.0, result.getCoordinateN(1).getX(), DELTA);
    Assert.assertEquals(linearRing.getNumPoints(), result.getNumPoints());
    Assert.assertTrue(result.isClosed());
  }
View Full Code Here

  }

  @Test
  public void testLinearRingBigIndex() {
    TranslateCoordinateOperation op = new TranslateCoordinateOperation(10, 10, -10);
    LinearRing result = (LinearRing) op.execute(linearRing);
    Assert.assertEquals(10.0, result.getCoordinateN(0).getX(), DELTA);
    Assert.assertEquals(30.0, result.getCoordinateN(result.getNumPoints() - 2).getX(), DELTA);
    Assert.assertEquals(linearRing.getNumPoints(), result.getNumPoints());
    Assert.assertTrue(result.isClosed());
  }
View Full Code Here

  }

  @Test
  public void testLinearRingMiddleIndex() {
    TranslateCoordinateOperation op = new TranslateCoordinateOperation(2, 10, -10);
    LinearRing result = (LinearRing) op.execute(linearRing);
    Assert.assertEquals(10.0, result.getCoordinateN(0).getX(), DELTA);
    Assert.assertEquals(30.0, result.getCoordinateN(2).getX(), DELTA);
    Assert.assertEquals(linearRing.getNumPoints(), result.getNumPoints());
    Assert.assertTrue(result.isClosed());
  }
View Full Code Here

  }

  @Test
  public void testLinearRingZeroIndex() {
    InsertCoordinateOperation op = new InsertCoordinateOperation(0, new Coordinate(0, 0));
    LinearRing result = (LinearRing) op.execute(linearRing);
    Assert.assertEquals(result.getCoordinateN(0).getX(), 0.0, DELTA);
    Assert.assertEquals(result.getCoordinateN(1).getX(), 10.0, DELTA);
    Assert.assertEquals(result.getNumPoints(), linearRing.getNumPoints() + 1);
    Assert.assertTrue(result.isClosed());
  }
View Full Code Here

  }

  @Test
  public void testLinearRingBigIndex() {
    InsertCoordinateOperation op = new InsertCoordinateOperation(linearRing.getNumPoints(), new Coordinate(30, 30));
    LinearRing result = (LinearRing) op.execute(linearRing);
    Assert.assertEquals(result.getCoordinateN(0).getX(), 10.0, DELTA);
    Assert.assertEquals(result.getCoordinateN(result.getNumPoints() - 2).getX(), 30.0, DELTA);
    Assert.assertEquals(result.getNumPoints(), linearRing.getNumPoints() + 1);
    Assert.assertTrue(result.isClosed());
  }
View Full Code Here

  }

  @Test
  public void testLinearRingMiddleIndex() {
    InsertCoordinateOperation op = new InsertCoordinateOperation(2, new Coordinate(30, 30));
    LinearRing result = (LinearRing) op.execute(linearRing);
    Assert.assertEquals(result.getCoordinateN(0).getX(), 10.0, DELTA);
    Assert.assertEquals(result.getCoordinateN(2).getX(), 30.0, DELTA);
    Assert.assertEquals(result.getCoordinateN(3).getX(), 20.0, DELTA);
    Assert.assertEquals(result.getNumPoints(), linearRing.getNumPoints() + 1);
    Assert.assertTrue(result.isClosed());
  }
View Full Code Here

    }
    return linearRing.getGeometryFactory().createLinearRing(coordinates);
  }

  private Polygon translate(Polygon polygon) {
    LinearRing exteriorRing = translate(polygon.getExteriorRing());
    LinearRing[] interiorRings = new LinearRing[polygon.getNumInteriorRing()];
    for (int n = 0; n < polygon.getNumInteriorRing(); n++) {
      interiorRings[n] = translate(polygon.getInteriorRingN(n));
    }
    return polygon.getGeometryFactory().createPolygon(exteriorRing, interiorRings);
View Full Code Here

  // -------------------------------------------------------------------------

  public RemoveRingTest() {
    GeometryFactory factory = new GeometryFactory(SRID, PRECISION);

    LinearRing exteriorRing = factory.createLinearRing(new Coordinate[] {new Coordinate(0.0, 0.0),
        new Coordinate(100.0, 0.0), new Coordinate(100.0, 100.0), new Coordinate(0.0, 100.0)});
    LinearRing interiorRing1 = factory.createLinearRing(new Coordinate[] {new Coordinate(20.0, 20.0),
        new Coordinate(40.0, 20.0), new Coordinate(40.0, 40.0), new Coordinate(20.0, 40.0)});
    LinearRing interiorRing2 = factory.createLinearRing(new Coordinate[] {new Coordinate(60.0, 60.0),
        new Coordinate(80.0, 60.0), new Coordinate(80.0, 80.0), new Coordinate(60.0, 80.0)});
    polygon = factory.createPolygon(exteriorRing, new LinearRing[] {interiorRing1, interiorRing2});
    multiPolygon = factory.createMultiPolygon(new Polygon[] {(Polygon) polygon.clone()});

    index = new TransactionGeomIndex();
View Full Code Here

  public void testPolygon() {
    Feature feature = new Feature();
    feature.setGeometry((Polygon) polygon.clone());
    op.execute(feature);
    Polygon p = (Polygon) feature.getGeometry();
    LinearRing r = p.getInteriorRingN(index.getInteriorRingIndex());
    Assert.assertEquals(60.0, r.getCoordinateN(0).getX(), DELTA);
    op.undo(feature);
    Assert.assertEquals(polygon.toWkt(), feature.getGeometry().toWkt());
  }
View Full Code Here

TOP

Related Classes of org.geomajas.gwt.client.spatial.geometry.LinearRing

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.