Examples of LinearRing


Examples of com.sun.syndication.feed.module.georss.geometries.LinearRing

        }
        else if (ag.getClass().equals(new Polygon().getClass())) //<georss:polygon>
        {
          Polygon poly = ((Polygon)geoRSSModule.getGeometry());
          AbstractRing ar = poly.getExterior();
          LinearRing lr = (LinearRing)ar;

          double latAvg = 0.0;
          double lonAvg = 0.0;
          int length = lr.getPositionList().size();
          for (int i = 0; i < length; i ++)
          {
            latAvg += lr.getPositionList().getLatitude(i);
            lonAvg += lr.getPositionList().getLongitude(i);
          }
          latAvg = latAvg/length;
          lonAvg = lonAvg/length;
          GeoPojo gp = new GeoPojo();
          gp.lat = latAvg;
View Full Code Here

Examples of com.vividsolutions.jts.geom.LinearRing

  }

  @Test
  public void dtoLinearRingToJts() throws GeomajasException {
    // Test DTO LinearRing to JTS:
    LinearRing linearRing = (LinearRing) converter.toInternal(createDtoLinearRing());
    Assert.assertEquals(dtoC3.getX(), linearRing.getCoordinateN(2).x);
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.LinearRing

    return factory.createLinearRing(new com.vividsolutions.jts.geom.Coordinate[] { jtsC1, jtsC2, jtsC3, jtsC4,
        jtsC1 });
  }

  private Polygon createJtsPolygon() {
    LinearRing shell = factory.createLinearRing(new com.vividsolutions.jts.geom.Coordinate[] { jtsC1, jtsC2, jtsC3,
        jtsC4, jtsC1 });
    LinearRing hole = factory.createLinearRing(new com.vividsolutions.jts.geom.Coordinate[] { jtsC5, jtsC6, jtsC7,
        jtsC8, jtsC5 });
    return factory.createPolygon(shell, new LinearRing[] { hole });
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.LinearRing

        jtsC8 });
    return factory.createMultiLineString(new LineString[] { l1, l2 });
  }

  private MultiPolygon createJtsMultiPolygon() {
    LinearRing shell = factory.createLinearRing(new com.vividsolutions.jts.geom.Coordinate[] { jtsC1, jtsC2, jtsC3,
        jtsC4, jtsC1 });
    LinearRing hole = factory.createLinearRing(new com.vividsolutions.jts.geom.Coordinate[] { jtsC5, jtsC6, jtsC7,
        jtsC8, jtsC5 });
    Polygon polygon1 = factory.createPolygon(shell, new LinearRing[] {});
    Polygon polygon2 = factory.createPolygon(shell, new LinearRing[] { hole });
    return factory.createMultiPolygon(new Polygon[] { polygon1, polygon2 });
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.LinearRing

    GeometrySerializer ser = new GeometrySerializer();
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(100.0), 31300);
    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);
    JSONObject jo = (JSONObject) ser.marshall(null, p);
    assertEquals("Polygon", jo.get("type").toString());
    assertEquals("[]", jo.get("holes").toString());
    assertEquals("31300", jo.get("srid").toString());
View Full Code Here

Examples of com.vividsolutions.jts.geom.LinearRing

    GeometrySerializer ser = new GeometrySerializer();
    GeometryFactory factory = new GeometryFactory(new PrecisionModel(100.0), 31300);
    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());
View Full Code Here

Examples of com.vividsolutions.jts.geom.LinearRing

    request.setRatio(0.5f);
    request.setLayerIds(new String[] {LAYER_ID});

    // create a rectangle that overlaps 50 %
    GeometryFactory factory = new GeometryFactory();
    LinearRing half1 = factory.createLinearRing(new Coordinate[] {new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 0.5), new Coordinate(0, 0.5), new Coordinate(0, 0)});
    Polygon polygon = factory.createPolygon(half1, null);
    request.setLocation(converter.toDto(polygon));

    // execute
View Full Code Here

Examples of com.vividsolutions.jts.geom.LinearRing

    request.setRatio(0.5f);
    request.setLayerIds(new String[] {LAYER_ID});

    // create a rectangle that overlaps 49 %
    GeometryFactory factory = new GeometryFactory();
    LinearRing half1 = factory.createLinearRing(new Coordinate[] {new Coordinate(0, 0), new Coordinate(1, 0),
        new Coordinate(1, 0.49), new Coordinate(0, 0.49), new Coordinate(0, 0)});
    Polygon polygon = factory.createPolygon(half1, null);
    request.setLocation(converter.toDto(polygon));

    // execute
View Full Code Here

Examples of com.vividsolutions.jts.geom.LinearRing

        geometry = factory.createLineString(getCoordinates(linestring.getCoordinates()));
      }
    } else if (geom instanceof PolygonTypeInfo) {
      PolygonTypeInfo polygon = (PolygonTypeInfo) geom;
      OuterBoundaryIsInfo outer = polygon.getOuterBoundaryIs();
      LinearRing shell = toLinearRing(factory, outer.getLinearRing());
      LinearRing[] holes = new LinearRing[polygon.getInnerBoundaryIList().size()];
      int i = 0;
      for (InnerBoundaryIsInfo inner : polygon.getInnerBoundaryIList()) {
        holes[i++] = toLinearRing(factory, inner.getLinearRing());
      }
View Full Code Here

Examples of com.vividsolutions.jts.geom.LinearRing

    }
    return geometry;
  }

  private LinearRing toLinearRing(GeometryFactory factory, LinearRingTypeInfo linearRing) {
    LinearRing ring = null;
    if (linearRing.ifCoordList()) {
      ring = factory.createLinearRing(getCoordinates(linearRing.getCoordList()));
    } else if (linearRing.ifCoordinates()) {
      ring = factory.createLinearRing(getCoordinates(linearRing.getCoordinates()));
    }
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.