Changeset 6473 in josm for trunk/src/org
- Timestamp:
- 2013-12-14T16:13:55+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/util/HighlightHelper.java
r6038 r6473 7 7 import java.util.Iterator; 8 8 import java.util.Set; 9 9 10 import org.openstreetmap.josm.Main; 10 11 import org.openstreetmap.josm.data.osm.DataSet; … … 18 19 public class HighlightHelper { 19 20 Set<OsmPrimitive> highlightedPrimitives = new HashSet<OsmPrimitive>(); 20 21 21 22 /** 22 23 * Highlight and remember given primitives … … 26 27 return highlight(prims, false); 27 28 } 28 29 29 30 /** 30 31 * Highlight and remember given primitives … … 51 52 return needsRepaint; 52 53 } 53 54 54 55 /** 55 56 * Highlight and remember given primitives, forgetting previously highlighted by this instance … … 59 60 return highlight(prims, true); 60 61 } 61 62 62 63 /** 63 64 * Highlight and remember given primitive, forgetting previously highlighted by this instance … … 67 68 return highlight(Collections.singleton(p), true); 68 69 } 69 70 70 71 /** 71 72 * Highlight and remember given primitive … … 74 75 */ 75 76 public boolean setHighlight(OsmPrimitive p, boolean flag) { 77 return setHighlight(p, flag, new HashSet<Relation>()); 78 } 79 80 private boolean setHighlight(OsmPrimitive p, boolean flag, Set<Relation> seenRelations) { 76 81 if (p instanceof Relation) { 82 Relation r = (Relation) p; 83 seenRelations.add(r); 77 84 boolean needRepaint = false; 78 for (OsmPrimitive m: ((Relation) p).getMemberPrimitives()) { 79 needRepaint |= setHighlight(m, flag); 85 for (OsmPrimitive m : r.getMemberPrimitives()) { 86 if (!(m instanceof Relation) || !seenRelations.contains(m)) { 87 needRepaint |= setHighlight(m, flag, seenRelations); 88 } 80 89 } 81 90 return needRepaint; 82 } else 83 if (flag) { 91 } else if (flag) { 84 92 if (highlightedPrimitives.add(p)) { 85 93 p.setHighlighted(true); … … 94 102 return false; 95 103 } 96 104 97 105 /** 98 106 * Clear highlighting of all remembered primitives … … 104 112 highlightedPrimitives.clear(); 105 113 } 106 114 107 115 /** 108 116 * Slow method to import all currently highlighted primitives into this instance … … 114 122 } 115 123 } 116 124 117 125 /** 118 126 * Slow method to remove highlights from all primitives
Note:
See TracChangeset
for help on using the changeset viewer.