/** * Parses the hemisphere of latitude from specified field. * * @param index Index of field that contains the latitude hemisphere value. * @return Hemisphere of latitude */ protected CompassPoint parseHemisphereLat(int index) { char ch = getCharValue(index); CompassPoint d = CompassPoint.valueOf(ch); if (d != CompassPoint.NORTH && d != CompassPoint.SOUTH) { throw new ParseException("Invalid latitude hemisphere '" + ch + "'"); } return d; }
/** * Parses the hemisphere of longitude from the specified field. * * @param index Field index for longitude hemisphere indicator * @return Hemisphere of longitude */ protected CompassPoint parseHemisphereLon(int index) { char ch = getCharValue(index); CompassPoint d = CompassPoint.valueOf(ch); if (d != CompassPoint.EAST && d != CompassPoint.WEST) { throw new ParseException("Invalid longitude hemisphere " + ch + "'"); } return d; }
/** * Set the hemisphere of latitude in specified field. * * @param field Field index * @param hem Direction.NORTH or Direction.SOUTH * @throws IllegalArgumentException If specified Direction is other than NORTH or SOUTH. */ protected void setLatHemisphere(int field, CompassPoint hem) { if (hem != CompassPoint.NORTH && hem != CompassPoint.SOUTH) { throw new IllegalArgumentException("Invalid latitude hemisphere: " + hem); } setCharValue(field, hem.toChar()); }
/** * Set the hemisphere of longitude in specified field. * * @param field Field index * @param hem Direction.EAST or Direction.WEST * @throws IllegalArgumentException If specified Direction is other than EAST or WEST. */ protected void setLonHemisphere(int field, CompassPoint hem) { if (hem != CompassPoint.EAST && hem != CompassPoint.WEST) { throw new IllegalArgumentException("Invalid longitude hemisphere: " + hem); } setCharValue(field, hem.toChar()); }