private static void addEdge(Coordinate[] coords, boolean isForward, CoordinateList coordList) { if (isForward) { for (int i = 0; i < coords.length; i++) { coordList.add(coords[i], false); } } else { for (int i = coords.length - 1; i >= 0; i--) { coordList.add(coords[i], false); } } }
/** * 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; }