public class AutoScaleAction extends JosmAction
Modifier and Type | Class and Description |
---|---|
static class |
AutoScaleAction.AutoScaleMode
A list of things we can zoom to.
|
private class |
AutoScaleAction.MapFrameAdapter
Adapter for MapFrame change events
|
private class |
AutoScaleAction.ZoomChangeAdapter
Adapter for zoom change events
|
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
Modifier and Type | Field and Description |
---|---|
protected int |
lastZoomArea
Last zommed bounds
|
protected long |
lastZoomTime
Time of last zoom to bounds action
|
private AutoScaleAction.AutoScaleMode |
mode
One of
AutoScaleAction.AutoScaleMode . |
sc
Modifier | Constructor and Description |
---|---|
|
AutoScaleAction(AutoScaleAction.AutoScaleMode mode)
Constructs a new
AutoScaleAction . |
private |
AutoScaleAction(AutoScaleAction.AutoScaleMode mode,
boolean marker)
Constructs a new
AutoScaleAction . |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
void |
autoScale()
Performs this auto scale operation for the mode this action is in.
|
static void |
autoScale(AutoScaleAction.AutoScaleMode mode)
Performs the auto scale operation of the given mode without the need to create a new action.
|
protected Layer |
getFirstSelectedLayer()
Replies the first selected layer in the layer list dialog.
|
private static int |
getModeShortcut(java.lang.String mode) |
protected void |
installAdapters()
Installs the listeners to this action.
|
private static void |
modeData(BoundingXYVisitor v) |
private void |
modeDownload() |
private void |
modeLayer(BoundingXYVisitor v) |
private static void |
modeProblem(ValidatorDialog.ValidatorBoundingXYVisitor v) |
private void |
modeSelectionOrConflict(BoundingXYVisitor v) |
protected void |
updateEnabledState()
Override in subclasses to update the enabled state of the action when
something in the JOSM state changes, i.e.
|
protected void |
updateEnabledState(java.util.Collection<? extends OsmPrimitive> selection)
Override in subclasses to update the enabled state of the action if the
collection of selected primitives changes.
|
static void |
zoomTo(java.util.Collection<? extends IPrimitive> sel)
Zooms the view to display the given set of primitives.
|
static void |
zoomToSelection()
Zooms the current map view to the currently selected primitives.
|
checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, listenToLayerChange, listenToSelectionChange, setHelpId, setTooltip, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFuture
private final AutoScaleAction.AutoScaleMode mode
AutoScaleAction.AutoScaleMode
. Defines what we are zooming to.protected long lastZoomTime
protected int lastZoomArea
private AutoScaleAction(AutoScaleAction.AutoScaleMode mode, boolean marker)
AutoScaleAction
.mode
- The autoscale mode (one of AutoScaleAction.AutoScaleMode
)marker
- Must be set to false. Used only to differentiate from default constructorpublic AutoScaleAction(AutoScaleAction.AutoScaleMode mode)
AutoScaleAction
.mode
- The autoscale mode (one of AutoScaleAction.AutoScaleMode
)public static void zoomToSelection()
public static void zoomTo(java.util.Collection<? extends IPrimitive> sel)
sel
- The primitives to zoom to, e.g. the current selection.public static void autoScale(AutoScaleAction.AutoScaleMode mode)
mode
- One of AutoScaleAction.AutoScaleMode
.private static int getModeShortcut(java.lang.String mode)
public void autoScale()
public void actionPerformed(java.awt.event.ActionEvent e)
protected Layer getFirstSelectedLayer()
private static void modeProblem(ValidatorDialog.ValidatorBoundingXYVisitor v)
private static void modeData(BoundingXYVisitor v)
private void modeLayer(BoundingXYVisitor v)
private void modeSelectionOrConflict(BoundingXYVisitor v)
private void modeDownload()
protected void updateEnabledState()
JosmAction
JosmAction.updateEnabledState(Collection)
to respond to changes in the collection
of selected primitives.
Default behavior is empty.updateEnabledState
in class JosmAction
JosmAction.updateEnabledState(Collection)
,
JosmAction.initEnabledState()
,
JosmAction.listenToLayerChange()
protected void updateEnabledState(java.util.Collection<? extends OsmPrimitive> selection)
JosmAction
updateEnabledState
in class JosmAction
selection
- the collection of selected primitives; may be empty, but not nullJosmAction.updateEnabledState()
,
JosmAction.initEnabledState()
,
JosmAction.listenToSelectionChange()
protected final void installAdapters()
JosmAction
This should either never be called or only called in the constructor of this action.
All registered adapters should be removed in JosmAction.destroy()
installAdapters
in class JosmAction