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

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


    // And some geometries
    final GfxGeometry worldGeometry = new GfxGeometry("MultiPolygonInWorldSpace");
    final GeometryFactory gf = new GeometryFactory(map.getMapModel().getSrid(), map.getMapModel().getPrecision());
    Polygon p1 = gf.createPolygon(gf.createLinearRing(new Bbox(10000000d, 1000d, 1000000d, 1000000d)), null);
    Polygon p2 = gf.createPolygon(gf.createLinearRing(new Bbox(12000000d, 1000d, 500000d, 500000d)), null);
    MultiPolygon mp = gf.createMultiPolygon(new Polygon[] {p1, p2});
    worldGeometry.setStyle(new ShapeStyle("#FF0000", 0.5f, "#FF0000", 1.0f, 2));
    worldGeometry.setGeometry(mp);

    final GfxGeometry worldGeometry2 = new GfxGeometry("MultiPointInWorldSpace");
    SymbolInfo si = new SymbolInfo();
View Full Code Here


          context.getVectorContext().drawLine(feature, name + "." + i, (LineString) m.getGeometryN(i), style);
        }
      } else if (geometry instanceof Polygon) {
        context.getVectorContext().drawPolygon(feature, name, (Polygon) geometry, style);
      } else if (geometry instanceof MultiPolygon) {
        MultiPolygon m = (MultiPolygon) geometry;
        for (int i = 0; i < m.getNumGeometries(); i++) {
          context.getVectorContext().drawPolygon(feature, name + "." + i, (Polygon) m.getGeometryN(i), style);
        }
      } else if (geometry instanceof Point) {
        if (hasImageSymbol(feature)) {
          context.getVectorContext().drawSymbol(feature, name, geometry.getCoordinate(), null,
              feature.getStyleId() + "-selection");
View Full Code Here

  protected void updateTempLines(FeatureTransaction featureTransaction, MouseEvent<?> event) {
    if (featureTransaction.getNewFeatures() != null && featureTransaction.getNewFeatures().length > 0) {
      if (tempLine1 == null) {
        createTempLines(featureTransaction, event);
      }
      MultiPolygon multiPolygon = (MultiPolygon) getGeometryIndex().getGeometry(featureTransaction);
      LinearRing ring = getGeometryIndex().getLinearRing(multiPolygon.getGeometryN(0));
      if (ring != null) {
        Coordinate[] coordinates = ring.getCoordinates();
        if (coordinates != null && coordinates.length > 0) {
          Coordinate lastCoordinate = coordinates[coordinates.length - 2];
          LineString lineString1 = featureTransaction.getNewFeatures()[index.getFeatureIndex()].getGeometry()
View Full Code Here

          gc.drawLine(group, gfxId + "." + i, (LineString) m.getGeometryN(i), shapeStyle);
        }
      } else if (geometry instanceof Polygon) {
        context.getVectorContext().drawPolygon(group, gfxGeometry.getId(), (Polygon) geometry, shapeStyle);
      } else if (geometry instanceof MultiPolygon) {
        MultiPolygon m = (MultiPolygon) geometry;
        String gfxId = gfxGeometry.getId();
        GraphicsContext gc = context.getVectorContext();
        for (int i = 0; i < m.getNumGeometries(); i++) {
          gc.drawPolygon(group, gfxId + "." + i, (Polygon) m.getGeometryN(i), shapeStyle);
        }
      } else if (geometry instanceof Point) {
        context.getVectorContext().drawSymbolDefinition(group, gfxGeometry.getId() + ".def",
            gfxGeometry.getSymbolInfo(), shapeStyle, null);
        context.getVectorContext().drawSymbol(group, gfxGeometry.getId(), geometry.getCoordinate(), shapeStyle,
View Full Code Here

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

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

  @Test
  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(r.getNumPoints() - 2).getX(), DELTA);
    op.undo(feature);
    Assert.assertEquals(multiPolygon.toWkt(), feature.getGeometry().toWkt());
  }
View Full Code Here

  @Test
  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 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

TOP

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