cdm/src/main/java/ucar/nc2/ft2/coverage/HorizCoordSys.java
public static List<LatLonPointNoNormalize> connectLatLonPoints(List<LatLonPoint> points) {
    LinkedList<LatLonPointNoNormalize> connectedPoints = new LinkedList<>();

    for (LatLonPoint point : points) {
      double curLat = point.getLatitude();
      double curLon = point.getLongitude();

      if (!connectedPoints.isEmpty()) {
        double prevLon = connectedPoints.getLast().getLongitude();
        curLon = LatLonPointImpl.lonNormal(curLon, prevLon);
      }
      connectedPoints.add(new LatLonPointNoNormalize(curLat, curLon));
    }

    return connectedPoints;
  }
public static List<LatLonPointNoNormalize> connectLatLonPoints(List<LatLonPoint> points) {
    LinkedList<LatLonPointNoNormalize> connectedPoints = new LinkedList<>();

    for (LatLonPoint point : points) {
      double curLat = point.getLatitude();
      double curLon = point.getLongitude();

      if (!connectedPoints.isEmpty()) {
        double prevLon = connectedPoints.getLast().getLongitude();
        curLon = LatLonPointImpl.lonNormal(curLon, prevLon);
      }
      connectedPoints.add(new LatLonPointNoNormalize(curLat, curLon));
    }

    return connectedPoints;
  }
public static List < LatLonPointNoNormalize > connectLatLonPoints ( List < LatLonPoint > points ) { LinkedList < LatLonPointNoNormalize > connectedPoints = new LinkedList <> ( ) ; for ( LatLonPoint point : points ) { double curLat = point . getLatitude ( ) ; double curLon = point . getLongitude ( ) ; if ( ! connectedPoints . isEmpty ( ) ) { double prevLon = connectedPoints . getLast ( ) . getLongitude ( ) ; curLon = LatLonPointImpl . lonNormal ( curLon , prevLon ) ; } connectedPoints . add ( new LatLonPointNoNormalize ( curLat , curLon ) ) ; } return connectedPoints ; }
Returns a list of points that is equivalent to the input list, but with longitude values adjusted to ensure that
adjacent elements are "connected".
<p>
Two points are "connected" if the absolute difference of their {@link LatLonPointImpl#lonNormal normalized
longitudes} is {@code ≤180}. For example, the longitudes {@code 112} and {@code 124} are connected. So are
{@code 15} and {@code -27}.
<p>
Two points may be "disconnected" if they lie on opposite sides of the international date line. For example,
the longitudes {@code 175} and {@code -175} are disconnected because their absolute difference is {@code 350},
which is {@code >180}. To connect the two points, we adjust the second longitude to an equivalent value
in the range {@code [firstLon ± 180]} by adding or subtracting {@code 360}. So, {@code -175} would become
{@code 185}. We perform this adjustment for each pair of adjacent elements in the list.
<p>
Performing the above adjustment will result in longitudes that lie outside of the normalized range of
({@code [-180, 180]}). To be precise, if adjustments are necessary, all of the longitudes in the returned list
will be in either {@code [-360, 0]} or {@code [0, 360]}. Consequently, adjusted points cannot be returned as
{@link LatLonPoint}s; they are returned as {@link LatLonPointNoNormalize} objects instead.
<p>
Longitudes {@code lon1} and {@code lon2} are considered equivalent if {@code lon1 == lon2 + 360 * i}, for some
integer {@code i}.

@param points  a sequence of normalized lat/lon points that potentially crosses the international date line.
@return  an equivalent sequence of points that has been adjusted to be "connected".
Returns a list of points that is equivalent to the input list but with longitude values adjusted to ensure that adjacent elements are connected . <p > Two points are connected if the absolute difference of their { @link LatLonPointImpl#lonNormal normalized longitudes } is { @code ≤180 } . For example the longitudes { @code 112 } and { @code 124 } are connected . So are { @code 15 } and { @code - 27 } . <p > Two points may be disconnected if they lie on opposite sides of the international date line . For example the longitudes { @code 175 } and { @code - 175 } are disconnected because their absolute difference is { @code 350 } which is { @code > 180 } . To connect the two points we adjust the second longitude to an equivalent value in the range { @code [ firstLon ± 180 ] } by adding or subtracting { @code 360 } . So { @code - 175 } would become { @code 185 } . We perform this adjustment for each pair of adjacent elements in the list . <p > Performing the above adjustment will result in longitudes that lie outside of the normalized range of ( { @code [ - 180 180 ] } ) . To be precise if adjustments are necessary all of the longitudes in the returned list will be in either { @code [ - 360 0 ] } or { @code [ 0 360 ] } . Consequently adjusted points cannot be returned as { @link LatLonPoint } s ; they are returned as { @link LatLonPointNoNormalize } objects instead . <p > Longitudes { @code lon1 } and { @code lon2 } are considered equivalent if { @code lon1 == lon2 + 360 * i } for some integer { @code i } .