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

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


  @Test
  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(50.0, r.getCoordinateN(index.getCoordinateIndex()).getX(), DELTA);
    op.undo(feature);
    Assert.assertEquals(polygon.toWkt(), feature.getGeometry().toWkt());
  }
View Full Code Here


  public void testMultiPolygon() {
    Feature feature = new Feature();
    feature.setGeometry((MultiPolygon) multiPolygon.clone());
    op.execute(feature);
    MultiPolygon m = (MultiPolygon) feature.getGeometry();
    Polygon p = (Polygon) m.getGeometryN(index.getGeometryIndex());
    LinearRing r = p.getInteriorRingN(index.getInteriorRingIndex());
    Assert.assertEquals(50.0, r.getCoordinateN(index.getCoordinateIndex()).getX(), DELTA);
    op.undo(feature);
    Assert.assertEquals(multiPolygon.toWkt(), feature.getGeometry().toWkt());
  }
View Full Code Here

  @Test
  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(50.0, r.getCoordinateN(index.getCoordinateIndex()).getX(), DELTA);
    op.undo(feature);
    Assert.assertEquals(polygon.toWkt(), feature.getGeometry().toWkt());
  }
View Full Code Here

  public void testMultiPolygon() {
    Feature feature = new Feature();
    feature.setGeometry((MultiPolygon) multiPolygon.clone());
    op.execute(feature);
    MultiPolygon m = (MultiPolygon) feature.getGeometry();
    Polygon p = (Polygon) m.getGeometryN(index.getGeometryIndex());
    LinearRing r = p.getInteriorRingN(index.getInteriorRingIndex());
    Assert.assertEquals(50.0, r.getCoordinateN(index.getCoordinateIndex()).getX(), DELTA);
    op.undo(feature);
    Assert.assertEquals(multiPolygon.toWkt(), feature.getGeometry().toWkt());
  }
View Full Code Here

  // -------------------------------------------------------------------------
  // Private execution functions:
  // -------------------------------------------------------------------------

  private void execute(MultiPolygon multiPolygon) {
    Polygon polygon = execute((Polygon) multiPolygon.getGeometryN(index.getGeometryIndex()));
    setPolygonN(multiPolygon, polygon, index.getGeometryIndex());
  }
View Full Code Here

    Polygon polygon = execute((Polygon) multiPolygon.getGeometryN(index.getGeometryIndex()));
    setPolygonN(multiPolygon, polygon, index.getGeometryIndex());
  }

  private Polygon execute(Polygon polygon) {
    Polygon result = null;
    if (index.getInteriorRingIndex() >= 0) {
      interiorRing = polygon.getInteriorRingN(index.getInteriorRingIndex());
      RemoveRingOperation op = new RemoveRingOperation(index.getInteriorRingIndex());
      result = (Polygon) op.execute(polygon);
    }
View Full Code Here

  // -------------------------------------------------------------------------
  // Private undo functions:
  // -------------------------------------------------------------------------

  private void undo(MultiPolygon multiPolygon) {
    Polygon polygon = undo((Polygon) multiPolygon.getGeometryN(index.getGeometryIndex()));
    setPolygonN(multiPolygon, polygon, index.getGeometryIndex());
  }
View Full Code Here

    Polygon polygon = undo((Polygon) multiPolygon.getGeometryN(index.getGeometryIndex()));
    setPolygonN(multiPolygon, polygon, index.getGeometryIndex());
  }

  private Polygon undo(Polygon polygon) {
    Polygon result = null;
    if (index.getInteriorRingIndex() >= 0) {
      InsertRingOperation op = new InsertRingOperation(interiorRing, index.getInteriorRingIndex());
      result = (Polygon) op.execute(polygon);
    }
    if (result != null) {
View Full Code Here

    Feature feature = new Feature();
    GeometryFactory factory = new GeometryFactory(4326, -1);
    LinearRing invalidRing = factory.createLinearRing(new Coordinate[] {new Coordinate(10, 10),
        new Coordinate(20, 10), new Coordinate(15, 20)/*, new Coordinate(15, 5)*/});
    Polygon inValidPolygon = factory.createPolygon(invalidRing, null);
    feature.setGeometry(inValidPolygon);
    mapModel.getFeatureEditor().startEditing(new Feature[] {feature}, new Feature[] {feature});
  }
View Full Code Here

TOP

Related Classes of org.geomajas.gwt.client.spatial.geometry.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.