Changeset 5724 in josm


Ignore:
Timestamp:
2013-02-17T15:01:13+01:00 (12 years ago)
Author:
Don-vip
Message:

fix #4664 - warn when reverting a way with direction defined by tag

Location:
trunk/src/org/openstreetmap/josm
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java

    r4982 r5724  
    1919import org.openstreetmap.josm.command.Command;
    2020import org.openstreetmap.josm.command.SequenceCommand;
     21import org.openstreetmap.josm.corrector.ReverseWayNoTagCorrector;
    2122import org.openstreetmap.josm.corrector.ReverseWayTagCorrector;
    2223import org.openstreetmap.josm.corrector.UserCancelException;
     
    109110     * @param w the way
    110111     * @return the reverse command and the tag correction commands
     112     * @throws UserCancelException if user cancels a reverse warning dialog
    111113     */
    112114    public static ReverseWayResult reverseWay(Way w) throws UserCancelException {
     115        ReverseWayNoTagCorrector.checkAndConfirmReverseWay(w);
    113116        Way wnew = new Way(w);
    114117        List<Node> nodesCopy = wnew.getNodes();
  • trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java

    r5266 r5724  
    2424 * A TagCollection can be created:
    2525 * <ul>
    26  *  <li>from the tags managed by a specific {@link OsmPrimitive} with {@link #from(OsmPrimitive)}</li>
     26 *  <li>from the tags managed by a specific {@link OsmPrimitive} with {@link #from(Tagged)}</li>
    2727 *  <li>from the union of all tags managed by a collection of {@link OsmPrimitive}s with {@link #unionOfAllPrimitives(Collection)}</li>
    2828 *  <li>from the union of all tags managed by a {@link DataSet} with {@link #unionOfAllPrimitives(DataSet)}</li>
     
    5151    public static TagCollection from(Tagged primitive) {
    5252        TagCollection tags = new TagCollection();
    53         for (String key: primitive.keySet()) {
    54             tags.add(new Tag(key, primitive.get(key)));
     53        if (primitive != null) {
     54            for (String key: primitive.keySet()) {
     55                tags.add(new Tag(key, primitive.get(key)));
     56            }
    5557        }
    5658        return tags;
     
    158160
    159161    /**
     162     * Creates a tag collection from <code>tags</code>.
     163     * @param tags the collection of tags
     164     * @since 5724
     165     */
     166    public TagCollection(Collection<Tag> tags) {
     167        add(tags);
     168    }
     169
     170    /**
    160171     * Replies the number of tags in this tag collection
    161172     *
     
    637648     * Does nothing if primitives is null
    638649     *
    639      * @param primitive  the collection of primitives
     650     * @param primitives the collection of primitives
    640651     * @throws IllegalStateException thrown if this tag collection can't be applied
    641652     * because there are keys with multiple values
     
    657668     */
    658669    public TagCollection intersect(TagCollection other) {
    659         if (other == null) {
    660             other = new TagCollection();
    661         }
    662         TagCollection ret = new TagCollection(this);
    663         for (Tag tag: tags) {
    664             if (other.contains(tag)) {
    665                 ret.add(tag);
     670        TagCollection ret = new TagCollection();
     671        if (other != null) {
     672            for (Tag tag: tags) {
     673                if (other.contains(tag)) {
     674                    ret.add(tag);
     675                }
    666676            }
    667677        }
  • trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java

    r5266 r5724  
    9898     * @param messageType the message type
    9999     * @param options a list of options
    100      * @param defaultOption the default option
     100     * @param defaultOption the default option; only meaningful if options is used; can be null
    101101     *
    102102     * @return the option selected by user. {@link JOptionPane#CLOSED_OPTION} if the dialog was closed.
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r5614 r5724  
    3131import java.util.Set;
    3232
    33 import javax.swing.*;
     33import javax.swing.AbstractAction;
     34import javax.swing.BorderFactory;
     35import javax.swing.InputMap;
     36import javax.swing.JComponent;
     37import javax.swing.JLabel;
     38import javax.swing.JMenu;
     39import javax.swing.JMenuItem;
     40import javax.swing.JOptionPane;
     41import javax.swing.JPanel;
     42import javax.swing.JScrollPane;
     43import javax.swing.JSplitPane;
     44import javax.swing.JTabbedPane;
     45import javax.swing.JToolBar;
     46import javax.swing.KeyStroke;
     47import javax.swing.SwingUtilities;
    3448import javax.swing.event.ChangeEvent;
    3549import javax.swing.event.ChangeListener;
     
    5973import org.openstreetmap.josm.gui.DefaultNameFormatter;
    6074import org.openstreetmap.josm.gui.HelpAwareOptionPane;
     75import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
    6176import org.openstreetmap.josm.gui.MainMenu;
    6277import org.openstreetmap.josm.gui.SideButton;
    63 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
    64 import org.openstreetmap.josm.gui.dialogs.properties.PresetListPanel;
    6578import org.openstreetmap.josm.gui.dialogs.properties.PresetListPanel.PresetHandler;
    6679import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction;
     
    697710    }
    698711
    699     static boolean confirmAddingPrimtive(OsmPrimitive primitive) throws AddAbortException {
     712    static boolean confirmAddingPrimitive(OsmPrimitive primitive) throws AddAbortException {
    700713        String msg = tr("<html>This relation already has one or more members referring to<br>"
    701714                + "the object ''{0}''<br>"
     
    747760                    continue;
    748761                } else if (MemberTableModel.hasMembersReferringTo(relation.getMembers(), Collections.singleton(p))
    749                         && !confirmAddingPrimtive(p)) {
     762                        && !confirmAddingPrimitive(p)) {
    750763                    continue;
    751764                }
     
    776789                }
    777790                if (isPotentialDuplicate(primitive))  {
    778                     if (confirmAddingPrimtive(primitive)) {
     791                    if (confirmAddingPrimitive(primitive)) {
    779792                        ret.add(primitive);
    780793                    }
Note: See TracChangeset for help on using the changeset viewer.