source: josm/src/org/openstreetmap/josm/data/DataSetChecker.java@ 290

Last change on this file since 290 was 290, checked in by imi, 17 years ago
  • added support for multiple data layers
File size: 1.1 KB
Line 
1package org.openstreetmap.josm.data;
2
3import java.util.HashSet;
4import java.util.Set;
5
6import javax.swing.JOptionPane;
7
8import org.openstreetmap.josm.Main;
9import org.openstreetmap.josm.data.osm.OsmPrimitive;
10import org.openstreetmap.josm.gui.layer.Layer;
11import org.openstreetmap.josm.gui.layer.OsmDataLayer;
12
13public class DataSetChecker {
14
15 public static void check() {
16 if (Main.map == null)
17 return;
18
19 Set<OsmPrimitive> s = new HashSet<OsmPrimitive>();
20 for (Layer l : Main.map.mapView.getAllLayers()) {
21 if (l instanceof OsmDataLayer) {
22 for (OsmPrimitive osm : ((OsmDataLayer)l).data.allPrimitives()) {
23 if (s.contains(osm)) {
24 JOptionPane.showMessageDialog(Main.parent, "cross references");
25 return;
26 }
27 s.add(osm);
28 }
29 }
30 }
31
32 if (Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) {
33 OsmDataLayer l = (OsmDataLayer)Main.map.mapView.getActiveLayer();
34 if (l.data != Main.ds) {
35 JOptionPane.showMessageDialog(Main.parent, "Main.ds / active layer mismatch");
36 return;
37 }
38 }
39
40 JOptionPane.showMessageDialog(Main.parent, "working");
41 }
42}
Note: See TracBrowser for help on using the repository browser.