/** * Create a geobbox of the right kind given the specified {@link LatLonBounds}. * * @param planetModel is the planet model * @param bounds are the bounds * @return a GeoBBox corresponding to what was specified. */ public static GeoBBox makeGeoBBox(final PlanetModel planetModel, LatLonBounds bounds) { final double topLat = (bounds.checkNoTopLatitudeBound()) ? Math.PI * 0.5 : bounds.getMaxLatitude(); final double bottomLat = (bounds.checkNoBottomLatitudeBound()) ? -Math.PI * 0.5 : bounds.getMinLatitude(); final double leftLon = (bounds.checkNoLongitudeBound()) ? -Math.PI : bounds.getLeftLongitude(); final double rightLon = (bounds.checkNoLongitudeBound()) ? Math.PI : bounds.getRightLongitude(); return makeGeoBBox(planetModel, topLat, bottomLat, leftLon, rightLon); }
/** * Set the bounds from the wrapped GeoBBox. */ private void setBoundsFromshape() { LatLonBounds bounds = new LatLonBounds(); shape.getBounds(bounds); minX = bounds.checkNoLongitudeBound() ? -180.0 : bounds.getLeftLongitude() * DistanceUtils.RADIANS_TO_DEGREES; minY = bounds.checkNoBottomLatitudeBound() ? -90.0 : bounds.getMinLatitude() * DistanceUtils.RADIANS_TO_DEGREES; maxX = bounds.checkNoLongitudeBound() ? 180.0 : bounds.getRightLongitude() * DistanceUtils.RADIANS_TO_DEGREES; maxY = bounds.checkNoTopLatitudeBound() ? 90.0 : bounds.getMaxLatitude() * DistanceUtils.RADIANS_TO_DEGREES; }