Ignore:
Timestamp:
2008-08-22T21:25:28+02:00 (16 years ago)
Author:
stoecker
Message:

Prevent editing inactive layer. Fix layer oder and display order. Closes #371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r805 r845  
    1818import org.openstreetmap.josm.data.coor.EastNorth;
    1919import org.openstreetmap.josm.data.coor.LatLon;
     20import org.openstreetmap.josm.data.osm.DataSet;
    2021import org.openstreetmap.josm.data.osm.Node;
    2122import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    4950        public NavigatableComponent() {
    5051                setLayout(null);
    51     }
     52        }
     53
     54        protected DataSet getData()
     55        {
     56                return Main.ds;
     57        }
    5258
    5359        /**
     
    137143                double minDistanceSq = Double.MAX_VALUE;
    138144                Node minPrimitive = null;
    139                 for (Node n : Main.ds.nodes) {
     145                for (Node n : getData().nodes) {
    140146                        if (n.deleted || n.incomplete)
    141147                                continue;
     
    163169        public final List<WaySegment> getNearestWaySegments(Point p) {
    164170                TreeMap<Double, List<WaySegment>> nearest = new TreeMap<Double, List<WaySegment>>();
    165                 for (Way w : Main.ds.ways) {
     171                for (Way w : getData().ways) {
    166172                        if (w.deleted || w.incomplete) continue;
    167173                        Node lastN = null;
     
    273279        public Collection<OsmPrimitive> getAllNearest(Point p) {
    274280                Collection<OsmPrimitive> nearest = new HashSet<OsmPrimitive>();
    275                         for (Way w : Main.ds.ways) {
     281                        for (Way w : getData().ways) {
    276282                        if (w.deleted || w.incomplete) continue;
    277283                        Node lastN = null;
     
    295301                                }
    296302                        }
    297                 for (Node n : Main.ds.nodes) {
     303                for (Node n : getData().nodes) {
    298304                        if (!n.deleted && !n.incomplete
    299305                                        && getPoint(n.eastNorth).distanceSq(p) < snapDistance) {
     
    314320        public Collection<Node> getNearestNodes(Point p) {
    315321                Collection<Node> nearest = new HashSet<Node>();
    316                 for (Node n : Main.ds.nodes) {
     322                for (Node n : getData().nodes) {
    317323                        if (!n.deleted && !n.incomplete
    318324                                        && getPoint(n.eastNorth).distanceSq(p) < snapDistance) {
Note: See TracChangeset for help on using the changeset viewer.