Hashtable library = new Hashtable();
// Create location data
if (locationFile != null && nameIndex != -1) {
Debug.message("scenario", "Reading location file...");
try {
CSVFile locations = new CSVFile(locationFile);
locations.loadData();
Iterator records = locations.iterator();
while (records.hasNext()) {
String name = null;
String icon = null;
Vector record = (Vector) records.next();
if (record.size() == 0)
continue;
name = (String) record.elementAt(nameIndex);
if (iconIndex != -1) {
icon = (String) record.elementAt(iconIndex);
}
if (name != null) {
ScenarioPoint location = new ScenarioPoint(name, icon);
location.setShowName(showNames);
drawingAttributes.setTo(location);
library.put(name.intern(), location);
list.add(location);
} else {
Debug.error("ScenaroGraphicLoader: no name to use to create location: "
+ name);
}
}
} catch (MalformedURLException murle) {
Debug.error("ScenarioGraphicLoader: problem finding the location file: "
+ locationFile);
return list;
} catch (ArrayIndexOutOfBoundsException aioobe) {
Debug.error("ScenarioGraphicLoader: problem with parsing location file: "
+ locationFile);
if (Debug.debugging("scenario")) {
Debug.output("The problem is with one of the indexes into the file: \n"
+ aioobe.getMessage());
aioobe.printStackTrace();
}
} catch (NullPointerException npe) {
Debug.error("ScenarioGraphicLoader ("
+ getName()
+ ") null pointer exception, most likely a problem finding the organization data file");
}
} else {
Debug.error("ScenarioGraphicLoader(" + getName()
+ "): Location file (" + locationFile + ") not configured.");
return list;
}
// OK, got the locations built up, need to fill up the
// scenario
// Create location data
if (activityFile != null && activityNameIndex != -1 && latIndex != -1
&& lonIndex != -1 && timeIndex != -1) {
Debug.message("scenario", "Reading activity file...");
try {
CSVFile activities = new CSVFile(activityFile);
activities.loadData(); // numbers as strings == false
Iterator records = activities.iterator();
while (records.hasNext()) {
String name = null;
float lat;
float lon;
long time;