/** * Calculates the bounding box of this coordinate reference system, in projection coordinates. If this CRS * {@link #isProjection isn't a projection}, than {@code null} is returned. * * @return the bounding box of this CRS, in projection coordinates. */ public ProjectionRect calcProjectionBoundingBox() { if (!isProjection) return null; double minX = Math.min(xAxis.getCoordEdgeFirst(), xAxis.getCoordEdgeLast()); double minY = Math.min(yAxis.getCoordEdgeFirst(), yAxis.getCoordEdgeLast()); double width = Math.abs(xAxis.getCoordEdgeLast() - xAxis.getCoordEdgeFirst()); double height = Math.abs(yAxis.getCoordEdgeLast() - yAxis.getCoordEdgeFirst()); return new ProjectionRect(new ProjectionPointImpl(minX, minY), width, height); }
private List<LatLonPoint> calcLatLon1DBoundaryPoints(int maxPointsInYEdge, int maxPointsInXEdge) { if (!isLatLon1D) { throw new UnsupportedOperationException("Coordinate system is not 1D latitude/longitude."); } checkMaxPointsInEdges(maxPointsInYEdge, maxPointsInXEdge); int numYtotal = latAxis.getNcoords(); int numXtotal = lonAxis.getNcoords(); int strideY = calcStride(numYtotal, maxPointsInYEdge); int strideX = calcStride(numXtotal, maxPointsInXEdge); List<LatLonPoint> points = new LinkedList<>(); // Bottom boundary points for (int i = 0; i < numXtotal; i += strideX) { points.add(new LatLonPointImpl(latAxis.getCoordEdgeFirst(), lonAxis.getCoordEdge1(i))); } // Right boundary points for (int j = 0; j < numYtotal; j += strideY) { points.add(new LatLonPointImpl(latAxis.getCoordEdge1(j), lonAxis.getCoordEdgeLast())); } // Top boundary points for (int i = numXtotal - 1; i >= 0; i -= strideX) { points.add(new LatLonPointImpl(latAxis.getCoordEdgeLast(), lonAxis.getCoordEdge2(i))); } // Left boundary points for (int j = numYtotal - 1; j >= 0; j -= strideY) { points.add(new LatLonPointImpl(latAxis.getCoordEdge2(j), lonAxis.getCoordEdgeFirst())); } assertNotExceedingMaxBoundaryPoints(points.size(), maxPointsInYEdge, maxPointsInXEdge); return points; }
points.add(new ProjectionPointImpl(xAxis.getCoordEdgeLast(), yAxis.getCoordEdge1(j))); points.add(new ProjectionPointImpl(xAxis.getCoordEdge2(i), yAxis.getCoordEdgeLast()));
else if (target > axis.getCoordEdgeLast()) return bounded ? n - 1 : n; else if (target < axis.getCoordEdgeLast()) return bounded ? n - 1 : n;
if (yaxis.getCoordMidpoint(0) < yaxis.getCoordMidpoint(1)) { data = data.flip(0); yStart = yaxis.getCoordEdgeLast();