Ticket #11988: 0004-Added-documentation-to-AutoScaleAction.patch

File 0004-Added-documentation-to-AutoScaleAction.patch, 2.5 KB (added by michael2402, 10 years ago)
  • src/org/openstreetmap/josm/actions/AutoScaleAction.java

    From c2704616c3409889695d3e12c2fb419257125dec Mon Sep 17 00:00:00 2001
    From: Michael Zangl <michael.zangl@student.kit.edu>
    Date: Sat, 17 Oct 2015 18:25:25 +0200
    Subject: [PATCH 4/4] Added documentation to AutoScaleAction
    
    ---
     .../josm/actions/AutoScaleAction.java              |   17 +++++++++++++++++
     1 file changed, 17 insertions(+)
    
    diff --git a/src/org/openstreetmap/josm/actions/AutoScaleAction.java b/src/org/openstreetmap/josm/actions/AutoScaleAction.java
    index 7cfdc0d..4876708 100644
    a b import org.openstreetmap.josm.tools.Shortcut;  
    4242 */
    4343public class AutoScaleAction extends JosmAction {
    4444
     45    /**
     46     * A list of things we can zoom to. The zoom target is given depending on the mode.
     47     */
    4548    public static final Collection<String> MODES = Collections.unmodifiableList(Arrays.asList(
    4649        marktr(/* ICON(dialogs/autoscale/) */ "data"),
    4750        marktr(/* ICON(dialogs/autoscale/) */ "layer"),
    public class AutoScaleAction extends JosmAction {  
    5255        marktr(/* ICON(dialogs/autoscale/) */ "previous"),
    5356        marktr(/* ICON(dialogs/autoscale/) */ "next")));
    5457
     58    /**
     59     * One of {@link #MODES}. Defines what we are zooming to.
     60     */
    5561    private final String mode;
    5662
    5763    protected transient ZoomChangeAdapter zoomChangeAdapter;
    public class AutoScaleAction extends JosmAction {  
    8288        zoomTo(sel);
    8389    }
    8490
     91    /**
     92     * Zooms the view to display the given set of primitives.
     93     * @param sel The primitives to zoom to, e.g. the current selection.
     94     */
    8595    public static void zoomTo(Collection<OsmPrimitive> sel) {
    8696        BoundingXYVisitor bboxCalculator = new BoundingXYVisitor();
    8797        bboxCalculator.computeBoundingBox(sel);
    public class AutoScaleAction extends JosmAction {  
    94104        }
    95105    }
    96106
     107    /**
     108     * Performs the auto scale operation of the given mode without the need to create a new action.
     109     * @param mode One of {@link #MODES}.
     110     */
    97111    public static void autoScale(String mode) {
    98112        new AutoScaleAction(mode, false).autoScale();
    99113    }
    public class AutoScaleAction extends JosmAction {  
    171185        installAdapters();
    172186    }
    173187
     188    /**
     189     * Performs this auto scale operation for the mode this action is in.
     190     */
    174191    public void autoScale() {
    175192        if (Main.isDisplayingMapView()) {
    176193            switch (mode) {