Changeset 33608 in osm for applications/editors
- Timestamp:
- 2017-09-15T20:25:12+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/terracer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/terracer/build.xml
r33579 r33608 2 2 <project name="terracer" default="dist" basedir="."> 3 3 <property name="commit.message" value="applied #j5760 (patch by robome) - Order of housenumbers not correct"/> 4 <property name="plugin.main.version" value="12 678"/>4 <property name="plugin.main.version" value="12859"/> 5 5 <property name="plugin.author" value="Matt Amos"/> 6 6 <property name="plugin.class" value="terracer.TerracerPlugin"/> -
applications/editors/josm/plugins/terracer/src/terracer/HouseNumberInputDialog.java
r33579 r33608 27 27 import org.openstreetmap.josm.data.osm.OsmPrimitive; 28 28 import org.openstreetmap.josm.data.osm.Way; 29 import org.openstreetmap.josm.data.tagging.ac.AutoCompletionItem; 30 import org.openstreetmap.josm.data.tagging.ac.AutoCompletionSet; 29 31 import org.openstreetmap.josm.gui.ExtendedDialog; 30 32 import org.openstreetmap.josm.gui.MainApplication; 31 33 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox; 32 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletion ListItem;34 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager; 33 35 import org.openstreetmap.josm.gui.util.WindowGeometry; 34 36 import org.openstreetmap.josm.tools.GBC; … … 311 313 312 314 if (buildingComboBox == null) { 313 final List<AutoCompletionListItem> values = MainApplication314 .getLayerManager().getEditDataSet().getAutoCompletionManager().getValues("building");315 316 315 buildingComboBox = new AutoCompletingComboBox(); 317 buildingComboBox.setPossibleA CItems(values);316 buildingComboBox.setPossibleAcItems(AutoCompletionManager.of(Main.main.getEditDataSet()).getTagValues("building")); 318 317 buildingComboBox.setEditable(true); 319 318 if (buildingType != null && !buildingType.isEmpty()) { -
applications/editors/josm/plugins/terracer/src/terracer/HouseNumberInputHandler.java
r33579 r33608 24 24 import org.openstreetmap.josm.data.osm.Relation; 25 25 import org.openstreetmap.josm.data.osm.Way; 26 import org.openstreetmap.josm.data.tagging.ac.AutoCompletionItem; 26 27 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox; 27 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionListItem;28 28 import org.openstreetmap.josm.tools.Logging; 29 29 import org.openstreetmap.josm.tools.UserCancelException; … … 391 391 } else { 392 392 String name; 393 if (selected instanceof AutoCompletion ListItem) {394 name = ((AutoCompletion ListItem) selected).getValue();393 if (selected instanceof AutoCompletionItem) { 394 name = ((AutoCompletionItem) selected).getValue(); 395 395 } else { 396 396 name = selected.toString(); -
applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java
r33579 r33608 12 12 import java.util.Collections; 13 13 import java.util.Comparator; 14 import java.util.HashMap; 14 15 import java.util.HashSet; 15 16 import java.util.Iterator; 16 17 import java.util.LinkedList; 17 18 import java.util.List; 19 import java.util.Map; 18 20 import java.util.Set; 19 21 import java.util.regex.Matcher; … … 30 32 import org.openstreetmap.josm.command.DeleteCommand; 31 33 import org.openstreetmap.josm.command.SequenceCommand; 34 import org.openstreetmap.josm.data.osm.DataSet; 32 35 import org.openstreetmap.josm.data.osm.Node; 33 36 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 60 63 public final class TerracerAction extends JosmAction { 61 64 62 // smsms1 asked for the last value to be remembered to make it easier to do 63 // repeated terraces. this is the easiest, but not necessarily nicest, way. 64 // private static String lastSelectedValue = ""; 65 66 Collection<Command> commands; 67 65 private Collection<Command> commands; 68 66 private Collection<OsmPrimitive> primitives; 69 67 private TagCollection tagsInConflict; … … 347 345 this.commands = new LinkedList<>(); 348 346 Collection<Way> ways = new LinkedList<>(); 347 DataSet ds = getLayerManager().getEditDataSet(); 349 348 350 349 if (nb > 1) { … … 355 354 newNodes[1][i] = interpolateAlong(interp.b, backLength * iDir / nb); 356 355 if (!outline.containsNode(newNodes[0][i])) 357 this.commands.add(new AddCommand( newNodes[0][i]));356 this.commands.add(new AddCommand(ds, newNodes[0][i])); 358 357 else 359 358 reusedNodes.add(newNodes[0][i]); 360 359 if (!outline.containsNode(newNodes[1][i])) 361 this.commands.add(new AddCommand( newNodes[1][i]));360 this.commands.add(new AddCommand(ds, newNodes[1][i])); 362 361 else 363 362 reusedNodes.add(newNodes[1][i]); … … 388 387 if (createNewWay) { 389 388 ways.add(terr); 390 this.commands.add(new AddCommand( terr));389 this.commands.add(new AddCommand(ds, terr)); 391 390 } else { 392 391 ways.add(outline); … … 404 403 } 405 404 if (!nodesToDelete.isEmpty()) 406 this.commands.add(DeleteCommand.delete( MainApplication.getLayerManager().getEditLayer(),nodesToDelete));405 this.commands.add(DeleteCommand.delete(nodesToDelete)); 407 406 } 408 407 } else { … … 415 414 // Or should removing them also be an option? 416 415 if (!housenumbers.isEmpty()) { 417 commands.add(DeleteCommand.delete(MainApplication.getLayerManager().getEditLayer(), 418 housenumbers, true, true)); 416 commands.add(DeleteCommand.delete(housenumbers, true, true)); 419 417 } 420 418 … … 462 460 associatedStreet.addMember(new RelationMember("house", w)); 463 461 } 464 this.commands.add(new AddCommand( associatedStreet));462 this.commands.add(new AddCommand(getLayerManager().getEditDataSet(), associatedStreet)); 465 463 } 466 464 … … 514 512 boolean buildingAdded = false; 515 513 boolean numberAdded = false; 514 Map<String, String> tags = new HashMap<>(); 516 515 if (houseNum != null) { 517 516 primitives = Arrays.asList(new OsmPrimitive[]{houseNum, outline}); … … 522 521 523 522 for (Tag tag : tagsToCopy) { 524 t his.commands.add(new ChangePropertyCommand(outline, tag.getKey(), tag.getValue()));523 tags.put(tag.getKey(), tag.getValue()); 525 524 } 526 525 … … 529 528 } 530 529 if (!buildingAdded && buildingValue != null && !buildingValue.isEmpty()) { 531 t his.commands.add(new ChangePropertyCommand(outline, "building", buildingValue));530 tags.put("building", buildingValue); 532 531 } 533 532 if (defaultNumber != null && !numberAdded) { 534 t his.commands.add(new ChangePropertyCommand(outline, "addr:housenumber", defaultNumber));533 tags.put("addr:housenumber", defaultNumber); 535 534 } 536 535 // Only put addr:street if no relation exists or if it has no name 537 536 if (associatedStreet == null || !associatedStreet.hasKey("name")) { 538 537 if (street != null) { 539 t his.commands.add(new ChangePropertyCommand(outline, "addr:street", street.get("name")));538 tags.put("addr:street", street.get("name")); 540 539 } else if (streetName != null && !streetName.trim().isEmpty()) { 541 this.commands.add(new ChangePropertyCommand(outline, "addr:street", streetName.trim())); 542 } 540 tags.put("addr:street", streetName.trim()); 541 } 542 } 543 if (!tags.isEmpty()) { 544 commands.add(new ChangePropertyCommand(getLayerManager().getEditDataSet(), Collections.singleton(outline), tags)); 543 545 } 544 546 }
Note:
See TracChangeset
for help on using the changeset viewer.