- Timestamp:
- 2009-11-08T17:51:35+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r2381 r2412 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;6 6 import static org.openstreetmap.josm.tools.I18n.trn; 7 7 … … 15 15 import java.util.LinkedList; 16 16 import java.util.List; 17 import java.util.Map; 17 18 import java.util.Set; 18 19 import java.util.Map.Entry; … … 101 102 // is exactly one way that all nodes are part of. 102 103 if (selectedWay == null && selectedNodes != null) { 103 HashMap<Way, Integer> wayOccurenceCounter = new HashMap<Way, Integer>();104 Map<Way, Integer> wayOccurenceCounter = new HashMap<Way, Integer>(); 104 105 for (Node n : selectedNodes) { 105 for (Way w : getCurrentDataSet().getWays()) {106 for (Way w : OsmPrimitive.getFilteredList(n.getReferrers(), Way.class)) { 106 107 if (!w.isUsable()) { 107 108 continue; … … 294 295 // now copy all relations to new way also 295 296 296 for (Relation r : getCurrentDataSet().getRelations()) {297 for (Relation r : OsmPrimitive.getFilteredList(selectedWay.getReferrers(), Relation.class)) { 297 298 if (!r.isUsable()) { 298 299 continue; -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r2410 r2412 67 67 if (checkSelection(selection)) { 68 68 int count = 0; 69 for (Way w : getCurrentDataSet().getWays()) {69 for (Way w : OsmPrimitive.getFilteredList(selectedNode.getReferrers(), Way.class)) { 70 70 if (!w.isUsable() || w.getNodesCount() < 1) { 71 continue;72 }73 if (!w.containsNode(selectedNode)) {74 71 continue; 75 72 } … … 92 89 for (Node n : selectedNodes) { 93 90 int count = 0; 94 for (Way w : getCurrentDataSet().getWays()) {91 for (Way w : OsmPrimitive.getFilteredList(n.getReferrers(), Way.class)) { 95 92 if (w.isDeleted() || w.incomplete || w.getNodesCount() < 1) { 96 continue;97 }98 if (!w.containsNode(n)) {99 93 continue; 100 94 } … … 189 183 if (!(n instanceof Node)) 190 184 return false; 191 boolean isPartOfWay = false; 192 for (Way w : getCurrentDataSet().getWays()) { 193 if (w.containsNode((Node) n)) { 194 isPartOfWay = true; 195 break; 196 } 197 } 198 if (!isPartOfWay) 185 if (OsmPrimitive.getFilteredList(n.getReferrers(), Way.class).isEmpty()) 199 186 return false; 200 187 … … 320 307 Relation newRel = null; 321 308 HashSet<String> rolesToReAdd = null; 322 for (Relation r : getCurrentDataSet().getRelations()) {309 for (Relation r : OsmPrimitive.getFilteredList(originalNode.getReferrers(), Relation.class)) { 323 310 if (r.isDeleted() || r.incomplete) { 324 311 continue; … … 365 352 boolean firstway = true; 366 353 // modify all ways containing the nodes 367 for (Way w : getCurrentDataSet().getWays()) {354 for (Way w : OsmPrimitive.getFilteredList(selectedNode.getReferrers(), Way.class)) { 368 355 if (w.isDeleted() || w.incomplete || w.getNodesCount() < 1) { 369 continue;370 }371 if (!w.containsNode(selectedNode)) {372 356 continue; 373 357 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r2407 r2412 773 773 public Way getWayForNode(Node n) { 774 774 Way way = null; 775 for (Way w : getCurrentDataSet().getWays()) {775 for (Way w : OsmPrimitive.getFilteredList(n.getReferrers(), Way.class)) { 776 776 if (!w.isUsable() || w.getNodesCount() < 1) { 777 777 continue; -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r2405 r2412 753 753 } 754 754 755 public Set<Relation> getReferringRelations(Collection<? extends OsmPrimitive> primitives) {756 return this.getReferringRelations(new HashSet<OsmPrimitive>(primitives));757 }758 public Set<Relation> getReferringRelations(Set<? extends OsmPrimitive> referred) {759 HashSet<Relation> ret = new HashSet<Relation>();760 if (referred == null) return ret;761 referred.remove(null); // just in case - remove null element from primitives762 for (Relation r: relations) {763 if (r.isDeleted() || r.incomplete) {764 continue;765 }766 Set<OsmPrimitive> memberPrimitives = r.getMemberPrimitives();767 memberPrimitives.retainAll(referred);768 if (!memberPrimitives.isEmpty()) {769 ret.add(r);770 }771 }772 return ret;773 }774 775 755 /** 776 756 * Reindex all nodes and ways after their coordinates were changed. This is a temporary solution, reindexing should
Note:
See TracChangeset
for help on using the changeset viewer.