[josm-dev] Empty marker layers
Dave Hansen
dave at sr71.net
Sun Dec 2 22:02:59 GMT 2007
I was opening a bunch of .gpx files today, and it kinda cluttered up my
layer dialog box with "Markers from...". The problem is that I didn't
_have_ any markers in my .gpx files. :)
Could we have openFileAsGpx() check for the layers to have actual data
in them before addition?
private void openFileAsGpx(File file) throws SAXException, IOException, FileNotFoundException {
String fn = file.getName();
if (ExtensionFileFilter.filters[ExtensionFileFilter.GPX].acceptName(fn)) {
GpxReader r = null;
if (file.getName().endsWith(".gpx.gz")) {
r = new GpxReader(new GZIPInputStream(new FileInputStream(file)), file.getAbsoluteFile().getParentFile());
} else{
r = new GpxReader(new FileInputStream(file), file.getAbsoluteFile().getParentFile());
}
r.data.storageFile = file;
Main.main.addLayer(new GpxLayer(r.data, fn));
> MarkerLayer m = new MarkerLayer(r.data, tr("Markers from {0}", fn), file);
> if (m.data.size() > 0)
> Main.main.addLayer(m);
} else {
throw new IllegalStateException();
}
}
-- Dave
More information about the josm-dev
mailing list