Examples of LineString


Examples of ca.carleton.gcrc.geom.LineString

    Point point = new Point(positions);
    return point;
  }
 
  private LineString parseLineString(BufferedReader br) throws Exception {
    LineString lineString = new LineString();
   
    skipWhiteSpaces(br);
    popLeftParen(br);
   
    // Accumulate points
    boolean done = false;
    do {
      List<Number> positions = parsePositions(br);
      if( positions.size() < 2 ){
        throw new Exception("A point must have 2 or more positions");
      }

      Point point = new Point(positions);
      lineString.addPoint(point);
     
      if( checkForRightParen(br) ) {
        done = true;
      } else {
        popComma(br);
View Full Code Here

Examples of chunmap.model.geom.LineString

  WktReader reader=new WktReader();
  @Test
  public void testHasIntersection() {
    Geometry g=reader.read("LINESTRING(92.28571428571429 100.21428571428572,93.71428571428571 100.21428571428572,93.71428571428571 101.64285714285715,92.28571428571429 101.64285714285715,92.28571428571429 100.21428571428572)");
    Geometry g2=reader.read("LINESTRING(0.0 100.0,100.0 101.0)");
    LineString ls=(LineString)g;
    LineString ls2=(LineString)g2;
    Assert.assertTrue(LineAlgorithm.hasIntersection(ls.getPoints(), ls2.getPoints()));
  }
View Full Code Here

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

        doc.setDocGeo(gp);
      }
      if (null != geoRSSModule.getGeometry())
      {
        AbstractGeometry ag = geoRSSModule.getGeometry();
        if(ag.getClass().equals(new LineString().getClass()))
        { //<georss:line>
          LineString ls = ((LineString)geoRSSModule.getGeometry());
         
          double latAvg = 0.0;
          double lonAvg = 0.0;
          int length = ls.getPositionList().size();
          for (int i = 0; i < length; i ++)
          {
            latAvg += ls.getPositionList().getLatitude(i);
            lonAvg += ls.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.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

Examples of com.vividsolutions.jts.geom.LineString

  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

Examples of com.vividsolutions.jts.geom.LineString

  }

  @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

Examples of com.vividsolutions.jts.geom.LineString

  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

Examples of com.vividsolutions.jts.geom.LineString

    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

Examples of com.vividsolutions.jts.geom.LineString

  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

Examples of com.vividsolutions.jts.geom.LineString

    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
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.