Changeset 16626 in osm for applications/editors
- Timestamp:
- 2009-07-21T20:56:01+02:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/terracer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/terracer/build.xml
r16162 r16626 26 26 <attribute name="Plugin-Description" value="Make terraced houses out of single blocks."/> 27 27 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/Terracer"/> 28 <attribute name="Plugin-Mainversion" value="1 638"/>28 <attribute name="Plugin-Mainversion" value="1815"/> 29 29 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 30 30 </manifest> -
applications/editors/josm/plugins/terracer/src/terracer/ReverseTerraceAction.java
r13990 r16626 26 26 * in the wrong direction, or when someone has added house numbers in the wrong 27 27 * direction anyway. 28 * 28 * 29 29 * Finds all connected ways which have a building=* tag on them in order (breadth 30 30 * first search) and then changes the tags to be the reverse of the order in which … … 34 34 35 35 public ReverseTerraceAction() { 36 super(tr("Reverse a terrace"), 37 "reverse_terrace", 36 super(tr("Reverse a terrace"), 37 "reverse_terrace", 38 38 tr("Reverses house numbers on a terrace."), 39 Shortcut.registerShortcut("tools:ReverseTerrace", 39 Shortcut.registerShortcut("tools:ReverseTerrace", 40 40 tr("Tool: {0}", tr("Reverse a Terrace")), 41 KeyEvent.VK_R, Shortcut.GROUP_EDIT, 41 KeyEvent.VK_R, Shortcut.GROUP_EDIT, 42 42 Shortcut.SHIFT_DEFAULT), 43 43 true); … … 50 50 */ 51 51 public void actionPerformed(ActionEvent e) { 52 Collection<OsmPrimitive> sel = Main. ds.getSelected();53 52 Collection<OsmPrimitive> sel = Main.main.getCurrentDataSet().getSelected(); 53 54 54 // set to keep track of all the nodes that have been visited - that is: if 55 55 // we encounter them again we will not follow onto the connected ways. 56 56 HashSet<Node> visitedNodes = new HashSet<Node>(); 57 57 58 58 // set to keep track of the ways the algorithm has seen, but not yet visited. 59 59 // since when a way is visited all of its nodes are marked as visited, there … … 61 61 HashSet<Way> front = new HashSet<Way>(); 62 62 63 // initialise the set with all the buildings in the selection. this means 63 // initialise the set with all the buildings in the selection. this means 64 64 // there is undefined behaviour when there is a multiple selection, as the 65 65 // ordering will be based on the hash. … … 69 69 } 70 70 } 71 71 72 72 // this is like a visitedWays set, but in a linear order. 73 73 LinkedList<Way> orderedWays = new LinkedList<Way>(); 74 74 75 75 // and the tags to reverse on the orderedWays. 76 76 LinkedList<String> houseNumbers = new LinkedList<String>(); 77 77 78 78 while (front.size() > 0) { 79 79 // Java apparently doesn't have useful methods to get single items from sets... 80 80 Way w = front.iterator().next(); 81 81 82 82 // visit all the nodes in the way, adding the building's they're members of 83 83 // to the front. 84 84 for (Node n : w.nodes) { 85 85 if (!visitedNodes.contains(n)) { 86 CollectBackReferencesVisitor v = new CollectBackReferencesVisitor(Main. ds);86 CollectBackReferencesVisitor v = new CollectBackReferencesVisitor(Main.main.getCurrentDataSet()); 87 87 v.visit(n); 88 88 for (OsmPrimitive prim : v.data) { … … 101 101 houseNumbers.addFirst(w.get("addr:housenumber")); 102 102 } 103 103 104 104 Collection<Command> commands = new LinkedList<Command>(); 105 105 // what, no zipWith? … … 112 112 113 113 Main.main.undoRedo.add(new SequenceCommand(tr("Reverse Terrace"), commands)); 114 Main. ds.setSelected(orderedWays);114 Main.main.getCurrentDataSet().setSelected(orderedWays); 115 115 } 116 116 -
applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java
r16162 r16626 63 63 // smsms1 asked for the last value to be remembered to make it easier to do 64 64 // repeated terraces. this is the easiest, but not necessarily nicest, way. 65 private static String lastSelectedValue = ""; 65 //private static String lastSelectedValue = ""; 66 66 67 67 public TerracerAction() { … … 81 81 */ 82 82 public void actionPerformed(ActionEvent e) { 83 Collection<OsmPrimitive> sel = Main. ds.getSelected();83 Collection<OsmPrimitive> sel = Main.main.getCurrentDataSet().getSelected(); 84 84 boolean badSelect = false; 85 85 … … 198 198 199 199 Main.main.undoRedo.add(new SequenceCommand(tr("Terrace"), commands)); 200 Main. ds.setSelected(ways);200 Main.main.getCurrentDataSet().setSelected(ways); 201 201 } 202 202 … … 516 516 private TreeSet<String> createAutoCompletionInfo() { 517 517 final TreeSet<String> names = new TreeSet<String>(); 518 for (OsmPrimitive osm : Main. ds.allNonDeletedPrimitives()) {518 for (OsmPrimitive osm : Main.main.getCurrentDataSet().allNonDeletedPrimitives()) { 519 519 if (osm.keys != null && 520 520 osm.keys.containsKey("highway") &&
Note:
See TracChangeset
for help on using the changeset viewer.