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

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


          coordinates[i] = viewToWorld(geometry.getCoordinates()[i]);
        }
        return geometry.getGeometryFactory().createLineString(coordinates);
      } else if (geometry instanceof Polygon) {
        Polygon polygon = (Polygon) geometry;
        LinearRing shell = (LinearRing) viewToWorld(polygon.getExteriorRing());
        LinearRing[] holes = new LinearRing[polygon.getNumInteriorRing()];
        for (int n = 0; n < polygon.getNumInteriorRing(); n++) {
          holes[n] = (LinearRing) viewToWorld(polygon.getInteriorRingN(n));
        }
        return polygon.getGeometryFactory().createPolygon(shell, holes);
View Full Code Here


          coordinates[i] = transform(geometry.getCoordinates()[i], matrix);
        }
        return geometry.getGeometryFactory().createLineString(coordinates);
      } else if (geometry instanceof Polygon) {
        Polygon polygon = (Polygon) geometry;
        LinearRing shell = (LinearRing) transform(polygon.getExteriorRing(), matrix);
        LinearRing[] holes = new LinearRing[polygon.getNumInteriorRing()];
        for (int n = 0; n < polygon.getNumInteriorRing(); n++) {
          holes[n] = (LinearRing) transform(polygon.getInteriorRingN(n), matrix);
        }
        return polygon.getGeometryFactory().createPolygon(shell, holes);
View Full Code Here

    mapWidget.setContextMenu(menu);

    if (maxBoundsDisplayed) {
      VectorLayer layer = getFeatureTransaction().getLayer();
      GeometryFactory factory = mapWidget.getMapModel().getGeometryFactory();
      LinearRing hole = factory.createLinearRing(new Bbox(layer.getLayerInfo().getMaxExtent()));
      LinearRing shell = factory.createLinearRing(mapWidget.getMapModel().getMapView().getMaxBounds());
      Polygon polygon = factory.createPolygon(shell, new LinearRing[] { hole });

      maxExtent = new GfxGeometry("maxExtent");
      maxExtent.setGeometry(polygon);
      maxExtent.setStyle(new ShapeStyle("#000000", .6f, "#990000", 1, 2));
View Full Code Here

      targetMaxExtentRectangle.setStyle(targetMaxExtentRectangleStyle);

      Bbox targetMaxExtent = getOverviewMaxBounds();

      Bbox box = getMapModel().getMapView().getWorldViewTransformer().worldToView(targetMaxExtent);
      LinearRing shell = getMapModel().getGeometryFactory().createLinearRing(
          new Coordinate[] { new Coordinate(-2, -2), new Coordinate(getWidth() + 2, -2),
              new Coordinate(getWidth() + 2, getHeight() + 2), new Coordinate(-2, getHeight() + 2) });
      LinearRing hole = getMapModel().getGeometryFactory().createLinearRing(
          new Coordinate[] { new Coordinate(box.getX(), box.getY()),
              new Coordinate(box.getMaxX(), box.getY()), new Coordinate(box.getMaxX(), box.getMaxY()),
              new Coordinate(box.getX(), box.getMaxY()) });
      Polygon polygon = getMapModel().getGeometryFactory().createPolygon(shell, new LinearRing[] { hole });
      targetMaxExtentRectangle.setGeometry(polygon);
View Full Code Here

  // Constructor
  // -------------------------------------------------------------------------

  public RemoveRingOperationTest() {
    GeometryFactory gwtFactory = new GeometryFactory(SRID, PRECISION);
    LinearRing exteriorRing = gwtFactory.createLinearRing(new Coordinate[] {new Coordinate(0.0, 0.0),
        new Coordinate(20.0, 0.0), new Coordinate(20.0, 20.0), new Coordinate(0.0, 20.0)});
    LinearRing interiorRing1 = gwtFactory.createLinearRing(new Coordinate[] {new Coordinate(12.0, 12.0),
        new Coordinate(14.0, 12.0), new Coordinate(14.0, 18.0), new Coordinate(12.0, 18.0)});
    LinearRing interiorRing2 = gwtFactory.createLinearRing(new Coordinate[] {new Coordinate(16.0, 12.0),
        new Coordinate(18.0, 12.0), new Coordinate(18.0, 18.0), new Coordinate(16.0, 18.0)});

    polygon = gwtFactory.createPolygon(exteriorRing, new LinearRing[] {interiorRing1, interiorRing2});
  }
View Full Code Here

  }

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

  }

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

  }

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

  }

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

  }

  @Test
  public void testLinearRingBigIndex() {
    GeometryOperation op = new SetCoordinateOperation(linearRing.getNumPoints(), 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(result.getNumPoints() - 2).getX(), DELTA);
    Assert.assertEquals(10.0, result.getCoordinateN(result.getNumPoints() - 1).getX(), DELTA);
    Assert.assertEquals(result.getNumPoints(), linearRing.getNumPoints());
    Assert.assertTrue(result.isClosed());
  }
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.