Ignore:
Timestamp:
2007-10-25T22:54:01+02:00 (19 years ago)
Author:
framm
Message:
  • added patch by Matthew Newton <matthew-osm@…> to merge nodes. I know there's already a merge nodes in the utils plugin but I guess we need the node merge in the core, as we already have merging and splitting ways there...
File:
1 edited

Legend:

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

    r407 r422  
    291291
    292292        /**
     293         * @return A list of all nodes that are nearest to
     294         * the mouse.  Does a simple sequential scan on all the data.
     295         *
     296         * @return A collection of all nodes or <code>null</code>
     297         *              if no node under or near the point. The returned
     298         *              list is never empty.
     299         */
     300        public Collection<Node> getNearestNodes(Point p) {
     301                Collection<Node> nearest = new HashSet<Node>();
     302                for (Node n : Main.ds.nodes) {
     303                        if (!n.deleted && !n.incomplete
     304                                        && getPoint(n.eastNorth).distanceSq(p) < 100) {
     305                                nearest.add(n);
     306                        }
     307                }
     308                return nearest.isEmpty() ? null : nearest;
     309        }
     310
     311        /**
     312         * @return the nearest nodes to the screen point given that is not
     313         * in ignore.
     314         *
     315         * @param p the point for which to search the nearest segment.
     316         * @param ignore a collection of nodes which are not to be returned.
     317         * May be null.
     318         */
     319        public final Collection<Node> getNearestNodes(Point p, Collection<Node> ignore) {
     320                Collection<Node> nearest = getNearestNodes(p);
     321                if (nearest == null) return null;
     322                if (ignore != null) nearest.removeAll(ignore);
     323                return nearest.isEmpty() ? null : nearest;
     324        }
     325
     326        /**
    293327         * @return The projection to be used in calculating stuff.
    294328         */
Note: See TracChangeset for help on using the changeset viewer.