use of de.fhg.igd.mapviewer.server.TileProviderMapServer in project hale by halestudio.
the class MapFileServerFactory method loadServer.
/**
* Load a map file server with the given name
*
* @param name the server name
* @return the map server or null
*/
private MapServer loadServer(String name) {
String filename = mapFiles.get(name, null);
if (filename == null) {
mapFiles.remove(name);
} else {
File file = new File(filename);
if (file.exists()) {
TileProvider tp;
try {
tp = MapFileTileProvider.createMapFileTileProvider(file);
MapServer server = new TileProviderMapServer(tp);
server.setName(name);
prefServers.put(server, name);
return server;
} catch (MalformedURLException e) {
log.error("Invalid file name", e);
} catch (IOException e) {
log.error("Error loading map file", e);
}
} else {
log.info("Map file not found, removing map: " + filename);
}
}
return null;
}
Aggregations