Examples of MultiPolygon


Examples of ca.carleton.gcrc.geom.MultiPolygon

   
    return multiLineString;
  }
 
  private MultiPolygon parseMultiPolygon(BufferedReader br) throws Exception {
    MultiPolygon multiPolygon = new MultiPolygon();
   
    skipWhiteSpaces(br);
    popLeftParen(br);
   
    boolean done = false;
    do {
      skipWhiteSpaces(br);

      Polygon polygon = parsePolygon(br);
      multiPolygon.addPolygon(polygon);

      if( checkForRightParen(br) ) {
        done = true;
      } else {
        popComma(br);
View Full Code Here

Examples of chunmap.model.geom.MultiPolygon

      return null;
    List<Polygon> pgs = new ArrayList<Polygon>();
    for (Polygon r : rs) {
      pgs.add(r);
    }
    return new MultiPolygon(pgs);
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

   */
  public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
    document.writeElement("vml:shape", asChild);
    document.writeAttribute("fill-rule", "evenodd");
    document.writeAttributeStart("path");
    MultiPolygon mpoly = (MultiPolygon) o;
    for (int i = 0; i < mpoly.getNumGeometries(); i++) {
      Polygon poly = (Polygon) mpoly.getGeometryN(i);
      LineString shell = poly.getExteriorRing();
      int nHoles = poly.getNumInteriorRing();
      document.writeClosedPathContent(shell.getCoordinates());

      for (int j = 0; j < nHoles; j++) {
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

  }

  @Test
  public void dtoMultiPolygonToJts() throws GeomajasException {
    // Test DTO MultiPolygon to JTS:
    MultiPolygon multiPolygon = (MultiPolygon) converter.toInternal(createDtoMultiPolygon());
    Polygon polygon = (Polygon) multiPolygon.getGeometryN(1);
    Assert.assertEquals(dtoC6.getX(), polygon.getInteriorRingN(0).getCoordinateN(1).x);
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

   */
  public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
    document.writeElement("path", asChild);
    document.writeAttribute("fill-rule", "evenodd");
    document.writeAttributeStart("d");
    MultiPolygon mpoly = (MultiPolygon) o;
    for (int i = 0; i < mpoly.getNumGeometries(); i++) {
      Polygon poly = (Polygon) mpoly.getGeometryN(i);
      LineString shell = poly.getExteriorRing();
      int nHoles = poly.getNumInteriorRing();
      document.writeClosedPathContent(shell.getCoordinates());

      for (int j = 0; j < nHoles; j++) {
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

    MultiLineString multilineString = (MultiLineString) reader.read("MULTILINESTRING ((0 1,1 1),(0 2,2 2))");
    geometry = geoService.transform(multilineString, new ThrowingTransform());
    Assert.assertEquals(MultiLineString.class, geometry.getClass());
    Assert.assertTrue(geometry.isEmpty());
   
    MultiPolygon multipolygon = (MultiPolygon) reader.read("MULTIPOLYGON (((0 0,1 1,0 1,0 0)),((0 0,2 2,0 2,0 0)))");
    geometry = geoService.transform(multipolygon, new ThrowingTransform());
    Assert.assertEquals(MultiPolygon.class, geometry.getClass());
    Assert.assertTrue(geometry.isEmpty());
   
    Geometry collection = (GeometryCollection) reader.read("GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10)) ");
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

    CoordinateArraySequence coords = new CoordinateArraySequence(new Coordinate[] {
        new Coordinate(12.0, 34.23), new Coordinate(12.000, 54.555), new Coordinate(7, 8),
        new Coordinate(12.0, 34.23)});
    LinearRing ring = new LinearRing(coords, factory);
    Polygon p = new Polygon(ring, new LinearRing[] {}, factory);
    MultiPolygon m = new MultiPolygon(new Polygon[] {p}, factory);
    JSONObject jo = (JSONObject) ser.marshall(null, m);
    assertEquals("MultiPolygon", jo.get("type").toString());
    assertEquals("31300", jo.get("srid").toString());
    assertEquals("2", jo.get("precision").toString());
    JSONArray polygons = jo.getJSONArray("polygons");
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

    template.restoreState();
  }

  private void drawGeometry(Geometry g, SymbolInfo symbol) {
    if (g instanceof MultiPolygon) {
      MultiPolygon mpoly = (MultiPolygon) g;
      for (int i = 0; i < mpoly.getNumGeometries(); i++) {
        drawGeometry(mpoly.getGeometryN(i), symbol);
      }
    } else if (g instanceof MultiLineString) {
      MultiLineString mline = (MultiLineString) g;
      for (int i = 0; i < mline.getNumGeometries(); i++) {
        drawGeometry(mline.getGeometryN(i), symbol);
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

  public void setupBeans() throws LayerException {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING), 4329);
    LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 1), new Coordinate(0, 1), new Coordinate(0, 0), });
    Polygon p = factory.createPolygon(shell, null);
    MultiPolygon expected = factory.createMultiPolygon(new Polygon[] { p });
    CustomBean cb = new CustomBean();
    cb.setId(1);
    cb.setGeometry(expected);
    cb.setName("testbean");
    layer.saveOrUpdate(cb);
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

  public void readGeometry() throws LayerException {
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326);
    LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 1), new Coordinate(0, 1), new Coordinate(0, 0), });
    Polygon p = factory.createPolygon(shell, null);
    MultiPolygon expected = factory.createMultiPolygon(new Polygon[] { p });
    Assert.assertTrue(((CustomBean) layer.read("1")).getGeometry().equalsExact(expected));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.