deg = min = 0; sec = 0.0; try { deg = st.getUInt16(); min = st.getUInt16(); sec = st.getDouble(); } catch (NumberFormatException e) { st.unget(); } s = st.getString(); if (!s.equalsIgnoreCase("S") && !s.equalsIgnoreCase("N")) throw st.exception("Invalid LOC latitude"); latitude = (long) (1000 * (sec + 60 * (min + 60 * deg))); if (s.equalsIgnoreCase("S")) latitude = -latitude; latitude += (1L << 31);   deg = min = 0; sec = 0.0; try { deg = st.getUInt16(); min = st.getUInt16(); sec = st.getDouble(); } catch (NumberFormatException e) { st.unget(); } s = st.getString(); if (!s.equalsIgnoreCase("W") && !s.equalsIgnoreCase("E")) throw st.exception("Invalid LOC longitude"); longitude = (long) (1000 * (sec + 60 * (min + 60 * deg))); if (s.equalsIgnoreCase("W")) longitude = -longitude; longitude += (1L << 31);   Tokenizer.Token token = st.get(); if (token.isEOL()) { st.unget(); return; } s = token.value; if (s.length() > 1 && s.charAt(s.length() - 1) == 'm') s = s.substring(0, s.length() - 1); try { altitude = (long)((new Double(s).doubleValue() + 100000) * 100); } catch (NumberFormatException e) { throw st.exception("Invalid LOC altitude"); }   token = st.get(); if (token.isEOL()) { st.unget(); return; } s = token.value; if (s.length() > 1 && s.charAt(s.length() - 1) == 'm') s = s.substring(0, s.length() - 1); try { size = (long) (100 * new Double(s).doubleValue()); } catch (NumberFormatException e) { throw st.exception("Invalid LOC size"); }   token = st.get(); if (token.isEOL()) { st.unget(); return; } s = token.value; if (s.length() > 1 && s.charAt(s.length() - 1) == 'm') s = s.substring(0, s.length() - 1); try { hPrecision = (long) (100 * new Double(s).doubleValue()); } catch (NumberFormatException e) { throw st.exception("Invalid LOC horizontal precision"); }   token = st.get(); if (token.isEOL()) { st.unget(); return; } s = token.value; if (s.length() > 1 && s.charAt(s.length() - 1) == 'm') s = s.substring(0, s.length() - 1); try { vPrecision = (long) (100 * new Double(s).doubleValue()); } catch (NumberFormatException e) { throw st.exception("Invalid LOC vertical precision"); }
latitude = parsePosition(st, "latitude"); longitude = parsePosition(st, "longitude"); altitude = parseDouble(st, "altitude", true, -10000000, 4284967295L, 0) + 10000000; size = parseDouble(st, "size", false, 0, 9000000000L, 100); hPrecision = parseDouble(st, "horizontal precision", false, 0, 9000000000L, 1000000); vPrecision = parseDouble(st, "vertical precision", false, 0, 9000000000L, 1000);
rdataFromString(Tokenizer st, Name origin) throws IOException {	String s = null;	int deg, min;	double sec;	/* Latitude */	deg = min = 0;	sec = 0.0;	try {		deg = st.getUInt16();		min = st.getUInt16();		sec = st.getDouble();	}	catch (NumberFormatException e) {		st.unget();	}	s = st.getString();	if (!s.equalsIgnoreCase("S") && !s.equalsIgnoreCase("N"))		throw st.exception("Invalid LOC latitude");	latitude = (long) (1000 * (sec + 60 * (min + 60 * deg)));	if (s.equalsIgnoreCase("S"))		latitude = -latitude;	latitude += (1L << 31);		/* Longitude */	deg = min = 0;	sec = 0.0;	try {		deg = st.getUInt16();		min = st.getUInt16();		sec = st.getDouble();	}	catch (NumberFormatException e) {		st.unget();	}	s = st.getString();	if (!s.equalsIgnoreCase("W") && !s.equalsIgnoreCase("E"))		throw st.exception("Invalid LOC longitude");	longitude = (long) (1000 * (sec + 60 * (min + 60 * deg)));	if (s.equalsIgnoreCase("W"))		longitude = -longitude;	longitude += (1L << 31);	/* Altitude */	Tokenizer.Token token = st.get();	if (token.isEOL()) {		st.unget();		return;	}	s = token.value;	if (s.length() > 1 && s.charAt(s.length() - 1) == 'm')		s = s.substring(0, s.length() - 1);	try {		altitude = (long)((new Double(s).doubleValue() + 100000) * 100);	}	catch (NumberFormatException e) {		throw st.exception("Invalid LOC altitude");	}		/* Size */	token = st.get();	if (token.isEOL()) {		st.unget();		return;	}	s = token.value;	if (s.length() > 1 && s.charAt(s.length() - 1) == 'm')		s = s.substring(0, s.length() - 1);	try {		size = (long) (100 * new Double(s).doubleValue());	}	catch (NumberFormatException e) {		throw st.exception("Invalid LOC size");	}		/* Horizontal precision */	token = st.get();	if (token.isEOL()) {		st.unget();		return;	}	s = token.value;	if (s.length() > 1 && s.charAt(s.length() - 1) == 'm')		s = s.substring(0, s.length() - 1);	try {		hPrecision = (long) (100 * new Double(s).doubleValue());	}	catch (NumberFormatException e) {		throw st.exception("Invalid LOC horizontal precision");	}		/* Vertical precision */	token = st.get();	if (token.isEOL()) {		st.unget();		return;	}	s = token.value;	if (s.length() > 1 && s.charAt(s.length() - 1) == 'm')		s = s.substring(0, s.length() - 1);	try {		vPrecision = (long) (100 * new Double(s).doubleValue());	}	catch (NumberFormatException e) {		throw st.exception("Invalid LOC vertical precision");	}}