Changeset 33608 in osm


Ignore:
Timestamp:
2017-09-15T20:25:12+02:00 (7 years ago)
Author:
donvip
Message:

fix #josm15312 - update to JOSM 12859

Location:
applications/editors/josm/plugins/terracer
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/terracer/build.xml

    r33579 r33608  
    22<project name="terracer" default="dist" basedir=".">
    33    <property name="commit.message" value="applied #j5760 (patch by robome) - Order of housenumbers not correct"/>
    4     <property name="plugin.main.version" value="12678"/>
     4    <property name="plugin.main.version" value="12859"/>
    55    <property name="plugin.author" value="Matt Amos"/>
    66    <property name="plugin.class" value="terracer.TerracerPlugin"/>
  • applications/editors/josm/plugins/terracer/src/terracer/HouseNumberInputDialog.java

    r33579 r33608  
    2727import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2828import org.openstreetmap.josm.data.osm.Way;
     29import org.openstreetmap.josm.data.tagging.ac.AutoCompletionItem;
     30import org.openstreetmap.josm.data.tagging.ac.AutoCompletionSet;
    2931import org.openstreetmap.josm.gui.ExtendedDialog;
    3032import org.openstreetmap.josm.gui.MainApplication;
    3133import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox;
    32 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionListItem;
     34import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager;
    3335import org.openstreetmap.josm.gui.util.WindowGeometry;
    3436import org.openstreetmap.josm.tools.GBC;
     
    311313
    312314        if (buildingComboBox == null) {
    313             final List<AutoCompletionListItem> values = MainApplication
    314                 .getLayerManager().getEditDataSet().getAutoCompletionManager().getValues("building");
    315 
    316315            buildingComboBox = new AutoCompletingComboBox();
    317             buildingComboBox.setPossibleACItems(values);
     316            buildingComboBox.setPossibleAcItems(AutoCompletionManager.of(Main.main.getEditDataSet()).getTagValues("building"));
    318317            buildingComboBox.setEditable(true);
    319318            if (buildingType != null && !buildingType.isEmpty()) {
  • applications/editors/josm/plugins/terracer/src/terracer/HouseNumberInputHandler.java

    r33579 r33608  
    2424import org.openstreetmap.josm.data.osm.Relation;
    2525import org.openstreetmap.josm.data.osm.Way;
     26import org.openstreetmap.josm.data.tagging.ac.AutoCompletionItem;
    2627import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox;
    27 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionListItem;
    2828import org.openstreetmap.josm.tools.Logging;
    2929import org.openstreetmap.josm.tools.UserCancelException;
     
    391391        } else {
    392392            String name;
    393             if (selected instanceof AutoCompletionListItem) {
    394                name = ((AutoCompletionListItem) selected).getValue();
     393            if (selected instanceof AutoCompletionItem) {
     394               name = ((AutoCompletionItem) selected).getValue();
    395395            } else {
    396396               name = selected.toString();
  • applications/editors/josm/plugins/terracer/src/terracer/TerracerAction.java

    r33579 r33608  
    1212import java.util.Collections;
    1313import java.util.Comparator;
     14import java.util.HashMap;
    1415import java.util.HashSet;
    1516import java.util.Iterator;
    1617import java.util.LinkedList;
    1718import java.util.List;
     19import java.util.Map;
    1820import java.util.Set;
    1921import java.util.regex.Matcher;
     
    3032import org.openstreetmap.josm.command.DeleteCommand;
    3133import org.openstreetmap.josm.command.SequenceCommand;
     34import org.openstreetmap.josm.data.osm.DataSet;
    3235import org.openstreetmap.josm.data.osm.Node;
    3336import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    6063public final class TerracerAction extends JosmAction {
    6164
    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;
    6866    private Collection<OsmPrimitive> primitives;
    6967    private TagCollection tagsInConflict;
     
    347345        this.commands = new LinkedList<>();
    348346        Collection<Way> ways = new LinkedList<>();
     347        DataSet ds = getLayerManager().getEditDataSet();
    349348
    350349        if (nb > 1) {
     
    355354                newNodes[1][i] = interpolateAlong(interp.b, backLength * iDir / nb);
    356355                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]));
    358357                else
    359358                    reusedNodes.add(newNodes[0][i]);
    360359                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]));
    362361                else
    363362                    reusedNodes.add(newNodes[1][i]);
     
    388387                if (createNewWay) {
    389388                    ways.add(terr);
    390                     this.commands.add(new AddCommand(terr));
     389                    this.commands.add(new AddCommand(ds, terr));
    391390                } else {
    392391                    ways.add(outline);
     
    404403                }
    405404                if (!nodesToDelete.isEmpty())
    406                     this.commands.add(DeleteCommand.delete(MainApplication.getLayerManager().getEditLayer(), nodesToDelete));
     405                    this.commands.add(DeleteCommand.delete(nodesToDelete));
    407406            }
    408407        } else {
     
    415414        // Or should removing them also be an option?
    416415        if (!housenumbers.isEmpty()) {
    417             commands.add(DeleteCommand.delete(MainApplication.getLayerManager().getEditLayer(),
    418                     housenumbers, true, true));
     416            commands.add(DeleteCommand.delete(housenumbers, true, true));
    419417        }
    420418
     
    462460            associatedStreet.addMember(new RelationMember("house", w));
    463461        }
    464         this.commands.add(new AddCommand(associatedStreet));
     462        this.commands.add(new AddCommand(getLayerManager().getEditDataSet(), associatedStreet));
    465463    }
    466464
     
    514512        boolean buildingAdded = false;
    515513        boolean numberAdded = false;
     514        Map<String, String> tags = new HashMap<>();
    516515        if (houseNum != null) {
    517516            primitives = Arrays.asList(new OsmPrimitive[]{houseNum, outline});
     
    522521
    523522            for (Tag tag : tagsToCopy) {
    524                 this.commands.add(new ChangePropertyCommand(outline, tag.getKey(), tag.getValue()));
     523                tags.put(tag.getKey(), tag.getValue());
    525524            }
    526525
     
    529528        }
    530529        if (!buildingAdded && buildingValue != null && !buildingValue.isEmpty()) {
    531             this.commands.add(new ChangePropertyCommand(outline, "building", buildingValue));
     530            tags.put("building", buildingValue);
    532531        }
    533532        if (defaultNumber != null && !numberAdded) {
    534             this.commands.add(new ChangePropertyCommand(outline, "addr:housenumber", defaultNumber));
     533            tags.put("addr:housenumber", defaultNumber);
    535534        }
    536535        // Only put addr:street if no relation exists or if it has no name
    537536        if (associatedStreet == null || !associatedStreet.hasKey("name")) {
    538537            if (street != null) {
    539                 this.commands.add(new ChangePropertyCommand(outline, "addr:street", street.get("name")));
     538                tags.put("addr:street", street.get("name"));
    540539            } 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));
    543545        }
    544546    }
Note: See TracChangeset for help on using the changeset viewer.