*/
private Object[] parseLine(String line) {
List<String> entries = tokenize(line);
Iterator<String> iter = entries.iterator();
ExternalID eid = null;
LabelList labels = null;
List<Polygon> polys = new java.util.Vector<Polygon>(1);
List<Vector> coords = new ArrayList<Vector>();
while(iter.hasNext()) {
String cur = iter.next();
Matcher m = COORD.matcher(cur);
if(m.find()) {
try {
double c1 = Double.parseDouble(m.group(1));
double c2 = Double.parseDouble(m.group(2));
if(m.group(3) != null) {
double c3 = Double.parseDouble(m.group(3));
coords.add(new Vector(new double[] { c1, c2, c3 }));
}
else {
coords.add(new Vector(new double[] { c1, c2 }));
}
continue;
}
catch(NumberFormatException e) {
logger.warning("Looked like a coordinate pair but didn't parse: " + cur);
}
}
// Polygon separator.
if(cur.equals(POLYGON_SEPARATOR)) {
if(coords.size() > 0) {
polys.add(new Polygon(coords));
coords = new ArrayList<Vector>();
}
continue;
}
// First label will become the External ID
if(eid == null) {
eid = new ExternalID(cur);
}
else {
// Label
if(labels == null) {
labels = new LabelList(1);