public Coordinate[] simplify() {
   usePt = new boolean[pts.length];
   for (int i = 0; i < pts.length; i++) {
     usePt[i] = true;
   }
   simplifySection(0, pts.length - 1);
   CoordinateList coordList = new CoordinateList();
   for (int i = 0; i < pts.length; i++) {
     if (usePt[i]) coordList.add(new Coordinate(pts[i]));
   }
   return coordList.toCoordinateArray();
 }
Example #2
0
 /**
  * Computes the list of coordinates which are contained in this ring. The coordinatea are computed
  * once only and cached.
  *
  * @return an array of the {@link Coordinate}s in this ring
  */
 private Coordinate[] getCoordinates() {
   if (ringPts == null) {
     CoordinateList coordList = new CoordinateList();
     for (Iterator i = deList.iterator(); i.hasNext(); ) {
       DirectedEdge de = (DirectedEdge) i.next();
       PolygonizeEdge edge = (PolygonizeEdge) de.getEdge();
       addEdge(edge.getLine().getCoordinates(), de.getEdgeDirection(), coordList);
     }
     ringPts = coordList.toCoordinateArray();
   }
   return ringPts;
 }
Example #3
0
  public Geometry densify(double segLength) {
    newCoords = new CoordinateList();

    CoordinateSequence seq = inputLine.getCoordinateSequence();

    Coordinate p0 = new Coordinate();
    Coordinate p1 = new Coordinate();
    seq.getCoordinate(0, p0);
    newCoords.add(new Coordinate(p0));

    for (int i = 0; i < seq.size() - 1; i++) {
      seq.getCoordinate(i, p0);
      seq.getCoordinate(i + 1, p1);
      densify(p0, p1, segLength);
    }
    Coordinate[] newPts = newCoords.toCoordinateArray();
    return inputLine.getFactory().createLineString(newPts);
  }