Skip to content

Commit

Permalink
Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-jts committed Jun 21, 2023
1 parent 618fde9 commit 2292bf6
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,21 @@ private static Coordinate[] extractUnique(Coordinate[] pts) {

/**
* Extracts unique coordinates from an array of coordinates,
* up to a maximum count of values.
* up to an (optional) maximum count of values.
* If more than the given maximum of unique values are found,
* this is reported by returning <code>null</code>.
* (the expectation is that the original array can then be used).
* This avoids scanning all input points if not needed.
* If the maximum points is not specified, all unique points are extracted.
*
* @param pts an array of Coordinates
* @param maxPts the maximum number of unique points to scan
* @param maxPts the maximum number of unique points to scan, or -1
* @return an array of unique values, or null
*/
private static Coordinate[] extractUnique(Coordinate[] pts, int maxPts) {
Set<Coordinate> uniquePts = new HashSet<Coordinate>();
for (Coordinate pt : pts) {
uniquePts.add(pt);
//-- if maxPts is provided, exit if more unique pts found
if (maxPts >= 0 && uniquePts.size() > maxPts) return null;
}
return CoordinateArrays.toCoordinateArray(uniquePts);
Expand Down Expand Up @@ -403,10 +405,11 @@ private Geometry lineOrPolygon(Coordinate[] coordinates) {
}

/**
*@param vertices the vertices of a linear ring, which may or may not be
* Cleans a list of points by removing interior collinear vertices.
*
* @param vertices the vertices of a linear ring, which may or may not be
* flattened (i.e. vertices collinear)
*@return the coordinates with unnecessary (collinear) vertices
* removed
* @return the coordinates with unnecessary (collinear) vertices removed
*/
private Coordinate[] cleanRing(Coordinate[] original) {
Assert.equals(original[0], original[original.length - 1]);
Expand Down

0 comments on commit 2292bf6

Please sign in to comment.