/** * Format an angle according to the current angle format. Prepend a specified label. * * @param label a label to prepend to the formatted angle. May be null to indicate no label. * @param angle the angle to format. * @return a string containing the formatted angle prepended with the specified label. * @throws IllegalArgumentException if the angle is null. */ public String angle(String label, Angle angle) { if (angle == null) { String msg = Logging.getMessage("nullValue.AngleIsNull"); Logging.logger().severe(msg); throw new IllegalArgumentException(msg); } String s; if (this.isShowDMS()) s = String.format("%s", angle.toFormattedDMSString()).trim(); else s = String.format(this.getFormat(FORMAT_DECIMAL_DEGREES), angle.degrees).trim(); return label != null ? label + " " + s : s; }