Ignore:
Timestamp:
2006-04-27T01:29:55+02:00 (20 years ago)
Author:
imi
Message:
  • added GeoImage feature (showing images on a tracklog)
  • added zoom slider
  • added Escape cancels selection rectangle
  • added "Save password" option to Auth-dialog
  • fixed that redo/undo buttons were not enabled
  • fixed hotkeys beeing inaccessible when no data is loaded
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/actions/mapmode/AddWayAction.java

    r98 r99  
    1414import org.openstreetmap.josm.command.AddCommand;
    1515import org.openstreetmap.josm.command.ChangeCommand;
    16 import org.openstreetmap.josm.command.Command;
    1716import org.openstreetmap.josm.command.DeleteCommand;
    1817import org.openstreetmap.josm.data.SelectionChangedListener;
     
    6463        @Override public void enterMode() {
    6564                super.enterMode();
    66                 Command c = null;
    6765                way = makeWay();
    68                 if (way != null) {
    69                         c = new AddCommand(way);
    70                         Main.ds.setSelected(way);
    71                         Main.main.editLayer().add(c);
    72                 } else
    73                         Main.ds.clearSelection();
     66                Main.ds.setSelected(way);
    7467                Main.map.mapView.addMouseListener(this);
    7568        }
     
    147140                }
    148141
     142                Way wayToAdd = null;
     143                boolean reordered = false;
    149144                if (numberOfSelectedWays > 0) {
    150145                        String ways = "way" + (numberOfSelectedWays==1?" has":"s have");
     
    155150                                        if (osm instanceof Way)
    156151                                                segmentSet.addAll(((Way)osm).segments);
     152                        } else if (numberOfSelectedWays == 1) {
     153                                answer = JOptionPane.showConfirmDialog(Main.parent, "Do you want to add all other selected segments to the one selected way?", "Add segments to way?", JOptionPane.YES_NO_OPTION);
     154                                if (answer == JOptionPane.YES_OPTION) {
     155                                        for (OsmPrimitive osm : selection) {
     156                                                if (osm instanceof Way) {
     157                                                        wayToAdd = (Way)osm;
     158                                                        answer = JOptionPane.showConfirmDialog(Main.parent, "Reorder all line segments?", "Reorder?", JOptionPane.YES_NO_CANCEL_OPTION);
     159                                                        if (answer == JOptionPane.CANCEL_OPTION)
     160                                                                return wayToAdd;
     161                                                        if (answer == JOptionPane.YES_OPTION) {
     162                                                                segmentSet.addAll(wayToAdd.segments);
     163                                                                reordered = true;
     164                                                        } else
     165                                                                segmentSet.removeAll(wayToAdd.segments);
     166                                                        break;
     167                                                }
     168                                        }
     169                                }
    157170                        }
    158171                }
     
    193206                }
    194207
     208                if (wayToAdd != null) {
     209                        Way w = new Way(wayToAdd);
     210                        if (reordered)
     211                                w.segments.clear();
     212                        w.segments.addAll(sortedSegments);
     213                        Main.main.editLayer().add(new ChangeCommand(wayToAdd, w));
     214                        return wayToAdd;
     215                }
     216
    195217                if (JOptionPane.YES_OPTION != JOptionPane.showConfirmDialog(Main.parent, "Create a new way out of "+sortedSegments.size()+" segments?", "Create new way", JOptionPane.YES_NO_OPTION))
    196218                        return null;
     
    198220                Way w = new Way();
    199221                w.segments.addAll(sortedSegments);
     222
     223                if (way != null)
     224                        Main.main.editLayer().add(new AddCommand(way));
    200225                return w;
    201226        }
Note: See TracChangeset for help on using the changeset viewer.