/** * Format angles of latitude and longitude according to the current angle format. * * <p>The values are formatted using the current {@link #LABEL_LATLON_LAT}, {@link * #LABEL_LATLON_LON} and angle format. * * @param latlon the angles to format. * @return a string containing the formatted angles. * @throws IllegalArgumentException if <code>latlon</code> is null. */ public String latLon(LatLon latlon) { if (latlon == null) { String msg = Logging.getMessage("nullValue.LatLonIsNull"); Logging.logger().severe(msg); throw new IllegalArgumentException(msg); } return String.format( "%s %s", this.angle(this.getLabel(LABEL_LATLON_LAT), latlon.getLatitude()), this.angle(this.getLabel(LABEL_LATLON_LON), latlon.getLongitude())) .trim(); }
protected static void legacyWmsRestoreStateToParams( RestorableSupport rs, RestorableSupport.StateObject context, AVList params) { // WMSTiledImageLayer has historically used a different format for storing LatLon and Sector // properties // in the restorable state XML documents. Although WMSTiledImageLayer no longer writes these // properties, // we must provide support for reading them here. Double lat = rs.getStateValueAsDouble(context, AVKey.LEVEL_ZERO_TILE_DELTA + ".Latitude"); Double lon = rs.getStateValueAsDouble(context, AVKey.LEVEL_ZERO_TILE_DELTA + ".Longitude"); if (lat != null && lon != null) params.setValue(AVKey.LEVEL_ZERO_TILE_DELTA, LatLon.fromDegrees(lat, lon)); Double minLat = rs.getStateValueAsDouble(context, AVKey.SECTOR + ".MinLatitude"); Double minLon = rs.getStateValueAsDouble(context, AVKey.SECTOR + ".MinLongitude"); Double maxLat = rs.getStateValueAsDouble(context, AVKey.SECTOR + ".MaxLatitude"); Double maxLon = rs.getStateValueAsDouble(context, AVKey.SECTOR + ".MaxLongitude"); if (minLat != null && minLon != null && maxLat != null && maxLon != null) params.setValue(AVKey.SECTOR, Sector.fromDegrees(minLat, maxLat, minLon, maxLon)); }