cdm/src/main/java/ucar/nc2/ft2/coverage/HorizCoordSys.java
public List<ProjectionPoint> calcProjectionBoundaryPoints(int maxPointsInYEdge, int maxPointsInXEdge) {
    if (!isProjection) {
      throw new UnsupportedOperationException("Coordinate system is not a projection.");
    }
    checkMaxPointsInEdges(maxPointsInYEdge, maxPointsInXEdge);

    int numYtotal = yAxis.getNcoords();
    int numXtotal = xAxis.getNcoords();
    int strideY = calcStride(numYtotal, maxPointsInYEdge);
    int strideX = calcStride(numXtotal, maxPointsInXEdge);

    List<ProjectionPoint> points = new LinkedList<>();

    // Bottom boundary points
    for (int i = 0; i < numXtotal; i += strideX) {
      points.add(new ProjectionPointImpl(xAxis.getCoordEdge1(i), yAxis.getCoordEdgeFirst()));
    }

    // Right boundary points
    for (int j = 0; j < numYtotal; j += strideY) {
      points.add(new ProjectionPointImpl(xAxis.getCoordEdgeLast(), yAxis.getCoordEdge1(j)));
    }

    // Top boundary points
    for (int i = numXtotal - 1; i >= 0; i -= strideX) {
      points.add(new ProjectionPointImpl(xAxis.getCoordEdge2(i), yAxis.getCoordEdgeLast()));
    }

    // Left boundary points
    for (int j = numYtotal - 1; j >= 0; j -= strideY) {
      points.add(new ProjectionPointImpl(xAxis.getCoordEdgeFirst(), yAxis.getCoordEdge2(j)));
    }

    assertNotExceedingMaxBoundaryPoints(points.size(), maxPointsInYEdge, maxPointsInXEdge);
    return points;
  }
public List<ProjectionPoint> calcProjectionBoundaryPoints(int maxPointsInYEdge, int maxPointsInXEdge) {
    if (!isProjection) {
      throw new UnsupportedOperationException("Coordinate system is not a projection.");
    }
    checkMaxPointsInEdges(maxPointsInYEdge, maxPointsInXEdge);

    int numYtotal = yAxis.getNcoords();
    int numXtotal = xAxis.getNcoords();
    int strideY = calcStride(numYtotal, maxPointsInYEdge);
    int strideX = calcStride(numXtotal, maxPointsInXEdge);

    List<ProjectionPoint> points = new LinkedList<>();

    // Bottom boundary points
    for (int i = 0; i < numXtotal; i += strideX) {
      points.add(new ProjectionPointImpl(xAxis.getCoordEdge1(i), yAxis.getCoordEdgeFirst()));
    }

    // Right boundary points
    for (int j = 0; j < numYtotal; j += strideY) {
      points.add(new ProjectionPointImpl(xAxis.getCoordEdgeLast(), yAxis.getCoordEdge1(j)));
    }

    // Top boundary points
    for (int i = numXtotal - 1; i >= 0; i -= strideX) {
      points.add(new ProjectionPointImpl(xAxis.getCoordEdge2(i), yAxis.getCoordEdgeLast()));
    }

    // Left boundary points
    for (int j = numYtotal - 1; j >= 0; j -= strideY) {
      points.add(new ProjectionPointImpl(xAxis.getCoordEdgeFirst(), yAxis.getCoordEdge2(j)));
    }

    assertNotExceedingMaxBoundaryPoints(points.size(), maxPointsInYEdge, maxPointsInXEdge);
    return points;
  }
public List < ProjectionPoint > calcProjectionBoundaryPoints ( int maxPointsInYEdge , int maxPointsInXEdge ) { if ( ! isProjection ) { throw new UnsupportedOperationException ( "Coordinate system is not a projection." ) ; } checkMaxPointsInEdges ( maxPointsInYEdge , maxPointsInXEdge ) ; int numYtotal = yAxis . getNcoords ( ) ; int numXtotal = xAxis . getNcoords ( ) ; int strideY = calcStride ( numYtotal , maxPointsInYEdge ) ; int strideX = calcStride ( numXtotal , maxPointsInXEdge ) ; List < ProjectionPoint > points = new LinkedList <> ( ) ; // Bottom boundary points for ( int i = 0 ; i < numXtotal ; i += strideX ) { points . add ( new ProjectionPointImpl ( xAxis . getCoordEdge1 ( i ) , yAxis . getCoordEdgeFirst ( ) ) ) ; } // Right boundary points for ( int j = 0 ; j < numYtotal ; j += strideY ) { points . add ( new ProjectionPointImpl ( xAxis . getCoordEdgeLast ( ) , yAxis . getCoordEdge1 ( j ) ) ) ; } // Top boundary points for ( int i = numXtotal - 1 ; i >= 0 ; i -= strideX ) { points . add ( new ProjectionPointImpl ( xAxis . getCoordEdge2 ( i ) , yAxis . getCoordEdgeLast ( ) ) ) ; } // Left boundary points for ( int j = numYtotal - 1 ; j >= 0 ; j -= strideY ) { points . add ( new ProjectionPointImpl ( xAxis . getCoordEdgeFirst ( ) , yAxis . getCoordEdge2 ( j ) ) ) ; } assertNotExceedingMaxBoundaryPoints ( points . size ( ) , maxPointsInYEdge , maxPointsInXEdge ) ; return points ; }
Calculates the boundary of this coordinate reference system, in projection coordinates. The boundary starts at the
lower left corner of the coverage--i.e. {@code (y[0], x[0])}--and consists of the points that lie along the bottom,
right, top, and left edges, in that order.
<p>
The {@code maxPointsInYEdge} parameter establishes a limit on the number of boundary points that'll be included
from the right and left edges. {@code maxPointsInXEdge} establishes a similar limit for the bottom and top edges.
The size of the returned list will be {@code ≤ 2 * maxPointsInYEdge + 2 * maxPointsInXEdge}. Note that the corners
are always included, regardless of the arguments. If you wish to include ALL of the points along the edges in
the boundary, simply choose values for the parameters that are greater than the lengths of the corresponding
axes in the CRS. {@link Integer#MAX_VALUE} works great. In that case, the size of the returned list will be
{@code 2 * numXcoords + 2 * numYcoords}.

@param maxPointsInYEdge  the maximum number of boundary points to include from the right and left edges.
@param maxPointsInXEdge  the maximum number of boundary points to include from the bottom and top edges.
@return  the boundary of this coordinate reference system, in projection coordinates.
@throws UnsupportedOperationException  if this CRS is not a projection.
Calculates the boundary of this coordinate reference system in projection coordinates . The boundary starts at the lower left corner of the coverage -- i . e . { @code ( y [ 0 ] x [ 0 ] ) } -- and consists of the points that lie along the bottom right top and left edges in that order . <p > The { @code maxPointsInYEdge } parameter establishes a limit on the number of boundary points that ll be included from the right and left edges . { @code maxPointsInXEdge } establishes a similar limit for the bottom and top edges . The size of the returned list will be { @code ≤ 2 * maxPointsInYEdge + 2 * maxPointsInXEdge } . Note that the corners are always included regardless of the arguments . If you wish to include ALL of the points along the edges in the boundary simply choose values for the parameters that are greater than the lengths of the corresponding axes in the CRS . { @link Integer#MAX_VALUE } works great . In that case the size of the returned list will be { @code 2 * numXcoords + 2 * numYcoords } .