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;
|
| 42 | 42 | */ |
| 43 | 43 | public class AutoScaleAction extends JosmAction { |
| 44 | 44 | |
| | 45 | /** |
| | 46 | * A list of things we can zoom to. The zoom target is given depending on the mode. |
| | 47 | */ |
| 45 | 48 | public static final Collection<String> MODES = Collections.unmodifiableList(Arrays.asList( |
| 46 | 49 | marktr(/* ICON(dialogs/autoscale/) */ "data"), |
| 47 | 50 | marktr(/* ICON(dialogs/autoscale/) */ "layer"), |
| … |
… |
public class AutoScaleAction extends JosmAction {
|
| 52 | 55 | marktr(/* ICON(dialogs/autoscale/) */ "previous"), |
| 53 | 56 | marktr(/* ICON(dialogs/autoscale/) */ "next"))); |
| 54 | 57 | |
| | 58 | /** |
| | 59 | * One of {@link #MODES}. Defines what we are zooming to. |
| | 60 | */ |
| 55 | 61 | private final String mode; |
| 56 | 62 | |
| 57 | 63 | protected transient ZoomChangeAdapter zoomChangeAdapter; |
| … |
… |
public class AutoScaleAction extends JosmAction {
|
| 82 | 88 | zoomTo(sel); |
| 83 | 89 | } |
| 84 | 90 | |
| | 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 | */ |
| 85 | 95 | public static void zoomTo(Collection<OsmPrimitive> sel) { |
| 86 | 96 | BoundingXYVisitor bboxCalculator = new BoundingXYVisitor(); |
| 87 | 97 | bboxCalculator.computeBoundingBox(sel); |
| … |
… |
public class AutoScaleAction extends JosmAction {
|
| 94 | 104 | } |
| 95 | 105 | } |
| 96 | 106 | |
| | 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 | */ |
| 97 | 111 | public static void autoScale(String mode) { |
| 98 | 112 | new AutoScaleAction(mode, false).autoScale(); |
| 99 | 113 | } |
| … |
… |
public class AutoScaleAction extends JosmAction {
|
| 171 | 185 | installAdapters(); |
| 172 | 186 | } |
| 173 | 187 | |
| | 188 | /** |
| | 189 | * Performs this auto scale operation for the mode this action is in. |
| | 190 | */ |
| 174 | 191 | public void autoScale() { |
| 175 | 192 | if (Main.isDisplayingMapView()) { |
| 176 | 193 | switch (mode) { |