Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.LineString


    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++) {
        document.writeClosedPathContent(poly.getInteriorRingN(j).getCoordinates());
      }
    }
View Full Code Here


  public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
    document.writeElement("vml:shape", asChild);
    document.writeAttribute("fill-rule", "evenodd");
    document.writeAttributeStart("path");
    Polygon poly = (Polygon) o;
    LineString shell = poly.getExteriorRing();
    int nHoles = poly.getNumInteriorRing();
    document.writeClosedPathContent(shell.getCoordinates());
    for (int j = 0; j < nHoles; j++) {
      document.writeClosedPathContent(poly.getInteriorRingN(j).getCoordinates());
    }
    document.writeAttributeEnd();
  }
View Full Code Here

  }

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

  private MultiPoint createJtsMultiPoint() {
    return factory.createMultiPoint(new com.vividsolutions.jts.geom.Coordinate[] { jtsC1, jtsC2, jtsC3 });
  }

  private MultiLineString createJtsMultiLineString() {
    LineString l1 = factory.createLineString(new com.vividsolutions.jts.geom.Coordinate[] { jtsC1, jtsC2, jtsC3,
        jtsC4 });
    LineString l2 = factory.createLineString(new com.vividsolutions.jts.geom.Coordinate[] { jtsC5, jtsC6, jtsC7,
        jtsC8 });
    return factory.createMultiLineString(new LineString[] { l1, l2 });
  }
View Full Code Here

    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++) {
        document.writeClosedPathContent(poly.getInteriorRingN(j).getCoordinates());
      }
    }
View Full Code Here

  public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
    document.writeElement("path", asChild);
    document.writeAttribute("fill-rule", "evenodd");
    document.writeAttributeStart("d");
    Polygon poly = (Polygon) o;
    LineString shell = poly.getExteriorRing();
    int nHoles = poly.getNumInteriorRing();
    document.writeClosedPathContent(shell.getCoordinates());
    for (int j = 0; j < nHoles; j++) {
      document.writeClosedPathContent(poly.getInteriorRingN(j).getCoordinates());
    }
    document.writeAttributeEnd();
  }
View Full Code Here

    Point point = (Point) reader.read("POINT (1 1)");
    Geometry geometry = geoService.transform(point, new ThrowingTransform());
    Assert.assertEquals(Point.class, geometry.getClass());
    Assert.assertTrue(geometry.isEmpty());
   
    LineString lineString = (LineString) reader.read("LINESTRING (0 1,1 1)");
    geometry = geoService.transform(lineString, new ThrowingTransform());
    Assert.assertEquals(LineString.class, geometry.getClass());
    Assert.assertTrue(geometry.isEmpty());
   
    Polygon polygon = (Polygon) reader.read("POLYGON ((0 0,1 1,0 1,0 0))");
View Full Code Here

  public void testLineString() throws MarshallException {
    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(-0.01, -0.0)});
    LineString p = new LineString(coords, factory);
    JSONObject jo = (JSONObject) ser.marshall(null, p);
    assertEquals("LineString", jo.get("type").toString());
    assertEquals("31300", jo.get("srid").toString());
    assertEquals("2", jo.get("precision").toString());
    assertEquals("[12,34.23,12,54.56,-0.01,0]", jo.get("coordinates").toString());
View Full Code Here

  public void testMultiLineString() throws MarshallException {
    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(-0.01, -0.0)});
    LineString l = new LineString(coords, factory);
    MultiLineString m = new MultiLineString(new LineString[] {l}, factory);
    JSONObject jo = (JSONObject) ser.marshall(null, m);
    assertEquals("MultiLineString", jo.get("type").toString());
    assertEquals("31300", jo.get("srid").toString());
    assertEquals("2", jo.get("precision").toString());
View Full Code Here

public class CentroidTest {

  @Test
  public void testSinglePointString() {
    GeometryFactory factory = new GeometryFactory();
    LineString ls = factory.createLineString(new Coordinate[] {new Coordinate(0, 0),
        new Coordinate(0, 0)});
    com.vividsolutions.jts.geom.Point p = ls.getCentroid();
    assertTrue(Double.isNaN(p.getX()));
  }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.LineString

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.