Changeset 2685 in josm for trunk


Ignore:
Timestamp:
2009-12-28T00:14:11+01:00 (15 years ago)
Author:
Gubaer
Message:

Partial commit due to issue described in #4137
Breaks the build

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

Legend:

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

    r2512 r2685  
    2828public class AutoScaleAction extends JosmAction {
    2929
    30     public static final String[] modes = { marktr("data"), marktr("layer"), marktr("selection"), marktr("conflict"), marktr("download") };
     30    public static final String[] MODES = { marktr("data"), marktr("layer"), marktr("selection"), marktr("conflict"), marktr("download") };
     31
     32    /**
     33     * Zooms the current map view to the currently selected primitives.
     34     * Does nothing if there either isn't a current map view or if there isn't a current data
     35     * layer.
     36     *
     37     */
     38    public static void zoomToSelection() {
     39        if (Main.main == null || Main.main.getEditLayer() == null) return;
     40        if (Main.map == null || Main.map.mapView == null) return;
     41        Collection<OsmPrimitive> sel = new HashSet<OsmPrimitive>();
     42        sel = Main.main.getEditLayer().data.getSelected();
     43        if (sel.isEmpty()) {
     44            JOptionPane.showMessageDialog(
     45                    Main.parent,
     46                    tr("Nothing selected to zoom to."),
     47                    tr("Information"),
     48                    JOptionPane.INFORMATION_MESSAGE
     49            );
     50            return;
     51        }
     52        BoundingXYVisitor bboxCalculator = new BoundingXYVisitor();
     53        bboxCalculator.computeBoundingBox(sel);
     54        // increase bbox by 0.001 degrees on each side. this is required
     55        // especially if the bbox contains one single node, but helpful
     56        // in most other cases as well.
     57        bboxCalculator.enlargeBoundingBox();
     58        if (bboxCalculator.getBounds() != null) {
     59            Main.map.mapView.recalculateCenterScale(bboxCalculator);
     60        }
     61    }
     62
    3163    private final String mode;
    3264
  • trunk/src/org/openstreetmap/josm/actions/CloseChangesetAction.java

    r2613 r2685  
    132132                    return;
    133133                reader = new OsmServerChangesetReader();
    134                 ChangesetQuery query = new ChangesetQuery().forUser(userInfo.getId()).beingOpen();
     134                ChangesetQuery query = new ChangesetQuery().forUser(userInfo.getId()).beingOpen(true);
    135135                changesets = reader.queryChangesets(
    136136                        query,
Note: See TracChangeset for help on using the changeset viewer.