try{
String tempLine = bread.readLine();
while (tempLine != null){
// The first element in the string is the OGC Identifying Number.
String[] tempElements = parse(tempLine, '|');
EPSGEllipsoid tempEllipsoid = new EPSGEllipsoid();
boolean tempAdd = true;
if (tempElements.length > 7){
// First element is the code
tempEllipsoid.setCode(tempElements[0]);
// second element is the name
tempEllipsoid.setName(tempElements[1]);
// third element is the major axis
double a = 0;
try{
a = Double.parseDouble(tempElements[2]);
tempEllipsoid.setMajorAxis(a);
}
catch (NumberFormatException e){
System.out.println("NumberFormatException Parsing Major Axis ="+tempElements[4]+" in Ellipsoid "+tempElements[1]);
tempAdd = false;
}
// Fourth element is the Axis Units code
tempEllipsoid.setUnitOfMeasure(tempElements[3]);
// Fifth element is the Inverse flattening
tempEllipsoid.setMinorAxis(0);
try{
if ((tempElements[4] != null) && (tempElements[4].trim().length() > 0)){
double f = Double.parseDouble(tempElements[4]);
// calculate the semiMinorAxis
double b = a-a*(1.0/f);
tempEllipsoid.setMinorAxis(b);
}
}
catch (NumberFormatException e){
System.out.println("NumberFormatException Parsing Inverse Flattening = "+tempElements[4]+" in Ellipsoid "+tempElements[1]);
tempAdd = false;
}
// Sixth element is the SemiMinor Axis
try{
if ((tempElements[5] != null) && (tempElements[5].trim().length() > 0)){
double b = Double.parseDouble(tempElements[5]);
tempEllipsoid.setMinorAxis(b);
}
}
catch (NumberFormatException e){
System.out.println("NumberFormatException Parsing Minor Axis = "+tempElements[4]+" in Ellipsoid "+tempElements[1]);
tempAdd = false;
}
if (tempEllipsoid.getMinorAxis() == 0) {
System.out.println("No Minor Axis found for Ellipsoid "+tempElements[2]);
tempAdd = false;
}
// Seventh element is the remarks
tempEllipsoid.setRemarks(tempElements[6]);
// Eight element is the Information Source
tempEllipsoid.setInformationSource(tempElements[7]);
}
if (tempAdd) tempVectEllipsoids.addElement(tempEllipsoid);
tempLine = bread.readLine();
}
}